diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2008-10-02 18:19:17 +0000 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2008-10-02 18:19:17 +0000 |
commit | 7f3d48c9afd8f3397f7ce85148d802082ccc9de9 (patch) | |
tree | e44ed0ce259beff8993ace0f25ccf2fa5808f966 /src/southbridge/nvidia/ck804/ck804.c | |
parent | 5107174459f581ff9a2f548768df6e1eef3c2d79 (diff) |
CK804 coding-style fixed based on an 'indent' run (trivial).
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3631 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/southbridge/nvidia/ck804/ck804.c')
-rw-r--r-- | src/southbridge/nvidia/ck804/ck804.c | 245 |
1 files changed, 116 insertions, 129 deletions
diff --git a/src/southbridge/nvidia/ck804/ck804.c b/src/southbridge/nvidia/ck804/ck804.c index 7b6d9f067a..209b15c26c 100644 --- a/src/southbridge/nvidia/ck804/ck804.c +++ b/src/southbridge/nvidia/ck804/ck804.c @@ -4,9 +4,7 @@ */ #include <console/console.h> - #include <arch/io.h> - #include <device/device.h> #include <device/pci.h> #include <device/pci_ids.h> @@ -15,28 +13,31 @@ static uint32_t final_reg; -static device_t find_lpc_dev( device_t dev, unsigned devfn) +static device_t find_lpc_dev(device_t dev, unsigned devfn) { - device_t lpc_dev; - lpc_dev = dev_find_slot(dev->bus->secondary, devfn); - - if ( !lpc_dev ) return lpc_dev; - - if ((lpc_dev->vendor != PCI_VENDOR_ID_NVIDIA) || ( - (lpc_dev->device != PCI_DEVICE_ID_NVIDIA_CK804_LPC) && - (lpc_dev->device != PCI_DEVICE_ID_NVIDIA_CK804_PRO) && - (lpc_dev->device != PCI_DEVICE_ID_NVIDIA_CK804_SLAVE)) ) { - uint32_t id; - id = pci_read_config32(lpc_dev, PCI_VENDOR_ID); - if ( (id != (PCI_VENDOR_ID_NVIDIA | (PCI_DEVICE_ID_NVIDIA_CK804_LPC << 16))) && - (id != (PCI_VENDOR_ID_NVIDIA | (PCI_DEVICE_ID_NVIDIA_CK804_PRO << 16))) && - (id != (PCI_VENDOR_ID_NVIDIA | (PCI_DEVICE_ID_NVIDIA_CK804_SLAVE << 16))) - ) { - lpc_dev = 0; - } - } + lpc_dev = dev_find_slot(dev->bus->secondary, devfn); + if (!lpc_dev) + return lpc_dev; + + if ((lpc_dev->vendor != PCI_VENDOR_ID_NVIDIA) + || ((lpc_dev->device != PCI_DEVICE_ID_NVIDIA_CK804_LPC) + && (lpc_dev->device != PCI_DEVICE_ID_NVIDIA_CK804_PRO) + && (lpc_dev->device != PCI_DEVICE_ID_NVIDIA_CK804_SLAVE))) + { + uint32_t id; + id = pci_read_config32(lpc_dev, PCI_VENDOR_ID); + if ((id != (PCI_VENDOR_ID_NVIDIA | + (PCI_DEVICE_ID_NVIDIA_CK804_LPC << 16))) + && (id != (PCI_VENDOR_ID_NVIDIA | + (PCI_DEVICE_ID_NVIDIA_CK804_PRO << 16))) + && (id != (PCI_VENDOR_ID_NVIDIA | + (PCI_DEVICE_ID_NVIDIA_CK804_SLAVE << 16)))) + { + lpc_dev = 0; + } + } return lpc_dev; } @@ -44,149 +45,135 @@ static device_t find_lpc_dev( device_t dev, unsigned devfn) void ck804_enable(device_t dev) { device_t lpc_dev; - unsigned index = 0; - unsigned index2 = 0; + unsigned index = 0, index2 = 0, deviceid, vendorid, devfn; uint32_t reg_old, reg; uint8_t byte; - unsigned deviceid; - unsigned vendorid; - - struct southbridge_nvidia_ck804_config *conf; - conf = dev->chip_info; - unsigned devfn; + struct southbridge_nvidia_ck804_config *conf; + conf = dev->chip_info; - if(dev->device==0x0000) { + if (dev->device == 0x0000) { vendorid = pci_read_config32(dev, PCI_VENDOR_ID); - deviceid = (vendorid>>16) & 0xffff; -// vendorid &= 0xffff; + deviceid = (vendorid >> 16) & 0xffff; + /* vendorid &= 0xffff; */ } else { -// vendorid = dev->vendor; + /* vendorid = dev->vendor; */ deviceid = dev->device; } devfn = (dev->path.u.pci.devfn) & ~7; - switch(deviceid) { - case PCI_DEVICE_ID_NVIDIA_CK804_SM: - index = 16; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_USB: - devfn -= (1<<3); - index = 8; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_USB2: - devfn -= (1<<3); - index = 20; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_NIC: - devfn -= (9<<3); - index = 10; - dev->rom_address = conf->nic_rom_address; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_NIC_BRIDGE: - devfn -= (9<<3); - index = 10; - dev->rom_address = conf->nic_rom_address; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_ACI: - devfn -= (3<<3); - index = 12; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_MCI: - devfn -= (3<<3); - index = 13; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_IDE: - devfn -= (5<<3); - index = 14; - dev->rom_address = conf->raid_rom_address; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_SATA0: - devfn -= (6<<3); - index = 22; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_SATA1: - devfn -= (7<<3); - index = 18; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_PCI: - devfn -= (8<<3); - index = 15; - break; - case PCI_DEVICE_ID_NVIDIA_CK804_PCI_E: - devfn -= (0xa<<3); - index2 = 19; - break; - default: - index = 0; + switch (deviceid) { + case PCI_DEVICE_ID_NVIDIA_CK804_SM: + index = 16; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_USB: + devfn -= (1 << 3); + index = 8; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_USB2: + devfn -= (1 << 3); + index = 20; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_NIC: + devfn -= (9 << 3); + index = 10; + dev->rom_address = conf->nic_rom_address; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_NIC_BRIDGE: + devfn -= (9 << 3); + index = 10; + dev->rom_address = conf->nic_rom_address; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_ACI: + devfn -= (3 << 3); + index = 12; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_MCI: + devfn -= (3 << 3); + index = 13; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_IDE: + devfn -= (5 << 3); + index = 14; + dev->rom_address = conf->raid_rom_address; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_SATA0: + devfn -= (6 << 3); + index = 22; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_SATA1: + devfn -= (7 << 3); + index = 18; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_PCI: + devfn -= (8 << 3); + index = 15; + break; + case PCI_DEVICE_ID_NVIDIA_CK804_PCI_E: + devfn -= (0xa << 3); + index2 = 19; + break; + default: + index = 0; } - if(index2!=0) { + if (index2 != 0) { int i; - for(i=0;i<4;i++) { - lpc_dev = find_lpc_dev(dev, devfn - (i<<3)); - if(!lpc_dev) continue; + for (i = 0; i < 4; i++) { + lpc_dev = find_lpc_dev(dev, devfn - (i << 3)); + if (!lpc_dev) + continue; index2 -= i; break; } - if ( lpc_dev ) { - reg_old = reg = pci_read_config32(lpc_dev, 0xe4); - - if (!dev->enabled) { - reg |= (1<<index2); - } - - if (reg != reg_old) { - pci_write_config32(lpc_dev, 0xe4, reg); - } + if (lpc_dev) { + reg_old = reg = pci_read_config32(lpc_dev, 0xe4); + if (!dev->enabled) + reg |= (1 << index2); + if (reg != reg_old) + pci_write_config32(lpc_dev, 0xe4, reg); } index2 = 0; return; } - lpc_dev = find_lpc_dev(dev, devfn); + if (!lpc_dev) + return; - if ( !lpc_dev ) return; - - if ( index == 0) { - + if (index == 0) { final_reg = pci_read_config32(lpc_dev, 0xe8); - final_reg &= ~((1<<16)|(1<<8)|(1<<20)|(1<<10)|(1<<12)|(1<<13)|(1<<14)|(1<<22)|(1<<18)|(1<<15)); - pci_write_config32(lpc_dev, 0xe8, final_reg); + final_reg &= ~((1 << 16) | (1 << 8) | (1 << 20) | (1 << 10) + | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 22) + | (1 << 18) | (1 << 15)); + pci_write_config32(lpc_dev, 0xe8, final_reg); - reg_old = reg = pci_read_config32(lpc_dev, 0xe4); - reg |= (1<<20); - if (reg != reg_old) { - pci_write_config32(lpc_dev, 0xe4, reg); - } + reg_old = reg = pci_read_config32(lpc_dev, 0xe4); + reg |= (1 << 20); + if (reg != reg_old) + pci_write_config32(lpc_dev, 0xe4, reg); - byte = pci_read_config8(lpc_dev, 0x74); - byte |= ((1<<1)); - pci_write_config8(dev, 0x74, byte); + byte = pci_read_config8(lpc_dev, 0x74); + byte |= ((1 << 1)); + pci_write_config8(dev, 0x74, byte); - byte = pci_read_config8(lpc_dev, 0xdd); - byte |= ((1<<0)|(1<<3)); - pci_write_config8(dev, 0xdd, byte); + byte = pci_read_config8(lpc_dev, 0xdd); + byte |= ((1 << 0) | (1 << 3)); + pci_write_config8(dev, 0xdd, byte); return; + } - } - - if (!dev->enabled) { - final_reg |= (1 << index); - } + if (!dev->enabled) + final_reg |= (1 << index); - if(index == 10 ) { + if (index == 10) { reg_old = pci_read_config32(lpc_dev, 0xe8); - if (final_reg != reg_old) { - pci_write_config32(lpc_dev, 0xe8, final_reg); - } - + if (final_reg != reg_old) + pci_write_config32(lpc_dev, 0xe8, final_reg); } - } struct chip_operations southbridge_nvidia_ck804_ops = { |