2003-04-22 21:02:15 +02:00
|
|
|
#include <console/console.h>
|
|
|
|
#include <arch/pirq_routing.h>
|
|
|
|
#include <string.h>
|
Now coreboot performs IRQ routing for some boards.
You can see this by executing commands like this:
grep -r pci_assign_irqs coreboot/src/*
This basically AMD/LX based boards: pcengines/alix1c,
digitallogic/msm800sev, artecgroup/dbe61, amd/norwich, amd/db800.
Also for AMD/GX1 based boards need a patch
[http://www.pengutronix.de/software/ptxdist/temporary-src/references/geode-5530.patch]
for the right IRQ setup.
AMD/GX1 based boards is: advantech/pcm-5820, asi/mb_5blmp, axus/tc320,
bcom/winnet100, eaglelion/5bcm, iei/nova4899r, iei/juki-511p.
I have two ideas.
1. Delete duplicate code from AMD/LX based boards.
2. Add IRQ routing for AMD/GX1 boards in coreboot.
The pirq.patch for IRQ routing logically consist from of two parts:
First part of pirq.patch independent from type chipsets and assign IRQ for
ever PCI device. It part based on AMD/LX write_pirq_routing_table() function.
Second part of pirq.patch depends of type chipset and set PIRQx lines
in interrupt router. This part supports only CS5530/5536 interrupt routers.
IRQ routing functionality is included through PIRQ_ROUTE in Config.lb.
Tested on iei/juki-511p(cs5530a), iei/pcisa-lx(cs5536) and also on
TeleVideo TC7020, see
http://www.coreboot.org/pipermail/coreboot/2007-December/027973.html.
Signed-off-by: Nikolay Petukhov <nikolay.petukhov@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3196 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2008-03-29 17:59:27 +01:00
|
|
|
#include <device/pci.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2004-03-23 18:41:15 +01:00
|
|
|
#if (DEBUG==1 && HAVE_PIRQ_TABLE==1)
|
2004-06-07 12:25:42 +02:00
|
|
|
static void check_pirq_routing_table(struct irq_routing_table *rt)
|
2003-04-22 21:02:15 +02:00
|
|
|
{
|
2004-06-07 12:25:42 +02:00
|
|
|
uint8_t *addr = (uint8_t *)rt;
|
|
|
|
uint8_t sum=0;
|
2003-04-22 21:02:15 +02:00
|
|
|
int i;
|
|
|
|
|
2004-06-07 12:25:42 +02:00
|
|
|
printk_info("Checking IRQ routing table consistency...\n");
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2003-04-24 08:56:37 +02:00
|
|
|
#if defined(IRQ_SLOT_COUNT)
|
2004-06-07 12:25:42 +02:00
|
|
|
if (sizeof(struct irq_routing_table) != rt->size) {
|
2003-10-28 18:02:10 +01:00
|
|
|
printk_warning("Inconsistent IRQ routing table size (0x%x/0x%x)\n",
|
2004-06-07 12:25:42 +02:00
|
|
|
sizeof(struct irq_routing_table),
|
|
|
|
rt->size
|
2004-04-15 19:33:21 +02:00
|
|
|
);
|
2004-06-07 12:25:42 +02:00
|
|
|
rt->size=sizeof(struct irq_routing_table);
|
2003-04-22 21:02:15 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
for (i = 0; i < rt->size; i++)
|
|
|
|
sum += addr[i];
|
|
|
|
|
2005-01-19 15:06:41 +01:00
|
|
|
printk_debug("%s() - irq_routing_table located at: 0x%p\n",
|
|
|
|
__FUNCTION__, addr);
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2003-04-25 04:02:25 +02:00
|
|
|
|
|
|
|
sum = rt->checksum - sum;
|
2003-04-22 21:02:15 +02:00
|
|
|
|
|
|
|
if (sum != rt->checksum) {
|
|
|
|
printk_warning("%s:%6d:%s() - "
|
2004-04-15 19:33:21 +02:00
|
|
|
"checksum is: 0x%02x but should be: 0x%02x\n",
|
|
|
|
__FILE__, __LINE__, __FUNCTION__, rt->checksum, sum);
|
2003-10-28 18:02:10 +01:00
|
|
|
rt->checksum = sum;
|
2003-04-22 21:02:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rt->signature != PIRQ_SIGNATURE || rt->version != PIRQ_VERSION ||
|
2004-06-07 12:25:42 +02:00
|
|
|
rt->size % 16 ) {
|
2003-04-22 21:02:15 +02:00
|
|
|
printk_warning("%s:%6d:%s() - "
|
2004-04-15 19:33:21 +02:00
|
|
|
"Interrupt Routing Table not valid\n",
|
|
|
|
__FILE__, __LINE__, __FUNCTION__);
|
2003-04-22 21:02:15 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sum = 0;
|
|
|
|
for (i=0; i<rt->size; i++)
|
|
|
|
sum += addr[i];
|
|
|
|
|
|
|
|
if (sum) {
|
|
|
|
printk_warning("%s:%6d:%s() - "
|
2004-04-15 19:33:21 +02:00
|
|
|
"checksum error in irq routing table\n",
|
|
|
|
__FILE__, __LINE__, __FUNCTION__);
|
2003-04-22 21:02:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
printk_info("done.\n");
|
|
|
|
}
|
|
|
|
|
2004-06-07 12:25:42 +02:00
|
|
|
static int verify_copy_pirq_routing_table(unsigned long addr)
|
2003-04-22 21:02:15 +02:00
|
|
|
{
|
|
|
|
int i;
|
2003-04-24 08:56:37 +02:00
|
|
|
uint8_t *rt_orig, *rt_curr;
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2003-04-24 08:56:37 +02:00
|
|
|
rt_curr = (uint8_t*)addr;
|
|
|
|
rt_orig = (uint8_t*)&intel_irq_routing_table;
|
2004-01-26 11:54:44 +01:00
|
|
|
printk_info("Verifing copy of IRQ routing tables at 0x%x...", addr);
|
2003-04-22 21:02:15 +02:00
|
|
|
for (i = 0; i < intel_irq_routing_table.size; i++) {
|
|
|
|
if (*(rt_curr + i) != *(rt_orig + i)) {
|
|
|
|
printk_info("failed\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2004-01-26 11:54:44 +01:00
|
|
|
printk_info("done\n");
|
2004-06-07 12:25:42 +02:00
|
|
|
|
|
|
|
check_pirq_routing_table((struct irq_routing_table *)addr);
|
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define verify_copy_pirq_routing_table(addr)
|
|
|
|
#endif
|
|
|
|
|
2004-03-23 18:41:15 +01:00
|
|
|
#if HAVE_PIRQ_TABLE==1
|
2003-04-22 21:02:15 +02:00
|
|
|
unsigned long copy_pirq_routing_table(unsigned long addr)
|
|
|
|
{
|
|
|
|
/* Align the table to be 16 byte aligned. */
|
|
|
|
addr += 15;
|
|
|
|
addr &= ~15;
|
|
|
|
|
|
|
|
/* This table must be betweeen 0xf0000 & 0x100000 */
|
|
|
|
printk_info("Copying IRQ routing tables to 0x%x...", addr);
|
|
|
|
memcpy((void *)addr, &intel_irq_routing_table, intel_irq_routing_table.size);
|
|
|
|
printk_info("done.\n");
|
|
|
|
verify_copy_pirq_routing_table(addr);
|
Now coreboot performs IRQ routing for some boards.
You can see this by executing commands like this:
grep -r pci_assign_irqs coreboot/src/*
This basically AMD/LX based boards: pcengines/alix1c,
digitallogic/msm800sev, artecgroup/dbe61, amd/norwich, amd/db800.
Also for AMD/GX1 based boards need a patch
[http://www.pengutronix.de/software/ptxdist/temporary-src/references/geode-5530.patch]
for the right IRQ setup.
AMD/GX1 based boards is: advantech/pcm-5820, asi/mb_5blmp, axus/tc320,
bcom/winnet100, eaglelion/5bcm, iei/nova4899r, iei/juki-511p.
I have two ideas.
1. Delete duplicate code from AMD/LX based boards.
2. Add IRQ routing for AMD/GX1 boards in coreboot.
The pirq.patch for IRQ routing logically consist from of two parts:
First part of pirq.patch independent from type chipsets and assign IRQ for
ever PCI device. It part based on AMD/LX write_pirq_routing_table() function.
Second part of pirq.patch depends of type chipset and set PIRQx lines
in interrupt router. This part supports only CS5530/5536 interrupt routers.
IRQ routing functionality is included through PIRQ_ROUTE in Config.lb.
Tested on iei/juki-511p(cs5530a), iei/pcisa-lx(cs5536) and also on
TeleVideo TC7020, see
http://www.coreboot.org/pipermail/coreboot/2007-December/027973.html.
Signed-off-by: Nikolay Petukhov <nikolay.petukhov@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3196 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2008-03-29 17:59:27 +01:00
|
|
|
pirq_routing_irqs(addr);
|
2003-04-22 21:02:15 +02:00
|
|
|
return addr + intel_irq_routing_table.size;
|
|
|
|
}
|
2004-03-23 18:41:15 +01:00
|
|
|
#endif
|
Now coreboot performs IRQ routing for some boards.
You can see this by executing commands like this:
grep -r pci_assign_irqs coreboot/src/*
This basically AMD/LX based boards: pcengines/alix1c,
digitallogic/msm800sev, artecgroup/dbe61, amd/norwich, amd/db800.
Also for AMD/GX1 based boards need a patch
[http://www.pengutronix.de/software/ptxdist/temporary-src/references/geode-5530.patch]
for the right IRQ setup.
AMD/GX1 based boards is: advantech/pcm-5820, asi/mb_5blmp, axus/tc320,
bcom/winnet100, eaglelion/5bcm, iei/nova4899r, iei/juki-511p.
I have two ideas.
1. Delete duplicate code from AMD/LX based boards.
2. Add IRQ routing for AMD/GX1 boards in coreboot.
The pirq.patch for IRQ routing logically consist from of two parts:
First part of pirq.patch independent from type chipsets and assign IRQ for
ever PCI device. It part based on AMD/LX write_pirq_routing_table() function.
Second part of pirq.patch depends of type chipset and set PIRQx lines
in interrupt router. This part supports only CS5530/5536 interrupt routers.
IRQ routing functionality is included through PIRQ_ROUTE in Config.lb.
Tested on iei/juki-511p(cs5530a), iei/pcisa-lx(cs5536) and also on
TeleVideo TC7020, see
http://www.coreboot.org/pipermail/coreboot/2007-December/027973.html.
Signed-off-by: Nikolay Petukhov <nikolay.petukhov@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3196 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2008-03-29 17:59:27 +01:00
|
|
|
|
|
|
|
#if (PIRQ_ROUTE==1 && HAVE_PIRQ_TABLE==1)
|
|
|
|
void pirq_routing_irqs(unsigned long addr)
|
|
|
|
{
|
|
|
|
int i, j, k, num_entries;
|
|
|
|
unsigned char irq_slot[4];
|
|
|
|
unsigned char pirq[4] = {0, 0, 0, 0};
|
|
|
|
struct irq_routing_table *pirq_tbl;
|
|
|
|
device_t pdev;
|
|
|
|
|
|
|
|
pirq_tbl = (struct irq_routing_table *)(addr);
|
|
|
|
num_entries = (pirq_tbl->size - 32) / 16;
|
|
|
|
|
|
|
|
/* Set PCI IRQs. */
|
|
|
|
for (i = 0; i < num_entries; i++) {
|
|
|
|
|
|
|
|
printk_debug("PIR Entry %d Dev/Fn: %X Slot: %d\n", i,
|
|
|
|
pirq_tbl->slots[i].devfn >> 3, pirq_tbl->slots[i].slot);
|
|
|
|
|
|
|
|
for (j = 0; j < 4; j++) {
|
|
|
|
|
|
|
|
int link = pirq_tbl->slots[i].irq[j].link;
|
2008-04-07 19:49:57 +02:00
|
|
|
int bitmap = pirq_tbl->slots[i].irq[j].bitmap;
|
Now coreboot performs IRQ routing for some boards.
You can see this by executing commands like this:
grep -r pci_assign_irqs coreboot/src/*
This basically AMD/LX based boards: pcengines/alix1c,
digitallogic/msm800sev, artecgroup/dbe61, amd/norwich, amd/db800.
Also for AMD/GX1 based boards need a patch
[http://www.pengutronix.de/software/ptxdist/temporary-src/references/geode-5530.patch]
for the right IRQ setup.
AMD/GX1 based boards is: advantech/pcm-5820, asi/mb_5blmp, axus/tc320,
bcom/winnet100, eaglelion/5bcm, iei/nova4899r, iei/juki-511p.
I have two ideas.
1. Delete duplicate code from AMD/LX based boards.
2. Add IRQ routing for AMD/GX1 boards in coreboot.
The pirq.patch for IRQ routing logically consist from of two parts:
First part of pirq.patch independent from type chipsets and assign IRQ for
ever PCI device. It part based on AMD/LX write_pirq_routing_table() function.
Second part of pirq.patch depends of type chipset and set PIRQx lines
in interrupt router. This part supports only CS5530/5536 interrupt routers.
IRQ routing functionality is included through PIRQ_ROUTE in Config.lb.
Tested on iei/juki-511p(cs5530a), iei/pcisa-lx(cs5536) and also on
TeleVideo TC7020, see
http://www.coreboot.org/pipermail/coreboot/2007-December/027973.html.
Signed-off-by: Nikolay Petukhov <nikolay.petukhov@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3196 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2008-03-29 17:59:27 +01:00
|
|
|
int irq = 0;
|
|
|
|
|
|
|
|
printk_debug("INT: %c link: %x bitmap: %x ",
|
|
|
|
'A' + j, link, bitmap);
|
|
|
|
|
|
|
|
if (!bitmap|| !link || link > 4) {
|
|
|
|
|
|
|
|
printk_debug("not routed\n");
|
|
|
|
irq_slot[j] = irq;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* yet not routed */
|
|
|
|
if (!pirq[link - 1]) {
|
|
|
|
|
2008-10-23 00:20:48 +02:00
|
|
|
for (k = 2; k <= 15; k++) {
|
Now coreboot performs IRQ routing for some boards.
You can see this by executing commands like this:
grep -r pci_assign_irqs coreboot/src/*
This basically AMD/LX based boards: pcengines/alix1c,
digitallogic/msm800sev, artecgroup/dbe61, amd/norwich, amd/db800.
Also for AMD/GX1 based boards need a patch
[http://www.pengutronix.de/software/ptxdist/temporary-src/references/geode-5530.patch]
for the right IRQ setup.
AMD/GX1 based boards is: advantech/pcm-5820, asi/mb_5blmp, axus/tc320,
bcom/winnet100, eaglelion/5bcm, iei/nova4899r, iei/juki-511p.
I have two ideas.
1. Delete duplicate code from AMD/LX based boards.
2. Add IRQ routing for AMD/GX1 boards in coreboot.
The pirq.patch for IRQ routing logically consist from of two parts:
First part of pirq.patch independent from type chipsets and assign IRQ for
ever PCI device. It part based on AMD/LX write_pirq_routing_table() function.
Second part of pirq.patch depends of type chipset and set PIRQx lines
in interrupt router. This part supports only CS5530/5536 interrupt routers.
IRQ routing functionality is included through PIRQ_ROUTE in Config.lb.
Tested on iei/juki-511p(cs5530a), iei/pcisa-lx(cs5536) and also on
TeleVideo TC7020, see
http://www.coreboot.org/pipermail/coreboot/2007-December/027973.html.
Signed-off-by: Nikolay Petukhov <nikolay.petukhov@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3196 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2008-03-29 17:59:27 +01:00
|
|
|
|
|
|
|
if (!((bitmap >> k) & 1))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
irq = k;
|
|
|
|
|
|
|
|
/* yet not routed */
|
|
|
|
if (pirq[0] != irq && pirq[1] != irq && pirq[2] != irq && pirq[3] != irq)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (irq)
|
|
|
|
pirq[link - 1] = irq;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
irq = pirq[link - 1];
|
|
|
|
|
|
|
|
printk_debug("IRQ: %d\n", irq);
|
|
|
|
irq_slot[j] = irq;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Bus, device, slots IRQs for {A,B,C,D}. */
|
|
|
|
pci_assign_irqs(pirq_tbl->slots[i].bus,
|
|
|
|
pirq_tbl->slots[i].devfn >> 3, irq_slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
printk_debug("PIRQ1: %d\n", pirq[0]);
|
|
|
|
printk_debug("PIRQ2: %d\n", pirq[1]);
|
|
|
|
printk_debug("PIRQ3: %d\n", pirq[2]);
|
|
|
|
printk_debug("PIRQ4: %d\n", pirq[3]);
|
|
|
|
|
|
|
|
pirq_assign_irqs(pirq);
|
|
|
|
}
|
|
|
|
#endif
|