nb/intel/*/gma.c: Skip NGI when VGA decode is not enabled
Writes to VGA MEM and IO by NGI are invalid if the IGD is not decoding them. Change-Id: I4b9329d14105eb563a0d4aea6ef75ff11febf6df Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/27984 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
parent
db2f91b1f7
commit
e6c8f7ec20
|
@ -771,11 +771,18 @@ static void gma_func0_init(struct device *dev)
|
||||||
/* Post VBIOS init */
|
/* Post VBIOS init */
|
||||||
gma_pm_init_post_vbios(dev, edid_lvds.ascii_string);
|
gma_pm_init_post_vbios(dev, edid_lvds.ascii_string);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) {
|
int vga_disable = (pci_read_config16(dev, D0F0_GGC) & 2) >> 1;
|
||||||
gma_ngi(dev, &edid_lvds);
|
|
||||||
} else if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
|
if (vga_disable) {
|
||||||
int lightup_ok;
|
printk(BIOS_INFO,
|
||||||
gma_gfxinit(&lightup_ok);
|
"IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n");
|
||||||
|
} else {
|
||||||
|
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) {
|
||||||
|
gma_ngi(dev, &edid_lvds);
|
||||||
|
} else if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
|
||||||
|
int lightup_ok;
|
||||||
|
gma_gfxinit(&lightup_ok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intel_gma_restore_opregion();
|
intel_gma_restore_opregion();
|
||||||
|
|
|
@ -468,10 +468,17 @@ static void gma_func0_init(struct device *dev)
|
||||||
/* Pre panel init */
|
/* Pre panel init */
|
||||||
gma_setup_panel(dev);
|
gma_setup_panel(dev);
|
||||||
|
|
||||||
|
int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
|
if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
|
||||||
printk(BIOS_SPEW, "NATIVE graphics, run native enable\n");
|
if (vga_disable) {
|
||||||
gma_gfxinit(&lightup_ok);
|
printk(BIOS_INFO,
|
||||||
gfx_set_init_done(1);
|
"IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n");
|
||||||
|
} else {
|
||||||
|
printk(BIOS_SPEW, "NATIVE graphics, run native enable\n");
|
||||||
|
gma_gfxinit(&lightup_ok);
|
||||||
|
gfx_set_init_done(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! lightup_ok) {
|
if (! lightup_ok) {
|
||||||
|
|
|
@ -700,12 +700,20 @@ static void gma_func0_init(struct device *dev)
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER
|
pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER
|
||||||
| PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
|
| PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
|
||||||
|
|
||||||
|
int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) {
|
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) {
|
||||||
if (acpi_is_wakeup_s3())
|
if (acpi_is_wakeup_s3()) {
|
||||||
printk(BIOS_INFO,
|
printk(BIOS_INFO,
|
||||||
"Skipping native VGA initialization when resuming from ACPI S3.\n");
|
"Skipping native VGA initialization when resuming from ACPI S3.\n");
|
||||||
else
|
} else {
|
||||||
gma_ngi(dev);
|
if (vga_disable) {
|
||||||
|
printk(BIOS_INFO,
|
||||||
|
"IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n");
|
||||||
|
} else {
|
||||||
|
gma_ngi(dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* PCI Init, will run VBIOS */
|
/* PCI Init, will run VBIOS */
|
||||||
pci_dev_init(dev);
|
pci_dev_init(dev);
|
||||||
|
|
|
@ -275,6 +275,8 @@ static void gma_func0_init(struct device *dev)
|
||||||
struct resource *pio_res;
|
struct resource *pio_res;
|
||||||
struct northbridge_intel_pineview_config *conf = dev->chip_info;
|
struct northbridge_intel_pineview_config *conf = dev->chip_info;
|
||||||
|
|
||||||
|
int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;
|
||||||
|
|
||||||
/* Find base addresses */
|
/* Find base addresses */
|
||||||
mmio_res = find_resource(dev, 0x10);
|
mmio_res = find_resource(dev, 0x10);
|
||||||
gtt_res = find_resource(dev, 0x1c);
|
gtt_res = find_resource(dev, 0x1c);
|
||||||
|
@ -282,11 +284,17 @@ static void gma_func0_init(struct device *dev)
|
||||||
physbase = pci_read_config32(dev, 0x5c) & ~0xf;
|
physbase = pci_read_config32(dev, 0x5c) & ~0xf;
|
||||||
|
|
||||||
if (gtt_res && gtt_res->base && physbase && pio_res && pio_res->base) {
|
if (gtt_res && gtt_res->base && physbase && pio_res && pio_res->base) {
|
||||||
printk(BIOS_SPEW, "Initializing VGA. MMIO 0x%llx\n",
|
if (vga_disable) {
|
||||||
mmio_res->base);
|
printk(BIOS_INFO,
|
||||||
intel_gma_init(conf, dev, res2mmio(mmio_res, 0, 0),
|
"IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n");
|
||||||
res2mmio(gtt_res, 0, 0),
|
} else {
|
||||||
physbase, pio_res->base);
|
printk(BIOS_SPEW, "Initializing VGA. MMIO 0x%llx\n",
|
||||||
|
mmio_res->base);
|
||||||
|
intel_gma_init(conf, dev,
|
||||||
|
res2mmio(mmio_res, 0, 0),
|
||||||
|
res2mmio(gtt_res, 0, 0),
|
||||||
|
physbase, pio_res->base);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Linux relies on VBT for panel info. */
|
/* Linux relies on VBT for panel info. */
|
||||||
|
|
|
@ -631,29 +631,38 @@ static void gma_func0_init(struct device *dev)
|
||||||
/* Post VBIOS init */
|
/* Post VBIOS init */
|
||||||
gma_pm_init_post_vbios(dev);
|
gma_pm_init_post_vbios(dev);
|
||||||
|
|
||||||
|
int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;
|
||||||
|
|
||||||
/* Running graphics init on S3 breaks Linux drm driver. */
|
/* Running graphics init on S3 breaks Linux drm driver. */
|
||||||
if (!acpi_is_wakeup_s3() &&
|
if (!acpi_is_wakeup_s3() &&
|
||||||
(IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) ||
|
(IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) ||
|
||||||
IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT))) {
|
IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT))) {
|
||||||
/* This should probably run before post VBIOS init. */
|
if (vga_disable) {
|
||||||
printk(BIOS_SPEW, "Initializing VGA without OPROM.\n");
|
printk(BIOS_INFO,
|
||||||
u8 *mmiobase;
|
"IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n");
|
||||||
u32 iobase, physbase, graphics_base;
|
|
||||||
struct northbridge_intel_sandybridge_config *conf = dev->chip_info;
|
|
||||||
iobase = dev->resource_list[2].base;
|
|
||||||
mmiobase = res2mmio(&dev->resource_list[0], 0, 0);
|
|
||||||
physbase = pci_read_config32(dev, 0x5c) & ~0xf;
|
|
||||||
graphics_base = dev->resource_list[1].base;
|
|
||||||
|
|
||||||
int lightup_ok;
|
|
||||||
if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
|
|
||||||
gma_gfxinit(&lightup_ok);
|
|
||||||
} else {
|
} else {
|
||||||
lightup_ok = i915lightup_sandy(&conf->gfx, physbase,
|
/* This should probably run before post VBIOS init. */
|
||||||
iobase, mmiobase, graphics_base);
|
printk(BIOS_SPEW, "Initializing VGA without OPROM.\n");
|
||||||
|
u8 *mmiobase;
|
||||||
|
u32 iobase, physbase, graphics_base;
|
||||||
|
struct northbridge_intel_sandybridge_config *conf = dev->chip_info;
|
||||||
|
iobase = dev->resource_list[2].base;
|
||||||
|
mmiobase = res2mmio(&dev->resource_list[0], 0, 0);
|
||||||
|
physbase = pci_read_config32(dev, 0x5c) & ~0xf;
|
||||||
|
graphics_base = dev->resource_list[1].base;
|
||||||
|
|
||||||
|
int lightup_ok;
|
||||||
|
if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
|
||||||
|
gma_gfxinit(&lightup_ok);
|
||||||
|
} else {
|
||||||
|
lightup_ok = i915lightup_sandy(&conf->gfx,
|
||||||
|
physbase,
|
||||||
|
iobase, mmiobase,
|
||||||
|
graphics_base);
|
||||||
|
}
|
||||||
|
if (lightup_ok)
|
||||||
|
gfx_set_init_done(1);
|
||||||
}
|
}
|
||||||
if (lightup_ok)
|
|
||||||
gfx_set_init_done(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gma_enable_swsci();
|
gma_enable_swsci();
|
||||||
|
|
|
@ -60,7 +60,7 @@ void gma_set_gnvs_aslb(void *gnvs, uintptr_t aslb)
|
||||||
|
|
||||||
static void gma_func0_init(struct device *dev)
|
static void gma_func0_init(struct device *dev)
|
||||||
{
|
{
|
||||||
u16 reg16, ggc;
|
u16 reg16;
|
||||||
u32 reg32;
|
u32 reg32;
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
/* IGD needs to be Bus Master */
|
||||||
|
@ -74,11 +74,16 @@ static void gma_func0_init(struct device *dev)
|
||||||
reg16 |= 0xbc;
|
reg16 |= 0xbc;
|
||||||
pci_write_config16(dev_find_slot(0, PCI_DEVFN(0x2, 0)), 0xcc, reg16);
|
pci_write_config16(dev_find_slot(0, PCI_DEVFN(0x2, 0)), 0xcc, reg16);
|
||||||
|
|
||||||
ggc = pci_read_config16(dev_find_slot(0, PCI_DEVFN(0, 0)), D0F0_GGC);
|
int vga_disable = pci_read_config16(dev, D0F0_GGC);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
|
if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
|
||||||
int lightup_ok;
|
if (vga_disable) {
|
||||||
gma_gfxinit(&lightup_ok);
|
printk(BIOS_INFO,
|
||||||
|
"IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n");
|
||||||
|
} else {
|
||||||
|
int lightup_ok;
|
||||||
|
gma_gfxinit(&lightup_ok);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pci_dev_init(dev);
|
pci_dev_init(dev);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue