tech-x11 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
re: netbsd-5: mga_drv.o build failure
a kernel with `mgadrm* at vga?' fails to build from netbsd-5 sources:
[...]
cc1: warnings being treated as errors
/usr/src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c: In function
'mga_driver_device_is_agp':
/usr/src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c:77: warning: implicit
declaration of function 'device_get_parent'
this is fixed by the patches rafal@ posted.
i plan to submit them to netbsd-5 today.
until then, this might apply:
Index: src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.3
src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.4
--- src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.3 Fri Jun 19
03:50:03 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c Tue Jun 23 04:42:01 2009
@@ -44,6 +44,12 @@
mach64_PCI_IDS
};
+int
+mach64_driver_load(struct drm_device * dev, unsigned long flags)
+{
+ return drm_vblank_init(dev, 1);
+}
+
static void mach64_configure(struct drm_device *dev)
{
dev->driver->driver_features =
@@ -73,6 +79,8 @@
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
+#if defined(__FreeBSD__)
+
static int
mach64_probe(device_t kdev)
{
@@ -92,12 +100,6 @@
return drm_attach(kdev, mach64_pciidlist);
}
-int
-mach64_driver_load(struct drm_device * dev, unsigned long flags)
-{
- return drm_vblank_init(dev, 1);
-}
-
static int
mach64_detach(device_t kdev)
{
@@ -133,3 +135,90 @@
DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(mach64, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__)
+
+static int
+mach64drm_probe(device_t parent, cfdata_t match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+
+ return drm_probe(pa, mach64_pciidlist);
+}
+
+static void
+mach64drm_attach(device_t parent, device_t self, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+ struct drm_device *dev = device_private(self);
+
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
+ M_WAITOK | M_ZERO);
+
+ mach64_configure(dev);
+
+ drm_attach(self, pa, mach64_pciidlist);
+}
+
+CFATTACH_DECL_NEW(mach64drm, sizeof(struct drm_device),
+ mach64drm_probe, mach64drm_attach, drm_detach, drm_activate);
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, mach64drm, NULL);
+
+CFDRIVER_DECL(mach64drm, DV_DULL, NULL);
+extern struct cfattach mach64drm_ca;
+static int drmloc[] = { -1 };
+static struct cfparent drmparent = {
+ "drm", "vga", DVUNIT_ANY
+};
+static struct cfdata mach64drm_cfdata[] = {
+ {
+ .cf_name = "mach64drm",
+ .cf_atname = "mach64drm",
+ .cf_unit = 0,
+ .cf_fstate = FSTATE_STAR,
+ .cf_loc = drmloc,
+ .cf_flags = 0,
+ .cf_pspec = &drmparent,
+ },
+ { NULL }
+};
+
+static int
+mach64drm_modcmd(modcmd_t cmd, void *arg)
+{
+ int err;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ err = config_cfdriver_attach(&mach64drm_cd);
+ if (err)
+ return err;
+ err = config_cfattach_attach("mach64drm", &mach64drm_ca);
+ if (err) {
+ config_cfdriver_detach(&mach64drm_cd);
+ return err;
+ }
+ err = config_cfdata_attach(mach64drm_cfdata, 1);
+ if (err) {
+ config_cfattach_detach("mach64drm", &mach64drm_ca);
+ config_cfdriver_detach(&mach64drm_cd);
+ return err;
+ }
+ return 0;
+ case MODULE_CMD_FINI:
+ err = config_cfdata_detach(mach64drm_cfdata);
+ if (err)
+ return err;
+ config_cfattach_detach("mach64drm", &mach64drm_ca);
+ config_cfdriver_detach(&mach64drm_cd);
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+#endif /* _MODULE */
+
+#endif
Index: src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c:1.3
src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c:1.4
--- src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c:1.3 Fri Jun 19
03:50:03 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c Tue Jun 23 04:42:01 2009
@@ -42,6 +42,11 @@
r128_PCI_IDS
};
+int r128_driver_load(struct drm_device * dev, unsigned long flags)
+{
+ return drm_vblank_init(dev, 1);
+}
+
static void r128_configure(struct drm_device *dev)
{
dev->driver->driver_features =
@@ -72,6 +77,8 @@
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
+#if defined(__FreeBSD__)
+
static int
r128_probe(device_t kdev)
{
@@ -91,11 +98,6 @@
return drm_attach(kdev, r128_pciidlist);
}
-int r128_driver_load(struct drm_device * dev, unsigned long flags)
-{
- return drm_vblank_init(dev, 1);
-}
-
static int
r128_detach(device_t kdev)
{
@@ -131,3 +133,90 @@
DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(r128, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__)
+
+static int
+r128drm_probe(device_t parent, cfdata_t match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+
+ return drm_probe(pa, r128_pciidlist);
+}
+
+static void
+r128drm_attach(device_t parent, device_t self, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+ struct drm_device *dev = device_private(self);
+
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
+ M_WAITOK | M_ZERO);
+
+ r128_configure(dev);
+
+ drm_attach(self, pa, r128_pciidlist);
+}
+
+CFATTACH_DECL_NEW(r128drm, sizeof(struct drm_device),
+ r128drm_probe, r128drm_attach, drm_detach, drm_activate);
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, r128drm, NULL);
+
+CFDRIVER_DECL(r128drm, DV_DULL, NULL);
+extern struct cfattach r128drm_ca;
+static int drmloc[] = { -1 };
+static struct cfparent drmparent = {
+ "drm", "vga", DVUNIT_ANY
+};
+static struct cfdata r128drm_cfdata[] = {
+ {
+ .cf_name = "r128drm",
+ .cf_atname = "r128drm",
+ .cf_unit = 0,
+ .cf_fstate = FSTATE_STAR,
+ .cf_loc = drmloc,
+ .cf_flags = 0,
+ .cf_pspec = &drmparent,
+ },
+ { NULL }
+};
+
+static int
+r128drm_modcmd(modcmd_t cmd, void *arg)
+{
+ int err;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ err = config_cfdriver_attach(&r128drm_cd);
+ if (err)
+ return err;
+ err = config_cfattach_attach("r128drm", &r128drm_ca);
+ if (err) {
+ config_cfdriver_detach(&r128drm_cd);
+ return err;
+ }
+ err = config_cfdata_attach(r128drm_cfdata, 1);
+ if (err) {
+ config_cfattach_detach("r128drm", &r128drm_ca);
+ config_cfdriver_detach(&r128drm_cd);
+ return err;
+ }
+ return 0;
+ case MODULE_CMD_FINI:
+ err = config_cfdata_detach(r128drm_cfdata);
+ if (err)
+ return err;
+ config_cfattach_detach("r128drm", &r128drm_ca);
+ config_cfdriver_detach(&r128drm_cd);
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+#endif /* _MODULE */
+
+#endif
Index: src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c:1.3
src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c:1.4
--- src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c:1.3 Fri Jun 19
03:50:03 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c Tue Jun 23 04:42:01 2009
@@ -62,6 +62,8 @@
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
+#if defined(__FreeBSD__)
+
static int
savage_probe(device_t kdev)
{
@@ -116,3 +118,90 @@
DRIVER_MODULE(savage, pci, savage_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(savage, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__)
+
+static int
+savagedrm_probe(device_t parent, cfdata_t match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+
+ return drm_probe(pa, savage_pciidlist);
+}
+
+static void
+savagedrm_attach(device_t parent, device_t self, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+ struct drm_device *dev = device_private(self);
+
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
+ M_WAITOK | M_ZERO);
+
+ savage_configure(dev);
+
+ drm_attach(self, pa, savage_pciidlist);
+}
+
+CFATTACH_DECL_NEW(savagedrm, sizeof(struct drm_device),
+ savagedrm_probe, savagedrm_attach, drm_detach, drm_activate);
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, savagedrm, NULL);
+
+CFDRIVER_DECL(savagedrm, DV_DULL, NULL);
+extern struct cfattach savagedrm_ca;
+static int drmloc[] = { -1 };
+static struct cfparent drmparent = {
+ "drm", "vga", DVUNIT_ANY
+};
+static struct cfdata savagedrm_cfdata[] = {
+ {
+ .cf_name = "savagedrm",
+ .cf_atname = "savagedrm",
+ .cf_unit = 0,
+ .cf_fstate = FSTATE_STAR,
+ .cf_loc = drmloc,
+ .cf_flags = 0,
+ .cf_pspec = &drmparent,
+ },
+ { NULL }
+};
+
+static int
+savagedrm_modcmd(modcmd_t cmd, void *arg)
+{
+ int err;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ err = config_cfdriver_attach(&savagedrm_cd);
+ if (err)
+ return err;
+ err = config_cfattach_attach("savagedrm", &savagedrm_ca);
+ if (err) {
+ config_cfdriver_detach(&savagedrm_cd);
+ return err;
+ }
+ err = config_cfdata_attach(savagedrm_cfdata, 1);
+ if (err) {
+ config_cfattach_detach("savagedrm", &savagedrm_ca);
+ config_cfdriver_detach(&savagedrm_cd);
+ return err;
+ }
+ return 0;
+ case MODULE_CMD_FINI:
+ err = config_cfdata_detach(savagedrm_cfdata);
+ if (err)
+ return err;
+ config_cfattach_detach("savagedrm", &savagedrm_ca);
+ config_cfdriver_detach(&savagedrm_cd);
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+#endif /* _MODULE */
+
+#endif
Index: src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c:1.3
src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c:1.4
--- src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c:1.3 Fri Jun 19
03:50:03 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c Tue Jun 23 04:42:01 2009
@@ -56,6 +56,8 @@
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
+#if defined(__FreeBSD__)
+
static int
sis_probe(device_t kdev)
{
@@ -110,3 +112,90 @@
DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(sisdrm, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__)
+
+static int
+sisdrm_probe(device_t parent, cfdata_t match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+
+ return drm_probe(pa, sis_pciidlist);
+}
+
+static void
+sisdrm_attach(device_t parent, device_t self, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+ struct drm_device *dev = device_private(self);
+
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
+ M_WAITOK | M_ZERO);
+
+ sis_configure(dev);
+
+ drm_attach(self, pa, sis_pciidlist);
+}
+
+CFATTACH_DECL_NEW(sisdrm, sizeof(struct drm_device),
+ sisdrm_probe, sisdrm_attach, drm_detach, drm_activate);
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, sisdrm, NULL);
+
+CFDRIVER_DECL(sisdrm, DV_DULL, NULL);
+extern struct cfattach sisdrm_ca;
+static int drmloc[] = { -1 };
+static struct cfparent drmparent = {
+ "drm", "vga", DVUNIT_ANY
+};
+static struct cfdata sisdrm_cfdata[] = {
+ {
+ .cf_name = "sisdrm",
+ .cf_atname = "sisdrm",
+ .cf_unit = 0,
+ .cf_fstate = FSTATE_STAR,
+ .cf_loc = drmloc,
+ .cf_flags = 0,
+ .cf_pspec = &drmparent,
+ },
+ { NULL }
+};
+
+static int
+sisdrm_modcmd(modcmd_t cmd, void *arg)
+{
+ int err;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ err = config_cfdriver_attach(&sisdrm_cd);
+ if (err)
+ return err;
+ err = config_cfattach_attach("sisdrm", &sisdrm_ca);
+ if (err) {
+ config_cfdriver_detach(&sisdrm_cd);
+ return err;
+ }
+ err = config_cfdata_attach(sisdrm_cfdata, 1);
+ if (err) {
+ config_cfattach_detach("sisdrm", &sisdrm_ca);
+ config_cfdriver_detach(&sisdrm_cd);
+ return err;
+ }
+ return 0;
+ case MODULE_CMD_FINI:
+ err = config_cfdata_detach(sisdrm_cfdata);
+ if (err)
+ return err;
+ config_cfattach_detach("sisdrm", &sisdrm_ca);
+ config_cfdriver_detach(&sisdrm_cd);
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+#endif /* _MODULE */
+
+#endif
Index: src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c:1.3
src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c:1.4
--- src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c:1.3 Fri Jun 19
03:50:03 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c Tue Jun 23 04:42:01 2009
@@ -58,6 +58,8 @@
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
+#if defined(__FreeBSD__)
+
static int
tdfx_probe(device_t kdev)
{
@@ -112,3 +114,90 @@
DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(tdfx, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__)
+
+static int
+tdfxdrm_probe(device_t parent, cfdata_t match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+
+ return drm_probe(pa, tdfx_pciidlist);
+}
+
+static void
+tdfxdrm_attach(device_t parent, device_t self, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+ struct drm_device *dev = device_private(self);
+
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
+ M_WAITOK | M_ZERO);
+
+ tdfx_configure(dev);
+
+ drm_attach(self, pa, tdfx_pciidlist);
+}
+
+CFATTACH_DECL_NEW(tdfxdrm, sizeof(struct drm_device),
+ tdfxdrm_probe, tdfxdrm_attach, drm_detach, drm_activate);
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, tdfxdrm, NULL);
+
+CFDRIVER_DECL(tdfxdrm, DV_DULL, NULL);
+extern struct cfattach tdfxdrm_ca;
+static int drmloc[] = { -1 };
+static struct cfparent drmparent = {
+ "drm", "vga", DVUNIT_ANY
+};
+static struct cfdata tdfxdrm_cfdata[] = {
+ {
+ .cf_name = "tdfxdrm",
+ .cf_atname = "tdfxdrm",
+ .cf_unit = 0,
+ .cf_fstate = FSTATE_STAR,
+ .cf_loc = drmloc,
+ .cf_flags = 0,
+ .cf_pspec = &drmparent,
+ },
+ { NULL }
+};
+
+static int
+tdfxdrm_modcmd(modcmd_t cmd, void *arg)
+{
+ int err;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ err = config_cfdriver_attach(&tdfxdrm_cd);
+ if (err)
+ return err;
+ err = config_cfattach_attach("tdfxdrm", &tdfxdrm_ca);
+ if (err) {
+ config_cfdriver_detach(&tdfxdrm_cd);
+ return err;
+ }
+ err = config_cfdata_attach(tdfxdrm_cfdata, 1);
+ if (err) {
+ config_cfattach_detach("tdfxdrm", &tdfxdrm_ca);
+ config_cfdriver_detach(&tdfxdrm_cd);
+ return err;
+ }
+ return 0;
+ case MODULE_CMD_FINI:
+ err = config_cfdata_detach(tdfxdrm_cfdata);
+ if (err)
+ return err;
+ config_cfattach_detach("tdfxdrm", &tdfxdrm_ca);
+ config_cfdriver_detach(&tdfxdrm_cd);
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+#endif /* _MODULE */
+
+#endif
Index: src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c:1.4
src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c:1.5
--- src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c:1.4 Fri Jun 19
03:50:03 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c Tue Jun 23 04:42:01 2009
@@ -37,11 +37,31 @@
#include "mga_drv.h"
#include "drm_pciids.h"
+#ifdef __NetBSD__
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+#include <dev/pci/pcidevs_data.h>
+#endif
+
/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
static drm_pci_id_list_t mga_pciidlist[] = {
mga_PCI_IDS
};
+#ifdef __NetBSD__
+static int mgadev_match(struct pci_attach_args *pa);
+static int
+mgadev_match(struct pci_attach_args *pa)
+{
+
+ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_HINT &&
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_HINT_HB1)
+ return 1;
+ return 0;
+}
+#endif
+
+
/**
* Determine if the device really is AGP or not.
*
@@ -61,8 +81,6 @@
*/
static int mga_driver_device_is_agp(struct drm_device * dev)
{
- device_t bus;
-
/* There are PCI versions of the G450. These cards have the
* same PCI ID as the AGP G450, but have an additional PCI-to-PCI
* bridge chip. We detect these cards, which are not currently
@@ -71,6 +89,9 @@
* device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
* device.
*/
+#if defined(__FreeBSD__)
+ device_t bus;
+
#if __FreeBSD_version >= 700010
bus = device_get_parent(device_get_parent(dev->device));
#else
@@ -79,6 +100,12 @@
if (pci_get_device(dev->device) == 0x0525 &&
pci_get_vendor(bus) == 0x3388 &&
pci_get_device(bus) == 0x0021)
+#else
+ struct pci_attach_args pa;
+
+ if (PCI_PRODUCT(dev->pa.pa_id) == PCI_PRODUCT_MATROX_G400_AGP &&
+ pci_find_device(&pa, mgadev_match))
+#endif
return DRM_IS_NOT_AGP;
else
return DRM_MIGHT_BE_AGP;
@@ -116,6 +143,8 @@
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
+#if defined(__FreeBSD__)
+
static int
mga_probe(device_t kdev)
{
@@ -170,3 +199,90 @@
DRIVER_MODULE(mga, pci, mga_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(mga, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__)
+
+static int
+mgadrm_probe(device_t parent, cfdata_t match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+
+ return drm_probe(pa, mga_pciidlist);
+}
+
+static void
+mgadrm_attach(device_t parent, device_t self, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+ struct drm_device *dev = device_private(self);
+
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
+ M_WAITOK | M_ZERO);
+
+ mga_configure(dev);
+
+ drm_attach(self, pa, mga_pciidlist);
+}
+
+CFATTACH_DECL_NEW(mgadrm, sizeof(struct drm_device),
+ mgadrm_probe, mgadrm_attach, drm_detach, drm_activate);
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, mgadrm, NULL);
+
+CFDRIVER_DECL(mgadrm, DV_DULL, NULL);
+extern struct cfattach mgadrm_ca;
+static int drmloc[] = { -1 };
+static struct cfparent drmparent = {
+ "drm", "vga", DVUNIT_ANY
+};
+static struct cfdata mgadrm_cfdata[] = {
+ {
+ .cf_name = "mgadrm",
+ .cf_atname = "mgadrm",
+ .cf_unit = 0,
+ .cf_fstate = FSTATE_STAR,
+ .cf_loc = drmloc,
+ .cf_flags = 0,
+ .cf_pspec = &drmparent,
+ },
+ { NULL }
+};
+
+static int
+mgadrm_modcmd(modcmd_t cmd, void *arg)
+{
+ int err;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ err = config_cfdriver_attach(&mgadrm_cd);
+ if (err)
+ return err;
+ err = config_cfattach_attach("mgadrm", &mgadrm_ca);
+ if (err) {
+ config_cfdriver_detach(&mgadrm_cd);
+ return err;
+ }
+ err = config_cfdata_attach(mgadrm_cfdata, 1);
+ if (err) {
+ config_cfattach_detach("mgadrm", &mgadrm_ca);
+ config_cfdriver_detach(&mgadrm_cd);
+ return err;
+ }
+ return 0;
+ case MODULE_CMD_FINI:
+ err = config_cfdata_detach(mgadrm_cfdata);
+ if (err)
+ return err;
+ config_cfattach_detach("mgadrm", &mgadrm_ca);
+ config_cfdriver_detach(&mgadrm_cd);
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+#endif /* _MODULE */
+
+#endif
Index: src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c
diff -u src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c:1.1.1.2
src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c:1.2
--- src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c:1.1.1.2 Fri Jun
19 03:22:24 2009
+++ src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c Tue Jun 23
04:42:01 2009
@@ -509,7 +509,7 @@
DRM_INFO("\n");
- if (ring->head >= 0 && ring->head < ring->size / sizeof(u32)) {
+ if (ring->head < ring->size / sizeof(u32)) {
struct list_head *ptr;
u32 addr = le32_to_cpu(((u32 *) ring->start)[ring->head + 1]);
@@ -1273,7 +1273,7 @@
entry = list_entry(ptr, drm_mach64_freelist_t, list);
buf = entry->buf;
offset = buf_addr - GETBUFADDR(buf);
- if (offset >= 0 && offset < MACH64_BUFFER_SIZE) {
+ if (offset < MACH64_BUFFER_SIZE) {
found = 1;
break;
}
Index: src/sys/external/bsd/drm/dist/shared-core/mach64_drv.h
diff -u src/sys/external/bsd/drm/dist/shared-core/mach64_drv.h:1.3
src/sys/external/bsd/drm/dist/shared-core/mach64_drv.h:1.4
--- src/sys/external/bsd/drm/dist/shared-core/mach64_drv.h:1.3 Fri Jun 19
03:50:05 2009
+++ src/sys/external/bsd/drm/dist/shared-core/mach64_drv.h Tue Jun 23
04:42:01 2009
@@ -504,7 +504,7 @@
#define MMREG0 0x0000
#define MMREG0_END 0x00ff
-#define ISMMREG0(r) (((r) >= MMREG0) && ((r) <= MMREG0_END))
+#define ISMMREG0(r) ((r) <= MMREG0_END)
#define MMSELECT0(r) (((r) << 2) + DWMREG0)
#define MMSELECT1(r) (((((r) & 0xff) << 2) + DWMREG1))
#define MMSELECT(r) (ISMMREG0(r) ? MMSELECT0(r) : MMSELECT1(r))
@@ -776,8 +776,8 @@
#define DMAADVANCE( dev_priv, _discard ) \
do { \
- struct list_head *ptr; \
- int ret; \
+ struct list_head *_ptr; \
+ int _ret; \
\
if ( MACH64_VERBOSE ) { \
DRM_INFO( "DMAADVANCE() in \n" ); \
@@ -790,9 +790,9 @@
} \
if (_buf->pending) { \
/* This is a resued buffer, so we need to find it in
the pending list */ \
- if ((ret = mach64_find_pending_buf_entry(dev_priv,
&_entry, _buf))) { \
+ if ((_ret = mach64_find_pending_buf_entry(dev_priv,
&_entry, _buf))) { \
DRM_ERROR( "DMAADVANCE(): couldn't find pending
buf %d\n", _buf->idx ); \
- return ret; \
+ return _ret; \
} \
if (_entry->discard) { \
DRM_ERROR( "DMAADVANCE(): sending discarded
pending buf %d\n", _buf->idx ); \
@@ -803,26 +803,26 @@
DRM_ERROR( "DMAADVANCE(): empty placeholder
list\n"); \
return -EFAULT; \
} \
- ptr = dev_priv->placeholders.next; \
- list_del(ptr); \
- _entry = list_entry(ptr, drm_mach64_freelist_t, list); \
+ _ptr = dev_priv->placeholders.next; \
+ list_del(_ptr); \
+ _entry = list_entry(_ptr, drm_mach64_freelist_t, list);
\
_buf->pending = 1; \
_entry->buf = _buf; \
- list_add_tail(ptr, &dev_priv->pending); \
+ list_add_tail(_ptr, &dev_priv->pending); \
} \
_entry->discard = (_discard); \
- if ((ret = mach64_add_buf_to_ring( dev_priv, _entry ))) \
- return ret; \
+ if ((_ret = mach64_add_buf_to_ring( dev_priv, _entry ))) \
+ return _ret; \
} while (0)
#define DMADISCARDBUF()
\
do { \
if (_entry == NULL) { \
- int ret; \
- if ((ret = mach64_find_pending_buf_entry(dev_priv,
&_entry, _buf))) { \
+ int _ret; \
+ if ((_ret = mach64_find_pending_buf_entry(dev_priv,
&_entry, _buf))) { \
DRM_ERROR( "couldn't find pending buf %d\n", \
_buf->idx ); \
- return ret; \
+ return _ret; \
} \
} \
_entry->discard = 1; \
@@ -831,7 +831,7 @@
#define DMAADVANCEHOSTDATA( dev_priv ) \
do { \
struct list_head *ptr; \
- int ret; \
+ int _ret; \
\
if ( MACH64_VERBOSE ) { \
DRM_INFO( "DMAADVANCEHOSTDATA() in \n" ); \
@@ -853,8 +853,8 @@
_entry->buf->pending = 1; \
list_add_tail(ptr, &dev_priv->pending); \
_entry->discard = 1; \
- if ((ret = mach64_add_hostdata_buf_to_ring( dev_priv, _entry
))) \
- return ret; \
+ if ((_ret = mach64_add_hostdata_buf_to_ring( dev_priv, _entry
))) \
+ return _ret; \
} while (0)
#endif /* __MACH64_DRV_H__ */
Index: src/sys/external/bsd/drm/dist/shared-core/savage_bci.c
diff -u src/sys/external/bsd/drm/dist/shared-core/savage_bci.c:1.3
src/sys/external/bsd/drm/dist/shared-core/savage_bci.c:1.4
--- src/sys/external/bsd/drm/dist/shared-core/savage_bci.c:1.3 Fri Jun 19
03:50:05 2009
+++ src/sys/external/bsd/drm/dist/shared-core/savage_bci.c Tue Jun 23
04:42:01 2009
@@ -661,9 +661,14 @@
for (i = 0; i < 3; ++i)
if (dev_priv->mtrr[i].handle >= 0)
+#if defined(__FreeBSD__)
drm_mtrr_del(dev_priv->mtrr[i].handle,
dev_priv->mtrr[i].base,
dev_priv->mtrr[i].size, DRM_MTRR_WC);
+#elif defined(__NetBSD__)
+ drm_mtrr_del(dev_priv->mtrr[i].base,
+ dev_priv->mtrr[i].size, DRM_MTRR_WC);
+#endif
}
int savage_driver_unload(struct drm_device *dev)
Index: src/sys/external/bsd/drm/dist/shared-core/savage_state.c
diff -u src/sys/external/bsd/drm/dist/shared-core/savage_state.c:1.3
src/sys/external/bsd/drm/dist/shared-core/savage_state.c:1.4
--- src/sys/external/bsd/drm/dist/shared-core/savage_state.c:1.3 Fri Jun
19 03:50:05 2009
+++ src/sys/external/bsd/drm/dist/shared-core/savage_state.c Tue Jun 23
04:42:01 2009
@@ -374,18 +374,18 @@
/* Need to reorder indices for correct flat
* shading while preserving the clock sense
* for correct culling. Only on Savage3D. */
- int reorder[3] = { -1, -1, -1 };
- reorder[start % 3] = 2;
+ int reorderarr[3] = { -1, -1, -1 };
+ reorderarr[start % 3] = 2;
BEGIN_BCI((count + 1 + 1) / 2);
BCI_DRAW_INDICES_S3D(count, prim, start + 2);
for (i = start + 1; i + 1 < start + count; i += 2)
- BCI_WRITE((i + reorder[i % 3]) |
+ BCI_WRITE((i + reorderarr[i % 3]) |
((i + 1 +
- reorder[(i + 1) % 3]) << 16));
+ reorderarr[(i + 1) % 3]) << 16));
if (i < start + count)
- BCI_WRITE(i + reorder[i % 3]);
+ BCI_WRITE(i + reorderarr[i % 3]);
} else if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
BEGIN_BCI((count + 1 + 1) / 2);
BCI_DRAW_INDICES_S3D(count, prim, start);
@@ -493,14 +493,14 @@
/* Need to reorder vertices for correct flat
* shading while preserving the clock sense
* for correct culling. Only on Savage3D. */
- int reorder[3] = { -1, -1, -1 };
- reorder[start % 3] = 2;
+ int reorderarr[3] = { -1, -1, -1 };
+ reorderarr[start % 3] = 2;
BEGIN_DMA(count * vtx_size + 1);
DMA_DRAW_PRIMITIVE(count, prim, skip);
for (i = start; i < start + count; ++i) {
- unsigned int j = i + reorder[i % 3];
+ unsigned int j = i + reorderarr[i % 3];
DMA_COPY(&vtxbuf[vb_stride * j], vtx_size);
}
@@ -634,17 +634,17 @@
/* Need to reorder indices for correct flat
* shading while preserving the clock sense
* for correct culling. Only on Savage3D. */
- int reorder[3] = { 2, -1, -1 };
+ int reorderarr[3] = { 2, -1, -1 };
BEGIN_BCI((count + 1 + 1) / 2);
BCI_DRAW_INDICES_S3D(count, prim, idx[2]);
for (i = 1; i + 1 < count; i += 2)
- BCI_WRITE(idx[i + reorder[i % 3]] |
+ BCI_WRITE(idx[i + reorderarr[i % 3]] |
(idx[i + 1 +
- reorder[(i + 1) % 3]] << 16));
+ reorderarr[(i + 1) % 3]] << 16));
if (i < count)
- BCI_WRITE(idx[i + reorder[i % 3]]);
+ BCI_WRITE(idx[i + reorderarr[i % 3]]);
} else if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
BEGIN_BCI((count + 1 + 1) / 2);
BCI_DRAW_INDICES_S3D(count, prim, idx[0]);
@@ -754,13 +754,13 @@
/* Need to reorder vertices for correct flat
* shading while preserving the clock sense
* for correct culling. Only on Savage3D. */
- int reorder[3] = { 2, -1, -1 };
+ int reorderarr[3] = { 2, -1, -1 };
BEGIN_DMA(count * vtx_size + 1);
DMA_DRAW_PRIMITIVE(count, prim, skip);
for (i = 0; i < count; ++i) {
- unsigned int j = idx[i + reorder[i % 3]];
+ unsigned int j = idx[i + reorderarr[i % 3]];
DMA_COPY(&vtxbuf[vb_stride * j], vtx_size);
}
Index: src/sys/external/bsd/drm/dist/shared-core/sis_ds.c
diff -u src/sys/external/bsd/drm/dist/shared-core/sis_ds.c:1.3
src/sys/external/bsd/drm/dist/shared-core/sis_ds.c:1.4
--- src/sys/external/bsd/drm/dist/shared-core/sis_ds.c:1.3 Fri Jun 19
03:50:05 2009
+++ src/sys/external/bsd/drm/dist/shared-core/sis_ds.c Tue Jun 23 04:42:01 2009
@@ -57,18 +57,18 @@
int setAdd(set_t * set, ITEM_TYPE item)
{
- int free = set->free;
+ int freeidx = set->free;
- if (free != -1) {
- set->list[free].val = item;
- set->free = set->list[free].free_next;
+ if (freeidx != -1) {
+ set->list[freeidx].val = item;
+ set->free = set->list[freeidx].free_next;
} else {
return 0;
}
- set->list[free].alloc_next = set->alloc;
- set->alloc = free;
- set->list[free].free_next = -1;
+ set->list[freeidx].alloc_next = set->alloc;
+ set->alloc = freeidx;
+ set->list[freeidx].free_next = -1;
return 1;
}
Home |
Main Index |
Thread Index |
Old Index