summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Kollasch <jakllsch@kollasch.net>2010-10-29 15:56:04 +0000
committerJonathan A. Kollasch <jakllsch@kollasch.net>2010-10-29 15:56:04 +0000
commitc7f3f80cf06165fc4e645a88590d7d8c982395de (patch)
tree22e37525d5ff3b75eaabf14ce528daf9dbbaaca8
parentbb42300f036c1bd1b047ba89104e97ed565f12ef (diff)
downloadcoreboot-c7f3f80cf06165fc4e645a88590d7d8c982395de.tar.xz
Deduplicate ck804 subsystem-setting functionality.
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
-rw-r--r--src/southbridge/nvidia/ck804/ck804.c10
-rw-r--r--src/southbridge/nvidia/ck804/ck804.h2
-rw-r--r--src/southbridge/nvidia/ck804/ck804_ac97.c14
-rw-r--r--src/southbridge/nvidia/ck804/ck804_ht.c12
-rw-r--r--src/southbridge/nvidia/ck804/ck804_ide.c12
-rw-r--r--src/southbridge/nvidia/ck804/ck804_lpc.c14
-rw-r--r--src/southbridge/nvidia/ck804/ck804_nic.c12
-rw-r--r--src/southbridge/nvidia/ck804/ck804_sata.c12
-rw-r--r--src/southbridge/nvidia/ck804/ck804_smbus.c12
-rw-r--r--src/southbridge/nvidia/ck804/ck804_usb.c12
-rw-r--r--src/southbridge/nvidia/ck804/ck804_usb2.c12
11 files changed, 23 insertions, 101 deletions
diff --git a/src/southbridge/nvidia/ck804/ck804.c b/src/southbridge/nvidia/ck804/ck804.c
index e8c1049311..0aab5d9d80 100644
--- a/src/southbridge/nvidia/ck804/ck804.c
+++ b/src/southbridge/nvidia/ck804/ck804.c
@@ -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,
diff --git a/src/southbridge/nvidia/ck804/ck804.h b/src/southbridge/nvidia/ck804/ck804.h
index 06e189b110..e42f078e06 100644
--- a/src/southbridge/nvidia/ck804/ck804.h
+++ b/src/southbridge/nvidia/ck804/ck804.h
@@ -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
diff --git a/src/southbridge/nvidia/ck804/ck804_ac97.c b/src/southbridge/nvidia/ck804/ck804_ac97.c
index 4d205f6d87..20b3cfb4b2 100644
--- a/src/southbridge/nvidia/ck804/ck804_ac97.c
+++ b/src/southbridge/nvidia/ck804/ck804_ac97.c
@@ -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 @@ 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 = {
diff --git a/src/southbridge/nvidia/ck804/ck804_ht.c b/src/southbridge/nvidia/ck804/ck804_ht.c
index bfd48f7af3..7a63d97b56 100644
--- a/src/southbridge/nvidia/ck804/ck804_ht.c
+++ b/src/southbridge/nvidia/ck804/ck804_ht.c
@@ -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 = {
diff --git a/src/southbridge/nvidia/ck804/ck804_ide.c b/src/southbridge/nvidia/ck804/ck804_ide.c
index ad87404ef4..47f451e6eb 100644
--- a/src/southbridge/nvidia/ck804/ck804_ide.c
+++ b/src/southbridge/nvidia/ck804/ck804_ide.c
@@ -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 = {
diff --git a/src/southbridge/nvidia/ck804/ck804_lpc.c b/src/southbridge/nvidia/ck804/ck804_lpc.c
index ec73f196d3..b3f14bfe18 100644
--- a/src/southbridge/nvidia/ck804/ck804_lpc.c
+++ b/src/southbridge/nvidia/ck804/ck804_lpc.c
@@ -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 = {
diff --git a/src/southbridge/nvidia/ck804/ck804_nic.c b/src/southbridge/nvidia/ck804/ck804_nic.c
index 4d468e6c29..8e1bddf9e2 100644
--- a/src/southbridge/nvidia/ck804/ck804_nic.c
+++ b/src/southbridge/nvidia/ck804/ck804_nic.c
@@ -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 = {
diff --git a/src/southbridge/nvidia/ck804/ck804_sata.c b/src/southbridge/nvidia/ck804/ck804_sata.c
index aee6bec5cc..b3ec80422d 100644
--- a/src/southbridge/nvidia/ck804/ck804_sata.c
+++ b/src/southbridge/nvidia/ck804/ck804_sata.c
@@ -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 = {
diff --git a/src/southbridge/nvidia/ck804/ck804_smbus.c b/src/southbridge/nvidia/ck804/ck804_smbus.c
index 9b51712db5..ca5305065f 100644
--- a/src/southbridge/nvidia/ck804/ck804_smbus.c
+++ b/src/southbridge/nvidia/ck804/ck804_smbus.c
@@ -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,
};
diff --git a/src/southbridge/nvidia/ck804/ck804_usb.c b/src/southbridge/nvidia/ck804/ck804_usb.c
index b03a334e27..45ee734eb1 100644
--- a/src/southbridge/nvidia/ck804/ck804_usb.c
+++ b/src/southbridge/nvidia/ck804/ck804_usb.c
@@ -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 = {
diff --git a/src/southbridge/nvidia/ck804/ck804_usb2.c b/src/southbridge/nvidia/ck804/ck804_usb2.c
index 425dabe2ef..e53f38f019 100644
--- a/src/southbridge/nvidia/ck804/ck804_usb2.c
+++ b/src/southbridge/nvidia/ck804/ck804_usb2.c
@@ -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 = {