Changeset 12c9dc8f in rtems


Ignore:
Timestamp:
Mar 2, 2016, 7:25:13 PM (4 years ago)
Author:
Joel Sherrill <joel@…>
Branches:
master
Children:
8ce16a4
Parents:
354064b
git-author:
Joel Sherrill <joel@…> (03/02/16 19:25:13)
git-committer:
Joel Sherrill <joel@…> (03/10/16 16:26:48)
Message:

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.

Location:
c/src
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/Makefile.am

    r354064b r12c9dc8f  
    2222
    2323# shared/pci
    24 EXTRA_DIST += shared/pci/pcibios.h
    2524EXTRA_DIST += shared/pci/pcibios.c
    2625
  • c/src/lib/libbsp/i386/pc386/Makefile.am

    r354064b r12c9dc8f  
    140140libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
    141141
    142 include_HEADERS += ../../i386/shared/pci/pcibios.h
    143142# pci
    144 libbsp_a_SOURCES += ../../i386/shared/pci/pcibios.c \
    145     ../../i386/shared/pci/pcibios.h
     143libbsp_a_SOURCES += ../../i386/shared/pci/pcibios.c
    146144
    147145include_HEADERS += ../../i386/shared/comm/uart.h
  • c/src/lib/libbsp/i386/pc386/preinstall.am

    r354064b r12c9dc8f  
    167167PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/console_private.h
    168168
    169 $(PROJECT_INCLUDE)/pcibios.h: ../../i386/shared/pci/pcibios.h $(PROJECT_INCLUDE)/$(dirstamp)
    170         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/pcibios.h
    171 PREINSTALL_FILES += $(PROJECT_INCLUDE)/pcibios.h
    172 
    173169$(PROJECT_INCLUDE)/uart.h: ../../i386/shared/comm/uart.h $(PROJECT_INCLUDE)/$(dirstamp)
    174170        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/uart.h
  • c/src/lib/libbsp/i386/shared/pci/pcibios.c

    r354064b r12c9dc8f  
    88#include <rtems.h>
    99#include <bsp.h>
    10 #include <pcibios.h>
     10#include <rtems/pci.h>
    1111
    1212#include <string.h>  /* memcpy */
     
    1616 * is flat and that stack is big enough
    1717 */
    18 
    19 
    2018static int pcibInitialized = 0;
    2119static unsigned int pcibEntry;
     
    3129static int pcib_convert_err(int err);
    3230
     31/** @brief
     32 * Make device signature from bus number, device numebr and function
     33 * number
     34 */
     35#define PCIB_DEVSIG_MAKE(b,d,f) ((b<<8)|(d<<3)|(f))
     36
     37/** @brief
     38 * Extract valrous part from device signature
     39 */
     40#define PCIB_DEVSIG_BUS(x) (((x)>>8) &0xff)
     41#define PCIB_DEVSIG_DEV(x) (((x)>>3) & 0x1f)
     42#define PCIB_DEVSIG_FUNC(x) ((x) & 0x7)
    3343/*
    3444 * Detects presense of PCI BIOS, returns
     
    233243    unsigned char hd = 0;
    234244    uint32_t d = 0;
    235     int sig;
    236245
    237246    ucBusCount = 0;
     
    239248    for (bus=0; bus< 0xff; bus++) {
    240249      for (dev=0; dev<PCI_MAX_DEVICES; dev++) {
    241         sig = PCIB_DEVSIG_MAKE(bus,dev,0);
    242         pcib_conf_read32(sig, PCI_VENDOR_ID, &d);
     250        pci_read_config_dword(bus, dev, fun, PCI_VENDOR_ID, &d);
    243251
    244252        if ( -1 == d ) {
     
    246254        }
    247255
    248         pcib_conf_read8(sig, PCI_HEADER_TYPE, &hd);
     256        pci_read_config_byte(bus, dev, fun, PCI_HEADER_TYPE, &hd);
    249257        nfn = (hd & 0x80) ? PCI_MAX_FUNCTIONS : 1;
    250258
    251259        for ( fun=0; fun<nfn; fun++ ) {
    252260
    253           sig = PCIB_DEVSIG_MAKE(bus,dev,fun);
    254           pcib_conf_read32(sig, PCI_VENDOR_ID, &d);
     261          pci_read_config_dword(bus, dev, fun, PCI_VENDOR_ID, &d);
    255262          if ( -1 == d )
    256263            continue;
    257264
    258           pcib_conf_read32(sig, PCI_CLASS_REVISION, &d);
     265          pci_read_config_dword(bus, dev, fun, PCI_CLASS_REVISION, &d);
    259266
    260267          if ( (d >> 16) == PCI_CLASS_BRIDGE_PCI ) {
    261             pcib_conf_read8(sig, PCI_SUBORDINATE_BUS, &hd);
     268            pci_read_config_byte(bus, dev, fun, PCI_SUBORDINATE_BUS, &hd);
    262269
    263270            if ( hd > ucBusCount )
     
    314321 * Read byte from config space
    315322 */
    316 int
     323static int
    317324pcib_conf_read8(int sig, int off, uint8_t *data)
    318325{
     
    350357 * Read word from config space
    351358 */
    352 int
     359static int
    353360pcib_conf_read16(int sig, int off, uint16_t *data)
    354361{
     
    386393 * Read dword from config space
    387394 */
    388 int
     395static int
    389396pcib_conf_read32(int sig, int off, uint32_t *data)
    390397{
     
    422429 * Write byte into  config space
    423430 */
    424 int
     431static int
    425432pcib_conf_write8(int sig, int off, uint8_t data)
    426433{
     
    452459 * Write word into config space
    453460 */
    454 int
     461static int
    455462pcib_conf_write16(int sig, int off, uint16_t data)
    456463{
     
    484491 * Write dword into config space
    485492 */
    486 int
     493static int
    487494pcib_conf_write32(int sig, int off, uint32_t data)
    488495{
  • c/src/libchip/network/if_fxp.c

    r354064b r12c9dc8f  
    7676#include <sys/systm.h>
    7777#include <bsp.h>
    78 #include <pcibios.h>
    7978#include <bsp/irq.h>
    8079#include <rtems/pci.h>
     
    352351                device_printf(sc->dev, "DMA timeout\n");
    353352}
     353
     354/*
     355 * These macros and instantiations define PCI Configuration Space accessors
     356 * which use the legacy API based on the PCI BIOS only used by pc386.
     357 * This was the only device driver using these.
     358 *
     359 * TBD: It may be worth it to fix this driver to use the current PCI API rather
     360 *      than this legacy PC386 API.
     361 */
     362#define PCIB_DEVSIG_BUS(x) (((x)>>8) &0xff)
     363#define PCIB_DEVSIG_DEV(x) (((x)>>3) & 0x1f)
     364#define PCIB_DEVSIG_FUNC(x) ((x) & 0x7)
     365#define PCIB_DEVSIG_MAKE(b,d,f) ((b<<8)|(d<<3)|(f))
     366
     367#define PCI_CONF_ACCESSOR(_confop, _baseop, _type) \
     368  /* prototype before body */ \
     369  static inline int _confop ( \
     370    int signature, \
     371    int offset, \
     372    _type data ); \
     373  \
     374  static inline int _confop ( \
     375    int signature, \
     376    int offset, \
     377    _type data ) \
     378  { \
     379    _baseop( \
     380        PCIB_DEVSIG_BUS(signature), \
     381        PCIB_DEVSIG_DEV(signature), \
     382        PCIB_DEVSIG_FUNC(signature), \
     383        offset, \
     384        data \
     385    ); \
     386   return PCIB_ERR_SUCCESS; \
     387  }
     388
     389PCI_CONF_ACCESSOR( pcib_conf_read8,   pci_read_config_byte,   uint8_t * );
     390PCI_CONF_ACCESSOR( pcib_conf_read16,  pci_read_config_word,   uint16_t * );
     391PCI_CONF_ACCESSOR( pcib_conf_read32,  pci_read_config_dword,  uint32_t * );
     392PCI_CONF_ACCESSOR( pcib_conf_write8,  pci_write_config_byte,  uint8_t );
     393PCI_CONF_ACCESSOR( pcib_conf_write16, pci_write_config_word,  uint16_t );
     394PCI_CONF_ACCESSOR( pcib_conf_write32, pci_write_config_dword, uint32_t );
    354395
    355396static __inline unsigned int pci_get_vendor(struct fxp_softc *sc) {
Note: See TracChangeset for help on using the changeset viewer.