summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-10-02 04:07:03 +0000
committerEric Anholt <anholt@freebsd.org>2003-10-02 04:07:03 +0000
commit4a55e75e97e39256d5cdb561cf01ff7df73fe664 (patch)
tree2efed50db55a480faeaa970d58baa0fe8d684122
parent8fe6a0d6c9aae796cc1217794644b314a9960a43 (diff)
Allow the DRM to attach to a "drmsub" device. This will be provided by the
i810 AGP module, working around the limitation of one driver per device. Obtained from: i865-0-1-branch
-rw-r--r--bsd-core/drm_drv.c20
-rw-r--r--bsd/drm_drv.h20
2 files changed, 32 insertions, 8 deletions
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 8bec4da3..8ff78b7b 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -222,10 +222,17 @@ static struct cdevsw DRM(cdevsw) = {
static int DRM(probe)(device_t dev)
{
const char *s = NULL;
+ int pciid, vendor, device;
+
- int pciid=pci_get_devid(dev);
- int vendor = (pciid & 0x0000ffff);
- int device = (pciid & 0xffff0000) >> 16;
+ /* XXX: Cope with agp bridge device? */
+ if (!strcmp(device_get_name(dev), "drmsub"))
+ pciid = pci_get_devid(device_get_parent(dev));
+ else
+ pciid = pci_get_devid(dev);
+
+ vendor = (pciid & 0x0000ffff);
+ device = (pciid & 0xffff0000) >> 16;
s = DRM(find_description)(vendor, device);
if (s) {
@@ -651,7 +658,12 @@ static int DRM(init)( device_t nbdev )
unit = device_get_unit(nbdev);
dev = device_get_softc(nbdev);
memset( (void *)dev, 0, sizeof(*dev) );
- dev->device = nbdev;
+
+ if (!strcmp(device_get_name(nbdev), "drmsub"))
+ dev->device = device_get_parent(nbdev);
+ else
+ dev->device = nbdev;
+
dev->devnode = make_dev( &DRM(cdevsw),
unit,
DRM_DEV_UID,
diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h
index 8bec4da3..8ff78b7b 100644
--- a/bsd/drm_drv.h
+++ b/bsd/drm_drv.h
@@ -222,10 +222,17 @@ static struct cdevsw DRM(cdevsw) = {
static int DRM(probe)(device_t dev)
{
const char *s = NULL;
+ int pciid, vendor, device;
+
- int pciid=pci_get_devid(dev);
- int vendor = (pciid & 0x0000ffff);
- int device = (pciid & 0xffff0000) >> 16;
+ /* XXX: Cope with agp bridge device? */
+ if (!strcmp(device_get_name(dev), "drmsub"))
+ pciid = pci_get_devid(device_get_parent(dev));
+ else
+ pciid = pci_get_devid(dev);
+
+ vendor = (pciid & 0x0000ffff);
+ device = (pciid & 0xffff0000) >> 16;
s = DRM(find_description)(vendor, device);
if (s) {
@@ -651,7 +658,12 @@ static int DRM(init)( device_t nbdev )
unit = device_get_unit(nbdev);
dev = device_get_softc(nbdev);
memset( (void *)dev, 0, sizeof(*dev) );
- dev->device = nbdev;
+
+ if (!strcmp(device_get_name(nbdev), "drmsub"))
+ dev->device = device_get_parent(nbdev);
+ else
+ dev->device = nbdev;
+
dev->devnode = make_dev( &DRM(cdevsw),
unit,
DRM_DEV_UID,