switch-coreboot/include/device/pci.h
Ronald G. Minnich 0044d53a10 This set of changes creates irq tables for alix1c and adds the functions
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
2008-02-09 16:32:59 +00:00

132 lines
4.7 KiB
C

/*
* This file is part of the coreboot project.
*
* PCI defines and function prototypes
* Copyright 1994, Drew Eckhardt
* Copyright 1997-1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*
* 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
*/
#ifndef DEVICE_PCI_H
#define DEVICE_PCI_H
#include <types.h>
#include <device/pci_def.h>
#include <device/resource.h>
#include <device/device.h>
#include <device/pci_ops.h>
#include <device/pci_rom.h>
#include <device/pci_ids.h>
/*
* For more information, please consult the following manuals (look at
* http://www.pcisig.com/ for how to get them):
*
* PCI BIOS Specification
* PCI Local Bus Specification
* PCI to PCI Bridge Specification
* PCI System Design Guide
*/
/* Common pci operations without a standard interface */
struct pci_operations {
/* set the Subsystem IDs for the PCI device */
void (*set_subsystem)(struct device * dev, unsigned vendor, unsigned device);
};
/* Common pci bus operations */
struct pci_bus_operations {
u8 (*read8)(struct bus *pbus, int bus, int devfn, int where);
u16 (*read16)(struct bus *pbus, int bus, int devfn, int where);
u32 (*read32)(struct bus *pbus, int bus, int devfn, int where);
void (*write8)(struct bus *pbus, int bus, int devfn, int where, u8 val);
void (*write16)(struct bus *pbus, int bus, int devfn, int where, u16 val);
void (*write32)(struct bus *pbus, int bus, int devfn, int where, u32 val);
};
struct pci_driver {
struct device_operations *ops;
unsigned short vendor;
unsigned short device;
};
#define __pci_driver __attribute__ ((used,__section__(".rodata.pci_driver")))
/** start of compile time generated pci driver array */
extern struct pci_driver pci_drivers[];
/** end of compile time generated pci driver array */
extern struct pci_driver epci_drivers[];
extern struct device_operations default_pci_ops_dev;
extern struct device_operations default_pci_ops_bus;
extern struct pci_operations pci_dev_ops_pci;
extern struct pci_operations pci_bus_ops_pci;
void pci_dev_read_resources(struct device * dev);
void pci_bus_read_resources(struct device * dev);
void pci_dev_set_resources(struct device * dev);
void pci_dev_enable_resources(struct device * dev);
void pci_bus_enable_resources(struct device * dev);
void pci_bus_reset(struct bus *bus);
struct device * pci_probe_dev(struct device * dev, struct bus *bus, unsigned devfn);
unsigned int do_pci_scan_bridge(struct device * bus, unsigned int max,
unsigned int (*do_scan_bus)(struct bus *bus,
unsigned min_devfn, unsigned max_devfn, unsigned int max));
unsigned int pci_scan_bridge(struct device * bus, unsigned int max);
unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max);
u8 pci_moving_config8(struct device *dev, unsigned reg);
u16 pci_moving_config16(struct device *dev, unsigned reg);
u32 pci_moving_config32(struct device *dev, unsigned reg);
unsigned pci_find_next_capability(struct device * dev, unsigned cap, unsigned last);
unsigned pci_find_capability(struct device * dev, unsigned cap);
struct resource *pci_get_resource(struct device *dev, unsigned long index);
void pci_dev_set_subsystem(struct device * dev, unsigned vendor, unsigned device);
void pci_domain_read_resources(struct device *dev);
void ram_resource(struct device *dev, unsigned long index,
unsigned long basek, unsigned long sizek);
unsigned int pci_domain_scan_bus(struct device *dev, unsigned int max);
void pci_assign_irqs(unsigned int bus, unsigned int slot,
const unsigned char pIntAtoD[4]);
#define PCI_IO_BRIDGE_ALIGN 4096
#define PCI_MEM_BRIDGE_ALIGN (1024*1024)
#define PCI_BUS_SEGN_BITS 0
static inline const struct pci_operations *ops_pci(struct device * dev)
{
const struct pci_operations *pops;
pops = 0;
if (dev && dev->ops) {
pops = dev->ops->ops_pci;
}
return pops;
}
static inline const struct pci_bus_operations *ops_pci_bus(struct bus *bus)
{
const struct pci_bus_operations *bops;
bops = 0;
if (bus && bus->dev && bus->dev->ops) {
bops = bus->dev->ops->ops_pci_bus;
}
return bops;
}
#endif /* DEVICE_PCI_H */