coreboot-v2: drop this ugly historic union name in v2 that was dropped in v3
a long time ago. This will make it easier to port v2 boards forward to v3 at some point (and other things) Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3964 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
committed by
Stefan Reinauer
parent
3c924d2f48
commit
2b34db8d1d
@@ -40,8 +40,8 @@ unsigned int agp_scan_bus(struct bus *bus,
|
||||
device_t child;
|
||||
max = pci_scan_bus(bus, min_devfn, max_devfn, max);
|
||||
for(child = bus->children; child; child = child->sibling) {
|
||||
if ( (child->path.u.pci.devfn < min_devfn) ||
|
||||
(child->path.u.pci.devfn > max_devfn))
|
||||
if ( (child->path.pci.devfn < min_devfn) ||
|
||||
(child->path.pci.devfn > max_devfn))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ struct device *dev_find_slot(unsigned int bus, unsigned int devfn)
|
||||
for (dev = all_devices; dev; dev = dev->next) {
|
||||
if ((dev->path.type == DEVICE_PATH_PCI) &&
|
||||
(dev->bus->secondary == bus) &&
|
||||
(dev->path.u.pci.devfn == devfn)) {
|
||||
(dev->path.pci.devfn == devfn)) {
|
||||
result = dev;
|
||||
break;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ struct device *dev_find_slot_on_smbus(unsigned int bus, unsigned int addr)
|
||||
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)) {
|
||||
(dev->path.i2c.device == addr)) {
|
||||
result = dev;
|
||||
break;
|
||||
}
|
||||
@@ -166,39 +166,39 @@ const char *dev_path(device_t dev)
|
||||
#if PCI_BUS_SEGN_BITS
|
||||
sprintf(buffer, "PCI: %04x:%02x:%02x.%01x",
|
||||
dev->bus->secondary>>8, dev->bus->secondary & 0xff,
|
||||
PCI_SLOT(dev->path.u.pci.devfn), PCI_FUNC(dev->path.u.pci.devfn));
|
||||
PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn));
|
||||
#else
|
||||
sprintf(buffer, "PCI: %02x:%02x.%01x",
|
||||
dev->bus->secondary,
|
||||
PCI_SLOT(dev->path.u.pci.devfn), PCI_FUNC(dev->path.u.pci.devfn));
|
||||
PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn));
|
||||
#endif
|
||||
break;
|
||||
case DEVICE_PATH_PNP:
|
||||
sprintf(buffer, "PNP: %04x.%01x",
|
||||
dev->path.u.pnp.port, dev->path.u.pnp.device);
|
||||
dev->path.pnp.port, dev->path.pnp.device);
|
||||
break;
|
||||
case DEVICE_PATH_I2C:
|
||||
sprintf(buffer, "I2C: %02x:%02x",
|
||||
dev->bus->secondary,
|
||||
dev->path.u.i2c.device);
|
||||
dev->path.i2c.device);
|
||||
break;
|
||||
case DEVICE_PATH_APIC:
|
||||
sprintf(buffer, "APIC: %02x",
|
||||
dev->path.u.apic.apic_id);
|
||||
dev->path.apic.apic_id);
|
||||
break;
|
||||
case DEVICE_PATH_PCI_DOMAIN:
|
||||
sprintf(buffer, "PCI_DOMAIN: %04x",
|
||||
dev->path.u.pci_domain.domain);
|
||||
dev->path.pci_domain.domain);
|
||||
break;
|
||||
case DEVICE_PATH_APIC_CLUSTER:
|
||||
sprintf(buffer, "APIC_CLUSTER: %01x",
|
||||
dev->path.u.apic_cluster.cluster);
|
||||
dev->path.apic_cluster.cluster);
|
||||
break;
|
||||
case DEVICE_PATH_CPU:
|
||||
sprintf(buffer, "CPU: %02x", dev->path.u.cpu.id);
|
||||
sprintf(buffer, "CPU: %02x", dev->path.cpu.id);
|
||||
break;
|
||||
case DEVICE_PATH_CPU_BUS:
|
||||
sprintf(buffer, "CPU_BUS: %02x", dev->path.u.cpu_bus.id);
|
||||
sprintf(buffer, "CPU_BUS: %02x", dev->path.cpu_bus.id);
|
||||
break;
|
||||
default:
|
||||
printk_err("Unknown device path type: %d\n", dev->path.type);
|
||||
@@ -227,29 +227,29 @@ int path_eq(struct device_path *path1, struct device_path *path2)
|
||||
equal = 1;
|
||||
break;
|
||||
case DEVICE_PATH_PCI:
|
||||
equal = (path1->u.pci.devfn == path2->u.pci.devfn);
|
||||
equal = (path1->pci.devfn == path2->pci.devfn);
|
||||
break;
|
||||
case DEVICE_PATH_PNP:
|
||||
equal = (path1->u.pnp.port == path2->u.pnp.port) &&
|
||||
(path1->u.pnp.device == path2->u.pnp.device);
|
||||
equal = (path1->pnp.port == path2->pnp.port) &&
|
||||
(path1->pnp.device == path2->pnp.device);
|
||||
break;
|
||||
case DEVICE_PATH_I2C:
|
||||
equal = (path1->u.i2c.device == path2->u.i2c.device);
|
||||
equal = (path1->i2c.device == path2->i2c.device);
|
||||
break;
|
||||
case DEVICE_PATH_APIC:
|
||||
equal = (path1->u.apic.apic_id == path2->u.apic.apic_id);
|
||||
equal = (path1->apic.apic_id == path2->apic.apic_id);
|
||||
break;
|
||||
case DEVICE_PATH_PCI_DOMAIN:
|
||||
equal = (path1->u.pci_domain.domain == path2->u.pci_domain.domain);
|
||||
equal = (path1->pci_domain.domain == path2->pci_domain.domain);
|
||||
break;
|
||||
case DEVICE_PATH_APIC_CLUSTER:
|
||||
equal = (path1->u.apic_cluster.cluster == path2->u.apic_cluster.cluster);
|
||||
equal = (path1->apic_cluster.cluster == path2->apic_cluster.cluster);
|
||||
break;
|
||||
case DEVICE_PATH_CPU:
|
||||
equal = (path1->u.cpu.id == path2->u.cpu.id);
|
||||
equal = (path1->cpu.id == path2->cpu.id);
|
||||
break;
|
||||
case DEVICE_PATH_CPU_BUS:
|
||||
equal = (path1->u.cpu_bus.id == path2->u.cpu_bus.id);
|
||||
equal = (path1->cpu_bus.id == path2->cpu_bus.id);
|
||||
break;
|
||||
default:
|
||||
printk_err("Uknown device type: %d\n", path1->type);
|
||||
|
@@ -286,7 +286,7 @@ void run_bios(struct device * dev, unsigned long addr)
|
||||
int i;
|
||||
unsigned short initialcs = (addr & 0xF0000) >> 4;
|
||||
unsigned short initialip = (addr + 3) & 0xFFFF;
|
||||
unsigned short devfn = dev->bus->secondary << 8 | dev->path.u.pci.devfn;
|
||||
unsigned short devfn = dev->bus->secondary << 8 | dev->path.pci.devfn;
|
||||
X86EMU_intrFuncs intFuncs[256];
|
||||
|
||||
X86EMU_setMemBase(0, 0x100000);
|
||||
|
@@ -27,7 +27,7 @@ int pcibios_handler(void)
|
||||
dev = dev_find_device(X86_DX, X86_CX, dev);
|
||||
if (dev != 0) {
|
||||
X86_BH = dev->bus->secondary;
|
||||
X86_BL = dev->path.u.pci.devfn;
|
||||
X86_BL = dev->path.pci.devfn;
|
||||
X86_AH = SUCCESSFUL;
|
||||
X86_EFLAGS &= ~FB_CF; /* clear carry flag */
|
||||
ret = 1;
|
||||
@@ -42,7 +42,7 @@ int pcibios_handler(void)
|
||||
dev = dev_find_class(X86_ECX, dev);
|
||||
if (dev != 0) {
|
||||
X86_BH = dev->bus->secondary;
|
||||
X86_BL = dev->path.u.pci.devfn;
|
||||
X86_BL = dev->path.pci.devfn;
|
||||
X86_AH = SUCCESSFUL;
|
||||
X86_EFLAGS &= ~FB_CF; /* clear carry flag */
|
||||
ret = 1;
|
||||
|
@@ -56,7 +56,7 @@ static device_t ht_scan_get_devs(device_t *old_devices)
|
||||
*/
|
||||
while(last && last->sibling &&
|
||||
(last->sibling->path.type == DEVICE_PATH_PCI) &&
|
||||
(last->sibling->path.u.pci.devfn > last->path.u.pci.devfn))
|
||||
(last->sibling->path.pci.devfn > last->path.pci.devfn))
|
||||
{
|
||||
last = last->sibling;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ static void ht_collapse_early_enumeration(struct bus *bus, unsigned offset_uniti
|
||||
uint32_t id;
|
||||
dummy.bus = bus;
|
||||
dummy.path.type = DEVICE_PATH_PCI;
|
||||
dummy.path.u.pci.devfn = PCI_DEVFN(0, 0);
|
||||
dummy.path.pci.devfn = PCI_DEVFN(0, 0);
|
||||
id = pci_read_config32(&dummy, PCI_VENDOR_ID);
|
||||
if ( ! ( (id == 0xffffffff) || (id == 0x00000000) ||
|
||||
(id == 0x0000ffff) || (id == 0xffff0000) ) ) {
|
||||
@@ -355,7 +355,7 @@ static void ht_collapse_early_enumeration(struct bus *bus, unsigned offset_uniti
|
||||
unsigned pos, flags;
|
||||
dummy.bus = bus;
|
||||
dummy.path.type = DEVICE_PATH_PCI;
|
||||
dummy.path.u.pci.devfn = devfn;
|
||||
dummy.path.pci.devfn = devfn;
|
||||
id = pci_read_config32(&dummy, PCI_VENDOR_ID);
|
||||
if ( (id == 0xffffffff) || (id == 0x00000000) ||
|
||||
(id == 0x0000ffff) || (id == 0xffff0000)) {
|
||||
@@ -503,9 +503,9 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
|
||||
/* Update the Unitd id in the device structure */
|
||||
static_count = 1;
|
||||
for(func = dev; func; func = func->sibling) {
|
||||
func->path.u.pci.devfn += (next_unitid << 3);
|
||||
static_count = (func->path.u.pci.devfn >> 3)
|
||||
- (dev->path.u.pci.devfn >> 3) + 1;
|
||||
func->path.pci.devfn += (next_unitid << 3);
|
||||
static_count = (func->path.pci.devfn >> 3)
|
||||
- (dev->path.pci.devfn >> 3) + 1;
|
||||
last_func = func;
|
||||
}
|
||||
/* Compute the number of unitids consumed */
|
||||
@@ -561,7 +561,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
|
||||
pci_write_config16(real_last_dev, real_last_pos + PCI_CAP_FLAGS, flags);
|
||||
|
||||
for(func = real_last_dev; func; func = func->sibling) {
|
||||
func->path.u.pci.devfn -= ((real_last_unitid - HT_CHAIN_END_UNITID_BASE) << 3);
|
||||
func->path.pci.devfn -= ((real_last_unitid - HT_CHAIN_END_UNITID_BASE) << 3);
|
||||
last_func = func;
|
||||
}
|
||||
|
||||
|
@@ -868,7 +868,7 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn)
|
||||
dev_path(*list));
|
||||
continue;
|
||||
}
|
||||
if ((*list)->path.u.pci.devfn == devfn) {
|
||||
if ((*list)->path.pci.devfn == devfn) {
|
||||
/* Unlink from the list */
|
||||
dev = *list;
|
||||
*list = (*list)->sibling;
|
||||
@@ -919,7 +919,7 @@ device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn)
|
||||
struct device dummy;
|
||||
dummy.bus = bus;
|
||||
dummy.path.type = DEVICE_PATH_PCI;
|
||||
dummy.path.u.pci.devfn = devfn;
|
||||
dummy.path.pci.devfn = devfn;
|
||||
id = pci_read_config32(&dummy, PCI_VENDOR_ID);
|
||||
/* Have we found somthing?
|
||||
* Some broken boards return 0 if a slot is empty.
|
||||
|
@@ -41,35 +41,35 @@ static struct bus *get_pbus(device_t dev)
|
||||
uint8_t pci_read_config8(device_t dev, unsigned where)
|
||||
{
|
||||
struct bus *pbus = get_pbus(dev);
|
||||
return ops_pci_bus(pbus)->read8(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where);
|
||||
return ops_pci_bus(pbus)->read8(pbus, dev->bus->secondary, dev->path.pci.devfn, where);
|
||||
}
|
||||
|
||||
uint16_t pci_read_config16(device_t dev, unsigned where)
|
||||
{
|
||||
struct bus *pbus = get_pbus(dev);
|
||||
return ops_pci_bus(pbus)->read16(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where);
|
||||
return ops_pci_bus(pbus)->read16(pbus, dev->bus->secondary, dev->path.pci.devfn, where);
|
||||
}
|
||||
|
||||
uint32_t pci_read_config32(device_t dev, unsigned where)
|
||||
{
|
||||
struct bus *pbus = get_pbus(dev);
|
||||
return ops_pci_bus(pbus)->read32(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where);
|
||||
return ops_pci_bus(pbus)->read32(pbus, dev->bus->secondary, dev->path.pci.devfn, where);
|
||||
}
|
||||
|
||||
void pci_write_config8(device_t dev, unsigned where, uint8_t val)
|
||||
{
|
||||
struct bus *pbus = get_pbus(dev);
|
||||
ops_pci_bus(pbus)->write8(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where, val);
|
||||
ops_pci_bus(pbus)->write8(pbus, dev->bus->secondary, dev->path.pci.devfn, where, val);
|
||||
}
|
||||
|
||||
void pci_write_config16(device_t dev, unsigned where, uint16_t val)
|
||||
{
|
||||
struct bus *pbus = get_pbus(dev);
|
||||
ops_pci_bus(pbus)->write16(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where, val);
|
||||
ops_pci_bus(pbus)->write16(pbus, dev->bus->secondary, dev->path.pci.devfn, where, val);
|
||||
}
|
||||
|
||||
void pci_write_config32(device_t dev, unsigned where, uint32_t val)
|
||||
{
|
||||
struct bus *pbus = get_pbus(dev);
|
||||
ops_pci_bus(pbus)->write32(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where, val);
|
||||
ops_pci_bus(pbus)->write32(pbus, dev->bus->secondary, dev->path.pci.devfn, where, val);
|
||||
}
|
||||
|
@@ -45,8 +45,8 @@ unsigned int pciexp_scan_bus(struct bus *bus,
|
||||
device_t child;
|
||||
max = pci_scan_bus(bus, min_devfn, max_devfn, max);
|
||||
for(child = bus->children; child; child = child->sibling) {
|
||||
if ( (child->path.u.pci.devfn < min_devfn) ||
|
||||
(child->path.u.pci.devfn > max_devfn))
|
||||
if ( (child->path.pci.devfn < min_devfn) ||
|
||||
(child->path.pci.devfn > max_devfn))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -67,8 +67,8 @@ unsigned int pcix_scan_bus(struct bus *bus,
|
||||
device_t child;
|
||||
max = pci_scan_bus(bus, min_devfn, max_devfn, max);
|
||||
for(child = bus->children; child; child = child->sibling) {
|
||||
if ( (child->path.u.pci.devfn < min_devfn) ||
|
||||
(child->path.u.pci.devfn > max_devfn))
|
||||
if ( (child->path.pci.devfn < min_devfn) ||
|
||||
(child->path.pci.devfn > max_devfn))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -34,19 +34,19 @@
|
||||
|
||||
void pnp_write_config(device_t dev, uint8_t reg, uint8_t value)
|
||||
{
|
||||
outb(reg, dev->path.u.pnp.port);
|
||||
outb(value, dev->path.u.pnp.port + 1);
|
||||
outb(reg, dev->path.pnp.port);
|
||||
outb(value, dev->path.pnp.port + 1);
|
||||
}
|
||||
|
||||
uint8_t pnp_read_config(device_t dev, uint8_t reg)
|
||||
{
|
||||
outb(reg, dev->path.u.pnp.port);
|
||||
return inb(dev->path.u.pnp.port + 1);
|
||||
outb(reg, dev->path.pnp.port);
|
||||
return inb(dev->path.pnp.port + 1);
|
||||
}
|
||||
|
||||
void pnp_set_logical_device(device_t dev)
|
||||
{
|
||||
pnp_write_config(dev, 0x07, dev->path.u.pnp.device & 0xff);
|
||||
pnp_write_config(dev, 0x07, dev->path.pnp.device & 0xff);
|
||||
}
|
||||
|
||||
void pnp_set_enable(device_t dev, int enable)
|
||||
@@ -55,7 +55,7 @@ void pnp_set_enable(device_t dev, int enable)
|
||||
|
||||
tmp = pnp_read_config(dev, 0x30);
|
||||
/* handle the virtual devices, which share same LDN register */
|
||||
bitpos = (dev->path.u.pnp.device >> 8) & 0x7;
|
||||
bitpos = (dev->path.pnp.device >> 8) & 0x7;
|
||||
|
||||
if (enable) {
|
||||
tmp |= (1 << bitpos);
|
||||
@@ -70,7 +70,7 @@ int pnp_read_enable(device_t dev)
|
||||
uint8_t tmp, bitpos;
|
||||
tmp = pnp_read_config(dev, 0x30);
|
||||
/* handle the virtual devices, which share same LDN register */
|
||||
bitpos = (dev->path.u.pnp.device >> 8) & 0x7;
|
||||
bitpos = (dev->path.pnp.device >> 8) & 0x7;
|
||||
return !!(tmp & (1 << bitpos));
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ void pnp_enable_devices(device_t base_dev, struct device_operations *ops,
|
||||
int i;
|
||||
|
||||
path.type = DEVICE_PATH_PNP;
|
||||
path.u.pnp.port = base_dev->path.u.pnp.port;
|
||||
path.pnp.port = base_dev->path.pnp.port;
|
||||
|
||||
/* Setup the ops and resources on the newly allocated devices */
|
||||
for(i = 0; i < functions; i++) {
|
||||
@@ -259,7 +259,7 @@ void pnp_enable_devices(device_t base_dev, struct device_operations *ops,
|
||||
if (info[i].function == -1)
|
||||
continue;
|
||||
|
||||
path.u.pnp.device = info[i].function;
|
||||
path.pnp.device = info[i].function;
|
||||
dev = alloc_find_dev(base_dev->bus, &path);
|
||||
|
||||
/* Don't initialize a device multiple times */
|
||||
|
Reference in New Issue
Block a user