Changeset 15d0046 in mainline for uspace/drv/platform/malta/malta.c


Ignore:
Timestamp:
2014-09-12T13:22:33Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9b20126
Parents:
8db09e4 (diff), 105d8d6 (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

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/platform/malta/malta.c

    r8db09e4 r15d0046  
    2929
    3030/**
    31  * @defgroup root_malta Malta board platform driver.
     31 * @defgroup malta Malta board platform driver.
    3232 * @brief HelenOS Malta board platform driver.
    3333 * @{
     
    5555#include <byteorder.h>
    5656
    57 #define NAME "rootmalta"
     57#define NAME "malta"
    5858
    5959#define GT_BASE         UINT32_C(0x1be00000)
     
    7272#define GT_PCI_IOSIZE   UINT32_C(0x00200000)
    7373
    74 typedef struct rootmalta_fun {
     74typedef struct malta_fun {
    7575        hw_resource_list_t hw_resources;
    7676        pio_window_t pio_window;
    77 } rootmalta_fun_t;
    78 
    79 static int rootmalta_dev_add(ddf_dev_t *dev);
    80 static void root_malta_init(void);
     77} malta_fun_t;
     78
     79static int malta_dev_add(ddf_dev_t *dev);
     80static void malta_init(void);
    8181
    8282/** The root device driver's standard operations. */
    83 static driver_ops_t rootmalta_ops = {
    84         .dev_add = &rootmalta_dev_add
     83static driver_ops_t malta_ops = {
     84        .dev_add = &malta_dev_add
    8585};
    8686
    8787/** The root device driver structure. */
    88 static driver_t rootmalta_driver = {
     88static driver_t malta_driver = {
    8989        .name = NAME,
    90         .driver_ops = &rootmalta_ops
     90        .driver_ops = &malta_ops
    9191};
    9292
     
    112112};
    113113
    114 static rootmalta_fun_t pci_data = {
     114static malta_fun_t pci_data = {
    115115        .hw_resources = {
    116116                sizeof(pci_conf_regs) / sizeof(pci_conf_regs[0]),
     
    130130
    131131/** Obtain function soft-state from DDF function node */
    132 static rootmalta_fun_t *rootmalta_fun(ddf_fun_t *fnode)
     132static malta_fun_t *malta_fun(ddf_fun_t *fnode)
    133133{
    134134        return ddf_fun_data_get(fnode);
    135135}
    136136
    137 static hw_resource_list_t *rootmalta_get_resources(ddf_fun_t *fnode)
    138 {
    139         rootmalta_fun_t *fun = rootmalta_fun(fnode);
     137static hw_resource_list_t *malta_get_resources(ddf_fun_t *fnode)
     138{
     139        malta_fun_t *fun = malta_fun(fnode);
    140140       
    141141        assert(fun != NULL);
     
    143143}
    144144
    145 static bool rootmalta_enable_interrupt(ddf_fun_t *fun)
     145static bool malta_enable_interrupt(ddf_fun_t *fun)
    146146{
    147147        /* TODO */
     
    150150}
    151151
    152 static pio_window_t *rootmalta_get_pio_window(ddf_fun_t *fnode)
    153 {
    154         rootmalta_fun_t *fun = rootmalta_fun(fnode);
     152static pio_window_t *malta_get_pio_window(ddf_fun_t *fnode)
     153{
     154        malta_fun_t *fun = malta_fun(fnode);
    155155
    156156        assert(fun != NULL);
     
    159159
    160160static hw_res_ops_t fun_hw_res_ops = {
    161         .get_resource_list = &rootmalta_get_resources,
    162         .enable_interrupt = &rootmalta_enable_interrupt,
     161        .get_resource_list = &malta_get_resources,
     162        .enable_interrupt = &malta_enable_interrupt,
    163163};
    164164
    165165static pio_window_ops_t fun_pio_window_ops = {
    166         .get_pio_window = &rootmalta_get_pio_window
    167 };
    168 
    169 /* Initialized in root_malta_init() function. */
    170 static ddf_dev_ops_t rootmalta_fun_ops;
     166        .get_pio_window = &malta_get_pio_window
     167};
     168
     169/* Initialized in malta_init() function. */
     170static ddf_dev_ops_t malta_fun_ops;
    171171
    172172static bool
    173 rootmalta_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
    174     rootmalta_fun_t *fun_proto)
     173malta_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
     174    malta_fun_t *fun_proto)
    175175{
    176176        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
     
    184184                goto failure;
    185185       
    186         rootmalta_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootmalta_fun_t));
     186        malta_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(malta_fun_t));
    187187        *fun = *fun_proto;
    188188       
     
    193193       
    194194        /* Set provided operations to the device. */
    195         ddf_fun_set_ops(fnode, &rootmalta_fun_ops);
     195        ddf_fun_set_ops(fnode, &malta_fun_ops);
    196196       
    197197        /* Register function. */
     
    212212}
    213213
    214 static bool rootmalta_add_functions(ddf_dev_t *dev)
    215 {
    216         return rootmalta_add_fun(dev, "pci0", "intel_pci", &pci_data);
     214static bool malta_add_functions(ddf_dev_t *dev)
     215{
     216        return malta_add_fun(dev, "pci0", "intel_pci", &pci_data);
    217217}
    218218
     
    223223 * @return              Zero on success, negative error number otherwise.
    224224 */
    225 static int rootmalta_dev_add(ddf_dev_t *dev)
     225static int malta_dev_add(ddf_dev_t *dev)
    226226{
    227227        ioport32_t *gt;
     
    229229        int ret;
    230230
    231         ddf_msg(LVL_DEBUG, "rootmalta_dev_add, device handle = %d",
     231        ddf_msg(LVL_DEBUG, "malta_dev_add, device handle = %d",
    232232            (int)ddf_dev_get_handle(dev));
    233233
     
    248248       
    249249        /* Register functions. */
    250         if (!rootmalta_add_functions(dev)) {
     250        if (!malta_add_functions(dev)) {
    251251                ddf_msg(LVL_ERROR, "Failed to add functions for the Malta platform.");
    252252        }
     
    255255}
    256256
    257 static void root_malta_init(void)
     257static void malta_init(void)
    258258{
    259259        ddf_log_init(NAME);
    260         rootmalta_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
    261         rootmalta_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
     260        malta_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
     261        malta_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
    262262}
    263263
     
    265265{
    266266        printf(NAME ": HelenOS Malta platform driver\n");
    267         root_malta_init();
    268         return ddf_driver_main(&rootmalta_driver);
     267        malta_init();
     268        return ddf_driver_main(&malta_driver);
    269269}
    270270
Note: See TracChangeset for help on using the changeset viewer.