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