From f3b40ada808f2ad81780c63b0feafbe918bb9fd9 Mon Sep 17 00:00:00 2001 From: David Reid Date: Fri, 26 Jul 2002 05:32:00 +0000 Subject: [PATCH] This is a 5 minute attempted fix for Marcus's AGP card not working for VGA accesses. Marcus: can you try this and see if it makes any difference? There should be a debug message if it detects your agp bridge and applies the fix. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@451 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/addons/bus_managers/pci/pci.c | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/kernel/core/addons/bus_managers/pci/pci.c b/src/kernel/core/addons/bus_managers/pci/pci.c index 77085bc0d9..e7c68bd60f 100755 --- a/src/kernel/core/addons/bus_managers/pci/pci.c +++ b/src/kernel/core/addons/bus_managers/pci/pci.c @@ -78,7 +78,7 @@ static void write_pci_config (uchar, uchar, uchar, uchar, uchar, uint32); #define PCI_PRODUCT_INTEL_82443BX 0x7190 #define PCI_PRODUCT_INTEL_82443BX_AGP 0x7191 #define PCI_PRODUCT_INTEL_82443BX_NOAGP 0x7192 - +#define PCI_PRODUCT_INTEL_82845_AGP 0x1a31 /* Config space locking! * We need to make sure we only have one access at a time into the config space, @@ -504,10 +504,12 @@ static int pci_set_power_state(uint8 bus, uint8 dev, uint8 func, int state) return 0; } -/* Borrowed from NetBSD. - * Some Host bridges need to have fixes applied. +/* This used to be fixup_host_bridges, but some PCI-PCI bridges need + * to be adjusted as well so I'll make it more general. + * + * Partially borrowed from NetBSD. */ -static void fixup_host_bridge(uint8 bus, uint8 dev, uint8 func) +static void fixup_bridge(uint8 bus, uint8 dev, uint8 func) { uint16 vendor, device; @@ -534,6 +536,20 @@ static void fixup_host_bridge(uint8 bus, uint8 dev, uint8 func) } break; } + case PCI_PRODUCT_INTEL_82845_AGP: { + /* Foward accesses to VGA memory onto the AGP card + * + * This is very experimental! Added to see if this will + * fix Marcus's problem with this device. + */ + uint8 ctrl = read_pci_config(bus, dev, func, 0x3e, 1); + + if ((ctrl & 0x04) != 0x04) { + dprintf("Enabling VGA_EN1 for Intel 82845 AGP Bridge\n"); + ctrl |= 0x04; + write_pci_config(bus, dev, func, 0x3e, 1, ctrl); + } + } } } } @@ -925,8 +941,7 @@ static void pci_device_probe(uint8 bus, uint8 dev, uint8 func) sub_class = read_pci_config(bus, dev, func, PCI_class_sub, 1); if (base_class == PCI_bridge) { - if (sub_class == PCI_host) - fixup_host_bridge(bus, dev, func); + fixup_bridge(bus, dev, func); if (sub_class == PCI_pci) { pci_bridge(bus, dev, func); return;