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
This commit is contained in:
@@ -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:
|
||||
|
@@ -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
|
||||
|
@@ -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));
|
||||
|
||||
|
@@ -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 */
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user