summaryrefslogtreecommitdiff
path: root/bsd-core/drm_drv.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-10-17 03:14:39 +0000
committerEric Anholt <anholt@freebsd.org>2003-10-17 03:14:39 +0000
commitff58476011ba8fe72d65e884380d3d86710bfdd4 (patch)
treec2855a267ab001340e588ae6b32a55982312cfa0 /bsd-core/drm_drv.c
parent355b204de0dbc01308bebc77c4c1c0a9a402cded (diff)
- Converted Linux drivers to initialize DRM instances based on PCI IDs, not
just a single instance. Moved the PCI ID lists from <card>_drv.c in BSD to <card>.h. The PCI ID lists include a driver private field, which may be used by drivers for chip family or other information. Based on work by jonsmirl. - Make tdfx_drv.c and tdfx.h match other drivers. - Fixed up linking of sis shared files. Tested with Radeon and SiS on Linux and FreeBSD, including a Linux setup with 2 SiS cards in a machine, but only one head being used (with DRI)
Diffstat (limited to 'bsd-core/drm_drv.c')
-rw-r--r--bsd-core/drm_drv.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index d517d056..bfded6bb 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -219,11 +219,14 @@ static struct cdevsw DRM(cdevsw) = {
#endif
};
+static drm_pci_id_list_t DRM(pciidlist)[] = {
+ DRIVER_PCI_IDS
+};
+
static int DRM(probe)(device_t dev)
{
const char *s = NULL;
int pciid, vendor, device;
-
/* XXX: Cope with agp bridge device? */
if (!strcmp(device_get_name(dev), "drmsub"))
@@ -235,7 +238,7 @@ static int DRM(probe)(device_t dev)
device = (pciid & 0xffff0000) >> 16;
s = DRM(find_description)(vendor, device);
- if (s) {
+ if (s != NULL) {
device_set_desc(dev, s);
return 0;
}
@@ -349,7 +352,8 @@ int DRM(probe)(struct pci_attach_args *pa)
{
const char *desc;
- desc = DRM(find_description)(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id));
+ desc = DRM(find_description)(PCI_VENDOR(pa->pa_id),
+ PCI_PRODUCT(pa->pa_id));
if (desc != NULL) {
return 1;
}
@@ -396,21 +400,15 @@ int DRM(activate)(struct device *self, enum devact act)
#endif /* __NetBSD__ */
const char *DRM(find_description)(int vendor, int device) {
- const char *s = NULL;
- int i=0, done=0;
+ int i = 0;
- while ( !done && (DRM(devicelist)[i].vendor != 0 ) ) {
- if ( (DRM(devicelist)[i].vendor == vendor) &&
- (DRM(devicelist)[i].device == device) ) {
- done=1;
- if ( DRM(devicelist)[i].supported )
- s = DRM(devicelist)[i].name;
- else
- DRM_INFO("%s not supported\n", DRM(devicelist)[i].name);
+ for (i = 0; DRM(pciidlist)[i].vendor != 0; i++) {
+ if ((DRM(pciidlist)[i].vendor == vendor) &&
+ (DRM(pciidlist)[i].device == device)) {
+ return DRM(pciidlist)[i].name;
}
- i++;
}
- return s;
+ return NULL;
}
static int DRM(setup)( drm_device_t *dev )