Various cosmetic fixes and improvements (trivial).
authorUwe Hermann <uwe@hermann-uwe.de>
Thu, 15 Nov 2007 15:52:42 +0000 (15:52 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 15 Nov 2007 15:52:42 +0000 (15:52 +0000)
 - Use 'static' where appropriate.
 - Use 'const' where appropriate.
 - Indentation fixes.
 - Add comment wrt init code which is only valid for VT8237R.

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@2974 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

12 files changed:
src/southbridge/via/k8t890/k8t890_ctrl.c
src/southbridge/via/k8t890/k8t890_dram.c
src/southbridge/via/k8t890/k8t890_error.c
src/southbridge/via/k8t890/k8t890_host.c
src/southbridge/via/k8t890/k8t890_host_ctrl.c
src/southbridge/via/k8t890/k8t890_pcie.c
src/southbridge/via/k8t890/k8t890_traf_ctrl.c
src/southbridge/via/vt8237r/vt8237r.c
src/southbridge/via/vt8237r/vt8237r_bridge.c
src/southbridge/via/vt8237r/vt8237r_ide.c
src/southbridge/via/vt8237r/vt8237r_lpc.c
src/southbridge/via/vt8237r/vt8237r_sata.c

index c57c165195c5cd6b1433a5dc0b35f77c6f6cbfe1..128d50f1a71f5fe68ec79365ddcd1c398372e4da 100644 (file)
  * V-Link CKG Control                           0xb0  0x05  0x05  0x06  0x03
  * V-Link CKG Control                           0xb1  0x05  0x05  0x01  0x03
  */
-static void ctrl_init(struct device *dev)
+static void ctrl_init_vt8237r(struct device *dev)
 {
        u8 reg;
+
+       /*
+        * This init code is valid only for the VT8237R! For different
+        * sounthbridges (e.g. VT8237A, VT8237S, VT8237 (without plus R)
+        * and VT8251) a different init code is required.
+        */
        device_t devsb = dev_find_device(PCI_VENDOR_ID_VIA,
                                         PCI_DEVICE_ID_VIA_VT8237R_LPC, 0);
-
        if (!devsb)
                return;
 
@@ -132,17 +137,17 @@ static void ctrl_enable(struct device *dev)
        pci_write_config8(dev, 0x63, regm3 | (regm & 0x3F));
 }
 
-static struct device_operations ctrl_ops = {
-       .read_resources = pci_dev_read_resources,
-       .set_resources = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable = ctrl_enable,
-       .init = ctrl_init,
-       .ops_pci = 0,
+static const struct device_operations ctrl_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .enable                 = ctrl_enable,
+       .init                   = ctrl_init_vt8237r,
+       .ops_pci                = 0,
 };
 
 static const struct pci_driver northbridge_driver __pci_driver = {
-       .ops = &ctrl_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_7,
+       .ops    = &ctrl_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_7,
 };
index 9d6517f775d549653fe1fc001789800f1003a557..e816594d922e150bccc7c29c5b1f5124ef8f2391 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/pci_ops.h>
 #include <device/pci_ids.h>
 #include <console/console.h>
 #include <cpu/x86/msr.h>
@@ -63,16 +62,16 @@ static void dram_enable(struct device *dev)
        pci_write_config16(dev, 0x88, (msr.lo >> 24) | reg);
 }
 
-static struct device_operations dram_ops = {
-       .read_resources = pci_dev_read_resources,
-       .set_resources = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable = dram_enable,
-       .ops_pci = 0,
+static const struct device_operations dram_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .enable                 = dram_enable,
+       .ops_pci                = 0,
 };
 
 static const struct pci_driver northbridge_driver __pci_driver = {
-       .ops = &dram_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_3,
+       .ops    = &dram_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_3,
 };
index 49d32bf90398e5dffd33c17b35b0e8d994140d9e..7c0c7444035d3f83e337d8a53006a6f655a54ec4 100644 (file)
@@ -33,15 +33,15 @@ static void error_enable(struct device *dev)
 }
 
 static const struct device_operations error_ops = {
-       .read_resources = pci_dev_read_resources,
-       .set_resources = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable = error_enable,
-       .ops_pci = 0,
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .enable                 = error_enable,
+       .ops_pci                = 0,
 };
 
 static const struct pci_driver northbridge_driver __pci_driver = {
-       .ops = &error_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_1,
+       .ops    = &error_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_1,
 };
index 980c85dea159299c5b37e7ac6232f329a2cc55d2..1ed9281a92299872017dda884168705ea7f2dff2 100644 (file)
@@ -30,16 +30,16 @@ static void host_enable(struct device *dev)
        pci_write_config8(dev, K8T890_MULTIPLE_FN_EN, 0x01);
 }
 
-static struct device_operations host_ops = {
-       .read_resources = pci_dev_read_resources,
-       .set_resources = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable = host_enable,
-       .ops_pci = 0,
+static const struct device_operations host_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .enable                 = host_enable,
+       .ops_pci                = 0,
 };
 
 static const struct pci_driver northbridge_driver __pci_driver = {
-       .ops = &host_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_0,
+       .ops    = &host_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_0,
 };
index e3e358b7ca5e7d1e90c21d84bf0437e1cece00f3..8c9f41871c29c45272de8f7214e9386fbdf6710c 100644 (file)
@@ -78,16 +78,16 @@ static void host_ctrl_enable(struct device *dev)
        dump_south(dev);
 }
 
-static struct device_operations host_ctrl_ops = {
-       .read_resources = pci_dev_read_resources,
-       .set_resources = pci_dev_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable = host_ctrl_enable,
-       .ops_pci = 0,
+static const struct device_operations host_ctrl_ops = {
+       .read_resources         = pci_dev_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .enable                 = host_ctrl_enable,
+       .ops_pci                = 0,
 };
 
 static const struct pci_driver northbridge_driver __pci_driver = {
-       .ops = &host_ctrl_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_2,
+       .ops    = &host_ctrl_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_2,
 };
index 21acf167805f97a29dfeaca6350af3a527a466f8..726d803873278d478ff0f2462f863dcf9fd51438 100644 (file)
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pciexp.h>
-#include <device/pci_ops.h>
 #include <device/pci_ids.h>
 
-void peg_init(struct device *dev)
+static void peg_init(struct device *dev)
 {
        u8 reg;
 
@@ -78,7 +77,7 @@ void peg_init(struct device *dev)
        dump_south(dev);
 }
 
-void pcie_init(struct device *dev)
+static void pcie_init(struct device *dev)
 {
        u8 reg;
 
@@ -113,52 +112,52 @@ void pcie_init(struct device *dev)
        dump_south(dev);
 }
 
-static struct device_operations peg_ops = {
-       .read_resources = pci_bus_read_resources,
-       .set_resources = pci_dev_set_resources,
-       .enable_resources = pci_bus_enable_resources,
-       .enable = peg_init,
-       .scan_bus = pciexp_scan_bridge,
-       .reset_bus = pci_bus_reset,
-       .ops_pci = 0,
+static const struct device_operations peg_ops = {
+       .read_resources         = pci_bus_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_bus_enable_resources,
+       .enable                 = peg_init,
+       .scan_bus               = pciexp_scan_bridge,
+       .reset_bus              = pci_bus_reset,
+       .ops_pci                = 0,
 };
 
-static struct device_operations pcie_ops = {
-       .read_resources = pci_bus_read_resources,
-       .set_resources = pci_dev_set_resources,
-       .enable_resources = pci_bus_enable_resources,
-       .enable = pcie_init,
-       .scan_bus = pciexp_scan_bridge,
-       .reset_bus = pci_bus_reset,
-       .ops_pci = 0,
+static const struct device_operations pcie_ops = {
+       .read_resources         = pci_bus_read_resources,
+       .set_resources          = pci_dev_set_resources,
+       .enable_resources       = pci_bus_enable_resources,
+       .enable                 = pcie_init,
+       .scan_bus               = pciexp_scan_bridge,
+       .reset_bus              = pci_bus_reset,
+       .ops_pci                = 0,
 };
 
 static const struct pci_driver northbridge_driver __pci_driver = {
-       .ops = &peg_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEG,
+       .ops    = &peg_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEG,
 };
 
 static const struct pci_driver pcie_drvd3f0 __pci_driver = {
-       .ops = &pcie_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEX0,
+       .ops    = &pcie_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEX0,
 };
 
 static const struct pci_driver pcie_drvd3f1 __pci_driver = {
-       .ops = &pcie_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEX1,
+       .ops    = &pcie_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEX1,
 };
 
 static const struct pci_driver pcie_drvd3f2 __pci_driver = {
-       .ops = &pcie_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEX2,
+       .ops    = &pcie_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEX2,
 };
 
 static const struct pci_driver pcie_drvd3f3 __pci_driver = {
-       .ops = &pcie_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEX3,
+       .ops    = &pcie_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_PEX3,
 };
index 85ab5a055114ac80f92a5061ee40d4d220c13880..304dfaea7f41aad85672bb47aa3939e1357b8208 100644 (file)
 
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/pci_ops.h>
 #include <device/pci_ids.h>
 #include <console/console.h>
-
 #include "k8t890.h"
 
-void mmconfig_set_resources(device_t dev)
+static void mmconfig_set_resources(device_t dev)
 {
        struct resource *resource;
        u8 reg;
@@ -106,16 +104,16 @@ static void traf_ctrl_enable(struct device *dev)
        apic[4] = (data & 0xF0FFFF) | (K8T890_APIC_ID << 24);
 }
 
-static struct device_operations traf_ctrl_ops = {
-       .read_resources = apic_mmconfig_read_resources,
-       .set_resources = mmconfig_set_resources,
-       .enable_resources = pci_dev_enable_resources,
-       .enable = traf_ctrl_enable,
-       .ops_pci = 0,
+static const struct device_operations traf_ctrl_ops = {
+       .read_resources         = apic_mmconfig_read_resources,
+       .set_resources          = mmconfig_set_resources,
+       .enable_resources       = pci_dev_enable_resources,
+       .enable                 = traf_ctrl_enable,
+       .ops_pci                = 0,
 };
 
 static const struct pci_driver northbridge_driver __pci_driver = {
-       .ops = &traf_ctrl_ops,
-       .vendor = PCI_VENDOR_ID_VIA,
-       .device = PCI_DEVICE_ID_VIA_K8T890CE_5,
+       .ops    = &traf_ctrl_ops,
+       .vendor = PCI_VENDOR_ID_VIA,
+       .device = PCI_DEVICE_ID_VIA_K8T890CE_5,
 };
index 0d257d1f2656994a5ac0aed787d23f0e0508c4c6..f87fc1a3982bb3357cf0d3cffa70a5cf2651de15 100644 (file)
@@ -20,7 +20,6 @@
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/pci_ops.h>
 #include <device/pci_ids.h>
 #include <pc80/keyboard.h>
 #include "chip.h"
index 8baaaf8f826e7cf352b9114b74a164ecc20f118d..2077f3bb09d50c03219db32d0af83ea95fef1acf 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/pci_ops.h>
 #include <device/pci_ids.h>
 #include <console/console.h>
 
index 1496f83b3333ed54228b57c530da5017f915d467..9f6f3a7a70ddea566b6017826c747f7ffce20057 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/pci_ops.h>
 #include <device/pci_ids.h>
 #include <console/console.h>
 #include "vt8237r.h"
index 5d2579e5304fa9fd3d2f414e4fce4ce2c9ea79a4..8d0fa3402f37d191ed221ec3d4f5e7a71be1520e 100644 (file)
@@ -23,7 +23,6 @@
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/pci_ops.h>
 #include <device/pci_ids.h>
 #include <pc80/mc146818rtc.h>
 #include <cpu/x86/lapic.h>
@@ -48,7 +47,7 @@
 
 extern void dump_south(device_t dev);
 
-struct ioapicreg {
+static struct ioapicreg {
        u32 reg;
        u32 value_low;
        u32 value_high;
@@ -146,7 +145,7 @@ static void pci_routing_fixup(struct device *dev)
  * Set up the power management capabilities directly into ACPI mode.
  * This avoids having to handle any System Management Interrupts (SMIs).
  */
-void setup_pm(device_t dev)
+static void setup_pm(device_t dev)
 {
        /* Debounce LID and PWRBTN# Inputs for 16ms. */
        pci_write_config8(dev, 0x80, 0x20);
@@ -299,7 +298,7 @@ static void vt8237r_init(struct device *dev)
        rtc_init(0);
 }
 
-void vt8237r_read_resources(device_t dev)
+static void vt8237r_read_resources(device_t dev)
 {
        struct resource *res;
 
@@ -320,7 +319,7 @@ void vt8237r_read_resources(device_t dev)
  * than standard PC I/O addresses), however it does control the ISA bus
  * and so we need to manually call enable childrens resources on that bus.
  */
-void vt8237r_enable_resources(device_t dev)
+static void vt8237r_enable_resources(device_t dev)
 {
        pci_dev_enable_resources(dev);
        enable_childrens_resources(dev);
index 941887f812b0e4cb52cc741dab9a05dfdba64a87..1cf2976327ec130f0571cef44f001558f998e0fd 100644 (file)
@@ -20,7 +20,6 @@
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/pci_ops.h>
 #include <device/pci_ids.h>
 
 #define SATA_MISC_CTRL 0x45