diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-10-30 11:21:02 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-10-30 11:21:02 +0000 |
commit | 4349f443d21b2ef4bab32588bf193e260bfadd26 (patch) | |
tree | e3ccef881757501a38250ce825dddf9d4754a85f /sys/dev/pci | |
parent | 7679e2512e2fbc9973bcb0e662e6a9c0ba232f57 (diff) |
Fix interaction between inteldrm(4) and efifb(4). If we were booted by UEFI
firmware and the efifb(4) framebuffer address matches one of the BARs
associated with the inteldrm(4) device, make inteldrm(4) the console and
prevent efifb(4) from attaching. Make sure that we do a full clear of the
framebuffer when inteldrm(4) attaches to prevent the contents of the old
framebuffer from showing up.
Based on an earlier diff from yasuoka@
ok yasuoka@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/drm/i915/i915_drv.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c index 52a987276c1..7b5b6393284 100644 --- a/sys/dev/pci/drm/i915/i915_drv.c +++ b/sys/dev/pci/drm/i915/i915_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_drv.c,v 1.95 2015/10/29 07:47:03 kettenis Exp $ */ +/* $OpenBSD: i915_drv.c,v 1.96 2015/10/30 11:21:01 kettenis Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org> * @@ -956,6 +956,14 @@ int i915_reset(struct drm_device *dev) return 0; } +#ifdef __amd64__ +#include "efifb.h" +#endif + +#if NEFIFB > 0 +#include <machine/efifbvar.h> +#endif + #include "intagp.h" #if NINTAGP > 0 @@ -1223,15 +1231,6 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux) int console = 0; int i; - if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY && - PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA && - (pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG) - & (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE)) - == (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE)) { - console = 1; - vga_console_attached = 1; - } - info = i915_get_device_id(PCI_PRODUCT(pa->pa_id)); KASSERT(info->gen != 0); @@ -1244,6 +1243,20 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux) dev_priv->memex = pa->pa_memex; dev_priv->regs = &dev_priv->bar; + if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY && + PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA && + (pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG) + & (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE)) + == (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE)) { + vga_console_attached = 1; + console = 1; + } + +#if NEFIFB > 0 + if (efifb_is_console(pa)) + console = 1; +#endif + printf("\n"); inteldrm_driver.num_ioctls = i915_max_ioctl; @@ -1495,12 +1508,17 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux) if (ri->ri_bits == NULL) return; +#if NEFIFB > 0 + if (efifb_is_console(pa)) + efifb_cndetach(); +#endif + printf("%s: %dx%d\n", dev_priv->sc_dev.dv_xname, ri->ri_width, ri->ri_height); intel_fbdev_restore_mode(dev); - ri->ri_flg = RI_CENTER | RI_WRONLY | RI_VCONS; + ri->ri_flg = RI_CENTER | RI_WRONLY | RI_VCONS | RI_CLEAR; ri->ri_hw = dev_priv; rasops_init(ri, 160, 160); |