1 #include <console/console.h>
2 #include <device/pci.h>
3 #include <device/pci_ids.h>
6 #if CONFIG_LOGICAL_CPUS==1
7 #include <cpu/amd/dualcore.h>
11 // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
13 unsigned char bus_isa;
14 unsigned char bus_ck804_0; //1
15 unsigned char bus_ck804_1; //2
16 unsigned char bus_ck804_2; //3
17 unsigned char bus_ck804_3; //4
18 unsigned char bus_ck804_4; //5
19 unsigned char bus_ck804_5; //6
20 unsigned char bus_8131_0; //7
21 unsigned char bus_8131_1; //8
22 unsigned char bus_8131_2; //9
23 unsigned apicid_ck804;
24 unsigned apicid_8131_1;
25 unsigned apicid_8131_2;
29 { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
30 //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
40 unsigned hc_possible_num;
43 { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
56 extern void get_sblk_pci1234(void);
58 static unsigned get_bus_conf_done = 0;
60 void get_bus_conf(void)
67 if(get_bus_conf_done==1) return; //do it only once
69 get_bus_conf_done = 1;
71 hc_possible_num = sizeof(pci1234)/sizeof(pci1234[0]);
75 sbdn = (hcdn[0] & 0xff); // first byte of first chain
77 sbdn3 = (hcdn[1] & 0xff); // first byte of second chain
79 // bus_ck804_0 = node_link_to_bus(0, sblk);
80 bus_ck804_0 = (pci1234[0] >> 16) & 0xff;
84 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09,0));
86 bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
88 bus_ck804_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
91 bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
96 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x09);
107 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0b,0));
109 bus_ck804_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
110 bus_ck804_3 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
114 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x0b);
116 bus_ck804_3 = bus_ck804_2+1;
119 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0c,0));
121 bus_ck804_3 = pci_read_config8(dev, PCI_SECONDARY_BUS);
122 bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
126 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x0c);
128 bus_ck804_4 = bus_ck804_3+1;
133 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0d,0));
135 bus_ck804_4 = pci_read_config8(dev, PCI_SECONDARY_BUS);
136 bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
140 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n",sbdn + 0x0d);
142 bus_ck804_5 = bus_ck804_4+1;
145 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn+ 0x0e,0));
147 bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS);
148 bus_8131_0 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
150 bus_isa = bus_8131_0; // incase only one installed
153 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn+ 0x0e);
155 bus_8131_0 = bus_ck804_5+1;
159 dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0));
161 bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
162 bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
166 printk_debug("ERROR - could not find PCI %02x:01.0, using defaults\n", bus_8131_0);
168 bus_8131_1 = bus_8131_0+1;
169 bus_8131_2 = bus_8131_0+2;
172 dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3+1,0));
174 bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
175 bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
179 printk_debug("ERROR - could not find PCI %02x:02.0, using defaults\n", bus_8131_0);
181 bus_8131_2 = bus_8131_1+1;
182 bus_isa = bus_8131_1+2;
187 /*I/O APICs: APIC ID Version State Address*/
188 #if CONFIG_LOGICAL_CPUS==1
189 apicid_base = get_apicid_base(3);
191 apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
193 apicid_ck804 = apicid_base+0;
194 apicid_8131_1 = apicid_base+1;
195 apicid_8131_2 = apicid_base+2;