Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 2a37b9f in mainline


Ignore:
Timestamp:
2014-08-28T19:54:48Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
0f2a9be
Parents:
0ddb84b
Message:

Reorganize platform drivers.

Files:
1 added
1 deleted
8 edited
34 moved

Legend:

Unmodified
Added
Removed
  • .bzrignore

    r0ddb84b r2a37b9f  
    133133uspace/dist/drv/root/
    134134uspace/dist/drv/rootpc/
    135 uspace/dist/drv/rootvirt/
     135uspace/dist/drv/virt/
    136136uspace/dist/drv/rtl8139/
    137137uspace/dist/drv/rtl8169/
     
    200200uspace/drv/char/xtkbd/xtkbd
    201201uspace/drv/fb/kfb/kfb
    202 uspace/drv/infrastructure/root/root
    203 uspace/drv/infrastructure/rootpc/rootpc
    204 uspace/drv/infrastructure/rootvirt/rootvirt
     202uspace/drv/root/root/root
     203uspace/drv/root/virt/virt
     204uspace/drv/platform/rootpc/rootpc
    205205uspace/drv/nic/e1k/e1k
    206206uspace/drv/nic/ne2k/ne2k
  • boot/Makefile.common

    r0ddb84b r2a37b9f  
    127127
    128128RD_DRVS_ESSENTIAL = \
    129         infrastructure/root \
    130         infrastructure/rootvirt \
     129        root/root \
     130        root/virt \
    131131        fb/kfb
    132132
  • boot/arch/amd64/Makefile.inc

    r0ddb84b r2a37b9f  
    3535
    3636RD_DRVS_ESSENTIAL += \
    37         infrastructure/rootpc \
     37        platform/pc \
    3838        block/ata_bd \
    3939        bus/pci/pciintel \
  • boot/arch/arm32/Makefile.inc

    r0ddb84b r2a37b9f  
    6666
    6767RD_DRVS_ESSENTIAL += \
    68         infrastructure/rootamdm37x \
     68        platform/amdm37x \
    6969        fb/amdm37x_dispc \
    7070        bus/usb/ehci \
  • boot/arch/ia64/Makefile.inc

    r0ddb84b r2a37b9f  
    6666
    6767RD_DRVS_ESSENTIAL += \
    68         infrastructure/rootpc \
     68        platform/pc \
    6969        bus/pci/pciintel \
    7070        bus/isa \
  • boot/arch/mips32/Makefile.inc

    r0ddb84b r2a37b9f  
    5252ifeq ($(MACHINE), $(filter $(MACHINE),bmalta lmalta))
    5353        RD_DRVS_ESSENTIAL += \
    54                 infrastructure/rootmalta \
     54                platform/malta \
    5555                block/ata_bd \
    5656                bus/pci/pciintel \
  • boot/arch/ppc32/Makefile.inc

    r0ddb84b r2a37b9f  
    4343
    4444RD_DRVS_ESSENTIAL += \
    45         infrastructure/rootmac \
     45        platform/mac \
    4646        bus/pci/pciintel \
    4747        bus/usb/ohci \
  • uspace/Makefile

    r0ddb84b r2a37b9f  
    131131        srv/hid/rfb \
    132132        drv/audio/sb16 \
    133         drv/infrastructure/root \
    134         drv/infrastructure/rootvirt \
     133        drv/root/root \
     134        drv/root/virt \
    135135        drv/block/ahci \
    136136        drv/block/ata_bd \
     
    162162ifeq ($(UARCH), $(filter $(UARCH),amd64 ia32 ia64))
    163163        DIRS += \
    164                 drv/infrastructure/rootpc \
     164                drv/platform/pc \
    165165                drv/bus/pci/pciintel \
    166166                drv/bus/isa \
     
    173173ifeq ($(UARCH), $(filter $(UARCH),mips32 mips32eb))
    174174        DIRS += \
    175                 drv/infrastructure/rootmalta \
     175                drv/platform/malta \
    176176                drv/bus/pci/pciintel \
    177177                drv/bus/isa
     
    180180ifeq ($(UARCH),ppc32)
    181181        DIRS += \
    182                 drv/infrastructure/rootmac \
     182                drv/platform/mac \
    183183                drv/bus/pci/pciintel \
    184184                srv/hw/bus/cuda_adb
     
    192192ifeq ($(UARCH),arm32)
    193193        DIRS += \
    194                 drv/infrastructure/rootamdm37x \
     194                drv/platform/amdm37x \
    195195                drv/fb/amdm37x_dispc
    196196endif
  • uspace/drv/platform/amdm37x/Makefile

    r0ddb84b r2a37b9f  
    3030LIBS = $(LIBDRV_PREFIX)/libdrv.a
    3131EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
    32 BINARY = rootamdm37x
     32BINARY = amdm37x
    3333
    3434SOURCES = \
    3535        amdm37x.c \
    36         rootamdm37x.c
     36        main.c
    3737
    3838include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/platform/amdm37x/main.c

    r0ddb84b r2a37b9f  
    4545#include "amdm37x.h"
    4646
    47 #define NAME  "rootamdm37x"
     47#define NAME  "amdm37x"
    4848
    4949typedef struct {
     
    5151        match_id_t match_id;
    5252        hw_resource_list_t hw_resources;
    53 } rootamdm37x_fun_t;
     53} amdm37x_fun_t;
    5454
    5555/* See amdm37x TRM page 3316 for these values */
     
    130130};
    131131
    132 static const rootamdm37x_fun_t amdm37x_funcs[] = {
     132static const amdm37x_fun_t amdm37x_funcs[] = {
    133133{
    134134        .name = "ohci",
     
    149149
    150150
    151 static hw_resource_list_t *rootamdm37x_get_resources(ddf_fun_t *fnode);
    152 static bool rootamdm37x_enable_interrupt(ddf_fun_t *fun);
     151static hw_resource_list_t *amdm37x_get_resources(ddf_fun_t *fnode);
     152static bool amdm37x_enable_interrupt(ddf_fun_t *fun);
    153153
    154154static hw_res_ops_t fun_hw_res_ops = {
    155         .get_resource_list = &rootamdm37x_get_resources,
    156         .enable_interrupt = &rootamdm37x_enable_interrupt,
    157 };
    158 
    159 static ddf_dev_ops_t rootamdm37x_fun_ops = {
     155        .get_resource_list = &amdm37x_get_resources,
     156        .enable_interrupt = &amdm37x_enable_interrupt,
     157};
     158
     159static ddf_dev_ops_t amdm37x_fun_ops = {
    160160        .interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops
    161161};
    162162
    163 static int rootamdm37x_add_fun(ddf_dev_t *dev, const rootamdm37x_fun_t *fun)
     163static int amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun)
    164164{
    165165        assert(dev);
     
    182182       
    183183        /* Alloc needed data */
    184         rootamdm37x_fun_t *rf =
    185             ddf_fun_data_alloc(fnode, sizeof(rootamdm37x_fun_t));
     184        amdm37x_fun_t *rf =
     185            ddf_fun_data_alloc(fnode, sizeof(amdm37x_fun_t));
    186186        if (!rf) {
    187187                ddf_fun_destroy(fnode);
     
    191191
    192192        /* Set provided operations to the device. */
    193         ddf_fun_set_ops(fnode, &rootamdm37x_fun_ops);
     193        ddf_fun_set_ops(fnode, &amdm37x_fun_ops);
    194194       
    195195        /* Register function. */
     
    212212 *
    213213 */
    214 static int rootamdm37x_dev_add(ddf_dev_t *dev)
     214static int amdm37x_dev_add(ddf_dev_t *dev)
    215215{
    216216        assert(dev);
     
    240240        /* Register functions */
    241241        for (unsigned i = 0; i < ARRAY_SIZE(amdm37x_funcs); ++i) {
    242                 if (rootamdm37x_add_fun(dev, &amdm37x_funcs[i]) != EOK)
     242                if (amdm37x_add_fun(dev, &amdm37x_funcs[i]) != EOK)
    243243                        ddf_msg(LVL_ERROR, "Failed to add %s function for "
    244244                            "BeagleBoard-xM platform.", amdm37x_funcs[i].name);
     
    248248
    249249/** The root device driver's standard operations. */
    250 static driver_ops_t rootamdm37x_ops = {
    251         .dev_add = &rootamdm37x_dev_add
     250static driver_ops_t amdm37x_ops = {
     251        .dev_add = &amdm37x_dev_add
    252252};
    253253
    254254/** The root device driver structure. */
    255 static driver_t rootamdm37x_driver = {
     255static driver_t amdm37x_driver = {
    256256        .name = NAME,
    257         .driver_ops = &rootamdm37x_ops
    258 };
    259 
    260 static hw_resource_list_t * rootamdm37x_get_resources(ddf_fun_t *fnode)
    261 {
    262         rootamdm37x_fun_t *fun = ddf_fun_data_get(fnode);
     257        .driver_ops = &amdm37x_ops
     258};
     259
     260static hw_resource_list_t * amdm37x_get_resources(ddf_fun_t *fnode)
     261{
     262        amdm37x_fun_t *fun = ddf_fun_data_get(fnode);
    263263        assert(fun != NULL);
    264264        return &fun->hw_resources;
    265265}
    266266
    267 static bool rootamdm37x_enable_interrupt(ddf_fun_t *fun)
     267static bool amdm37x_enable_interrupt(ddf_fun_t *fun)
    268268{
    269269        //TODO: Implement
     
    275275        printf("%s: HelenOS AM/DM37x(OMAP37x) platform driver\n", NAME);
    276276        ddf_log_init(NAME);
    277         return ddf_driver_main(&rootamdm37x_driver);
     277        return ddf_driver_main(&amdm37x_driver);
    278278}
    279279
  • uspace/drv/platform/leon3/Makefile

    r0ddb84b r2a37b9f  
    3030LIBS = $(LIBDRV_PREFIX)/libdrv.a
    3131EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
    32 BINARY = rootleon3
     32BINARY = leon3
    3333
    3434SOURCES = \
    35         rootleon3.c
     35        leon3.c
    3636
    3737include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/platform/leon3/leon3.c

    r0ddb84b r2a37b9f  
    4040#include <ops/hw_res.h>
    4141#include <stdio.h>
    42 #include "rootleon3.h"
     42#include "leon3.h"
    4343
    44 #define NAME  "rootleon3"
     44#define NAME  "leon3"
    4545
    4646typedef struct {
     
    4848        match_id_t match_id;
    4949        hw_resource_list_t hw_resources;
    50 } rootleon3_fun_t;
     50} leon3_fun_t;
    5151
    5252static hw_resource_t amba_res[] = {
     
    6969};
    7070
    71 static const rootleon3_fun_t leon3_func = {
     71static const leon3_fun_t leon3_func = {
    7272        .name = "leon_amba",
    7373        .match_id = {
     
    8181};
    8282
    83 static hw_resource_list_t *rootleon3_get_resources(ddf_fun_t *);
    84 static bool rootleon3_enable_interrupt(ddf_fun_t *);
     83static hw_resource_list_t *leon3_get_resources(ddf_fun_t *);
     84static bool leon3_enable_interrupt(ddf_fun_t *);
    8585
    8686static hw_res_ops_t fun_hw_res_ops = {
    87         .get_resource_list = &rootleon3_get_resources,
    88         .enable_interrupt = &rootleon3_enable_interrupt
     87        .get_resource_list = &leon3_get_resources,
     88        .enable_interrupt = &leon3_enable_interrupt
    8989};
    9090
    91 static ddf_dev_ops_t rootleon3_fun_ops = {
     91static ddf_dev_ops_t leon3_fun_ops = {
    9292        .interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops
    9393};
    9494
    95 static int rootleon3_add_fun(ddf_dev_t *dev, const rootleon3_fun_t *fun)
     95static int leon3_add_fun(ddf_dev_t *dev, const leon3_fun_t *fun)
    9696{
    9797        assert(dev);
     
    114114       
    115115        /* Allocate needed data */
    116         rootleon3_fun_t *rf =
    117             ddf_fun_data_alloc(fnode, sizeof(rootleon3_fun_t));
     116        leon3_fun_t *rf =
     117            ddf_fun_data_alloc(fnode, sizeof(leon3_fun_t));
    118118        if (!rf) {
    119119                ddf_fun_destroy(fnode);
     
    123123       
    124124        /* Set provided operations to the device. */
    125         ddf_fun_set_ops(fnode, &rootleon3_fun_ops);
     125        ddf_fun_set_ops(fnode, &leon3_fun_ops);
    126126       
    127127        /* Register function. */
     
    144144 *
    145145 */
    146 static int rootleon3_dev_add(ddf_dev_t *dev)
     146static int leon3_dev_add(ddf_dev_t *dev)
    147147{
    148148        assert(dev);
    149149       
    150150        /* Register functions */
    151         if (rootleon3_add_fun(dev, &leon3_func) != EOK) {
     151        if (leon3_add_fun(dev, &leon3_func) != EOK) {
    152152                ddf_msg(LVL_ERROR, "Failed to add %s function for "
    153153                    "LEON3 platform.", leon3_func.name);
     
    158158
    159159/** The root device driver's standard operations. */
    160 static driver_ops_t rootleon3_ops = {
    161         .dev_add = &rootleon3_dev_add
     160static driver_ops_t leon3_ops = {
     161        .dev_add = &leon3_dev_add
    162162};
    163163
    164164/** The root device driver structure. */
    165 static driver_t rootleon3_driver = {
     165static driver_t leon3_driver = {
    166166        .name = NAME,
    167         .driver_ops = &rootleon3_ops
     167        .driver_ops = &leon3_ops
    168168};
    169169
    170 static hw_resource_list_t *rootleon3_get_resources(ddf_fun_t *fnode)
     170static hw_resource_list_t *leon3_get_resources(ddf_fun_t *fnode)
    171171{
    172         rootleon3_fun_t *fun = ddf_fun_data_get(fnode);
     172        leon3_fun_t *fun = ddf_fun_data_get(fnode);
    173173        assert(fun != NULL);
    174174       
    175         printf("rootleon3_get_resources() called\n");
     175        printf("leon3_get_resources() called\n");
    176176       
    177177        return &fun->hw_resources;
    178178}
    179179
    180 static bool rootleon3_enable_interrupt(ddf_fun_t *fun)
     180static bool leon3_enable_interrupt(ddf_fun_t *fun)
    181181{
    182182        // FIXME TODO
     
    188188        printf("%s: HelenOS SPARC LEON3 platform driver\n", NAME);
    189189        ddf_log_init(NAME);
    190         return ddf_driver_main(&rootleon3_driver);
     190        return ddf_driver_main(&leon3_driver);
    191191}
    192192
  • uspace/drv/platform/leon3/leon3.h

    r0ddb84b r2a37b9f  
    3434 */
    3535
    36 #ifndef ROOTLEON3_H
    37 #define ROOTLEON3_H
     36#ifndef LEON3_H
     37#define LEON3_H
    3838
    3939#define AMBAPP_MASTER_AREA  0xfffff000
  • uspace/drv/platform/mac/Makefile

    r0ddb84b r2a37b9f  
    3030LIBS = $(LIBDRV_PREFIX)/libdrv.a
    3131EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
    32 BINARY = rootpc
     32BINARY = mac
    3333
    3434SOURCES = \
    35         rootpc.c
     35        mac.c
    3636
    3737include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/platform/mac/mac.c

    r0ddb84b r2a37b9f  
    4242#include <stdio.h>
    4343
    44 #define NAME  "rootmac"
     44#define NAME  "mac"
    4545
    4646typedef struct {
    4747        hw_resource_list_t hw_resources;
    48 } rootmac_fun_t;
     48} mac_fun_t;
    4949
    5050static hw_resource_t pci_conf_regs[] = {
     
    6969};
    7070
    71 static rootmac_fun_t pci_data = {
     71static mac_fun_t pci_data = {
    7272        .hw_resources = {
    7373                2,
     
    7676};
    7777
    78 static ddf_dev_ops_t rootmac_fun_ops;
     78static ddf_dev_ops_t mac_fun_ops;
    7979
    8080/** Obtain function soft-state from DDF function node */
    81 static rootmac_fun_t *rootmac_fun(ddf_fun_t *fnode)
     81static mac_fun_t *mac_fun(ddf_fun_t *fnode)
    8282{
    8383        return ddf_fun_data_get(fnode);
    8484}
    8585
    86 static bool rootmac_add_fun(ddf_dev_t *dev, const char *name,
    87     const char *str_match_id, rootmac_fun_t *fun_proto)
     86static bool mac_add_fun(ddf_dev_t *dev, const char *name,
     87    const char *str_match_id, mac_fun_t *fun_proto)
    8888{
    8989        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
     
    9797                goto failure;
    9898       
    99         rootmac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootmac_fun_t));
     99        mac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(mac_fun_t));
    100100        *fun = *fun_proto;
    101101       
     
    106106       
    107107        /* Set provided operations to the device. */
    108         ddf_fun_set_ops(fnode, &rootmac_fun_ops);
     108        ddf_fun_set_ops(fnode, &mac_fun_ops);
    109109       
    110110        /* Register function. */
     
    133133 *
    134134 */
    135 static int rootmac_dev_add(ddf_dev_t *dev)
     135static int mac_dev_add(ddf_dev_t *dev)
    136136{
    137137#if 0
    138138        /* Register functions */
    139         if (!rootmac_add_fun(dev, "pci0", "intel_pci", &pci_data))
     139        if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data))
    140140                ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform.");
    141141#else
    142142        (void)pci_data;
    143         (void)rootmac_add_fun;
     143        (void)mac_add_fun;
    144144#endif
    145145       
     
    148148
    149149/** The root device driver's standard operations. */
    150 static driver_ops_t rootmac_ops = {
    151         .dev_add = &rootmac_dev_add
     150static driver_ops_t mac_ops = {
     151        .dev_add = &mac_dev_add
    152152};
    153153
    154154/** The root device driver structure. */
    155 static driver_t rootmac_driver = {
     155static driver_t mac_driver = {
    156156        .name = NAME,
    157         .driver_ops = &rootmac_ops
     157        .driver_ops = &mac_ops
    158158};
    159159
    160 static hw_resource_list_t *rootmac_get_resources(ddf_fun_t *fnode)
     160static hw_resource_list_t *mac_get_resources(ddf_fun_t *fnode)
    161161{
    162         rootmac_fun_t *fun = rootmac_fun(fnode);
     162        mac_fun_t *fun = mac_fun(fnode);
    163163        assert(fun != NULL);
    164164       
     
    166166}
    167167
    168 static bool rootmac_enable_interrupt(ddf_fun_t *fun)
     168static bool mac_enable_interrupt(ddf_fun_t *fun)
    169169{
    170170        /* TODO */
     
    174174
    175175static hw_res_ops_t fun_hw_res_ops = {
    176         .get_resource_list = &rootmac_get_resources,
    177         .enable_interrupt = &rootmac_enable_interrupt
     176        .get_resource_list = &mac_get_resources,
     177        .enable_interrupt = &mac_enable_interrupt
    178178};
    179179
     
    182182        printf("%s: HelenOS Mac platform driver\n", NAME);
    183183        ddf_log_init(NAME);
    184         rootmac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
    185         return ddf_driver_main(&rootmac_driver);
     184        mac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
     185        return ddf_driver_main(&mac_driver);
    186186}
    187187
  • uspace/drv/platform/malta/Makefile

    r0ddb84b r2a37b9f  
    3030LIBS = $(LIBDRV_PREFIX)/libdrv.a
    3131EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
    32 BINARY = rootmac
     32BINARY = malta
    3333
    3434SOURCES = \
    35         rootmac.c
     35        malta.c
    3636
    3737include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/platform/malta/malta.c

    r0ddb84b r2a37b9f  
    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);
     77} malta_fun_t;
     78
     79static int malta_dev_add(ddf_dev_t *dev);
    8080static void root_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
     166        .get_pio_window = &malta_get_pio_window
    167167};
    168168
    169169/* Initialized in root_malta_init() function. */
    170 static ddf_dev_ops_t rootmalta_fun_ops;
     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        }
     
    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
     
    266266        printf(NAME ": HelenOS Malta platform driver\n");
    267267        root_malta_init();
    268         return ddf_driver_main(&rootmalta_driver);
     268        return ddf_driver_main(&malta_driver);
    269269}
    270270
  • uspace/drv/platform/pc/Makefile

    r0ddb84b r2a37b9f  
    3030LIBS = $(LIBDRV_PREFIX)/libdrv.a
    3131EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
    32 BINARY = rootmalta
     32BINARY = pc
    3333
    3434SOURCES = \
    35         rootmalta.c
     35        pc.c
    3636
    3737include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/platform/pc/pc.c

    r0ddb84b r2a37b9f  
    5252#include <ops/pio_window.h>
    5353
    54 #define NAME "rootpc"
    55 
    56 typedef struct rootpc_fun {
     54#define NAME "pc"
     55
     56typedef struct pc_fun {
    5757        hw_resource_list_t hw_resources;
    5858        pio_window_t pio_window;
    59 } rootpc_fun_t;
    60 
    61 static int rootpc_dev_add(ddf_dev_t *dev);
     59} pc_fun_t;
     60
     61static int pc_dev_add(ddf_dev_t *dev);
    6262static void root_pc_init(void);
    6363
    6464/** The root device driver's standard operations. */
    65 static driver_ops_t rootpc_ops = {
    66         .dev_add = &rootpc_dev_add
     65static driver_ops_t pc_ops = {
     66        .dev_add = &pc_dev_add
    6767};
    6868
    6969/** The root device driver structure. */
    70 static driver_t rootpc_driver = {
     70static driver_t pc_driver = {
    7171        .name = NAME,
    72         .driver_ops = &rootpc_ops
     72        .driver_ops = &pc_ops
    7373};
    7474
     
    9494};
    9595
    96 static rootpc_fun_t pci_data = {
     96static pc_fun_t pci_data = {
    9797        .hw_resources = {
    9898                sizeof(pci_conf_regs) / sizeof(pci_conf_regs[0]),
     
    112112
    113113/** Obtain function soft-state from DDF function node */
    114 static rootpc_fun_t *rootpc_fun(ddf_fun_t *fnode)
     114static pc_fun_t *pc_fun(ddf_fun_t *fnode)
    115115{
    116116        return ddf_fun_data_get(fnode);
    117117}
    118118
    119 static hw_resource_list_t *rootpc_get_resources(ddf_fun_t *fnode)
    120 {
    121         rootpc_fun_t *fun = rootpc_fun(fnode);
     119static hw_resource_list_t *pc_get_resources(ddf_fun_t *fnode)
     120{
     121        pc_fun_t *fun = pc_fun(fnode);
    122122       
    123123        assert(fun != NULL);
     
    125125}
    126126
    127 static bool rootpc_enable_interrupt(ddf_fun_t *fun)
     127static bool pc_enable_interrupt(ddf_fun_t *fun)
    128128{
    129129        /* TODO */
     
    132132}
    133133
    134 static pio_window_t *rootpc_get_pio_window(ddf_fun_t *fnode)
    135 {
    136         rootpc_fun_t *fun = rootpc_fun(fnode);
     134static pio_window_t *pc_get_pio_window(ddf_fun_t *fnode)
     135{
     136        pc_fun_t *fun = pc_fun(fnode);
    137137       
    138138        assert(fun != NULL);
     
    141141
    142142static hw_res_ops_t fun_hw_res_ops = {
    143         .get_resource_list = &rootpc_get_resources,
    144         .enable_interrupt = &rootpc_enable_interrupt,
     143        .get_resource_list = &pc_get_resources,
     144        .enable_interrupt = &pc_enable_interrupt,
    145145};
    146146
    147147static pio_window_ops_t fun_pio_window_ops = {
    148         .get_pio_window = &rootpc_get_pio_window
     148        .get_pio_window = &pc_get_pio_window
    149149};
    150150
    151151/* Initialized in root_pc_init() function. */
    152 static ddf_dev_ops_t rootpc_fun_ops;
     152static ddf_dev_ops_t pc_fun_ops;
    153153
    154154static bool
    155 rootpc_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
    156     rootpc_fun_t *fun_proto)
     155pc_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
     156    pc_fun_t *fun_proto)
    157157{
    158158        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
     
    166166                goto failure;
    167167       
    168         rootpc_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootpc_fun_t));
     168        pc_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(pc_fun_t));
    169169        *fun = *fun_proto;
    170170       
     
    175175       
    176176        /* Set provided operations to the device. */
    177         ddf_fun_set_ops(fnode, &rootpc_fun_ops);
     177        ddf_fun_set_ops(fnode, &pc_fun_ops);
    178178       
    179179        /* Register function. */
     
    194194}
    195195
    196 static bool rootpc_add_functions(ddf_dev_t *dev)
    197 {
    198         return rootpc_add_fun(dev, "pci0", "intel_pci", &pci_data);
     196static bool pc_add_functions(ddf_dev_t *dev)
     197{
     198        return pc_add_fun(dev, "pci0", "intel_pci", &pci_data);
    199199}
    200200
     
    205205 * @return              Zero on success, negative error number otherwise.
    206206 */
    207 static int rootpc_dev_add(ddf_dev_t *dev)
    208 {
    209         ddf_msg(LVL_DEBUG, "rootpc_dev_add, device handle = %d",
     207static int pc_dev_add(ddf_dev_t *dev)
     208{
     209        ddf_msg(LVL_DEBUG, "pc_dev_add, device handle = %d",
    210210            (int)ddf_dev_get_handle(dev));
    211211       
    212212        /* Register functions. */
    213         if (!rootpc_add_functions(dev)) {
     213        if (!pc_add_functions(dev)) {
    214214                ddf_msg(LVL_ERROR, "Failed to add functions for PC platform.");
    215215        }
     
    221221{
    222222        ddf_log_init(NAME);
    223         rootpc_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
    224         rootpc_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
     223        pc_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
     224        pc_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
    225225}
    226226
     
    229229        printf(NAME ": HelenOS PC platform driver\n");
    230230        root_pc_init();
    231         return ddf_driver_main(&rootpc_driver);
     231        return ddf_driver_main(&pc_driver);
    232232}
    233233
  • uspace/drv/root/root/root.c

    r0ddb84b r2a37b9f  
    6161
    6262#define VIRTUAL_FUN_NAME "virt"
    63 #define VIRTUAL_FUN_MATCH_ID "rootvirt"
     63#define VIRTUAL_FUN_MATCH_ID "virt"
    6464#define VIRTUAL_FUN_MATCH_SCORE 100
    6565
  • uspace/drv/root/virt/Makefile

    r0ddb84b r2a37b9f  
    3030LIBS = $(LIBDRV_PREFIX)/libdrv.a
    3131EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
    32 BINARY = rootvirt
     32BINARY = virt
    3333
    3434SOURCES = \
    35         rootvirt.c
     35        virt.c
    3636
    3737include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/root/virt/virt.c

    r0ddb84b r2a37b9f  
    2828
    2929/**
    30  * @defgroup rootvirt Root device driver for virtual devices.
     30 * @defgroup virt Root device driver for virtual devices.
    3131 * @{
    3232 */
     
    4242#include <ddf/log.h>
    4343
    44 #define NAME "rootvirt"
     44#define NAME "virt"
    4545
    4646/** Virtual function entry */
     
    6262};
    6363
    64 static int rootvirt_dev_add(ddf_dev_t *dev);
    65 static int rootvirt_dev_remove(ddf_dev_t *dev);
    66 static int rootvirt_fun_online(ddf_fun_t *fun);
    67 static int rootvirt_fun_offline(ddf_fun_t *fun);
    68 
    69 static driver_ops_t rootvirt_ops = {
    70         .dev_add = &rootvirt_dev_add,
    71         .dev_remove = &rootvirt_dev_remove,
    72         .fun_online = &rootvirt_fun_online,
    73         .fun_offline = &rootvirt_fun_offline
     64static int virt_dev_add(ddf_dev_t *dev);
     65static int virt_dev_remove(ddf_dev_t *dev);
     66static int virt_fun_online(ddf_fun_t *fun);
     67static int virt_fun_offline(ddf_fun_t *fun);
     68
     69static driver_ops_t virt_ops = {
     70        .dev_add = &virt_dev_add,
     71        .dev_remove = &virt_dev_remove,
     72        .fun_online = &virt_fun_online,
     73        .fun_offline = &virt_fun_offline
    7474};
    7575
    76 static driver_t rootvirt_driver = {
     76static driver_t virt_driver = {
    7777        .name = NAME,
    78         .driver_ops = &rootvirt_ops
     78        .driver_ops = &virt_ops
    7979};
    8080
     
    8383        ddf_dev_t *dev;
    8484        list_t functions;
    85 } rootvirt_t;
     85} virt_t;
    8686
    8787/* Function soft state */
     
    8989        ddf_fun_t *fun;
    9090        link_t dev_link;
    91 } rootvirt_fun_t;
     91} virt_fun_t;
    9292
    9393static int instances = 0;
     
    100100 * @return              EOK on success or negative error code.
    101101 */
    102 static int rootvirt_add_fun(rootvirt_t *rootvirt, virtual_function_t *vfun)
    103 {
    104         ddf_dev_t *vdev = rootvirt->dev;
     102static int virt_add_fun(virt_t *virt, virtual_function_t *vfun)
     103{
     104        ddf_dev_t *vdev = virt->dev;
    105105        ddf_fun_t *fun;
    106         rootvirt_fun_t *rvfun;
     106        virt_fun_t *rvfun;
    107107        int rc;
    108108
     
    116116        }
    117117
    118         rvfun = ddf_fun_data_alloc(fun, sizeof(rootvirt_fun_t));
     118        rvfun = ddf_fun_data_alloc(fun, sizeof(virt_fun_t));
    119119        if (rvfun == NULL) {
    120120                ddf_msg(LVL_ERROR, "Failed allocating soft state for %s.",
     
    142142        }
    143143
    144         list_append(&rvfun->dev_link, &rootvirt->functions);
     144        list_append(&rvfun->dev_link, &virt->functions);
    145145
    146146        ddf_msg(LVL_NOTE, "Registered child device `%s'", vfun->name);
     
    148148}
    149149
    150 static int rootvirt_fun_remove(rootvirt_fun_t *rvfun)
     150static int virt_fun_remove(virt_fun_t *rvfun)
    151151{
    152152        int rc;
    153153        const char *name = ddf_fun_get_name(rvfun->fun);
    154154
    155         ddf_msg(LVL_DEBUG, "rootvirt_fun_remove('%s')", name);
     155        ddf_msg(LVL_DEBUG, "virt_fun_remove('%s')", name);
    156156        rc = ddf_fun_offline(rvfun->fun);
    157157        if (rc != EOK) {
     
    172172
    173173
    174 static int rootvirt_dev_add(ddf_dev_t *dev)
    175 {
    176         rootvirt_t *rootvirt;
     174static int virt_dev_add(ddf_dev_t *dev)
     175{
     176        virt_t *virt;
    177177
    178178        /*
     
    185185        ddf_msg(LVL_DEBUG, "dev_add(handle=%d)", (int)ddf_dev_get_handle(dev));
    186186
    187         rootvirt = ddf_dev_data_alloc(dev, sizeof(rootvirt_t));
    188         if (rootvirt == NULL)
     187        virt = ddf_dev_data_alloc(dev, sizeof(virt_t));
     188        if (virt == NULL)
    189189                return ENOMEM;
    190190
    191         rootvirt->dev = dev;
    192         list_initialize(&rootvirt->functions);
     191        virt->dev = dev;
     192        list_initialize(&virt->functions);
    193193
    194194        /*
     
    198198        virtual_function_t *vfun = virtual_functions;
    199199        while (vfun->name != NULL) {
    200                 (void) rootvirt_add_fun(rootvirt, vfun);
     200                (void) virt_add_fun(virt, vfun);
    201201                vfun++;
    202202        }
     
    205205}
    206206
    207 static int rootvirt_dev_remove(ddf_dev_t *dev)
    208 {
    209         rootvirt_t *rootvirt = (rootvirt_t *)ddf_dev_data_get(dev);
     207static int virt_dev_remove(ddf_dev_t *dev)
     208{
     209        virt_t *virt = (virt_t *)ddf_dev_data_get(dev);
    210210        int rc;
    211211
    212         while (!list_empty(&rootvirt->functions)) {
    213                 rootvirt_fun_t *rvfun = list_get_instance(
    214                     list_first(&rootvirt->functions), rootvirt_fun_t,
     212        while (!list_empty(&virt->functions)) {
     213                virt_fun_t *rvfun = list_get_instance(
     214                    list_first(&virt->functions), virt_fun_t,
    215215                        dev_link);
    216216
    217                 rc = rootvirt_fun_remove(rvfun);
     217                rc = virt_fun_remove(rvfun);
    218218                if (rc != EOK)
    219219                        return rc;
     
    224224}
    225225
    226 static int rootvirt_fun_online(ddf_fun_t *fun)
    227 {
    228         ddf_msg(LVL_DEBUG, "rootvirt_fun_online()");
     226static int virt_fun_online(ddf_fun_t *fun)
     227{
     228        ddf_msg(LVL_DEBUG, "virt_fun_online()");
    229229        return ddf_fun_online(fun);
    230230}
    231231
    232 static int rootvirt_fun_offline(ddf_fun_t *fun)
    233 {
    234         ddf_msg(LVL_DEBUG, "rootvirt_fun_offline()");
     232static int virt_fun_offline(ddf_fun_t *fun)
     233{
     234        ddf_msg(LVL_DEBUG, "virt_fun_offline()");
    235235        return ddf_fun_offline(fun);
    236236}
     
    241241
    242242        ddf_log_init(NAME);
    243         return ddf_driver_main(&rootvirt_driver);
     243        return ddf_driver_main(&virt_driver);
    244244}
    245245
Note: See TracChangeset for help on using the changeset viewer.