This is the last remainder from Yinghai's mega patch. It fixes issues with
devices conflicting with the northbridge devices on PCI bus 0. Signed-off-by: Yinghai Lu <yinghailu@gmail.com> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2681 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
c141282193
commit
ecad5df6b7
|
@ -383,6 +383,8 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
|
||||||
struct ht_link prev;
|
struct ht_link prev;
|
||||||
device_t last_func = 0;
|
device_t last_func = 0;
|
||||||
int ht_dev_num = 0;
|
int ht_dev_num = 0;
|
||||||
|
unsigned temp_unitid;
|
||||||
|
unsigned not_use_count;
|
||||||
|
|
||||||
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
|
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
|
||||||
//let't record the device of last ht device, So we can set the Unitid to HT_CHAIN_END_UNITID_BASE
|
//let't record the device of last ht device, So we can set the Unitid to HT_CHAIN_END_UNITID_BASE
|
||||||
|
@ -473,39 +475,53 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
|
||||||
if (flags & 0x1f) {
|
if (flags & 0x1f) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags &= ~0x1f; /* mask out base Unit ID */
|
flags &= ~0x1f; /* mask out base Unit ID */
|
||||||
flags |= next_unitid & 0x1f;
|
|
||||||
|
count = (flags >> 5) & 0x1f; /* get unit count */
|
||||||
|
not_use_count = 0;
|
||||||
|
temp_unitid = next_unitid;
|
||||||
|
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
|
||||||
|
if(offset_unitid) {
|
||||||
|
if((next_unitid+count)>=0x20) {
|
||||||
|
temp_unitid = HT_CHAIN_END_UNITID_BASE;
|
||||||
|
//still use the old next_unitid
|
||||||
|
not_use_count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
flags |= temp_unitid & 0x1f;
|
||||||
pci_write_config16(dev, pos + PCI_CAP_FLAGS, flags);
|
pci_write_config16(dev, pos + PCI_CAP_FLAGS, flags);
|
||||||
|
|
||||||
/* Update the Unitd id in the device structure */
|
/* Update the Unitd id in the device structure */
|
||||||
static_count = 1;
|
static_count = 1;
|
||||||
for(func = dev; func; func = func->sibling) {
|
for(func = dev; func; func = func->sibling) {
|
||||||
func->path.u.pci.devfn += (next_unitid << 3);
|
func->path.u.pci.devfn += (temp_unitid << 3);
|
||||||
static_count = (func->path.u.pci.devfn >> 3)
|
static_count = (func->path.u.pci.devfn >> 3)
|
||||||
- (dev->path.u.pci.devfn >> 3) + 1;
|
- (dev->path.u.pci.devfn >> 3) + 1;
|
||||||
last_func = func;
|
last_func = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the number of unitids consumed */
|
/* Compute the number of unitids consumed */
|
||||||
count = (flags >> 5) & 0x1f; /* get unit count */
|
|
||||||
printk_spew("%s count: %04x static_count: %04x\n",
|
printk_spew("%s count: %04x static_count: %04x\n",
|
||||||
dev_path(dev), count, static_count);
|
dev_path(dev), count, static_count);
|
||||||
if (count < static_count) {
|
if (count < static_count) {
|
||||||
count = static_count;
|
count = static_count;
|
||||||
}
|
}
|
||||||
|
if(!not_use_count)
|
||||||
|
next_unitid += count;
|
||||||
|
|
||||||
/* Update the Unitid of the next device */
|
/* Update the Unitid of the next device */
|
||||||
ht_unitid_base[ht_dev_num] = next_unitid;
|
ht_unitid_base[ht_dev_num] = temp_unitid;
|
||||||
ht_dev_num++;
|
ht_dev_num++;
|
||||||
|
|
||||||
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
|
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
|
||||||
if(offset_unitid) {
|
if(offset_unitid) {
|
||||||
real_last_unitid = next_unitid;
|
|
||||||
real_last_pos = pos;
|
real_last_pos = pos;
|
||||||
|
real_last_unitid = temp_unitid;
|
||||||
real_last_dev = dev;
|
real_last_dev = dev;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
next_unitid += count;
|
|
||||||
|
|
||||||
/* Setup the hypetransport link */
|
/* Setup the hypetransport link */
|
||||||
bus->reset_needed |= ht_setup_link(&prev, dev, pos);
|
bus->reset_needed |= ht_setup_link(&prev, dev, pos);
|
||||||
|
@ -515,7 +531,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
|
||||||
dev->vendor, dev->device,
|
dev->vendor, dev->device,
|
||||||
(dev->enabled? "enabled": "disabled"), next_unitid);
|
(dev->enabled? "enabled": "disabled"), next_unitid);
|
||||||
|
|
||||||
} while((last_unitid != next_unitid) && (next_unitid <= (max_devfn >> 3)));
|
} while((last_unitid != next_unitid) && (next_unitid <= 0x1f /*(max_devfn >> 3)*/ ));
|
||||||
end_of_chain:
|
end_of_chain:
|
||||||
#if OPT_HT_LINK == 1
|
#if OPT_HT_LINK == 1
|
||||||
if(bus->reset_needed) {
|
if(bus->reset_needed) {
|
||||||
|
@ -527,7 +543,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
|
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
|
||||||
if(offset_unitid && (ht_dev_num>0)) {
|
if(offset_unitid && (ht_dev_num>1) && (real_last_unitid != HT_CHAIN_END_UNITID_BASE) ) {
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
int i;
|
int i;
|
||||||
device_t last_func = 0;
|
device_t last_func = 0;
|
||||||
|
@ -550,6 +566,9 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
|
||||||
if (next_unitid > 0x1f) {
|
if (next_unitid > 0x1f) {
|
||||||
next_unitid = 0x1f;
|
next_unitid = 0x1f;
|
||||||
}
|
}
|
||||||
|
if( (bus->secondary == 0) && (next_unitid > 0x17)) {
|
||||||
|
next_unitid = 0x17; /* avoid K8 on bus 0 */
|
||||||
|
}
|
||||||
|
|
||||||
/* Die if any leftover Static devices are are found.
|
/* Die if any leftover Static devices are are found.
|
||||||
* There's probably a problem in the Config.lb.
|
* There's probably a problem in the Config.lb.
|
||||||
|
@ -567,7 +586,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
|
||||||
/* Now that nothing is overlapping it is safe to scan the
|
/* Now that nothing is overlapping it is safe to scan the
|
||||||
* children.
|
* children.
|
||||||
*/
|
*/
|
||||||
max = pci_scan_bus(bus, 0x00, (next_unitid << 3)|7, max);
|
max = pci_scan_bus(bus, 0x00, ((next_unitid-1) << 3)|7, max);
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue