From 0ea281f70077b6f8d69d3070447205b7afd6883a Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Mon, 11 Oct 2010 21:38:49 +0000 Subject: First round of ICH2/ICH2-M cleanups after split from i82801xx. - Drop all non-ICH2 "struct pci_driver" entries from all files. - Kconfig: Add missing USE_WATCHDOG_ON_BOOT. - Drop i82801bx_sata.c and i82801bx_usb_ehci.c, ICH2 doesn't have SATA/EHCI. - Simplify lots of code, getting rid of i82801xx remainders. - Use u8 et al (instead of uint8_t) in a few more places. - Use #defines from header files where possible. - Various other fixes and updates. Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5938 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/southbridge/intel/i82801bx/i82801bx.c | 37 +++++++++---------------------- 1 file changed, 10 insertions(+), 27 deletions(-) (limited to 'src/southbridge/intel/i82801bx/i82801bx.c') diff --git a/src/southbridge/intel/i82801bx/i82801bx.c b/src/southbridge/intel/i82801bx/i82801bx.c index 2352723935..7f59977ab2 100644 --- a/src/southbridge/intel/i82801bx/i82801bx.c +++ b/src/southbridge/intel/i82801bx/i82801bx.c @@ -27,38 +27,21 @@ void i82801bx_enable(device_t dev) { - unsigned int index = 0; - uint16_t cur_disable_mask, new_disable_mask; + u16 reg16, index; + device_t lpc_dev; - /* All 82801xx devices should be on bus 0. */ - unsigned int devfn = PCI_DEVFN(0x1f, 0); // LPC - device_t lpc_dev = dev_find_slot(0, devfn); // 0 + /* Search for the 82801BA/BAM LPC device (D31:F0) on PCI bus 0. */ + lpc_dev = dev_find_slot(0, PCI_DEVFN(0x1f, 0)); if (!lpc_dev) return; - /* We're going to assume, perhaps incorrectly, that if a function - * exists it can be disabled. Workarounds for ICH variants that don't - * follow this should be done by checking the device ID. - */ - if (PCI_SLOT(dev->path.pci.devfn) == 31) { - index = PCI_FUNC(dev->path.pci.devfn); - } else if (PCI_SLOT(dev->path.pci.devfn) == 29) { - index = 8 + PCI_FUNC(dev->path.pci.devfn); - } + index = PCI_FUNC(dev->path.pci.devfn); - /* Function 0 is a bit of an exception. */ - if (index == 0) { - index = 14; - } - - cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS); - new_disable_mask = cur_disable_mask & ~(1 << index); /* Enable it. */ - if (!dev->enabled) { - new_disable_mask |= (1 << index); /* Disable it, if desired. */ - } - if (new_disable_mask != cur_disable_mask) { - pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask); - } + reg16 = pci_read_config16(lpc_dev, FUNC_DIS); + reg16 &= ~(1 << index); /* Enable device. */ + if (!dev->enabled) + reg16 |= (1 << index); /* Disable device, if desired. */ + pci_write_config16(lpc_dev, FUNC_DIS, reg16); } struct chip_operations southbridge_intel_i82801bx_ops = { -- cgit v1.2.3