summaryrefslogtreecommitdiff
path: root/src/mainboard/amd/serengeti_leopard
diff options
context:
space:
mode:
authorYinghai Lu <yinghailu@gmail.com>2005-12-06 23:34:09 +0000
committerYinghai Lu <yinghailu@gmail.com>2005-12-06 23:34:09 +0000
commit968bbe89cdc0a8bb47852388842bdf4ab625126e (patch)
tree74c95722c3a6b02e3cf8a3f532221ee4a42c1ef4 /src/mainboard/amd/serengeti_leopard
parent2c2d54479d777f4095851f65bda67c6ace26b35b (diff)
use hcdn to simplify the mptable.c and irqtable.c --- patch fro issue
48 git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2136 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/mainboard/amd/serengeti_leopard')
-rw-r--r--src/mainboard/amd/serengeti_leopard/Config.lb101
-rw-r--r--src/mainboard/amd/serengeti_leopard/get_bus_conf.c52
-rw-r--r--src/mainboard/amd/serengeti_leopard/irq_tables.c40
-rw-r--r--src/mainboard/amd/serengeti_leopard/mptable.c46
4 files changed, 102 insertions, 137 deletions
diff --git a/src/mainboard/amd/serengeti_leopard/Config.lb b/src/mainboard/amd/serengeti_leopard/Config.lb
index 1be3cb6eb9..b6ee7180ec 100644
--- a/src/mainboard/amd/serengeti_leopard/Config.lb
+++ b/src/mainboard/amd/serengeti_leopard/Config.lb
@@ -53,53 +53,68 @@ if HAVE_PIRQ_TABLE
object irq_tables.o
end
+#if HAVE_ACPI_TABLES
+# object acpi_tables.o
+# object fadt.o
+# if K8_SB_HT_CHAIN_ON_BUS0
+# object dsdt_bus0.o
+# else
+# object dsdt.o
+# end
+# object ssdt.o
+# if ACPI_SSDTX_NUM
+# if K8_SB_HT_CHAIN_ON_BUS0
+# object ssdt2_bus0.o
+# else
+# object ssdt2.o
+# end
+# end
+#end
+
if HAVE_ACPI_TABLES
- object acpi_tables.o
- object fadt.o
- if K8_SB_HT_CHAIN_ON_BUS0
- makerule dsdt.c
- depends "$(MAINBOARD)/dx_bus0/dsdt_lb.dsl"
- action "/usr/sbin/iasl -tc $(MAINBOARD)/dx_bus0/dsdt_lb.dsl"
- action "mv dsdt_lb.hex dsdt.c"
- end
- object ./dsdt.o
- else
- makerule dsdt.c
- depends "$(MAINBOARD)/dx/dsdt_lb.dsl"
- action "/usr/sbin/iasl -tc $(MAINBOARD)/dx/dsdt_lb.dsl"
- action "mv dsdt_lb.hex dsdt.c"
- end
- object ./dsdt.o
+ object acpi_tables.o
+ object fadt.o
+ if K8_SB_HT_CHAIN_ON_BUS0
+ makerule dsdt.c
+ depends "$(MAINBOARD)/dx_bus0/dsdt_lb.dsl"
+ action "/usr/sbin/iasl -tc $(MAINBOARD)/dx_bus0/dsdt_lb.dsl"
+ action "mv dsdt_lb.hex dsdt.c"
+ end
+ else
+ makerule dsdt.c
+ depends "$(MAINBOARD)/dx/dsdt_lb.dsl"
+ action "/usr/sbin/iasl -tc $(MAINBOARD)/dx/dsdt_lb.dsl"
+ action "mv dsdt_lb.hex dsdt.c"
+ end
end
+ object ./dsdt.o
- makerule ssdt.c
- depends "$(MAINBOARD)/ssdt_lb_x.dsl"
- action "/usr/sbin/iasl -tc $(MAINBOARD)/ssdt_lb_x.dsl"
- action "perl -pi -e 's/AmlCode/AmlCode_ssdt/g' ssdt_lb_x.hex"
- action "mv ssdt_lb_x.hex ssdt.c"
- end
- object ./ssdt.o
-
- if ACPI_SSDTX_NUM
- if K8_SB_HT_CHAIN_ON_BUS0
- makerule ssdt2.c
- depends "$(MAINBOARD)/dx/pci2.asl"
- action "/usr/sbin/iasl -tc $(MAINBOARD)/dx/pci2.asl"
- action "perl -pi -e 's/AmlCode/AmlCode_ssdt2/g' pci2.hex"
- action "mv pci2.hex ssdt2.c"
- end
- object ./ssdt2.o
- else
- makerule ssdt2.c
- depends "$(MAINBOARD)/dx_bus0/pci2.asl"
- action "/usr/sbin/iasl -tc $(MAINBOARD)/dx_bus0/pci2.asl"
- action "perl -pi -e 's/AmlCode/AmlCode_ssdt2/g' pci2.hex"
- action "mv pci2.hex ssdt2.c"
- end
-
- object ./ssdt2.o
+ makerule ssdt.c
+ depends "$(MAINBOARD)/ssdt_lb_x.dsl"
+ action "/usr/sbin/iasl -tc $(MAINBOARD)/ssdt_lb_x.dsl"
+ action "perl -pi -e 's/AmlCode/AmlCode_ssdt/g' ssdt_lb_x.hex"
+ action "mv ssdt_lb_x.hex ssdt.c"
+ end
+ object ./ssdt.o
+
+ if ACPI_SSDTX_NUM
+ if K8_SB_HT_CHAIN_ON_BUS0
+ makerule ssdt2.c
+ depends "$(MAINBOARD)/dx/pci2.asl"
+ action "/usr/sbin/iasl -tc $(MAINBOARD)/dx/pci2.asl"
+ action "perl -pi -e 's/AmlCode/AmlCode_ssdt2/g' pci2.hex"
+ action "mv pci2.hex ssdt2.c"
+ end
+ else
+ makerule ssdt2.c
+ depends "$(MAINBOARD)/dx_bus0/pci2.asl"
+ action "/usr/sbin/iasl -tc $(MAINBOARD)/dx_bus0/pci2.asl"
+ action "perl -pi -e 's/AmlCode/AmlCode_ssdt2/g' pci2.hex"
+ action "mv pci2.hex ssdt2.c"
+ end
end
- end
+ object ./ssdt2.o
+ end
end
object reset.o
diff --git a/src/mainboard/amd/serengeti_leopard/get_bus_conf.c b/src/mainboard/amd/serengeti_leopard/get_bus_conf.c
index aba931bb71..bfdbda6b70 100644
--- a/src/mainboard/amd/serengeti_leopard/get_bus_conf.c
+++ b/src/mainboard/amd/serengeti_leopard/get_bus_conf.c
@@ -48,45 +48,8 @@ unsigned hcdn[] =
// 0x20202020,
// 0x20202020,
};
-
-
-static unsigned get_sbdn(void)
-{
- device_t dev;
-#if 0
-#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
- unsigned sbdn = 1 + HT_CHAIN_END_UNITID_BASE -1;
-#else
- unsigned sbdn = 3 + HT_CHAIN_UNITID_BASE - 1; // 8111 unit id base is 3 if 8131 before it
-#endif
-
- sbd3 = 1 + HT_CHAIN_UNITID_BASE - 1;
-
-#if SB_HT_CHAIN_UNITID_OFFSET_ONLY == 1
- sbd5 = 1;
-#else
- sbd5 = 1 + HT_CHAIN_UNITID_BASE - 1;
-#endif
-
- dev = dev_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_PCI , 0); //FIXME: if 8111 PCI is disabled?
- if(dev) {
- sbdn = (dev->path.u.pci.devfn >> 3) & 0x1f;
- }
-
- dev = dev_find_device(PCI_VENDOR_ID_AMD, 0x7458 , 0); //FIXME: if 8131 PCI is disabled?
- if(dev) {
- sbd3 = (dev->path.u.pci.devfn >> 3) & 0x1f;
- }
-
- dev = dev_find_device(PCI_VENDOR_ID_AMD, 0x7454 , 0); //FIXME: if 8151 PCI is disabled?
- if(dev) {
- sbd5 = (dev->path.u.pci.devfn >> 3) & 0x1f;
- }
-#endif
- sbdn = (hcdn[0] >> 8) & 0xff; // second byte
-
- return sbdn;
-}
+unsigned sbdn3;
+unsigned sbdn5;
extern void get_sblk_pci1234(void);
@@ -107,7 +70,9 @@ void get_bus_conf(void)
get_sblk_pci1234();
- sbdn = get_sbdn();
+ sbdn = (hcdn[0] >> 8) & 0xff;
+ sbdn3 = hcdn[0] & 0xff;
+ sbdn5 = hcdn[1] & 0xff;
// bus_8132_0 = node_link_to_bus(0, sblk);
bus_8132_0 = (pci1234[0] >> 16) & 0xff;
@@ -128,7 +93,7 @@ void get_bus_conf(void)
}
/* 8132-1 */
- dev = dev_find_slot(bus_8132_0, PCI_DEVFN((hcdn[0]&0xff),0));
+ dev = dev_find_slot(bus_8132_0, PCI_DEVFN(sbdn3,0));
if (dev) {
bus_8132_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
@@ -142,7 +107,7 @@ void get_bus_conf(void)
}
/* 8132-2 */
- dev = dev_find_slot(bus_8132_0, PCI_DEVFN((hcdn[0] & 0xff)+1,0));
+ dev = dev_find_slot(bus_8132_0, PCI_DEVFN(sbdn3+1,0));
if (dev) {
bus_8132_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
}
@@ -152,10 +117,9 @@ void get_bus_conf(void)
/* HT chain 1 */
if((pci1234[1] & 0x1) == 1) {
-// bus_8151_0 = node_link_to_bus( (pci1234[1]>>4) & 0xf, (pci1234[1]>>8) & 0xf);
bus_8151_0 = (pci1234[1] >> 16) & 0xff;
/* 8151 */
- dev = dev_find_slot(bus_8151_0, PCI_DEVFN((hcdn[1] & 0xff)+1, 0));
+ dev = dev_find_slot(bus_8151_0, PCI_DEVFN(sbdn5+1, 0));
if (dev) {
bus_8151_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
diff --git a/src/mainboard/amd/serengeti_leopard/irq_tables.c b/src/mainboard/amd/serengeti_leopard/irq_tables.c
index e9c78b3ce0..5a6f34e744 100644
--- a/src/mainboard/amd/serengeti_leopard/irq_tables.c
+++ b/src/mainboard/amd/serengeti_leopard/irq_tables.c
@@ -10,33 +10,6 @@
#include <stdint.h>
#include <arch/pirq_routing.h>
-const struct irq_routing_table intel_irq_routing_table = {
- PIRQ_SIGNATURE, /* u32 signature */
- PIRQ_VERSION, /* u16 version */
- 32+16*11, /* there can be total 11 devices on the bus */
- 3, /* Where the interrupt router lies (bus) */
- (4<<3)|3, /* Where the interrupt router lies (dev) */
- 0, /* IRQs devoted exclusively to PCI usage */
- 0x1022, /* Vendor */
- 0x746b, /* Device */
- 0, /* Crap (miniport) */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* u8 rfu[11] */
- 0x42, /* u8 checksum , this hase to set to some value that would give 0 after the sum of all bytes for this structure (including checksum) */
- {
- {3,(4<<3)|0, {{0x1, 0xdef8}, {0x2, 0xdef8}, {0x3, 0xdef8}, {0x4, 0xdef8}}, 0, 0},
- {0x6,0, {{0, 0}, {0, 0}, {0, 0}, {0x4, 0xdef8}}, 0, 0},
- {0x1,0, {{0x1, 0xdef8}, {0x2, 0xdef8}, {0, 0}, {0, 0}}, 0x0, 0},
- {0x5,(3<<3)|0, {{0x1, 0xdef8}, {0x2, 0xdef8}, {0x3, 0xdef8}, {0x4, 0xdef8}}, 0x1, 0},
- {0x5,(6<<3)|0, {{0x2, 0xdef8}, {0x3, 0xdef8}, {0x4, 0xdef8}, {0x1, 0xdef8}}, 0x2, 0},
- {0x4,(8<<3)|0, {{0x4, 0xdef8}, {0x1, 0xdef8}, {0x2, 0xdef8}, {0x3, 0xdef8}}, 0x3, 0},
- {0x4,(7<<3)|0, {{0x3, 0xdef8}, {0x4, 0xdef8}, {0x1, 0xdef8}, {0x2, 0xdef8}}, 0x4, 0},
- {0x6,(0x0a<<3)|0, {{0x1, 0xdef8}, {0x2, 0xdef8}, {0x3, 0xdef8}, {0x4, 0xdef8}}, 0x5, 0},
- {0x4,(9<<3)|0, {{0x1, 0xdef8}, {2, 0xdef8}, {0, 0}, {0, 0}}, 0, 0},
- {0x6,(0x0b<<3)|0, {{0x2, 0xdef8}, {0, 0}, {0, 0}, {0, 0}}, 0, 0},
- {0x6,(0x0c<<3)|0, {{0x4, 0xdef8}, {0, 0}, {0, 0}, {0, 0}}, 0, 0},
- }
-};
-
static void write_pirq_info(struct irq_info *pirq_info, uint8_t bus, uint8_t devfn, uint8_t link0, uint16_t bitmap0,
uint8_t link1, uint16_t bitmap1, uint8_t link2, uint16_t bitmap2,uint8_t link3, uint16_t bitmap3,
uint8_t slot, uint8_t rfu)
@@ -63,8 +36,12 @@ extern unsigned char bus_8111_1;
extern unsigned char bus_8151_0;
extern unsigned char bus_8151_1;
+extern unsigned pci1234[];
+
extern unsigned sbdn;
extern unsigned hcdn[];
+extern unsigned sbdn3;
+extern unsigned sbdn5;
extern void get_bus_conf(void);
@@ -112,10 +89,13 @@ unsigned long write_pirq_routing_table(unsigned long addr)
write_pirq_info(pirq_info, bus_8111_0, ((sbdn+1)<<3)|0, 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 0, 0);
pirq_info++; slot_num++;
//pcix bridge
-// write_pirq_info(pirq_info, bus_8132_0, (sbd3<<3)|0, 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 0, 0);
+// write_pirq_info(pirq_info, bus_8132_0, (sbdn3<<3)|0, 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 0, 0);
// pirq_info++; slot_num++;
-//agp bridge
- write_pirq_info(pirq_info, bus_8151_0, ((hcdn[1] & 0xff)<<3)|0, 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 0, 0);
+
+ if(pci1234[1] & 0xf) {
+ //agp bridge
+ write_pirq_info(pirq_info, bus_8151_0, (sbdn5<<3)|0, 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 0, 0);
+ }
pirq_info++; slot_num++;
diff --git a/src/mainboard/amd/serengeti_leopard/mptable.c b/src/mainboard/amd/serengeti_leopard/mptable.c
index e210d8b683..16bb74ea45 100644
--- a/src/mainboard/amd/serengeti_leopard/mptable.c
+++ b/src/mainboard/amd/serengeti_leopard/mptable.c
@@ -19,8 +19,11 @@ extern unsigned apicid_8111;
extern unsigned apicid_8132_1;
extern unsigned apicid_8132_2;
+extern unsigned pci1234[];
extern unsigned sbdn;
extern unsigned hcdn[];
+extern unsigned sbdn3;
+extern unsigned sbdn5;
extern void get_bus_conf(void);
@@ -32,6 +35,7 @@ void *smp_write_config_table(void *v)
struct mp_config_table *mc;
unsigned char bus_num;
+ int i;
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
memset(mc, 0, sizeof(*mc));
@@ -66,14 +70,14 @@ void *smp_write_config_table(void *v)
{
device_t dev;
struct resource *res;
- dev = dev_find_slot(bus_8132_0, PCI_DEVFN((hcdn[0]&0xff), 1));
+ dev = dev_find_slot(bus_8132_0, PCI_DEVFN(sbdn3, 1));
if (dev) {
res = find_resource(dev, PCI_BASE_ADDRESS_0);
if (res) {
smp_write_ioapic(mc, apicid_8132_1, 0x11, res->base);
}
}
- dev = dev_find_slot(bus_8132_0, PCI_DEVFN((hcdn[0]&0xff)+1, 1));
+ dev = dev_find_slot(bus_8132_0, PCI_DEVFN(sbdn3+1, 1));
if (dev) {
res = find_resource(dev, PCI_BASE_ADDRESS_0);
if (res) {
@@ -103,32 +107,34 @@ void *smp_write_config_table(void *v)
// Onboard AMD USB
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (0<<2)|3, apicid_8111, 0x13);
-// Slot AGP
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8151_1, 0x0, apicid_8111, 0x11);
+ if(pci1234[1] & 0xf) {
+ // Slot AGP
+ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8151_1, 0x0, apicid_8111, 0x11);
+ }
//Slot 3 PCI 32
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (5<<2)|0, apicid_8111, 0x11);
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (5<<2)|1, apicid_8111, 0x12);
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (5<<2)|2, apicid_8111, 0x13); //
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (5<<2)|3, apicid_8111, 0x10); //
+ for(i=0;i<4;i++) {
+ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (5<<2)|i, apicid_8111, 0x10 + (1+i)%4); //16
+ }
+
//Slot 4 PCI 32
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (4<<2)|0, apicid_8111, 0x10);
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (4<<2)|1, apicid_8111, 0x11);
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (4<<2)|2, apicid_8111, 0x12); //
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (4<<2)|3, apicid_8111, 0x13); //
+ for(i=0;i<4;i++) {
+ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (4<<2)|i, apicid_8111, 0x10 + (0+i)%4); //16
+ }
+
//Slot 1 PCI-X 133/100/66
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_2, (1<<2)|0, apicid_8132_2, 0x0);
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_2, (1<<2)|1, apicid_8132_2, 0x1);
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_2, (1<<2)|2, apicid_8132_2, 0x2); //
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_2, (1<<2)|3, apicid_8132_2, 0x3); //
+ for(i=0;i<4;i++) {
+ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_2, (1<<2)|i, apicid_8132_2, (0+i)%4); //
+ }
+
//Slot 2 PCI-X 133/100/66
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_1, (1<<2)|0, apicid_8132_1, 0x1);
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_1, (1<<2)|1, apicid_8132_1, 0x2);
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_1, (1<<2)|2, apicid_8132_1, 0x3);//
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_1, (1<<2)|3, apicid_8132_1, 0x0);//
+ for(i=0;i<4;i++) {
+ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8132_1, (1<<2)|i, apicid_8132_1, (1+i)%4); //25
+ }
+
/*Local Ints: Type Polarity Trigger Bus ID IRQ APIC ID PIN#*/
smp_write_intsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH, bus_isa, 0x0, MP_APIC_ALL, 0x0);