1 static int 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;
14 uint8_t hdr_type, pos;
15 last_unitid = next_unitid;
17 id = pci_read_config32(PCI_DEV(0,0,0), PCI_VENDOR_ID);
18 /* If the chain is enumerated quit */
19 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
20 (((id >> 16) & 0xffff) == 0xffff) ||
21 (((id >> 16) & 0xffff) == 0x0000)) {
25 #if CK804_DEVN_BASE==0
27 // CK804 UnitID changes not use
28 if(id == 0x005e10de) {
33 hdr_type = pci_read_config8(PCI_DEV(0,0,0), PCI_HEADER_TYPE);
37 if ((hdr_type == PCI_HEADER_TYPE_NORMAL) ||
38 (hdr_type == PCI_HEADER_TYPE_BRIDGE)) {
39 pos = pci_read_config8(PCI_DEV(0,0,0), PCI_CAPABILITY_LIST);
43 cap = pci_read_config8(PCI_DEV(0,0,0), pos + PCI_CAP_LIST_ID);
44 if (cap == PCI_CAP_ID_HT) {
46 flags = pci_read_config16(PCI_DEV(0,0,0), pos + PCI_CAP_FLAGS);
47 if ((flags >> 13) == 0) {
51 flags |= next_unitid & 0x1f;
52 count = (flags >> 5) & 0x1f;
54 pci_write_config16(PCI_DEV(0, 0, 0), pos + PCI_CAP_FLAGS, flags);
60 pos = pci_read_config8(PCI_DEV(0, 0, 0), pos + PCI_CAP_LIST_NEXT);
62 } while((last_unitid != next_unitid) && (next_unitid <= 0x1f));