Changeset 96e01fbc in mainline for uspace/drv/infrastructure


Ignore:
Timestamp:
2012-08-31T17:30:29Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2be2506a
Parents:
e0d5bc5 (diff), 0d57c3e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
uspace/drv/infrastructure
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/infrastructure/root/root.c

    re0d5bc5 r96e01fbc  
    204204{
    205205        ddf_msg(LVL_DEBUG, "root_dev_add, device handle=%" PRIun,
    206             dev->handle);
     206            ddf_dev_get_handle(dev));
    207207
    208208        /*
  • uspace/drv/infrastructure/rootmac/rootmac.c

    re0d5bc5 r96e01fbc  
    4444#define NAME  "rootmac"
    4545
    46 /** Obtain function soft-state from DDF function node */
    47 #define ROOTMAC_FUN(fnode) \
    48         ((rootmac_fun_t *) (fnode)->driver_data)
    49 
    5046typedef struct {
    5147        hw_resource_list_t hw_resources;
    5248} rootmac_fun_t;
    5349
    54 static hw_resource_t pci_conf_regs = {
    55         .type = IO_RANGE,
    56         .res.io_range = {
    57                 .address = 0xCF8,
    58                 .size = 8,
    59                 .endianness = LITTLE_ENDIAN
     50static hw_resource_t pci_conf_regs[] = {
     51        {
     52                .type = IO_RANGE,
     53                .res.io_range = {
     54                        .address = 0xfec00000,
     55                        .size = 4,
     56                        .endianness = LITTLE_ENDIAN
     57                }
     58        },
     59        {
     60                .type = IO_RANGE,
     61                .res.io_range = {
     62                        .address = 0xfee00000,
     63                        .size = 4,
     64                        .endianness = LITTLE_ENDIAN
     65                }
    6066        }
    6167};
     
    6369static rootmac_fun_t pci_data = {
    6470        .hw_resources = {
    65                 1,
    66                 &pci_conf_regs
     71                2,
     72                pci_conf_regs
    6773        }
    6874};
     
    7076static ddf_dev_ops_t rootmac_fun_ops;
    7177
     78/** Obtain function soft-state from DDF function node */
     79static rootmac_fun_t *rootmac_fun(ddf_fun_t *fnode)
     80{
     81        return ddf_fun_data_get(fnode);
     82}
     83
    7284static bool rootmac_add_fun(ddf_dev_t *dev, const char *name,
    73     const char *str_match_id, rootmac_fun_t *fun)
     85    const char *str_match_id, rootmac_fun_t *fun_proto)
    7486{
    7587        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
    7688       
    7789        ddf_fun_t *fnode = NULL;
    78         match_id_t *match_id = NULL;
     90        int rc;
    7991       
    8092        /* Create new device. */
     
    8395                goto failure;
    8496       
    85         fnode->driver_data = fun;
     97        rootmac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootmac_fun_t));
     98        *fun = *fun_proto;
    8699       
    87         /* Initialize match id list */
    88         match_id = create_match_id();
    89         if (match_id == NULL)
     100        /* Add match ID */
     101        rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
     102        if (rc != EOK)
    90103                goto failure;
    91104       
    92         match_id->id = str_match_id;
    93         match_id->score = 100;
    94         add_match_id(&fnode->match_ids, match_id);
    95        
    96105        /* Set provided operations to the device. */
    97         fnode->ops = &rootmac_fun_ops;
     106        ddf_fun_set_ops(fnode, &rootmac_fun_ops);
    98107       
    99108        /* Register function. */
     
    106115       
    107116failure:
    108         if (match_id != NULL)
    109                 match_id->id = NULL;
    110        
    111117        if (fnode != NULL)
    112118                ddf_fun_destroy(fnode);
     
    127133static int rootmac_dev_add(ddf_dev_t *dev)
    128134{
     135#if 0
    129136        /* Register functions */
    130         if (!rootmac_add_fun(dev, "pci0", "pangea_pci", &pci_data))
     137        if (!rootmac_add_fun(dev, "pci0", "intel_pci", &pci_data))
    131138                ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform.");
     139#else
     140        (void)pci_data;
     141        (void)rootmac_add_fun;
     142#endif
    132143       
    133144        return EOK;
     
    147158static hw_resource_list_t *rootmac_get_resources(ddf_fun_t *fnode)
    148159{
    149         rootmac_fun_t *fun = ROOTMAC_FUN(fnode);
     160        rootmac_fun_t *fun = rootmac_fun(fnode);
    150161        assert(fun != NULL);
    151162       
  • uspace/drv/infrastructure/rootpc/rootpc.c

    re0d5bc5 r96e01fbc  
    5454#define NAME "rootpc"
    5555
    56 /** Obtain function soft-state from DDF function node */
    57 #define ROOTPC_FUN(fnode) ((rootpc_fun_t *) (fnode)->driver_data)
    58 
    5956typedef struct rootpc_fun {
    6057        hw_resource_list_t hw_resources;
     
    7572};
    7673
    77 static hw_resource_t pci_conf_regs = {
    78         .type = IO_RANGE,
    79         .res.io_range = {
    80                 .address = 0xCF8,
    81                 .size = 8,
    82                 .endianness = LITTLE_ENDIAN
     74static hw_resource_t pci_conf_regs[] = {
     75        {
     76                .type = IO_RANGE,
     77                .res.io_range = {
     78                        .address = 0xCF8,
     79                        .size = 4,
     80                        .endianness = LITTLE_ENDIAN
     81                }
     82        },
     83        {
     84                .type = IO_RANGE,
     85                .res.io_range = {
     86                        .address = 0xCFC,
     87                        .size = 4,
     88                        .endianness = LITTLE_ENDIAN
     89                }
    8390        }
    8491};
     
    8693static rootpc_fun_t pci_data = {
    8794        .hw_resources = {
    88                 1,
    89                 &pci_conf_regs
    90         }
    91 };
     95                sizeof(pci_conf_regs)/sizeof(pci_conf_regs[0]),
     96                pci_conf_regs
     97        }
     98};
     99
     100/** Obtain function soft-state from DDF function node */
     101static rootpc_fun_t *rootpc_fun(ddf_fun_t *fnode)
     102{
     103        return ddf_fun_data_get(fnode);
     104}
    92105
    93106static hw_resource_list_t *rootpc_get_resources(ddf_fun_t *fnode)
    94107{
    95         rootpc_fun_t *fun = ROOTPC_FUN(fnode);
     108        rootpc_fun_t *fun = rootpc_fun(fnode);
    96109       
    97110        assert(fun != NULL);
     
    116129static bool
    117130rootpc_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
    118     rootpc_fun_t *fun)
     131    rootpc_fun_t *fun_proto)
    119132{
    120133        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
    121134       
    122135        ddf_fun_t *fnode = NULL;
    123         match_id_t *match_id = NULL;
     136        int rc;
    124137       
    125138        /* Create new device. */
     
    128141                goto failure;
    129142       
    130         fnode->driver_data = fun;
    131        
    132         /* Initialize match id list */
    133         match_id = create_match_id();
    134         if (match_id == NULL)
     143        rootpc_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootpc_fun_t));
     144        *fun = *fun_proto;
     145       
     146        /* Add match ID */
     147        rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
     148        if (rc != EOK)
    135149                goto failure;
    136150       
    137         match_id->id = str_match_id;
    138         match_id->score = 100;
    139         add_match_id(&fnode->match_ids, match_id);
    140        
    141151        /* Set provided operations to the device. */
    142         fnode->ops = &rootpc_fun_ops;
     152        ddf_fun_set_ops(fnode, &rootpc_fun_ops);
    143153       
    144154        /* Register function. */
     
    151161       
    152162failure:
    153         if (match_id != NULL)
    154                 match_id->id = NULL;
    155        
    156163        if (fnode != NULL)
    157164                ddf_fun_destroy(fnode);
     
    176183{
    177184        ddf_msg(LVL_DEBUG, "rootpc_dev_add, device handle = %d",
    178             (int)dev->handle);
     185            (int)ddf_dev_get_handle(dev));
    179186       
    180187        /* Register functions. */
  • uspace/drv/infrastructure/rootvirt/devices.def

    re0d5bc5 r96e01fbc  
    44 * Unless the list is empty, the last item shall be followed by a comma.
    55 */
     6
     7/* Kernel framebuffer */
     8{
     9    .name = "kfb",
     10    .match_id = "virtual&kfb"
     11},
    612
    713#ifdef CONFIG_TEST_DRIVERS
  • uspace/drv/infrastructure/rootvirt/rootvirt.c

    re0d5bc5 r96e01fbc  
    151151{
    152152        int rc;
    153         const char *name = rvfun->fun->name;
     153        const char *name = ddf_fun_get_name(rvfun->fun);
    154154
    155155        ddf_msg(LVL_DEBUG, "rootvirt_fun_remove('%s')", name);
     
    183183        }
    184184
    185         ddf_msg(LVL_DEBUG, "dev_add(handle=%d)", (int)dev->handle);
     185        ddf_msg(LVL_DEBUG, "dev_add(handle=%d)", (int)ddf_dev_get_handle(dev));
    186186
    187187        rootvirt = ddf_dev_data_alloc(dev, sizeof(rootvirt_t));
     
    207207static int rootvirt_dev_remove(ddf_dev_t *dev)
    208208{
    209         rootvirt_t *rootvirt = (rootvirt_t *)dev->driver_data;
     209        rootvirt_t *rootvirt = (rootvirt_t *)ddf_dev_data_get(dev);
    210210        int rc;
    211211
Note: See TracChangeset for help on using the changeset viewer.