mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
from v2 to install them. Linux boots fine and all interrupts seem to work correctly -- the network comes up, USB hot plug works, I can mount the USB disk, etc. To enable pirq tables for a given mainboard, simply add the select PIRQ_TABLE (see below) to the Kconfig for that board. Again, this code builds and boots linux on the alix1c. I think, with this change, we are very close to moving ALL LX boards to v3 and deprecating v2. The major remaining fix is to add an empty LAR entry to fill empty space in LAR and speed up the LAR file search process. Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Stefan Reinauer <stepan@coresystems.de> Index: include/tables.h Add prototype, conditioned on CONFIG_PIRQ_TABLE Index: util/x86emu/vm86.c Comment out 'debug trap' code that scribbles vectors at 0x4000. I don't know why this is here, but I'd like to leave it #if'ed out -- somebody, at some point, thought we needed it. To reenable, we will need to move stage2 code or these magic vectors. Index: arch/x86/Makefile Add support for conditional compilation of pirq support code. Index: arch/x86/pirq_routing.c Add this file from v2. Index: arch/x86/archtables.c Add call to write_pirq_routing_table (controlled by #ifdef CONFIG_PIRQ_TABLE) Index: arch/x86/Kconfig Add new config variable: PIRQ_TABLE Index: device/device.c Fix some trivial bugs. Index: mainboard/pcengines/alix1c/Makefile Add pirq table code for stage2 Index: mainboard/pcengines/alix1c/dts Modify dts to properly set southbridge variables Index: mainboard/pcengines/alix1c/irq_tables.c Add code from v2 for the alix1c. Index: mainboard/pcengines/Kconfig Add 'select PIRQ_TABLE' Index: include/arch/x86/pirq_routing.h Add include file from v2. Remove all the SLOTCOUNT nonsense. This hack was only needed for a very early version of gcc 3.x, where they screwed up the creation of struct members that used the [] syntax for variable-length array at the end of the struct. Index: include/device/pci.h Add prototype git-svn-id: svn://coreboot.org/repository/coreboot-v3@582 f3766cd6-281f-0410-b1cd-43a5c92072e9
120 lines
3.3 KiB
C
120 lines
3.3 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright (C) 2000 Ollie Lo, Silicon Integrated Systems
|
|
* Copyright (C) 2000 Ron Minnich
|
|
* Copyright (C) 2001 Eric Biederman
|
|
* Copyright (C) 2002 Andrew Ip
|
|
* Copyright (C) 2008 Ron Minnich
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
#include <types.h>
|
|
#include <string.h>
|
|
#include <lar.h>
|
|
#include <console.h>
|
|
#include <device/device.h>
|
|
#include <tables.h>
|
|
#include <pirq_routing.h>
|
|
|
|
static void check_pirq_routing_table(struct irq_routing_table *rt)
|
|
{
|
|
u8 *addr = (u8 *)rt;
|
|
u8 sum=0;
|
|
int i;
|
|
|
|
printk(BIOS_INFO, "Checking IRQ routing table consistency...\n");
|
|
|
|
#if defined(IRQ_SLOT_COUNT)
|
|
if (sizeof(struct irq_routing_table) != rt->size) {
|
|
printk_warning("Inconsistent IRQ routing table size (0x%x/0x%x)\n",
|
|
sizeof(struct irq_routing_table),
|
|
rt->size
|
|
);
|
|
rt->size=sizeof(struct irq_routing_table);
|
|
}
|
|
#endif
|
|
|
|
for (i = 0; i < rt->size; i++)
|
|
sum += addr[i];
|
|
|
|
printk(BIOS_DEBUG, "%s() - irq_routing_table located at: 0x%p\n",
|
|
__FUNCTION__, addr);
|
|
|
|
|
|
sum = rt->checksum - sum;
|
|
|
|
if (sum != rt->checksum) {
|
|
printk(BIOS_WARNING, "%s:%6d:%s() - "
|
|
"checksum is: 0x%02x but should be: 0x%02x\n",
|
|
__FILE__, __LINE__, __FUNCTION__, rt->checksum, sum);
|
|
rt->checksum = sum;
|
|
}
|
|
|
|
if (rt->signature != PIRQ_SIGNATURE || rt->version != PIRQ_VERSION ||
|
|
rt->size % 16 ) {
|
|
printk(BIOS_WARNING, "%s:%6d:%s() - "
|
|
"Interrupt Routing Table not valid\n",
|
|
__FILE__, __LINE__, __FUNCTION__);
|
|
return;
|
|
}
|
|
|
|
sum = 0;
|
|
for (i=0; i<rt->size; i++)
|
|
sum += addr[i];
|
|
|
|
if (sum) {
|
|
printk(BIOS_WARNING, "%s:%6d:%s() - "
|
|
"checksum error in irq routing table\n",
|
|
__FILE__, __LINE__, __FUNCTION__);
|
|
}
|
|
|
|
printk(BIOS_INFO, "done.\n");
|
|
}
|
|
|
|
static int verify_copy_pirq_routing_table(unsigned long addr)
|
|
{
|
|
int i;
|
|
u8 *rt_orig, *rt_curr;
|
|
|
|
rt_curr = (u8*)addr;
|
|
rt_orig = (u8*)&intel_irq_routing_table;
|
|
printk(BIOS_INFO, "Verifing copy of IRQ routing tables at 0x%lux...", addr);
|
|
for (i = 0; i < intel_irq_routing_table.size; i++) {
|
|
if (*(rt_curr + i) != *(rt_orig + i)) {
|
|
printk(BIOS_INFO, "failed\n");
|
|
return -1;
|
|
}
|
|
}
|
|
printk(BIOS_INFO, "done\n");
|
|
|
|
check_pirq_routing_table((struct irq_routing_table *)addr);
|
|
|
|
return 0;
|
|
}
|
|
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(BIOS_INFO, "Copying IRQ routing tables to 0x%lux...", addr);
|
|
memcpy((void *)addr, &intel_irq_routing_table, intel_irq_routing_table.size);
|
|
printk(BIOS_INFO, "done.\n");
|
|
verify_copy_pirq_routing_table(addr);
|
|
return addr + intel_irq_routing_table.size;
|
|
}
|
|
|