summaryrefslogtreecommitdiffstats
path: root/c/src/libchip
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2016-03-02 13:25:13 -0600
committerJoel Sherrill <joel@rtems.org>2016-03-10 10:26:48 -0600
commit12c9dc8ff5ad2e1226562474600a5abe8c2e575d (patch)
tree50c652446c8674b72317626dc39e41b085f94d96 /c/src/libchip
parentlibtests/syscall01: Explicitly request close (diff)
downloadrtems-12c9dc8ff5ad2e1226562474600a5abe8c2e575d.tar.bz2
pc386: Eliminate pcibios.h and begin removal obsolete PCI BIOS API uses
This first step eliminates the following as public APIs for the pc386 BSP: + pcib_conf_read8 + pcib_conf_read16 + pcib_conf_read32 + pcib_conf_write8 + pcib_conf_write16 + pcib_conf_write32 The if_fxp.c driver uses these enough where I provided local macros to allow the code to be mostly unmodified. On other architectures these names have been used privately. It will take multiple patches to completely eliminate these symbols from the RTEMS source tree. The focus of the first effort is just to eliminate these as a public pc386 API so support can be added for systems without legacy PCI BIOS.
Diffstat (limited to '')
-rw-r--r--c/src/libchip/network/if_fxp.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/c/src/libchip/network/if_fxp.c b/c/src/libchip/network/if_fxp.c
index 9d223bb11f..ce59db1599 100644
--- a/c/src/libchip/network/if_fxp.c
+++ b/c/src/libchip/network/if_fxp.c
@@ -75,7 +75,6 @@
#include <sys/malloc.h>
#include <sys/systm.h>
#include <bsp.h>
-#include <pcibios.h>
#include <bsp/irq.h>
#include <rtems/pci.h>
@@ -352,6 +351,48 @@ fxp_dma_wait(volatile u_int16_t *status, struct fxp_softc *sc)
device_printf(sc->dev, "DMA timeout\n");
}
+/*
+ * These macros and instantiations define PCI Configuration Space accessors
+ * which use the legacy API based on the PCI BIOS only used by pc386.
+ * This was the only device driver using these.
+ *
+ * TBD: It may be worth it to fix this driver to use the current PCI API rather
+ * than this legacy PC386 API.
+ */
+#define PCIB_DEVSIG_BUS(x) (((x)>>8) &0xff)
+#define PCIB_DEVSIG_DEV(x) (((x)>>3) & 0x1f)
+#define PCIB_DEVSIG_FUNC(x) ((x) & 0x7)
+#define PCIB_DEVSIG_MAKE(b,d,f) ((b<<8)|(d<<3)|(f))
+
+#define PCI_CONF_ACCESSOR(_confop, _baseop, _type) \
+ /* prototype before body */ \
+ static inline int _confop ( \
+ int signature, \
+ int offset, \
+ _type data ); \
+ \
+ static inline int _confop ( \
+ int signature, \
+ int offset, \
+ _type data ) \
+ { \
+ _baseop( \
+ PCIB_DEVSIG_BUS(signature), \
+ PCIB_DEVSIG_DEV(signature), \
+ PCIB_DEVSIG_FUNC(signature), \
+ offset, \
+ data \
+ ); \
+ return PCIB_ERR_SUCCESS; \
+ }
+
+PCI_CONF_ACCESSOR( pcib_conf_read8, pci_read_config_byte, uint8_t * );
+PCI_CONF_ACCESSOR( pcib_conf_read16, pci_read_config_word, uint16_t * );
+PCI_CONF_ACCESSOR( pcib_conf_read32, pci_read_config_dword, uint32_t * );
+PCI_CONF_ACCESSOR( pcib_conf_write8, pci_write_config_byte, uint8_t );
+PCI_CONF_ACCESSOR( pcib_conf_write16, pci_write_config_word, uint16_t );
+PCI_CONF_ACCESSOR( pcib_conf_write32, pci_write_config_dword, uint32_t );
+
static __inline unsigned int pci_get_vendor(struct fxp_softc *sc) {
u_int16_t vendor;
pcib_conf_read16(sc->pci_signature,0,&vendor);