summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/drm_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci/drm/drm_drv.c')
-rw-r--r--sys/dev/pci/drm/drm_drv.c78
1 files changed, 48 insertions, 30 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index 0e9fecb33b4..f44cfb50e0c 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -49,25 +49,39 @@ int drm_debug_flag = 0;
int drm_firstopen(struct drm_device *);
int drm_lastclose(struct drm_device *);
+void drm_attach(struct device *, struct device *, void *);
+int drm_probe(struct device *, void *, void *);
+int drm_detach(struct device *, int);
+int drm_activate(struct device *, enum devact);
+int drmprint(void *, const char *);
+
+struct device *
+drm_attach_mi(const struct drm_driver_info *driver, struct pci_attach_args *pa,
+ struct device *vga, struct device *dev)
+{
+ struct drm_attach_args arg;
+ arg.driver = driver;
+ arg.pa = pa;
+ arg.vga = (struct vga_pci_softc *)vga;
-struct drm_device *drm_units[DRM_MAXUNITS];
+ printf("\n");
+ return (config_found(dev, &arg, drmprint));
+}
-static int init_units = 1;
+int
+drmprint(void *aux, const char *pnp)
+{
+ if (pnp != NULL)
+ printf("drm at %s\n", pnp);
+ return (UNCONF);
+}
int
-drm_probe(struct pci_attach_args *pa, drm_pci_id_list_t *idlist)
+drm_pciprobe(struct pci_attach_args *pa, drm_pci_id_list_t *idlist)
{
- int unit;
drm_pci_id_list_t *id_entry;
- /* first make sure there is place for the device */
- for (unit=0; unit<DRM_MAXUNITS; unit++)
- if (drm_units[unit] == NULL)
- break;
- if (unit == DRM_MAXUNITS)
- return 0;
-
id_entry = drm_find_description(PCI_VENDOR(pa->pa_id),
PCI_PRODUCT(pa->pa_id), idlist);
if (id_entry != NULL)
@@ -76,32 +90,27 @@ drm_probe(struct pci_attach_args *pa, drm_pci_id_list_t *idlist)
return 0;
}
-void
-drm_attach(struct device *parent, struct device *kdev,
- struct pci_attach_args *pa)
+int
+drm_probe(struct device *parent, void *match, void *aux)
{
- int unit;
- struct drm_device *dev;
-
- if (init_units) {
- for (unit=0; unit<DRM_MAXUNITS; unit++)
- drm_units[unit] = NULL;
- init_units = 0;
- }
+ struct drm_attach_args *da = aux;
+ return (da->driver != NULL ? 1 : 0);
+}
- for (unit=0; unit<DRM_MAXUNITS; unit++)
- if (drm_units[unit] == NULL)
- break;
- if (unit == DRM_MAXUNITS)
- return;
+void
+drm_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct drm_device *dev = (struct drm_device *)self;
+ struct drm_attach_args *da = aux;
+ struct pci_attach_args *pa = da->pa;
- dev = drm_units[unit] = (struct drm_device*)kdev;
- dev->unit = unit;
+ dev->dev_private = parent;
+ dev->driver = da->driver;
+ dev->vga_softc = da->vga;
/* needed for pci_mapreg_* */
memcpy(&dev->pa, pa, sizeof(dev->pa));
- dev->vga_softc = (struct vga_pci_softc *)parent;
dev->irq = pa->pa_intrline;
dev->pci_domain = 0;
@@ -200,6 +209,15 @@ drm_activate(struct device *self, enum devact act)
return (0);
}
+struct cfattach drm_ca = {
+ sizeof(struct drm_device), drm_probe, drm_attach,
+ drm_detach, drm_activate
+};
+
+struct cfdriver drm_cd = {
+ 0, "drm", DV_DULL
+};
+
drm_pci_id_list_t *
drm_find_description(int vendor, int device, drm_pci_id_list_t *idlist)
{