1 | /* PCI Auto Configuration Library |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 2010 Cobham Gaisler AB. |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef __PCI_CFG_AUTO_H__ |
---|
11 | #define __PCI_CFG_AUTO_H__ |
---|
12 | |
---|
13 | #define CFGOPT_NOSETUP_IRQ 0x1 /* Skip IRQ setup */ |
---|
14 | |
---|
15 | /* PCI Memory Layout setup, used by the auto-config library in order to |
---|
16 | * determine the addresses of PCI BARs and Buses. |
---|
17 | * |
---|
18 | * All addresses are in PCI address space, the actual address the CPU access |
---|
19 | * may be different, and taken care of elsewhere. |
---|
20 | */ |
---|
21 | struct pci_auto_setup { |
---|
22 | int options; |
---|
23 | |
---|
24 | /* PCI prefetchable Memory space (OPTIONAL) */ |
---|
25 | uint32_t mem_start; |
---|
26 | uint32_t mem_size; /* 0 = Use MEMIO space for prefetchable mem BARs */ |
---|
27 | |
---|
28 | /* PCI non-prefetchable Memory */ |
---|
29 | uint32_t memio_start; |
---|
30 | uint32_t memio_size; |
---|
31 | |
---|
32 | /* PCI I/O space (OPTIONAL) */ |
---|
33 | uint32_t io_start; |
---|
34 | uint32_t io_size; /* 0 = No I/O space */ |
---|
35 | |
---|
36 | /* Get System IRQ connected to a PCI line of a PCI device on bus0. |
---|
37 | * The return IRQ value zero equals no IRQ (IRQ disabled). |
---|
38 | */ |
---|
39 | uint8_t (*irq_map)(pci_dev_t dev, int irq_pin); |
---|
40 | |
---|
41 | /* IRQ Bridge routing. Returns the interrupt pin (0..3 = A..D) that |
---|
42 | * a device is connected to on parent bus. |
---|
43 | */ |
---|
44 | int (*irq_route)(pci_dev_t dev, int irq_pin); |
---|
45 | }; |
---|
46 | |
---|
47 | /* Do PCI initialization: Enumrate buses, scan buses for devices, assign |
---|
48 | * I/O MEM and MEMIO resources, assign IRQ and so on. |
---|
49 | */ |
---|
50 | extern int pci_config_auto(void); |
---|
51 | |
---|
52 | /* Register a configuration for the auto library (struct pci_auto_setup *) */ |
---|
53 | extern void pci_config_auto_register(void *config); |
---|
54 | |
---|
55 | /* PCI memory map */ |
---|
56 | extern struct pci_auto_setup pci_auto_cfg; |
---|
57 | |
---|
58 | #endif |
---|