28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: bus_pci.h,v 1.29 2006/02/18 13:15:21 debug Exp $ |
* $Id: bus_pci.h,v 1.30 2006/08/12 19:32:20 debug Exp $ |
32 |
*/ |
*/ |
33 |
|
|
34 |
#include "misc.h" |
#include "misc.h" |
39 |
|
|
40 |
struct pci_device; |
struct pci_device; |
41 |
|
|
42 |
|
|
43 |
#ifndef BUS_PCI_C |
#ifndef BUS_PCI_C |
44 |
|
|
45 |
struct pci_data; |
struct pci_data; |
46 |
|
|
47 |
#else |
#else |
48 |
|
|
49 |
struct pci_data { |
struct pci_data { |
83 |
#define PCI_CFG_MEM_SIZE 0x100 |
#define PCI_CFG_MEM_SIZE 0x100 |
84 |
|
|
85 |
struct pci_device { |
struct pci_device { |
86 |
|
/* Pointer to the next PCI device on this bus: */ |
87 |
struct pci_device *next; |
struct pci_device *next; |
88 |
|
|
89 |
|
/* Pointer back to the bus this device is connected to: */ |
90 |
struct pci_data *pcibus; |
struct pci_data *pcibus; |
91 |
|
|
92 |
|
/* Short device name, and bus/device/function value: */ |
93 |
char *name; |
char *name; |
94 |
int bus, device, function; |
int bus, device, function; |
95 |
|
|
96 |
|
/* Configuration memory: */ |
97 |
unsigned char cfg_mem[PCI_CFG_MEM_SIZE]; |
unsigned char cfg_mem[PCI_CFG_MEM_SIZE]; |
98 |
unsigned char cfg_mem_size[PCI_CFG_MEM_SIZE]; |
unsigned char cfg_mem_size[PCI_CFG_MEM_SIZE]; |
99 |
|
|
100 |
|
/* Used when setting up the configuration registers: */ |
101 |
int cur_mapreg_offset; |
int cur_mapreg_offset; |
102 |
|
|
103 |
|
/* Function to handle device-specific cfg register writes: */ |
104 |
|
int (*cfg_reg_write)(struct pci_device *pd, |
105 |
|
int reg, uint32_t value); |
106 |
|
void *extra; |
107 |
}; |
}; |
108 |
|
|
109 |
#define PCIINIT(name) void pciinit_ ## name(struct machine *machine, \ |
#define PCIINIT(name) void pciinit_ ## name(struct machine *machine, \ |
148 |
uint64_t pci_actual_io_offset, uint64_t pci_actual_mem_offset, |
uint64_t pci_actual_io_offset, uint64_t pci_actual_mem_offset, |
149 |
uint64_t pci_portbase, uint64_t pci_membase, int pci_irqbase, |
uint64_t pci_portbase, uint64_t pci_membase, int pci_irqbase, |
150 |
uint64_t isa_portbase, uint64_t isa_membase, int isa_irqbase); |
uint64_t isa_portbase, uint64_t isa_membase, int isa_irqbase); |
151 |
|
|
152 |
|
/* Add a PCI device to a PCI bus: */ |
153 |
void bus_pci_add(struct machine *machine, struct pci_data *pci_data, |
void bus_pci_add(struct machine *machine, struct pci_data *pci_data, |
154 |
struct memory *mem, int bus, int device, int function, |
struct memory *mem, int bus, int device, int function, |
155 |
const char *name); |
const char *name); |