Deduplicate ck804 subsystem-setting functionality.
authorJonathan Kollasch <jakllsch@kollasch.net>
Fri, 29 Oct 2010 15:56:04 +0000 (15:56 +0000)
committerJonathan A. Kollasch <jakllsch@kollasch.net>
Fri, 29 Oct 2010 15:56:04 +0000 (15:56 +0000)
Signed-off-by: Jonathan Kollasch <jakllsch@kollasch.net>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6002 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

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

index e8c1049311f38fb3100dd225afa094fa55793857..0aab5d9d80b5ab16e91214e8719a28132ccb547a 100644 (file)
@@ -188,6 +188,16 @@ void ck804_enable(device_t dev)
        }
 }
 
+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,
index 06e189b1101e18755d1557cca27f868a02a6247b..e42f078e06239cd875c8b8b6335eb4b27650e829 100644 (file)
@@ -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
index 4d205f6d87271cd6cb5c8a26a7c0dbec6bace7e8..20b3cfb4b22db0fc37dced12550858dae7d3efd8 100644 (file)
 #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 @@ static struct device_operations ac97audio_ops = {
        // .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 @@ static struct device_operations ac97modem_ops = {
        // .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 = {
index bfd48f7af354870d85b53bdf7d8c8f8f2143140b..7a63d97b56f20c184679f65d36c8afd076393e6e 100644 (file)
 #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 = {
index ad87404ef450754e908f0859f8a0eca207fd586b..47f451e6eb5fc266cd4f5bda09305018d14733d1 100644 (file)
@@ -65,16 +65,6 @@ static void ide_init(struct device *dev)
 #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 @@ static struct device_operations ide_ops = {
        .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 = {
index ec73f196d3328476ca21f333bdde6f36cfd60bce..b3f14bfe1832b2eacb2321aeaffbacb0340dd2a3 100644 (file)
@@ -299,16 +299,6 @@ static void ck804_lpc_enable_resources(device_t dev)
        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 @@ static struct device_operations lpc_ops = {
        .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 @@ static struct device_operations lpc_slave_ops = {
        .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 = {
index 4d468e6c29a81e6c3366a16bbab40936719789bc..8e1bddf9e281c45ba60e7ee97e5fba6d759a8450 100644 (file)
@@ -113,16 +113,6 @@ static void nic_init(struct device *dev)
 #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 @@ static struct device_operations nic_ops = {
        .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 = {
index aee6bec5cc7ef16316462640b614a14b0cdc8568..b3ec80422d9801beea4b24c7cf312dae836e0868 100644 (file)
@@ -164,16 +164,6 @@ static void sata_init(struct device *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 sata_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -181,7 +171,7 @@ static struct device_operations sata_ops = {
        // .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 = {
index 9b51712db56eb84607595e78b866e637145d5219..ca5305065f1a0b847601c9a8c43368513c6480e7 100644 (file)
@@ -92,16 +92,6 @@ static struct smbus_bus_operations lops_smbus_bus = {
        .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 @@ static struct device_operations smbus_ops = {
        .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,
 };
 
index b03a334e27675d5c197c2f490ec5b36b7eb0422c..45ee734eb14161128bb9f2cbea1435b054bfa6f5 100644 (file)
@@ -44,16 +44,6 @@ static void usb1_init(struct device *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 usb_ops = {
        .read_resources   = pci_dev_read_resources,
        .set_resources    = pci_dev_set_resources,
@@ -61,7 +51,7 @@ static struct device_operations usb_ops = {
        .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 = {
index 425dabe2ef4d044d5a228f2c95a8a4320959b8f0..e53f38f01989a68d2782656778faf4465d282484 100644 (file)
@@ -33,16 +33,6 @@ static void usb2_init(struct device *dev)
        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 @@ static struct device_operations usb2_ops = {
        .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 = {