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
This commit is contained in:
Jonathan Kollasch 2010-10-29 15:56:04 +00:00 committed by Jonathan A. Kollasch
parent bb42300f03
commit c7f3f80cf0
11 changed files with 23 additions and 101 deletions

View 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 = { struct chip_operations southbridge_nvidia_ck804_ops = {
CHIP_NAME("NVIDIA CK804 Southbridge") CHIP_NAME("NVIDIA CK804 Southbridge")
.enable_dev = ck804_enable, .enable_dev = ck804_enable,

View File

@ -26,4 +26,6 @@
void ck804_enable(device_t dev); void ck804_enable(device_t dev);
void ck804_enable_usbdebug(unsigned int port); void ck804_enable_usbdebug(unsigned int port);
extern struct pci_operations ck804_pci_ops;
#endif #endif

View File

@ -25,16 +25,6 @@
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include "ck804.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 = { static struct device_operations ac97audio_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -42,7 +32,7 @@ static struct device_operations ac97audio_ops = {
// .enable = ck804_enable, // .enable = ck804_enable,
.init = 0, .init = 0,
.scan_bus = 0, .scan_bus = 0,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver ac97audio_driver __pci_driver = { static const struct pci_driver ac97audio_driver __pci_driver = {
@ -58,7 +48,7 @@ static struct device_operations ac97modem_ops = {
// .enable = ck804_enable, // .enable = ck804_enable,
.init = 0, .init = 0,
.scan_bus = 0, .scan_bus = 0,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver ac97modem_driver __pci_driver = { static const struct pci_driver ac97modem_driver __pci_driver = {

View File

@ -25,23 +25,13 @@
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include "ck804.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 = { static struct device_operations ht_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources, .enable_resources = pci_dev_enable_resources,
.init = 0, .init = 0,
.scan_bus = 0, .scan_bus = 0,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver ht_driver __pci_driver = { static const struct pci_driver ht_driver __pci_driver = {

View File

@ -65,16 +65,6 @@ static void ide_init(struct device *dev)
#endif #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 = { static struct device_operations ide_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -82,7 +72,7 @@ static struct device_operations ide_ops = {
.init = ide_init, .init = ide_init,
.scan_bus = 0, .scan_bus = 0,
// .enable = ck804_enable, // .enable = ck804_enable,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver ide_driver __pci_driver = { static const struct pci_driver ide_driver __pci_driver = {

View File

@ -299,16 +299,6 @@ static void ck804_lpc_enable_resources(device_t dev)
ck804_lpc_enable_childrens_resources(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 = { static struct device_operations lpc_ops = {
.read_resources = ck804_lpc_read_resources, .read_resources = ck804_lpc_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -316,7 +306,7 @@ static struct device_operations lpc_ops = {
.init = lpc_init, .init = lpc_init,
.scan_bus = scan_static_bus, .scan_bus = scan_static_bus,
// .enable = ck804_enable, // .enable = ck804_enable,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver lpc_driver __pci_driver = { 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, .enable_resources = pci_dev_enable_resources,
.init = lpc_slave_init, .init = lpc_slave_init,
// .enable = ck804_enable, // .enable = ck804_enable,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver lpc_driver_slave __pci_driver = { static const struct pci_driver lpc_driver_slave __pci_driver = {

View File

@ -113,16 +113,6 @@ static void nic_init(struct device *dev)
#endif #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 = { static struct device_operations nic_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -130,7 +120,7 @@ static struct device_operations nic_ops = {
.init = nic_init, .init = nic_init,
.scan_bus = 0, .scan_bus = 0,
// .enable = ck804_enable, // .enable = ck804_enable,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver nic_driver __pci_driver = { static const struct pci_driver nic_driver __pci_driver = {

View 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 = { static struct device_operations sata_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -181,7 +171,7 @@ static struct device_operations sata_ops = {
// .enable = ck804_enable, // .enable = ck804_enable,
.init = sata_init, .init = sata_init,
.scan_bus = 0, .scan_bus = 0,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver sata0_driver __pci_driver = { static const struct pci_driver sata0_driver __pci_driver = {

View File

@ -92,16 +92,6 @@ static struct smbus_bus_operations lops_smbus_bus = {
.write_byte = lsmbus_write_byte, .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 = { static struct device_operations smbus_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -109,7 +99,7 @@ static struct device_operations smbus_ops = {
.init = 0, .init = 0,
.scan_bus = scan_static_bus, .scan_bus = scan_static_bus,
// .enable = ck804_enable, // .enable = ck804_enable,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
.ops_smbus_bus = &lops_smbus_bus, .ops_smbus_bus = &lops_smbus_bus,
}; };

View 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 = { static struct device_operations usb_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -61,7 +51,7 @@ static struct device_operations usb_ops = {
.init = usb1_init, .init = usb1_init,
// .enable = ck804_enable, // .enable = ck804_enable,
.scan_bus = 0, .scan_bus = 0,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver usb_driver __pci_driver = { static const struct pci_driver usb_driver __pci_driver = {

View File

@ -33,16 +33,6 @@ static void usb2_init(struct device *dev)
pci_write_config32(dev, 0xf8, dword); 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 = { static struct device_operations usb2_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -50,7 +40,7 @@ static struct device_operations usb2_ops = {
.init = usb2_init, .init = usb2_init,
// .enable = ck804_enable, // .enable = ck804_enable,
.scan_bus = 0, .scan_bus = 0,
.ops_pci = &lops_pci, .ops_pci = &ck804_pci_ops,
}; };
static const struct pci_driver usb2_driver __pci_driver = { static const struct pci_driver usb2_driver __pci_driver = {