2 * This file is part of the LinuxBIOS project.
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <console/console.h>
21 #include <device/pci.h>
22 #include <device/pci_ids.h>
26 #include <cpu/amd/amdfam10_sysconf.h>
30 * pci1234[0] will record sblink and bus range
31 * pci1234[i] will record ht chain i.
32 * It will keep the sequence when some ht io card is not installed.
48 * Total: xxx: I just want to use 32 instead, If you have more, you may need to
49 * reset HC_POSSIBLE_NUM and update ssdt.dsl (hcdn, hclk)
51 * Put all the possible ht node/link to the list tp pci1234[] in get_bus_conf.c
52 * on MB dir. Also, don't forget to increase the ACPI_SSDTX_NUM etc if you have
53 * too much SSDT. How about co-processor on socket 1 on 2 way system.
54 * or socket 2, and socket3 on 4 way system? treat that as one hc too!
59 void get_pci1234(void)
65 dword = sysconf.sblk<<8;
67 sysconf.pci1234[0] = dword; // sblink
70 /* about hardcode numbering for HT_IO support
71 set the node_id and link_id that could have ht chain in the one array,
72 then check if is enabled.... then update final value
75 //here we need to set hcdn
76 //1. hypertransport.c need to record hcdn_reg together with 0xe0, 0xe4, 0xe8, 0xec when are set
77 //2. so at the same time we need update hsdn with hcdn_reg here
78 // printk_debug("sysconf.ht_c_num = %02d\n", sysconf.ht_c_num);
80 for(j=0;j<sysconf.ht_c_num;j++) {
82 dwordx = sysconf.ht_c_conf_bus[j];
83 // printk_debug("sysconf.ht_c_conf_bus[%02d] = %08x\n", j, sysconf.ht_c_conf_bus[j]);
84 dwordx &=0xfffffffd; //keep bus num, node_id, link_num, enable bits
85 if((dwordx & 0x7fd) == dword) { //SBLINK
86 sysconf.pci1234[0] = dwordx;
87 sysconf.hcdn[0] = sysconf.hcdn_reg[j];
91 // We need to find out the number of HC
93 for(i=1;i<sysconf.hc_possible_num;i++) {
94 if((dwordx & 0x7fc) == (sysconf.pci1234[i] & 0x7fc)) { // same node and same linkn
95 sysconf.pci1234[i] = dwordx;
96 sysconf.hcdn[i] = sysconf.hcdn_reg[j];
100 // for 0xffc match or same node
101 for(i=1;i<sysconf.hc_possible_num;i++) {
102 if((dwordx & 0x7fc) == (dwordx & sysconf.pci1234[i] & 0x7fc)) {
103 sysconf.pci1234[i] = dwordx;
104 sysconf.hcdn[i] = sysconf.hcdn_reg[j];
111 for(i=1;i<sysconf.hc_possible_num;i++) {
112 if(!(sysconf.pci1234[i] & 1)) {
113 sysconf.pci1234[i] = 0;
114 sysconf.hcdn[i] = 0x20202020;