1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * PCI defines and function prototypes |
---|
5 | * Copyright 1994, Drew Eckhardt |
---|
6 | * Copyright 1997, 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz> |
---|
7 | * |
---|
8 | * For more information, please consult the following manuals (look at |
---|
9 | * http://www.pcisig.com/ for how to get them): |
---|
10 | * |
---|
11 | * PCI BIOS Specification |
---|
12 | * PCI Local Bus Specification |
---|
13 | * PCI to PCI Bridge Specification |
---|
14 | * PCI System Design Guide |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef BOOTLOADER_PCI_H |
---|
18 | #define BOOTLOADER_PCI_H |
---|
19 | |
---|
20 | #include <rtems/pci.h> |
---|
21 | |
---|
22 | |
---|
23 | /* Functions used to access pci configuration space */ |
---|
24 | struct pci_bootloader_config_access_functions { |
---|
25 | int (*read_config_byte)(unsigned char, unsigned char, |
---|
26 | unsigned char, unsigned char *); |
---|
27 | int (*read_config_word)(unsigned char, unsigned char, |
---|
28 | unsigned char, unsigned short *); |
---|
29 | int (*read_config_dword)(unsigned char, unsigned char, |
---|
30 | unsigned char, unsigned int *); |
---|
31 | int (*write_config_byte)(unsigned char, unsigned char, |
---|
32 | unsigned char, unsigned char); |
---|
33 | int (*write_config_word)(unsigned char, unsigned char, |
---|
34 | unsigned char, unsigned short); |
---|
35 | int (*write_config_dword)(unsigned char, unsigned char, |
---|
36 | unsigned char, unsigned int); |
---|
37 | }; |
---|
38 | |
---|
39 | /* |
---|
40 | * There is one pci_dev structure for each slot-number/function-number |
---|
41 | * combination: |
---|
42 | */ |
---|
43 | struct pci_dev { |
---|
44 | struct pci_bus *bus; /* bus this device is on */ |
---|
45 | struct pci_dev *sibling; /* next device on this bus */ |
---|
46 | struct pci_dev *next; /* chain of all devices */ |
---|
47 | |
---|
48 | void *sysdata; /* hook for sys-specific extension */ |
---|
49 | struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ |
---|
50 | |
---|
51 | unsigned int devfn; /* encoded device & function index */ |
---|
52 | unsigned short vendor; |
---|
53 | unsigned short device; |
---|
54 | unsigned int class; /* 3 bytes: (base,sub,prog-if) */ |
---|
55 | unsigned int hdr_type; /* PCI header type */ |
---|
56 | unsigned int master : 1; /* set if device is master capable */ |
---|
57 | /* |
---|
58 | * In theory, the irq level can be read from configuration |
---|
59 | * space and all would be fine. However, old PCI chips don't |
---|
60 | * support these registers and return 0 instead. For example, |
---|
61 | * the Vision864-P rev 0 chip can uses INTA, but returns 0 in |
---|
62 | * the interrupt line and pin registers. pci_init() |
---|
63 | * initializes this field with the value at PCI_INTERRUPT_LINE |
---|
64 | * and it is the job of pcibios_fixup() to change it if |
---|
65 | * necessary. The field must not be 0 unless the device |
---|
66 | * cannot generate interrupts at all. |
---|
67 | */ |
---|
68 | unsigned int irq; /* irq generated by this device */ |
---|
69 | |
---|
70 | /* Base registers for this device, can be adjusted by |
---|
71 | * pcibios_fixup() as necessary. |
---|
72 | */ |
---|
73 | unsigned long base_address[6]; |
---|
74 | unsigned long rom_address; |
---|
75 | }; |
---|
76 | |
---|
77 | struct pci_bus { |
---|
78 | struct pci_bus *parent; /* parent bus this bridge is on */ |
---|
79 | struct pci_bus *children; /* chain of P2P bridges on this bus */ |
---|
80 | struct pci_bus *next; /* chain of all PCI buses */ |
---|
81 | |
---|
82 | struct pci_dev *self; /* bridge device as seen by parent */ |
---|
83 | struct pci_dev *devices; /* devices behind this bridge */ |
---|
84 | |
---|
85 | void *sysdata; /* hook for sys-specific extension */ |
---|
86 | struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */ |
---|
87 | |
---|
88 | unsigned char number; /* bus number */ |
---|
89 | unsigned char primary; /* number of primary bridge */ |
---|
90 | unsigned char secondary; /* number of secondary bridge */ |
---|
91 | unsigned char subordinate; /* max number of subordinate buses */ |
---|
92 | }; |
---|
93 | |
---|
94 | extern struct pci_bus pci_root; /* root bus */ |
---|
95 | extern struct pci_dev *pci_devices; /* list of all devices */ |
---|
96 | |
---|
97 | #endif /* BOOTLOADER_PCI_H */ |
---|