Changeset f9fbb333 in rtems


Ignore:
Timestamp:
Aug 30, 2017, 9:01:38 AM (22 months ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
master
Children:
2e1d595
Parents:
0b134aca
git-author:
Daniel Hellstrom <daniel@…> (08/30/17 09:01:38)
git-committer:
Daniel Hellstrom <daniel@…> (09/29/17 11:36:44)
Message:

libpci: fix pci device allocation

The refactoring of pci_dev_create() was incorrect since the code relied on
different defines before including pci/cfg.h. This reverts back to the
original code having two pci_dev_create() one in auto and one in read library.
confdefs.h selectes between the two libraries so both there is no link
conflict.

Updates #3029

Location:
cpukit/libpci
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libpci/Makefile.am

    r0b134aca rf9fbb333  
    2929libpci_a_SOURCES += pci_cfg_static.c
    3030libpci_a_SOURCES += pci_cfg_peripheral.c
    31 libpci_a_SOURCES += pci_dev_create.c
    3231libpci_a_SOURCES += pci_find.c
    3332libpci_a_SOURCES += pci_find_dev.c
  • cpukit/libpci/pci_cfg_auto.c

    r0b134aca rf9fbb333  
    267267}
    268268#endif
     269
     270static struct pci_dev *pci_dev_create(int isbus)
     271{
     272        void *ptr;
     273        int size;
     274
     275        if (isbus)
     276                size = sizeof(struct pci_bus);
     277        else
     278                size = sizeof(struct pci_dev);
     279
     280        ptr = calloc(1, size);
     281        if (!ptr)
     282                rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
     283        return ptr;
     284}
    269285
    270286static void pci_find_devs(struct pci_bus *bus)
  • cpukit/libpci/pci_cfg_read.c

    r0b134aca rf9fbb333  
    3636/* The Host Bridge bus is initialized here */
    3737extern struct pci_bus pci_hb;
     38
     39static struct pci_dev *pci_dev_create(int isbus)
     40{
     41        void *ptr;
     42        int size;
     43
     44        if (isbus)
     45                size = sizeof(struct pci_bus);
     46        else
     47                size = sizeof(struct pci_dev);
     48
     49        ptr = calloc(1, size);
     50        if (!ptr)
     51                rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
     52        return ptr;
     53}
    3854
    3955/* Check if address is accessible from host */
  • cpukit/libpci/pci_internal.h

    r0b134aca rf9fbb333  
    1010/* Number of buses */
    1111extern int pci_bus_cnt;
    12 
    13 /* Allocate a PCI device for a standard device or a bridge device */
    14 struct pci_dev *pci_dev_create(int isbus);
Note: See TracChangeset for help on using the changeset viewer.