diff --git a/src/northsouthbridge/sis/540/northbridge.c b/src/northsouthbridge/sis/540/northbridge.c index 887f756f0a..6ccce42d57 100644 --- a/src/northsouthbridge/sis/540/northbridge.c +++ b/src/northsouthbridge/sis/540/northbridge.c @@ -98,13 +98,20 @@ unsigned long sizeram() #ifdef HAVE_FRAMEBUFFER void framebuffer_on() { - unsigned long devfn = PCI_DEVFN(0, 0); - u32 command; + struct pci_dev *pcidev; + u16 command; - /* enable legacy VGA register (0x3?4, 0x3?5), not actually needed */ - devfn = PCI_DEVFN(2, 0); - pcibios_read_config_dword(0, devfn, 0x3e, &command); + if ((pcidev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5591_AGP, NULL)) == NULL) + return 0; + + pci_read_config_word(pcidev, 0x04, &command); + command |= 0x20; + pci_write_config_word(pcidev, 0x04, command); + + /* enable legacy VGA IO (0x3B0 - 0x3BB, 0x3C0 - 0x3DF) and MEM (0xA0000 - 0xBFFFF), + needed for XFree86 3.3.6 */ + pci_read_config_word(pcidev, 0x3e, &command); command |= 0x08; - pcibios_write_config_dword(0, devfn, 0x3e, command); + pci_write_config_word(pcidev, 0x3e, command); } #endif /* HAVE_FRAMEBUFFER */ diff --git a/src/northsouthbridge/sis/550/northbridge.c b/src/northsouthbridge/sis/550/northbridge.c index 4862b67abc..ade4c1a42d 100644 --- a/src/northsouthbridge/sis/550/northbridge.c +++ b/src/northsouthbridge/sis/550/northbridge.c @@ -95,13 +95,20 @@ unsigned long sizeram() #ifdef HAVE_FRAMEBUFFER void framebuffer_on() { - unsigned long devfn; + struct pci_dev *pcidev; u16 command; - /* enable legacy VGA register (0x3?4, 0x3?5), needed for XFree86 3.3.6 */ - devfn = PCI_DEVFN(2, 0); - pcibios_read_config_word(0, devfn, 0x3e, &command); + if ((pcidev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5591_AGP, NULL)) == NULL) + return 0; + + pci_read_config_word(pcidev, 0x04, &command); + command |= 0x20; + pci_write_config_word(pcidev, 0x04, command); + + /* enable legacy VGA IO (0x3B0 - 0x3BB, 0x3C0 - 0x3DF) and MEM (0xA0000 - 0xBFFFF), + needed for XFree86 3.3.6 */ + pci_read_config_word(pcidev, 0x3e, &command); command |= 0x08; - pcibios_write_config_word(0, devfn, 0x3e, command); + pci_write_config_word(pcidev, 0x3e, command); } #endif /* HAVE_FRAMEBUFFER */ diff --git a/src/northsouthbridge/sis/630/northbridge.c b/src/northsouthbridge/sis/630/northbridge.c index a6781ce9c3..247f1fe791 100644 --- a/src/northsouthbridge/sis/630/northbridge.c +++ b/src/northsouthbridge/sis/630/northbridge.c @@ -95,20 +95,20 @@ unsigned long sizeram() #ifdef HAVE_FRAMEBUFFER void framebuffer_on() { - unsigned long devfn; + struct pci_dev *pcidev; u16 command; - devfn = PCI_DEVFN(2, 0); + if ((pcidev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5591_AGP, NULL)) == NULL) + return 0; - /* Enable VGA Palette Snoop */ - pcibios_read_config_word(0, devfn, 0x04, &command); + pci_read_config_word(pcidev, 0x04, &command); command |= 0x20; - pcibios_write_config_word(0, devfn, 0x04, command); + pci_write_config_word(pcidev, 0x04, command); /* enable legacy VGA IO (0x3B0 - 0x3BB, 0x3C0 - 0x3DF) and MEM (0xA0000 - 0xBFFFF), needed for XFree86 3.3.6 */ - pcibios_read_config_word(0, devfn, 0x3e, &command); + pci_read_config_word(pcidev, 0x3e, &command); command |= 0x08; - pcibios_write_config_word(0, devfn, 0x3e, command); + pci_write_config_word(pcidev, 0x3e, command); } #endif /* HAVE_FRAMEBUFFER */ diff --git a/src/northsouthbridge/sis/635/northbridge.c b/src/northsouthbridge/sis/635/northbridge.c index 893f5ad506..8d4ae9a9ac 100644 --- a/src/northsouthbridge/sis/635/northbridge.c +++ b/src/northsouthbridge/sis/635/northbridge.c @@ -90,20 +90,20 @@ long sizeram() #ifdef HAVE_FRAMEBUFFER void framebuffer_on() { - unsigned long devfn; + struct pci_dev *pcidev; u16 command; - devfn = PCI_DEVFN(2, 0); + if ((pcidev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5591_AGP, NULL)) == NULL) + return 0; - /* Enable VGA Palette Snoop */ - pcibios_read_config_word(0, devfn, 0x04, &command); + pci_read_config_word(pcidev, 0x04, &command); command |= 0x20; - pcibios_write_config_word(0, devfn, 0x04, command); + pci_write_config_word(pcidev, 0x04, command); /* enable legacy VGA IO (0x3B0 - 0x3BB, 0x3C0 - 0x3DF) and MEM (0xA0000 - 0xBFFFF), needed for XFree86 3.3.6 */ - pcibios_read_config_word(0, devfn, 0x3e, &command); + pci_read_config_word(pcidev, 0x3e, &command); command |= 0x08; - pcibios_write_config_word(0, devfn, 0x3e, command); + pci_write_config_word(pcidev, 0x3e, command); } #endif /* HAVE_FRAMEBUFFER */ diff --git a/src/northsouthbridge/sis/730/northbridge.c b/src/northsouthbridge/sis/730/northbridge.c index 4ac51b06e1..319e8c83be 100644 --- a/src/northsouthbridge/sis/730/northbridge.c +++ b/src/northsouthbridge/sis/730/northbridge.c @@ -103,21 +103,21 @@ unsigned long sizeram() #ifdef HAVE_FRAMEBUFFER void framebuffer_on() { - unsigned long devfn = PCI_DEVFN(0, 0); - u32 command; + struct pci_dev *pcidev; + u16 command; - devfn = PCI_DEVFN(2, 0); + if ((pcidev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5591_AGP, NULL)) == NULL) + return 0; - /* Enable VGA Palette Snoop */ - pcibios_read_config_word(0, devfn, 0x04, &command); + pci_read_config_word(pcidev, 0x04, &command); command |= 0x20; - pcibios_write_config_word(0, devfn, 0x04, command); + pci_write_config_word(pcidev, 0x04, command); /* enable legacy VGA IO (0x3B0 - 0x3BB, 0x3C0 - 0x3DF) and MEM (0xA0000 - 0xBFFFF), needed for XFree86 3.3.6 */ - pcibios_read_config_byte(0, devfn, 0x3e, &command); + pci_read_config_word(pcidev, 0x3e, &command); command |= 0x08; - pcibios_write_config_byte(0, devfn, 0x3e, command); + pci_write_config_word(pcidev, 0x3e, command); } #endif /* HAVE_FRAMEBUFFER */ diff --git a/src/northsouthbridge/sis/735/northbridge.c b/src/northsouthbridge/sis/735/northbridge.c index c4f147ff1c..4366d8b826 100644 --- a/src/northsouthbridge/sis/735/northbridge.c +++ b/src/northsouthbridge/sis/735/northbridge.c @@ -90,20 +90,20 @@ long sizeram() #ifdef HAVE_FRAMEBUFFER void framebuffer_on() { - unsigned long devfn; + struct pci_dev *pcidev; u16 command; - devfn = PCI_DEVFN(2, 0); + if ((pcidev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5591_AGP, NULL)) == NULL) + return 0; - /* Enable VGA Palette Snoop */ - pcibios_read_config_word(0, devfn, 0x04, &command); + pci_read_config_word(pcidev, 0x04, &command); command |= 0x20; - pcibios_write_config_word(0, devfn, 0x04, command); + pci_write_config_word(pcidev, 0x04, command); /* enable legacy VGA IO (0x3B0 - 0x3BB, 0x3C0 - 0x3DF) and MEM (0xA0000 - 0xBFFFF), needed for XFree86 3.3.6 */ - pcibios_read_config_word(0, devfn, 0x3e, &command); + pci_read_config_word(pcidev, 0x3e, &command); command |= 0x08; - pcibios_write_config_word(0, devfn, 0x3e, command); + pci_write_config_word(pcidev, 0x3e, command); } #endif /* HAVE_FRAMEBUFFER */