summaryrefslogtreecommitdiff
path: root/src/devices
diff options
context:
space:
mode:
authorarch import user (historical) <svn@openbios.org>2005-07-06 17:13:46 +0000
committerarch import user (historical) <svn@openbios.org>2005-07-06 17:13:46 +0000
commit98d0d30f6b8237f888cd44b33292319e3c167a47 (patch)
tree0571a9e863b7a7749c2e4fd5bda7ec080831a73c /src/devices
parent577f185d382c8130f20f0ee7e8466ed8bbebbacc (diff)
downloadcoreboot-98d0d30f6b8237f888cd44b33292319e3c167a47.tar.xz
Revision: linuxbios@linuxbios.org--devel/freebios--devel--2.0--patch-30
Creator: Yinghai Lu <yhlu@tyan.com> Nvidia Ck804 support git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1946 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/device_util.c26
-rw-r--r--src/devices/emulator/biosemu.c7
-rw-r--r--src/devices/hypertransport.c28
-rw-r--r--src/devices/pci_device.c1
-rw-r--r--src/devices/root_device.c6
5 files changed, 62 insertions, 6 deletions
diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index ff2d90ce6e..a19a878b47 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -64,6 +64,29 @@ struct device *dev_find_slot(unsigned int bus, unsigned int devfn)
return result;
}
+/**
+ * @brief Given a smbus bus and a device number, find the device structure
+ *
+ * @param bus The bus number
+ * @param addr a device number
+ * @return pointer to the device structure
+ */
+struct device *dev_find_slot_on_smbus(unsigned int bus, unsigned int addr)
+{
+ struct device *dev, *result;
+
+ result = 0;
+ for (dev = all_devices; dev; dev = dev->next) {
+ if ((dev->path.type == DEVICE_PATH_I2C) &&
+ (dev->bus->secondary == bus) &&
+ (dev->path.u.i2c.device == addr)) {
+ result = dev;
+ break;
+ }
+ }
+ return result;
+}
+
/** Find a device of a given vendor and type
* @param vendor Vendor ID (e.g. 0x8086 for Intel)
* @param device Device ID
@@ -125,7 +148,8 @@ const char *dev_path(device_t dev)
dev->path.u.pnp.port, dev->path.u.pnp.device);
break;
case DEVICE_PATH_I2C:
- sprintf(buffer, "I2C: %02x",
+ sprintf(buffer, "I2C: %02x:%02x",
+ dev->bus->secondary,
dev->path.u.i2c.device);
break;
case DEVICE_PATH_APIC:
diff --git a/src/devices/emulator/biosemu.c b/src/devices/emulator/biosemu.c
index 59785fb229..85f10c648f 100644
--- a/src/devices/emulator/biosemu.c
+++ b/src/devices/emulator/biosemu.c
@@ -113,7 +113,7 @@ void do_int(int num)
{
int ret = 0;
- printk_debug("int%x vector at %x\n", num, getIntVect(num));
+// printk_debug("int%x vector at %x\n", num, getIntVect(num));
switch (num) {
#ifndef _PC
@@ -154,6 +154,7 @@ void do_int(int num)
ret = run_bios_int(num);
}
+#if 0
#define SYS_BIOS 0xf0000
/*
* here we are really paranoid about faking a "real"
@@ -270,7 +271,7 @@ void reset_int_vect(void)
MEM_WW(0x6D << 2, 0xf065);
MEM_WW((0x6D << 2) + 2, SYS_BIOS >> 4);
}
-
+#endif
void run_bios(struct device * dev, unsigned long addr)
{
#if 1
@@ -322,7 +323,7 @@ void run_bios(struct device * dev, unsigned long addr)
pushw(X86_SS);
pushw(X86_SP + 2);
- //X86EMU_trace_on();
+// X86EMU_trace_on();
X86EMU_exec();
#endif
diff --git a/src/devices/hypertransport.c b/src/devices/hypertransport.c
index de5d132263..7bc1c215b8 100644
--- a/src/devices/hypertransport.c
+++ b/src/devices/hypertransport.c
@@ -200,6 +200,16 @@ static void ht_collapse_early_enumeration(struct bus *bus)
continue;
}
+#if 0
+#if CK804_DEVN_BASE==0
+ //CK804 workaround:
+ // CK804 UnitID changes not use
+ if(id == 0x005e10de) {
+ break;
+ }
+#endif
+#endif
+
dummy.vendor = id & 0xffff;
dummy.device = (id >> 16) & 0xffff;
dummy.hdr_type = pci_read_config8(&dummy, PCI_HEADER_TYPE);
@@ -312,8 +322,17 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int max)
/* Update the Unitid of the current device */
flags = pci_read_config16(dev, pos + PCI_CAP_FLAGS);
flags &= ~0x1f; /* mask out base Unit ID */
- flags |= next_unitid & 0x1f;
- pci_write_config16(dev, pos + PCI_CAP_FLAGS, flags);
+#if CK804_DEVN_BASE==0
+ if(id == 0x005e10de) {
+ next_unitid = 0;
+ }
+ else {
+#endif
+ flags |= next_unitid & 0x1f;
+ pci_write_config16(dev, pos + PCI_CAP_FLAGS, flags);
+#if CK804_DEVN_BASE==0
+ }
+#endif
/* Update the Unitd id in the device structure */
static_count = 1;
@@ -354,6 +373,11 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int max)
dev_path(dev),
dev->vendor, dev->device,
(dev->enabled? "enabled": "disabled"), next_unitid);
+#if CK804_DEVN_BASE==0
+ if(id == 0x005e10de) {
+ break; // CK804 can not change unitid, so it only can be alone in the link
+ }
+#endif
} while((last_unitid != next_unitid) && (next_unitid <= 0x1f));
diff --git a/src/devices/pci_device.c b/src/devices/pci_device.c
index 0ad4e55915..3f9a1cadae 100644
--- a/src/devices/pci_device.c
+++ b/src/devices/pci_device.c
@@ -832,6 +832,7 @@ unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devf
dev_path(dev));
dev->enabled = 0;
}
+ continue;
}
}
/* Read the rest of the pci configuration information */
diff --git a/src/devices/root_device.c b/src/devices/root_device.c
index 91c706e4b6..2bb4f0afe8 100644
--- a/src/devices/root_device.c
+++ b/src/devices/root_device.c
@@ -74,6 +74,7 @@ void root_dev_set_resources(device_t root)
* @param max Maximum bus number currently used before scanning.
* @return Largest bus number used after scanning.
*/
+static int smbus_max = 0;
unsigned int scan_static_bus(device_t root, unsigned int max)
{
device_t child;
@@ -82,6 +83,11 @@ unsigned int scan_static_bus(device_t root, unsigned int max)
printk_spew("%s for %s\n", __func__, dev_path(root));
for (link = 0; link < root->links; link++) {
+ /* for smbus bus enumerate */
+ child = root->link[link].children;
+ if(child && child->path.type == DEVICE_PATH_I2C) {
+ root->link[link].secondary = ++smbus_max;
+ }
for (child = root->link[link].children; child; child = child->sibling) {
if (child->chip_ops && child->chip_ops->enable_dev) {
child->chip_ops->enable_dev(child);