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 char bus_coproc_0;
24 unsigned apicid_ck804;
25 unsigned apicid_8131_1;
26 unsigned apicid_8131_2;
30 { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
31 //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
41 unsigned hc_possible_num;
44 { //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
58 extern void get_sblk_pci1234(void);
60 static unsigned get_bus_conf_done = 0;
62 void get_bus_conf(void)
69 if(get_bus_conf_done==1) return; //do it only once
71 get_bus_conf_done = 1;
73 hc_possible_num = sizeof(pci1234)/sizeof(pci1234[0]);
77 sbdn = (hcdn[0] & 0xff); // first byte of first chain
79 sbdn3 = (hcdn[1] & 0xff); // first byte of second chain
81 // bus_ck804_0 = node_link_to_bus(0, sblk);
82 bus_ck804_0 = (pci1234[0] >> 16) & 0xff;
85 bus_coproc_0 = (pci1234[2] >> 16) & 0xff;
86 coprocdn = (hcdn[2] & 0xff);
92 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09,0));
94 bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
96 bus_ck804_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
99 bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
104 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x09);
115 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0b,0));
117 bus_ck804_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
118 bus_ck804_3 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
122 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x0b);
124 bus_ck804_3 = bus_ck804_2+1;
127 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0c,0));
129 bus_ck804_3 = pci_read_config8(dev, PCI_SECONDARY_BUS);
130 bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
134 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x0c);
136 bus_ck804_4 = bus_ck804_3+1;
141 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0d,0));
143 bus_ck804_4 = pci_read_config8(dev, PCI_SECONDARY_BUS);
144 bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
148 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n",sbdn + 0x0d);
150 bus_ck804_5 = bus_ck804_4+1;
153 dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn+ 0x0e,0));
155 bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS);
156 bus_8131_0 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
158 bus_isa = bus_8131_0; // incase only one installed
161 printk_debug("ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn+ 0x0e);
165 bus_8131_0 = (pci1234[1] >> 16) & 0xff;
168 dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0));
170 bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
171 bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
175 printk_debug("ERROR - could not find PCI %02x:01.0, using defaults\n", bus_8131_0);
177 bus_8131_1 = bus_8131_0+1;
178 bus_8131_2 = bus_8131_0+2;
181 dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3+1,0));
183 bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
184 bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
188 printk_debug("ERROR - could not find PCI %02x:02.0, using defaults\n", bus_8131_0);
190 bus_8131_2 = bus_8131_1+1;
191 bus_isa = bus_8131_1+2;
196 /*I/O APICs: APIC ID Version State Address*/
197 #if CONFIG_LOGICAL_CPUS==1
198 apicid_base = get_apicid_base(3);
200 apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
202 apicid_ck804 = apicid_base+0;
203 apicid_8131_1 = apicid_base+1;
204 apicid_8131_2 = apicid_base+2;