Patch by Ivan Kokshaysky originally posted to axp-list@redhat.com, updated to cleanly apply to X.Org CVS by Mike A. Harris Problems covered: * Detection of the primary adapter is broken. You have to set explicit PCI id in XF86Config to get the card detected as *secondary*. However, switching to VGA text console won't work then (most drivers don't save/restore VGA state for secondary adapters). * Rather old bug in mga driver (since 4.1.0, IIRC) - the driver attempts to read the video ROM *before* enabling it. Naturally, this causes annoying machine check on certain platforms. This patch fixes the following: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=91711 Submitted upstream on Jul 9, 2004 by Mike Harris: http://freedesktop.org/bugzilla/show_bug.cgi?id=843 --- xc.orig/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c 2004-06-16 05:44:00.000000000 -0400 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c 2004-07-09 04:25:18.000000000 -0400 @@ -712,10 +712,6 @@ pBios = &pMga->Bios; pBios2 = &pMga->Bios2; - /* Get the output mode set by the BIOS */ - xf86ReadDomainMemory(pMga->PciTag, pMga->BiosAddress + 0x7ff1u, - sizeof(CARD8), &pMga->BiosOutputMode); - /* * If the BIOS address was probed, it was found from the PCI config * space. If it was given in the config file, try to guess when it @@ -739,6 +735,9 @@ return; } + /* Get the output mode set by the BIOS */ + pMga->BiosOutputMode = BIOS[0x7ff1]; + /* Get the video BIOS info block */ if (strncmp((char *)(&BIOS[45]), "MATROX", 6)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, --- xc.orig/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2004-07-06 10:37:47.000000000 -0400 +++ xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2004-07-09 04:25:18.000000000 -0400 @@ -424,7 +424,7 @@ if ((pcrp->pci_command & PCI_CMD_MEM_ENABLE) && (num == 1 || ((info->class == PCI_CLASS_DISPLAY) && - (info->subclass == PCI_SUBCLASS_DISPLAY_MISC)))) { + (info->subclass == PCI_SUBCLASS_DISPLAY_VGA)))) { if (primaryBus.type == BUS_NONE) { primaryBus.type = BUS_PCI; primaryBus.id.pci.bus = pcrp->busnum;