summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/pc386/startup
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2016-03-03 10:36:24 -0600
committerJoel Sherrill <joel@rtems.org>2016-03-10 10:30:25 -0600
commitf770fcb3688f4db8aabb13964dfcbe28ef6fbd02 (patch)
tree298c432cb62516bb77f9a022e28837ba953e440a /c/src/lib/libbsp/i386/pc386/startup
parentpc386/configure.ac: Delete incorrect and unused AM_CONDITIONAL (diff)
downloadrtems-f770fcb3688f4db8aabb13964dfcbe28ef6fbd02.tar.bz2
Add shared PCI support and enhance pc386 to support non-legacy PCI configuration space
This patch fundamentally results from enhancements to the pc386 BSP to support systems which do **NOT** have the legacy PCI BIOS. The patch adds support for detecting when legacy PCI BIOS is not present and then using IO space to access to PCI Configuration Space. This resulted in dynamically selected between two implementations of PCI and refactoring out the shared methods. This patch adds shared implementations of pci_bus_count() and pci_find_device(). Subsequent patches will remove implementations of these methods in other BSPs where possible.
Diffstat (limited to 'c/src/lib/libbsp/i386/pc386/startup')
-rw-r--r--c/src/lib/libbsp/i386/pc386/startup/bspstart.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
index ac871f0565..f74300e971 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
+++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
@@ -34,17 +34,37 @@
#include <libcpu/cpuModel.h>
/*
+ * PCI Bus Configuration
+ */
+rtems_pci_config_t BSP_pci_configuration = {
+ (volatile unsigned char*)0,
+ (volatile unsigned char*)0,
+ NULL
+};
+
+/*
* Helper to initialize the PCI Bus
*/
static void bsp_pci_initialize_helper(void)
{
#if (BSP_IS_EDISON == 0)
- int pci_init_retval;
+ const pci_config_access_functions *pci_accessors;
- pci_init_retval = pci_initialize();
- if (pci_init_retval != PCIB_ERR_SUCCESS) {
- printk("PCI bus: could not initialize PCI BIOS interface\n");
+ pci_accessors = pci_bios_initialize();
+ if (pci_accessors != NULL) {
+ printk("PCI bus: using PCI BIOS interface\n");
+ BSP_pci_configuration.pci_functions = pci_accessors;
+ return;
}
+
+ pci_accessors = pci_io_initialize();
+ if (pci_accessors != NULL) {
+ printk("PCI bus: using PCI I/O interface\n");
+ BSP_pci_configuration.pci_functions = pci_accessors;
+ return;
+ }
+
+ printk("PCI bus: could not initialize PCI BIOS interface\n");
#endif
}
@@ -65,7 +85,6 @@ static void bsp_start_default( void )
*edison_wd = 0x11f8;
#endif
-
/*
* Calibrate variable for 1ms-loop (see timer.c)
*/