Changeset 713a4b9 in mainline for uspace/drv/pciintel/pci.h


Ignore:
Timestamp:
2010-10-23T17:39:53Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8304889
Parents:
791f58c
Message:

Convert inline functions to regular functions in pciintel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/pciintel/pci.h

    r791f58c r713a4b9  
    6969extern void pci_bus_scan(device_t *, int);
    7070
    71 static inline pci_dev_data_t *create_pci_dev_data(void)
    72 {
    73         pci_dev_data_t *res = (pci_dev_data_t *) malloc(sizeof(pci_dev_data_t));
    74        
    75         if (NULL != res)
    76                 memset(res, 0, sizeof(pci_dev_data_t));
    77         return res;
    78 }
     71extern pci_dev_data_t *create_pci_dev_data(void);
     72extern void init_pci_dev_data(pci_dev_data_t *, int, int, int);
     73extern void delete_pci_dev_data(pci_dev_data_t *);
     74extern void create_pci_dev_name(device_t *);
    7975
    80 static inline void
    81 init_pci_dev_data(pci_dev_data_t *d, int bus, int dev, int fn)
    82 {
    83         d->bus = bus;
    84         d->dev = dev;
    85         d->fn = fn;
    86 }
     76extern bool pci_alloc_resource_list(device_t *);
     77extern void pci_clean_resource_list(device_t *);
    8778
    88 static inline void delete_pci_dev_data(pci_dev_data_t *d)
    89 {
    90         if (NULL != d) {
    91                 clean_hw_resource_list(&d->hw_resources);
    92                 free(d);
    93         }
    94 }
    95 
    96 static inline void create_pci_dev_name(device_t *dev)
    97 {
    98         pci_dev_data_t *dev_data = (pci_dev_data_t *) dev->driver_data;
    99         char *name = NULL;
    100        
    101         asprintf(&name, "%02x:%02x.%01x", dev_data->bus, dev_data->dev,
    102             dev_data->fn);
    103         dev->name = name;
    104 }
    105 
    106 static inline bool pci_alloc_resource_list(device_t *dev)
    107 {
    108         pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
    109        
    110         dev_data->hw_resources.resources =
    111             (hw_resource_t *) malloc(PCI_MAX_HW_RES * sizeof(hw_resource_t));
    112         return dev_data->hw_resources.resources != NULL;
    113 }
    114 
    115 static inline void pci_clean_resource_list(device_t *dev)
    116 {
    117         pci_dev_data_t *dev_data = (pci_dev_data_t *) dev->driver_data;
    118        
    119         if (NULL != dev_data->hw_resources.resources) {
    120                 free(dev_data->hw_resources.resources);
    121                 dev_data->hw_resources.resources = NULL;
    122         }
    123 }
    124 
    125 /** Read the base address registers (BARs) of the device and adds the addresses
    126  * to its hw resource list.
    127  *
    128  * @param dev the pci device.
    129  */
    130 static inline  void pci_read_bars(device_t *dev)
    131 {
    132         /*
    133          * Position of the BAR in the PCI configuration address space of the
    134          * device.
    135          */
    136         int addr = PCI_BASE_ADDR_0;
    137        
    138         while (addr <= PCI_BASE_ADDR_5)
    139                 addr = pci_read_bar(dev, addr);
    140 }
    141 
    142 static inline size_t pci_bar_mask_to_size(uint32_t mask)
    143 {
    144         return ((mask & 0xfffffff0) ^ 0xffffffff) + 1;
    145 }
     79extern void pci_read_bars(device_t *);
     80extern size_t pci_bar_mask_to_size(uint32_t);
    14681
    14782#endif
Note: See TracChangeset for help on using the changeset viewer.