1 static void enumerate_ht_chain(void)
3 /* Assumption the HT chain that is bus 0 has the HT I/O Hub on it.
4 * On most boards this just happens. If a cpu has multiple
5 * non Coherent links the appropriate bus registers for the
6 * links needs to be programed to point at bus 0.
8 unsigned next_unitid, last_unitid;;
12 uint8_t hdr_type, pos;
13 last_unitid = next_unitid;
15 id = pci_read_config32(PCI_DEV(0,0,0), PCI_VENDOR_ID);
16 /* If the chain is enumerated quit */
17 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
18 (((id >> 16) & 0xffff) == 0xffff) ||
19 (((id >> 16) & 0xffff) == 0x0000)) {
22 hdr_type = pci_read_config8(PCI_DEV(0,0,0), PCI_HEADER_TYPE);
26 if ((hdr_type == PCI_HEADER_TYPE_NORMAL) ||
27 (hdr_type == PCI_HEADER_TYPE_BRIDGE)) {
28 pos = pci_read_config8(PCI_DEV(0,0,0), PCI_CAPABILITY_LIST);
32 cap = pci_read_config8(PCI_DEV(0,0,0), pos + PCI_CAP_LIST_ID);
33 if (cap == PCI_CAP_ID_HT) {
35 flags = pci_read_config16(PCI_DEV(0,0,0), pos + PCI_CAP_FLAGS);
36 if ((flags >> 13) == 0) {
39 flags |= next_unitid & 0x1f;
40 count = (flags >> 5) & 0x1f;
41 pci_write_config16(PCI_DEV(0, 0, 0), pos + PCI_CAP_FLAGS, flags);
46 pos = pci_read_config8(PCI_DEV(0, 0, 0), pos + PCI_CAP_LIST_NEXT);
48 } while((last_unitid != next_unitid) && (next_unitid <= 0x1f));