diff options
-rw-r--r-- | sys/dev/ic/vga.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/i915_drv.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/vga_pci.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/vga_pcivar.h | 2 |
4 files changed, 11 insertions, 18 deletions
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index a10224c24e7..dfe4440d38e 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -522,21 +522,13 @@ vga_extended_attach(struct device *self, bus_space_tag_t iot, int console; struct vga_config *vc; struct wsemuldisplaydev_attach_args aa; - extern struct cfdriver wsdisplay_cd; - struct device *dev; console = vga_is_console(iot, type); if (console) vga_console_attached = 1; - /* Bail if a drm driver already attached a wsdisplay. */ - for (dev = TAILQ_NEXT(self, dv_list); dev != NULL; - dev = TAILQ_NEXT(dev, dv_list)) { - if (dev->dv_parent != self) - continue; - if (dev->dv_cfdata->cf_driver == &wsdisplay_cd) - return NULL; - } + if (type == -1) + return NULL; if (console) { vc = &vga_console_vc; diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c index 608ac579af5..8b6db394be8 100644 --- a/sys/dev/pci/drm/i915/i915_drv.c +++ b/sys/dev/pci/drm/i915/i915_drv.c @@ -947,6 +947,7 @@ void inteldrm_attach(struct device *parent, struct device *self, void *aux) { struct inteldrm_softc *dev_priv = (struct inteldrm_softc *)self; + struct vga_pci_softc *vga_sc = (struct vga_pci_softc *)parent; struct pci_attach_args *pa = aux, bpa; struct vga_pci_bar *bar; struct drm_device *dev; @@ -971,15 +972,13 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux) dev = (struct drm_device *)dev_priv->drmdev; /* we need to use this api for now due to sharing with intagp */ - bar = vga_pci_bar_info((struct vga_pci_softc *)parent, - (IS_I9XX(dev) ? 0 : 1)); + bar = vga_pci_bar_info(vga_sc, (IS_I9XX(dev) ? 0 : 1)); if (bar == NULL) { printf(": can't get BAR info\n"); return; } - dev_priv->regs = vga_pci_bar_map((struct vga_pci_softc *)parent, - bar->addr, 0, 0); + dev_priv->regs = vga_pci_bar_map(vga_sc, bar->addr, 0, 0); if (dev_priv->regs == NULL) { printf(": can't map mmio space\n"); return; @@ -1191,6 +1190,7 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux) aa.console = 1; } + vga_sc->sc_type = -1; config_found(parent, &aa, wsemuldisplaydevprint); } #endif diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index c0030505a7d..db6a2d17423 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -227,7 +227,6 @@ vga_pci_attach(struct device *parent, struct device *self, void *aux) struct pci_attach_args *pa = aux; pcireg_t reg; struct vga_pci_softc *sc = (struct vga_pci_softc *)self; - #if !defined(SMALL_KERNEL) && NACPI > 0 int prod, vend, subid, subprod, subvend, i; #endif @@ -239,12 +238,14 @@ vga_pci_attach(struct device *parent, struct device *self, void *aux) reg |= PCI_COMMAND_MASTER_ENABLE; pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, reg); + sc->sc_type = WSDISPLAY_TYPE_PCIVGA; + #ifdef VESAFB if (vesabios_softc != NULL && vesabios_softc->sc_nmodes > 0) { sc->sc_textmode = vesafb_get_mode(sc); printf(", vesafb\n"); sc->sc_vc = vga_extended_attach(self, pa->pa_iot, pa->pa_memt, - WSDISPLAY_TYPE_PCIVGA, vga_pci_mmap); + sc->sc_type, vga_pci_mmap); return; } #endif @@ -294,7 +295,7 @@ vga_pci_attach(struct device *parent, struct device *self, void *aux) #endif sc->sc_vc = vga_common_attach(self, pa->pa_iot, pa->pa_memt, - WSDISPLAY_TYPE_PCIVGA); + sc->sc_type); } int diff --git a/sys/dev/pci/vga_pcivar.h b/sys/dev/pci/vga_pcivar.h index defbc7a1ddb..086f2ed1da5 100644 --- a/sys/dev/pci/vga_pcivar.h +++ b/sys/dev/pci/vga_pcivar.h @@ -55,6 +55,7 @@ struct vga_pci_bar { struct vga_pci_softc { struct device sc_dev; struct vga_config *sc_vc; + int sc_type; struct pci_attach_args pa; struct vga_pci_bar *bars[VGA_PCI_MAX_BARS]; @@ -79,7 +80,6 @@ struct vga_pci_softc { u_char sc_cmap_red[256]; /* saved color map */ u_char sc_cmap_green[256]; u_char sc_cmap_blue[256]; - #endif }; |