Author: jakllsch
Date: Fri Oct 29 17:56:04 2010
New Revision: 6002
URL: https://tracker.coreboot.org/trac/coreboot/changeset/6002

Log:
Deduplicate ck804 subsystem-setting functionality.

Signed-off-by: Jonathan Kollasch <[email protected]>
Acked-by: Peter Stuge <[email protected]>

Modified:
   trunk/src/southbridge/nvidia/ck804/ck804.c
   trunk/src/southbridge/nvidia/ck804/ck804.h
   trunk/src/southbridge/nvidia/ck804/ck804_ac97.c
   trunk/src/southbridge/nvidia/ck804/ck804_ht.c
   trunk/src/southbridge/nvidia/ck804/ck804_ide.c
   trunk/src/southbridge/nvidia/ck804/ck804_lpc.c
   trunk/src/southbridge/nvidia/ck804/ck804_nic.c
   trunk/src/southbridge/nvidia/ck804/ck804_sata.c
   trunk/src/southbridge/nvidia/ck804/ck804_smbus.c
   trunk/src/southbridge/nvidia/ck804/ck804_usb.c
   trunk/src/southbridge/nvidia/ck804/ck804_usb2.c

Modified: trunk/src/southbridge/nvidia/ck804/ck804.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804.c  Fri Oct 29 16:26:27 2010        
(r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804.c  Fri Oct 29 17:56:04 2010        
(r6002)
@@ -188,6 +188,16 @@
        }
 }
 
+static void ck804_set_subsystem(device_t dev, unsigned vendor, unsigned device)
+{
+       pci_write_config32(dev, 0x40,
+                          ((device & 0xffff) << 16) | (vendor & 0xffff));
+}
+
+struct pci_operations ck804_pci_ops = {
+       .set_subsystem = ck804_set_subsystem,
+};
+
 struct chip_operations southbridge_nvidia_ck804_ops = {
        CHIP_NAME("NVIDIA CK804 Southbridge")
        .enable_dev = ck804_enable,

Modified: trunk/src/southbridge/nvidia/ck804/ck804.h
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804.h  Fri Oct 29 16:26:27 2010        
(r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804.h  Fri Oct 29 17:56:04 2010        
(r6002)
@@ -26,4 +26,6 @@
 void ck804_enable(device_t dev);
 void ck804_enable_usbdebug(unsigned int port);
 
+extern struct pci_operations ck804_pci_ops;
+
 #endif

Modified: trunk/src/southbridge/nvidia/ck804/ck804_ac97.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_ac97.c     Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_ac97.c     Fri Oct 29 17:56:04 
2010        (r6002)
@@ -25,16 +25,6 @@
 #include <device/pci_ops.h>
 #include "ck804.h"
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations ac97audio_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -42,7 +32,7 @@
        // .enable        = ck804_enable,
        .init             = 0,
        .scan_bus         = 0,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver ac97audio_driver __pci_driver = {
@@ -58,7 +48,7 @@
        // .enable        = ck804_enable,
        .init             = 0,
        .scan_bus         = 0,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver ac97modem_driver __pci_driver = {

Modified: trunk/src/southbridge/nvidia/ck804/ck804_ht.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_ht.c       Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_ht.c       Fri Oct 29 17:56:04 
2010        (r6002)
@@ -25,23 +25,13 @@
 #include <device/pci_ops.h>
 #include "ck804.h"
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations ht_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
        .enable_resources = pci_dev_enable_resources,
        .init             = 0,
        .scan_bus         = 0,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver ht_driver __pci_driver = {

Modified: trunk/src/southbridge/nvidia/ck804/ck804_ide.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_ide.c      Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_ide.c      Fri Oct 29 17:56:04 
2010        (r6002)
@@ -65,16 +65,6 @@
 #endif
 }
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations ide_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -82,7 +72,7 @@
        .init             = ide_init,
        .scan_bus         = 0,
        // .enable        = ck804_enable,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver ide_driver __pci_driver = {

Modified: trunk/src/southbridge/nvidia/ck804/ck804_lpc.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_lpc.c      Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_lpc.c      Fri Oct 29 17:56:04 
2010        (r6002)
@@ -299,16 +299,6 @@
        ck804_lpc_enable_childrens_resources(dev);
 }
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations lpc_ops = {
        .read_resources   = ck804_lpc_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -316,7 +306,7 @@
        .init             = lpc_init,
        .scan_bus         = scan_static_bus,
        // .enable        = ck804_enable,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver lpc_driver __pci_driver = {
@@ -344,7 +334,7 @@
        .enable_resources = pci_dev_enable_resources,
        .init             = lpc_slave_init,
        // .enable        = ck804_enable,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver lpc_driver_slave __pci_driver = {

Modified: trunk/src/southbridge/nvidia/ck804/ck804_nic.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_nic.c      Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_nic.c      Fri Oct 29 17:56:04 
2010        (r6002)
@@ -113,16 +113,6 @@
 #endif
 }
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations nic_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -130,7 +120,7 @@
        .init             = nic_init,
        .scan_bus         = 0,
        // .enable        = ck804_enable,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver nic_driver __pci_driver = {

Modified: trunk/src/southbridge/nvidia/ck804/ck804_sata.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_sata.c     Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_sata.c     Fri Oct 29 17:56:04 
2010        (r6002)
@@ -164,16 +164,6 @@
 
 }
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations sata_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -181,7 +171,7 @@
        // .enable        = ck804_enable,
        .init             = sata_init,
        .scan_bus         = 0,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver sata0_driver __pci_driver = {

Modified: trunk/src/southbridge/nvidia/ck804/ck804_smbus.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_smbus.c    Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_smbus.c    Fri Oct 29 17:56:04 
2010        (r6002)
@@ -92,16 +92,6 @@
        .write_byte = lsmbus_write_byte,
 };
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations smbus_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -109,7 +99,7 @@
        .init             = 0,
        .scan_bus         = scan_static_bus,
        // .enable        = ck804_enable,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
        .ops_smbus_bus    = &lops_smbus_bus,
 };
 

Modified: trunk/src/southbridge/nvidia/ck804/ck804_usb.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_usb.c      Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_usb.c      Fri Oct 29 17:56:04 
2010        (r6002)
@@ -44,16 +44,6 @@
        }
 }
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations usb_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -61,7 +51,7 @@
        .init             = usb1_init,
        // .enable        = ck804_enable,
        .scan_bus         = 0,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver usb_driver __pci_driver = {

Modified: trunk/src/southbridge/nvidia/ck804/ck804_usb2.c
==============================================================================
--- trunk/src/southbridge/nvidia/ck804/ck804_usb2.c     Fri Oct 29 16:26:27 
2010        (r6001)
+++ trunk/src/southbridge/nvidia/ck804/ck804_usb2.c     Fri Oct 29 17:56:04 
2010        (r6002)
@@ -33,16 +33,6 @@
        pci_write_config32(dev, 0xf8, dword);
 }
 
-static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
-{
-       pci_write_config32(dev, 0x40,
-                          ((device & 0xffff) << 16) | (vendor & 0xffff));
-}
-
-static struct pci_operations lops_pci = {
-       .set_subsystem = lpci_set_subsystem,
-};
-
 static struct device_operations usb2_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -50,7 +40,7 @@
        .init             = usb2_init,
        // .enable        = ck804_enable,
        .scan_bus         = 0,
-       .ops_pci          = &lops_pci,
+       .ops_pci          = &ck804_pci_ops,
 };
 
 static const struct pci_driver usb2_driver __pci_driver = {

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to