Changeset f4bf22c in rtems


Ignore:
Timestamp:
Apr 8, 2015, 8:51:45 AM (4 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
4.11, master
Children:
1b645c3
Parents:
1f4f1e2e
git-author:
Daniel Hellstrom <daniel@…> (04/08/15 08:51:45)
git-committer:
Daniel Hellstrom <daniel@…> (04/16/15 23:10:28)
Message:

LIBPCI: new implementation private header file

  • new implementation private header file
  • moved double implementation of pci_dev_create used by read & auto cfg libraries to common pci_dev_create.c
  • moved declaration of pci_bus_cnt to private header file so avoid extern in .c files
Location:
cpukit/libpci
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libpci/Makefile.am

    r1f4f1e2e rf4bf22c  
    2929libpci_a_SOURCES += pci_cfg_static.c
    3030libpci_a_SOURCES += pci_cfg_peripheral.c
     31libpci_a_SOURCES += pci_dev_create.c
    3132libpci_a_SOURCES += pci_find.c
    3233libpci_a_SOURCES += pci_find_dev.c
  • cpukit/libpci/pci_cfg_auto.c

    r1f4f1e2e rf4bf22c  
    1919#include <pci/access.h>
    2020#include <pci/cfg.h>
     21
     22#include "pci_internal.h"
    2123
    2224/* #define DEBUG */
     
    3840#define PCI_CFG_W16(dev, args...) pci_cfg_w16(dev, args)
    3941#define PCI_CFG_W32(dev, args...) pci_cfg_w32(dev, args)
    40 
    41 /* Number of PCI buses */
    42 extern int pci_bus_cnt;
    4342
    4443int pci_config_auto_initialized = 0;
     
    268267}
    269268#endif
    270 
    271 static struct pci_dev *pci_dev_create(int isbus)
    272 {
    273         void *ptr;
    274         int size;
    275 
    276         if (isbus)
    277                 size = sizeof(struct pci_bus);
    278         else
    279                 size = sizeof(struct pci_dev);
    280 
    281         ptr = malloc(size);
    282         if (!ptr)
    283                 rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
    284         memset(ptr, 0, size);
    285         return ptr;
    286 }
    287269
    288270static void pci_find_devs(struct pci_bus *bus)
  • cpukit/libpci/pci_cfg_peripheral.c

    r1f4f1e2e rf4bf22c  
    1919#include <pci/cfg.h>
    2020
    21 /* Number of buses */
    22 extern int pci_bus_cnt;
     21#include "pci_internal.h"
    2322
    2423/* Assume that user has defined static setup array in pci_hb */
  • cpukit/libpci/pci_cfg_read.c

    r1f4f1e2e rf4bf22c  
    1414#include <pci/cfg.h>
    1515#include <pci/access.h>
     16
     17#include "pci_internal.h"
    1618
    1719/* PCI Library
     
    3234#endif
    3335
    34 /* Number of buses */
    35 extern int pci_bus_cnt;
    36 
    3736/* The Host Bridge bus is initialized here */
    3837extern struct pci_bus pci_hb;
    39 
    40 static struct pci_dev *pci_dev_create(int isbus)
    41 {
    42         void *ptr;
    43         int size;
    44 
    45         if (isbus)
    46                 size = sizeof(struct pci_bus);
    47         else
    48                 size = sizeof(struct pci_dev);
    49 
    50         ptr = malloc(size);
    51         if (!ptr)
    52                 rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
    53         memset(ptr, 0, size);
    54         return ptr;
    55 }
    5638
    5739/* Check if address is accessible from host */
  • cpukit/libpci/pci_cfg_static.c

    r1f4f1e2e rf4bf22c  
    2121#include <pci/cfg.h>
    2222
     23#include "pci_internal.h"
     24
    2325#define PCI_CFG_R8(dev, args...) pci_cfg_r8(dev, args)
    2426#define PCI_CFG_R16(dev, args...) pci_cfg_r16(dev, args)
     
    2729#define PCI_CFG_W16(dev, args...) pci_cfg_w16(dev, args)
    2830#define PCI_CFG_W32(dev, args...) pci_cfg_w32(dev, args)
    29 
    30 /* Number of buses */
    31 extern int pci_bus_cnt;
    3231
    3332/* Enumrate one bus if device is a bridge, and all it's subordinate buses */
Note: See TracChangeset for help on using the changeset viewer.