Changeset 2a37b9f in mainline
- Timestamp:
- 2014-08-28T19:54:48Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f2a9be
- Parents:
- 0ddb84b
- Files:
-
- 1 added
- 1 deleted
- 8 edited
- 34 moved
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
r0ddb84b r2a37b9f 133 133 uspace/dist/drv/root/ 134 134 uspace/dist/drv/rootpc/ 135 uspace/dist/drv/ rootvirt/135 uspace/dist/drv/virt/ 136 136 uspace/dist/drv/rtl8139/ 137 137 uspace/dist/drv/rtl8169/ … … 200 200 uspace/drv/char/xtkbd/xtkbd 201 201 uspace/drv/fb/kfb/kfb 202 uspace/drv/ infrastructure/root/root203 uspace/drv/ infrastructure/rootpc/rootpc204 uspace/drv/ infrastructure/rootvirt/rootvirt202 uspace/drv/root/root/root 203 uspace/drv/root/virt/virt 204 uspace/drv/platform/rootpc/rootpc 205 205 uspace/drv/nic/e1k/e1k 206 206 uspace/drv/nic/ne2k/ne2k -
boot/Makefile.common
r0ddb84b r2a37b9f 127 127 128 128 RD_DRVS_ESSENTIAL = \ 129 infrastructure/root \130 infrastructure/rootvirt \129 root/root \ 130 root/virt \ 131 131 fb/kfb 132 132 -
boot/arch/amd64/Makefile.inc
r0ddb84b r2a37b9f 35 35 36 36 RD_DRVS_ESSENTIAL += \ 37 infrastructure/rootpc \37 platform/pc \ 38 38 block/ata_bd \ 39 39 bus/pci/pciintel \ -
boot/arch/arm32/Makefile.inc
r0ddb84b r2a37b9f 66 66 67 67 RD_DRVS_ESSENTIAL += \ 68 infrastructure/rootamdm37x \68 platform/amdm37x \ 69 69 fb/amdm37x_dispc \ 70 70 bus/usb/ehci \ -
boot/arch/ia64/Makefile.inc
r0ddb84b r2a37b9f 66 66 67 67 RD_DRVS_ESSENTIAL += \ 68 infrastructure/rootpc \68 platform/pc \ 69 69 bus/pci/pciintel \ 70 70 bus/isa \ -
boot/arch/mips32/Makefile.inc
r0ddb84b r2a37b9f 52 52 ifeq ($(MACHINE), $(filter $(MACHINE),bmalta lmalta)) 53 53 RD_DRVS_ESSENTIAL += \ 54 infrastructure/rootmalta \54 platform/malta \ 55 55 block/ata_bd \ 56 56 bus/pci/pciintel \ -
boot/arch/ppc32/Makefile.inc
r0ddb84b r2a37b9f 43 43 44 44 RD_DRVS_ESSENTIAL += \ 45 infrastructure/rootmac \45 platform/mac \ 46 46 bus/pci/pciintel \ 47 47 bus/usb/ohci \ -
uspace/Makefile
r0ddb84b r2a37b9f 131 131 srv/hid/rfb \ 132 132 drv/audio/sb16 \ 133 drv/ infrastructure/root \134 drv/ infrastructure/rootvirt \133 drv/root/root \ 134 drv/root/virt \ 135 135 drv/block/ahci \ 136 136 drv/block/ata_bd \ … … 162 162 ifeq ($(UARCH), $(filter $(UARCH),amd64 ia32 ia64)) 163 163 DIRS += \ 164 drv/ infrastructure/rootpc \164 drv/platform/pc \ 165 165 drv/bus/pci/pciintel \ 166 166 drv/bus/isa \ … … 173 173 ifeq ($(UARCH), $(filter $(UARCH),mips32 mips32eb)) 174 174 DIRS += \ 175 drv/ infrastructure/rootmalta \175 drv/platform/malta \ 176 176 drv/bus/pci/pciintel \ 177 177 drv/bus/isa … … 180 180 ifeq ($(UARCH),ppc32) 181 181 DIRS += \ 182 drv/ infrastructure/rootmac \182 drv/platform/mac \ 183 183 drv/bus/pci/pciintel \ 184 184 srv/hw/bus/cuda_adb … … 192 192 ifeq ($(UARCH),arm32) 193 193 DIRS += \ 194 drv/ infrastructure/rootamdm37x \194 drv/platform/amdm37x \ 195 195 drv/fb/amdm37x_dispc 196 196 endif -
uspace/drv/platform/amdm37x/Makefile
r0ddb84b r2a37b9f 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 32 BINARY = rootamdm37x32 BINARY = amdm37x 33 33 34 34 SOURCES = \ 35 35 amdm37x.c \ 36 rootamdm37x.c36 main.c 37 37 38 38 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/platform/amdm37x/main.c
r0ddb84b r2a37b9f 45 45 #include "amdm37x.h" 46 46 47 #define NAME " rootamdm37x"47 #define NAME "amdm37x" 48 48 49 49 typedef struct { … … 51 51 match_id_t match_id; 52 52 hw_resource_list_t hw_resources; 53 } rootamdm37x_fun_t;53 } amdm37x_fun_t; 54 54 55 55 /* See amdm37x TRM page 3316 for these values */ … … 130 130 }; 131 131 132 static const rootamdm37x_fun_t amdm37x_funcs[] = {132 static const amdm37x_fun_t amdm37x_funcs[] = { 133 133 { 134 134 .name = "ohci", … … 149 149 150 150 151 static hw_resource_list_t * rootamdm37x_get_resources(ddf_fun_t *fnode);152 static bool rootamdm37x_enable_interrupt(ddf_fun_t *fun);151 static hw_resource_list_t *amdm37x_get_resources(ddf_fun_t *fnode); 152 static bool amdm37x_enable_interrupt(ddf_fun_t *fun); 153 153 154 154 static 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 159 static ddf_dev_ops_t amdm37x_fun_ops = { 160 160 .interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops 161 161 }; 162 162 163 static int rootamdm37x_add_fun(ddf_dev_t *dev, const rootamdm37x_fun_t *fun)163 static int amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun) 164 164 { 165 165 assert(dev); … … 182 182 183 183 /* 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)); 186 186 if (!rf) { 187 187 ddf_fun_destroy(fnode); … … 191 191 192 192 /* Set provided operations to the device. */ 193 ddf_fun_set_ops(fnode, & rootamdm37x_fun_ops);193 ddf_fun_set_ops(fnode, &amdm37x_fun_ops); 194 194 195 195 /* Register function. */ … … 212 212 * 213 213 */ 214 static int rootamdm37x_dev_add(ddf_dev_t *dev)214 static int amdm37x_dev_add(ddf_dev_t *dev) 215 215 { 216 216 assert(dev); … … 240 240 /* Register functions */ 241 241 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) 243 243 ddf_msg(LVL_ERROR, "Failed to add %s function for " 244 244 "BeagleBoard-xM platform.", amdm37x_funcs[i].name); … … 248 248 249 249 /** The root device driver's standard operations. */ 250 static driver_ops_t rootamdm37x_ops = {251 .dev_add = & rootamdm37x_dev_add250 static driver_ops_t amdm37x_ops = { 251 .dev_add = &amdm37x_dev_add 252 252 }; 253 253 254 254 /** The root device driver structure. */ 255 static driver_t rootamdm37x_driver = {255 static driver_t amdm37x_driver = { 256 256 .name = NAME, 257 .driver_ops = & rootamdm37x_ops258 }; 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 260 static hw_resource_list_t * amdm37x_get_resources(ddf_fun_t *fnode) 261 { 262 amdm37x_fun_t *fun = ddf_fun_data_get(fnode); 263 263 assert(fun != NULL); 264 264 return &fun->hw_resources; 265 265 } 266 266 267 static bool rootamdm37x_enable_interrupt(ddf_fun_t *fun)267 static bool amdm37x_enable_interrupt(ddf_fun_t *fun) 268 268 { 269 269 //TODO: Implement … … 275 275 printf("%s: HelenOS AM/DM37x(OMAP37x) platform driver\n", NAME); 276 276 ddf_log_init(NAME); 277 return ddf_driver_main(& rootamdm37x_driver);277 return ddf_driver_main(&amdm37x_driver); 278 278 } 279 279 -
uspace/drv/platform/leon3/Makefile
r0ddb84b r2a37b9f 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 32 BINARY = rootleon332 BINARY = leon3 33 33 34 34 SOURCES = \ 35 rootleon3.c35 leon3.c 36 36 37 37 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/platform/leon3/leon3.c
r0ddb84b r2a37b9f 40 40 #include <ops/hw_res.h> 41 41 #include <stdio.h> 42 #include " rootleon3.h"42 #include "leon3.h" 43 43 44 #define NAME " rootleon3"44 #define NAME "leon3" 45 45 46 46 typedef struct { … … 48 48 match_id_t match_id; 49 49 hw_resource_list_t hw_resources; 50 } rootleon3_fun_t;50 } leon3_fun_t; 51 51 52 52 static hw_resource_t amba_res[] = { … … 69 69 }; 70 70 71 static const rootleon3_fun_t leon3_func = {71 static const leon3_fun_t leon3_func = { 72 72 .name = "leon_amba", 73 73 .match_id = { … … 81 81 }; 82 82 83 static hw_resource_list_t * rootleon3_get_resources(ddf_fun_t *);84 static bool rootleon3_enable_interrupt(ddf_fun_t *);83 static hw_resource_list_t *leon3_get_resources(ddf_fun_t *); 84 static bool leon3_enable_interrupt(ddf_fun_t *); 85 85 86 86 static hw_res_ops_t fun_hw_res_ops = { 87 .get_resource_list = & rootleon3_get_resources,88 .enable_interrupt = & rootleon3_enable_interrupt87 .get_resource_list = &leon3_get_resources, 88 .enable_interrupt = &leon3_enable_interrupt 89 89 }; 90 90 91 static ddf_dev_ops_t rootleon3_fun_ops = {91 static ddf_dev_ops_t leon3_fun_ops = { 92 92 .interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops 93 93 }; 94 94 95 static int rootleon3_add_fun(ddf_dev_t *dev, const rootleon3_fun_t *fun)95 static int leon3_add_fun(ddf_dev_t *dev, const leon3_fun_t *fun) 96 96 { 97 97 assert(dev); … … 114 114 115 115 /* 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)); 118 118 if (!rf) { 119 119 ddf_fun_destroy(fnode); … … 123 123 124 124 /* Set provided operations to the device. */ 125 ddf_fun_set_ops(fnode, & rootleon3_fun_ops);125 ddf_fun_set_ops(fnode, &leon3_fun_ops); 126 126 127 127 /* Register function. */ … … 144 144 * 145 145 */ 146 static int rootleon3_dev_add(ddf_dev_t *dev)146 static int leon3_dev_add(ddf_dev_t *dev) 147 147 { 148 148 assert(dev); 149 149 150 150 /* Register functions */ 151 if ( rootleon3_add_fun(dev, &leon3_func) != EOK) {151 if (leon3_add_fun(dev, &leon3_func) != EOK) { 152 152 ddf_msg(LVL_ERROR, "Failed to add %s function for " 153 153 "LEON3 platform.", leon3_func.name); … … 158 158 159 159 /** The root device driver's standard operations. */ 160 static driver_ops_t rootleon3_ops = {161 .dev_add = & rootleon3_dev_add160 static driver_ops_t leon3_ops = { 161 .dev_add = &leon3_dev_add 162 162 }; 163 163 164 164 /** The root device driver structure. */ 165 static driver_t rootleon3_driver = {165 static driver_t leon3_driver = { 166 166 .name = NAME, 167 .driver_ops = & rootleon3_ops167 .driver_ops = &leon3_ops 168 168 }; 169 169 170 static hw_resource_list_t * rootleon3_get_resources(ddf_fun_t *fnode)170 static hw_resource_list_t *leon3_get_resources(ddf_fun_t *fnode) 171 171 { 172 rootleon3_fun_t *fun = ddf_fun_data_get(fnode);172 leon3_fun_t *fun = ddf_fun_data_get(fnode); 173 173 assert(fun != NULL); 174 174 175 printf(" rootleon3_get_resources() called\n");175 printf("leon3_get_resources() called\n"); 176 176 177 177 return &fun->hw_resources; 178 178 } 179 179 180 static bool rootleon3_enable_interrupt(ddf_fun_t *fun)180 static bool leon3_enable_interrupt(ddf_fun_t *fun) 181 181 { 182 182 // FIXME TODO … … 188 188 printf("%s: HelenOS SPARC LEON3 platform driver\n", NAME); 189 189 ddf_log_init(NAME); 190 return ddf_driver_main(& rootleon3_driver);190 return ddf_driver_main(&leon3_driver); 191 191 } 192 192 -
uspace/drv/platform/leon3/leon3.h
r0ddb84b r2a37b9f 34 34 */ 35 35 36 #ifndef ROOTLEON3_H37 #define ROOTLEON3_H36 #ifndef LEON3_H 37 #define LEON3_H 38 38 39 39 #define AMBAPP_MASTER_AREA 0xfffff000 -
uspace/drv/platform/mac/Makefile
r0ddb84b r2a37b9f 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 32 BINARY = rootpc32 BINARY = mac 33 33 34 34 SOURCES = \ 35 rootpc.c35 mac.c 36 36 37 37 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/platform/mac/mac.c
r0ddb84b r2a37b9f 42 42 #include <stdio.h> 43 43 44 #define NAME " rootmac"44 #define NAME "mac" 45 45 46 46 typedef struct { 47 47 hw_resource_list_t hw_resources; 48 } rootmac_fun_t;48 } mac_fun_t; 49 49 50 50 static hw_resource_t pci_conf_regs[] = { … … 69 69 }; 70 70 71 static rootmac_fun_t pci_data = {71 static mac_fun_t pci_data = { 72 72 .hw_resources = { 73 73 2, … … 76 76 }; 77 77 78 static ddf_dev_ops_t rootmac_fun_ops;78 static ddf_dev_ops_t mac_fun_ops; 79 79 80 80 /** Obtain function soft-state from DDF function node */ 81 static rootmac_fun_t *rootmac_fun(ddf_fun_t *fnode)81 static mac_fun_t *mac_fun(ddf_fun_t *fnode) 82 82 { 83 83 return ddf_fun_data_get(fnode); 84 84 } 85 85 86 static bool rootmac_add_fun(ddf_dev_t *dev, const char *name,87 const char *str_match_id, rootmac_fun_t *fun_proto)86 static bool mac_add_fun(ddf_dev_t *dev, const char *name, 87 const char *str_match_id, mac_fun_t *fun_proto) 88 88 { 89 89 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); … … 97 97 goto failure; 98 98 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)); 100 100 *fun = *fun_proto; 101 101 … … 106 106 107 107 /* Set provided operations to the device. */ 108 ddf_fun_set_ops(fnode, & rootmac_fun_ops);108 ddf_fun_set_ops(fnode, &mac_fun_ops); 109 109 110 110 /* Register function. */ … … 133 133 * 134 134 */ 135 static int rootmac_dev_add(ddf_dev_t *dev)135 static int mac_dev_add(ddf_dev_t *dev) 136 136 { 137 137 #if 0 138 138 /* Register functions */ 139 if (! rootmac_add_fun(dev, "pci0", "intel_pci", &pci_data))139 if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data)) 140 140 ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform."); 141 141 #else 142 142 (void)pci_data; 143 (void) rootmac_add_fun;143 (void)mac_add_fun; 144 144 #endif 145 145 … … 148 148 149 149 /** The root device driver's standard operations. */ 150 static driver_ops_t rootmac_ops = {151 .dev_add = & rootmac_dev_add150 static driver_ops_t mac_ops = { 151 .dev_add = &mac_dev_add 152 152 }; 153 153 154 154 /** The root device driver structure. */ 155 static driver_t rootmac_driver = {155 static driver_t mac_driver = { 156 156 .name = NAME, 157 .driver_ops = & rootmac_ops157 .driver_ops = &mac_ops 158 158 }; 159 159 160 static hw_resource_list_t * rootmac_get_resources(ddf_fun_t *fnode)160 static hw_resource_list_t *mac_get_resources(ddf_fun_t *fnode) 161 161 { 162 rootmac_fun_t *fun = rootmac_fun(fnode);162 mac_fun_t *fun = mac_fun(fnode); 163 163 assert(fun != NULL); 164 164 … … 166 166 } 167 167 168 static bool rootmac_enable_interrupt(ddf_fun_t *fun)168 static bool mac_enable_interrupt(ddf_fun_t *fun) 169 169 { 170 170 /* TODO */ … … 174 174 175 175 static hw_res_ops_t fun_hw_res_ops = { 176 .get_resource_list = & rootmac_get_resources,177 .enable_interrupt = & rootmac_enable_interrupt176 .get_resource_list = &mac_get_resources, 177 .enable_interrupt = &mac_enable_interrupt 178 178 }; 179 179 … … 182 182 printf("%s: HelenOS Mac platform driver\n", NAME); 183 183 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); 186 186 } 187 187 -
uspace/drv/platform/malta/Makefile
r0ddb84b r2a37b9f 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 32 BINARY = rootmac32 BINARY = malta 33 33 34 34 SOURCES = \ 35 rootmac.c35 malta.c 36 36 37 37 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/platform/malta/malta.c
r0ddb84b r2a37b9f 55 55 #include <byteorder.h> 56 56 57 #define NAME " rootmalta"57 #define NAME "malta" 58 58 59 59 #define GT_BASE UINT32_C(0x1be00000) … … 72 72 #define GT_PCI_IOSIZE UINT32_C(0x00200000) 73 73 74 typedef struct rootmalta_fun {74 typedef struct malta_fun { 75 75 hw_resource_list_t hw_resources; 76 76 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 79 static int malta_dev_add(ddf_dev_t *dev); 80 80 static void root_malta_init(void); 81 81 82 82 /** The root device driver's standard operations. */ 83 static driver_ops_t rootmalta_ops = {84 .dev_add = & rootmalta_dev_add83 static driver_ops_t malta_ops = { 84 .dev_add = &malta_dev_add 85 85 }; 86 86 87 87 /** The root device driver structure. */ 88 static driver_t rootmalta_driver = {88 static driver_t malta_driver = { 89 89 .name = NAME, 90 .driver_ops = & rootmalta_ops90 .driver_ops = &malta_ops 91 91 }; 92 92 … … 112 112 }; 113 113 114 static rootmalta_fun_t pci_data = {114 static malta_fun_t pci_data = { 115 115 .hw_resources = { 116 116 sizeof(pci_conf_regs) / sizeof(pci_conf_regs[0]), … … 130 130 131 131 /** Obtain function soft-state from DDF function node */ 132 static rootmalta_fun_t *rootmalta_fun(ddf_fun_t *fnode)132 static malta_fun_t *malta_fun(ddf_fun_t *fnode) 133 133 { 134 134 return ddf_fun_data_get(fnode); 135 135 } 136 136 137 static hw_resource_list_t * rootmalta_get_resources(ddf_fun_t *fnode)138 { 139 rootmalta_fun_t *fun = rootmalta_fun(fnode);137 static hw_resource_list_t *malta_get_resources(ddf_fun_t *fnode) 138 { 139 malta_fun_t *fun = malta_fun(fnode); 140 140 141 141 assert(fun != NULL); … … 143 143 } 144 144 145 static bool rootmalta_enable_interrupt(ddf_fun_t *fun)145 static bool malta_enable_interrupt(ddf_fun_t *fun) 146 146 { 147 147 /* TODO */ … … 150 150 } 151 151 152 static pio_window_t * rootmalta_get_pio_window(ddf_fun_t *fnode)153 { 154 rootmalta_fun_t *fun = rootmalta_fun(fnode);152 static pio_window_t *malta_get_pio_window(ddf_fun_t *fnode) 153 { 154 malta_fun_t *fun = malta_fun(fnode); 155 155 156 156 assert(fun != NULL); … … 159 159 160 160 static 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, 163 163 }; 164 164 165 165 static pio_window_ops_t fun_pio_window_ops = { 166 .get_pio_window = & rootmalta_get_pio_window166 .get_pio_window = &malta_get_pio_window 167 167 }; 168 168 169 169 /* Initialized in root_malta_init() function. */ 170 static ddf_dev_ops_t rootmalta_fun_ops;170 static ddf_dev_ops_t malta_fun_ops; 171 171 172 172 static bool 173 rootmalta_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,174 rootmalta_fun_t *fun_proto)173 malta_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id, 174 malta_fun_t *fun_proto) 175 175 { 176 176 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); … … 184 184 goto failure; 185 185 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)); 187 187 *fun = *fun_proto; 188 188 … … 193 193 194 194 /* Set provided operations to the device. */ 195 ddf_fun_set_ops(fnode, & rootmalta_fun_ops);195 ddf_fun_set_ops(fnode, &malta_fun_ops); 196 196 197 197 /* Register function. */ … … 212 212 } 213 213 214 static bool rootmalta_add_functions(ddf_dev_t *dev)215 { 216 return rootmalta_add_fun(dev, "pci0", "intel_pci", &pci_data);214 static bool malta_add_functions(ddf_dev_t *dev) 215 { 216 return malta_add_fun(dev, "pci0", "intel_pci", &pci_data); 217 217 } 218 218 … … 223 223 * @return Zero on success, negative error number otherwise. 224 224 */ 225 static int rootmalta_dev_add(ddf_dev_t *dev)225 static int malta_dev_add(ddf_dev_t *dev) 226 226 { 227 227 ioport32_t *gt; … … 229 229 int ret; 230 230 231 ddf_msg(LVL_DEBUG, " rootmalta_dev_add, device handle = %d",231 ddf_msg(LVL_DEBUG, "malta_dev_add, device handle = %d", 232 232 (int)ddf_dev_get_handle(dev)); 233 233 … … 248 248 249 249 /* Register functions. */ 250 if (! rootmalta_add_functions(dev)) {250 if (!malta_add_functions(dev)) { 251 251 ddf_msg(LVL_ERROR, "Failed to add functions for the Malta platform."); 252 252 } … … 258 258 { 259 259 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; 262 262 } 263 263 … … 266 266 printf(NAME ": HelenOS Malta platform driver\n"); 267 267 root_malta_init(); 268 return ddf_driver_main(& rootmalta_driver);268 return ddf_driver_main(&malta_driver); 269 269 } 270 270 -
uspace/drv/platform/pc/Makefile
r0ddb84b r2a37b9f 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 32 BINARY = rootmalta32 BINARY = pc 33 33 34 34 SOURCES = \ 35 rootmalta.c35 pc.c 36 36 37 37 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/platform/pc/pc.c
r0ddb84b r2a37b9f 52 52 #include <ops/pio_window.h> 53 53 54 #define NAME " rootpc"55 56 typedef struct rootpc_fun {54 #define NAME "pc" 55 56 typedef struct pc_fun { 57 57 hw_resource_list_t hw_resources; 58 58 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 61 static int pc_dev_add(ddf_dev_t *dev); 62 62 static void root_pc_init(void); 63 63 64 64 /** The root device driver's standard operations. */ 65 static driver_ops_t rootpc_ops = {66 .dev_add = & rootpc_dev_add65 static driver_ops_t pc_ops = { 66 .dev_add = &pc_dev_add 67 67 }; 68 68 69 69 /** The root device driver structure. */ 70 static driver_t rootpc_driver = {70 static driver_t pc_driver = { 71 71 .name = NAME, 72 .driver_ops = & rootpc_ops72 .driver_ops = &pc_ops 73 73 }; 74 74 … … 94 94 }; 95 95 96 static rootpc_fun_t pci_data = {96 static pc_fun_t pci_data = { 97 97 .hw_resources = { 98 98 sizeof(pci_conf_regs) / sizeof(pci_conf_regs[0]), … … 112 112 113 113 /** Obtain function soft-state from DDF function node */ 114 static rootpc_fun_t *rootpc_fun(ddf_fun_t *fnode)114 static pc_fun_t *pc_fun(ddf_fun_t *fnode) 115 115 { 116 116 return ddf_fun_data_get(fnode); 117 117 } 118 118 119 static hw_resource_list_t * rootpc_get_resources(ddf_fun_t *fnode)120 { 121 rootpc_fun_t *fun = rootpc_fun(fnode);119 static hw_resource_list_t *pc_get_resources(ddf_fun_t *fnode) 120 { 121 pc_fun_t *fun = pc_fun(fnode); 122 122 123 123 assert(fun != NULL); … … 125 125 } 126 126 127 static bool rootpc_enable_interrupt(ddf_fun_t *fun)127 static bool pc_enable_interrupt(ddf_fun_t *fun) 128 128 { 129 129 /* TODO */ … … 132 132 } 133 133 134 static pio_window_t * rootpc_get_pio_window(ddf_fun_t *fnode)135 { 136 rootpc_fun_t *fun = rootpc_fun(fnode);134 static pio_window_t *pc_get_pio_window(ddf_fun_t *fnode) 135 { 136 pc_fun_t *fun = pc_fun(fnode); 137 137 138 138 assert(fun != NULL); … … 141 141 142 142 static 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, 145 145 }; 146 146 147 147 static pio_window_ops_t fun_pio_window_ops = { 148 .get_pio_window = & rootpc_get_pio_window148 .get_pio_window = &pc_get_pio_window 149 149 }; 150 150 151 151 /* Initialized in root_pc_init() function. */ 152 static ddf_dev_ops_t rootpc_fun_ops;152 static ddf_dev_ops_t pc_fun_ops; 153 153 154 154 static bool 155 rootpc_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,156 rootpc_fun_t *fun_proto)155 pc_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id, 156 pc_fun_t *fun_proto) 157 157 { 158 158 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); … … 166 166 goto failure; 167 167 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)); 169 169 *fun = *fun_proto; 170 170 … … 175 175 176 176 /* Set provided operations to the device. */ 177 ddf_fun_set_ops(fnode, & rootpc_fun_ops);177 ddf_fun_set_ops(fnode, &pc_fun_ops); 178 178 179 179 /* Register function. */ … … 194 194 } 195 195 196 static bool rootpc_add_functions(ddf_dev_t *dev)197 { 198 return rootpc_add_fun(dev, "pci0", "intel_pci", &pci_data);196 static bool pc_add_functions(ddf_dev_t *dev) 197 { 198 return pc_add_fun(dev, "pci0", "intel_pci", &pci_data); 199 199 } 200 200 … … 205 205 * @return Zero on success, negative error number otherwise. 206 206 */ 207 static int rootpc_dev_add(ddf_dev_t *dev)208 { 209 ddf_msg(LVL_DEBUG, " rootpc_dev_add, device handle = %d",207 static int pc_dev_add(ddf_dev_t *dev) 208 { 209 ddf_msg(LVL_DEBUG, "pc_dev_add, device handle = %d", 210 210 (int)ddf_dev_get_handle(dev)); 211 211 212 212 /* Register functions. */ 213 if (! rootpc_add_functions(dev)) {213 if (!pc_add_functions(dev)) { 214 214 ddf_msg(LVL_ERROR, "Failed to add functions for PC platform."); 215 215 } … … 221 221 { 222 222 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; 225 225 } 226 226 … … 229 229 printf(NAME ": HelenOS PC platform driver\n"); 230 230 root_pc_init(); 231 return ddf_driver_main(& rootpc_driver);231 return ddf_driver_main(&pc_driver); 232 232 } 233 233 -
uspace/drv/root/root/root.c
r0ddb84b r2a37b9f 61 61 62 62 #define VIRTUAL_FUN_NAME "virt" 63 #define VIRTUAL_FUN_MATCH_ID " rootvirt"63 #define VIRTUAL_FUN_MATCH_ID "virt" 64 64 #define VIRTUAL_FUN_MATCH_SCORE 100 65 65 -
uspace/drv/root/virt/Makefile
r0ddb84b r2a37b9f 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 32 BINARY = rootvirt32 BINARY = virt 33 33 34 34 SOURCES = \ 35 rootvirt.c35 virt.c 36 36 37 37 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/root/virt/virt.c
r0ddb84b r2a37b9f 28 28 29 29 /** 30 * @defgroup rootvirt Root device driver for virtual devices.30 * @defgroup virt Root device driver for virtual devices. 31 31 * @{ 32 32 */ … … 42 42 #include <ddf/log.h> 43 43 44 #define NAME " rootvirt"44 #define NAME "virt" 45 45 46 46 /** Virtual function entry */ … … 62 62 }; 63 63 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_offline64 static int virt_dev_add(ddf_dev_t *dev); 65 static int virt_dev_remove(ddf_dev_t *dev); 66 static int virt_fun_online(ddf_fun_t *fun); 67 static int virt_fun_offline(ddf_fun_t *fun); 68 69 static 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 74 74 }; 75 75 76 static driver_t rootvirt_driver = {76 static driver_t virt_driver = { 77 77 .name = NAME, 78 .driver_ops = & rootvirt_ops78 .driver_ops = &virt_ops 79 79 }; 80 80 … … 83 83 ddf_dev_t *dev; 84 84 list_t functions; 85 } rootvirt_t;85 } virt_t; 86 86 87 87 /* Function soft state */ … … 89 89 ddf_fun_t *fun; 90 90 link_t dev_link; 91 } rootvirt_fun_t;91 } virt_fun_t; 92 92 93 93 static int instances = 0; … … 100 100 * @return EOK on success or negative error code. 101 101 */ 102 static int rootvirt_add_fun(rootvirt_t *rootvirt, virtual_function_t *vfun)103 { 104 ddf_dev_t *vdev = rootvirt->dev;102 static int virt_add_fun(virt_t *virt, virtual_function_t *vfun) 103 { 104 ddf_dev_t *vdev = virt->dev; 105 105 ddf_fun_t *fun; 106 rootvirt_fun_t *rvfun;106 virt_fun_t *rvfun; 107 107 int rc; 108 108 … … 116 116 } 117 117 118 rvfun = ddf_fun_data_alloc(fun, sizeof( rootvirt_fun_t));118 rvfun = ddf_fun_data_alloc(fun, sizeof(virt_fun_t)); 119 119 if (rvfun == NULL) { 120 120 ddf_msg(LVL_ERROR, "Failed allocating soft state for %s.", … … 142 142 } 143 143 144 list_append(&rvfun->dev_link, & rootvirt->functions);144 list_append(&rvfun->dev_link, &virt->functions); 145 145 146 146 ddf_msg(LVL_NOTE, "Registered child device `%s'", vfun->name); … … 148 148 } 149 149 150 static int rootvirt_fun_remove(rootvirt_fun_t *rvfun)150 static int virt_fun_remove(virt_fun_t *rvfun) 151 151 { 152 152 int rc; 153 153 const char *name = ddf_fun_get_name(rvfun->fun); 154 154 155 ddf_msg(LVL_DEBUG, " rootvirt_fun_remove('%s')", name);155 ddf_msg(LVL_DEBUG, "virt_fun_remove('%s')", name); 156 156 rc = ddf_fun_offline(rvfun->fun); 157 157 if (rc != EOK) { … … 172 172 173 173 174 static int rootvirt_dev_add(ddf_dev_t *dev)175 { 176 rootvirt_t *rootvirt;174 static int virt_dev_add(ddf_dev_t *dev) 175 { 176 virt_t *virt; 177 177 178 178 /* … … 185 185 ddf_msg(LVL_DEBUG, "dev_add(handle=%d)", (int)ddf_dev_get_handle(dev)); 186 186 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) 189 189 return ENOMEM; 190 190 191 rootvirt->dev = dev;192 list_initialize(& rootvirt->functions);191 virt->dev = dev; 192 list_initialize(&virt->functions); 193 193 194 194 /* … … 198 198 virtual_function_t *vfun = virtual_functions; 199 199 while (vfun->name != NULL) { 200 (void) rootvirt_add_fun(rootvirt, vfun);200 (void) virt_add_fun(virt, vfun); 201 201 vfun++; 202 202 } … … 205 205 } 206 206 207 static int rootvirt_dev_remove(ddf_dev_t *dev)208 { 209 rootvirt_t *rootvirt = (rootvirt_t *)ddf_dev_data_get(dev);207 static int virt_dev_remove(ddf_dev_t *dev) 208 { 209 virt_t *virt = (virt_t *)ddf_dev_data_get(dev); 210 210 int rc; 211 211 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, 215 215 dev_link); 216 216 217 rc = rootvirt_fun_remove(rvfun);217 rc = virt_fun_remove(rvfun); 218 218 if (rc != EOK) 219 219 return rc; … … 224 224 } 225 225 226 static int rootvirt_fun_online(ddf_fun_t *fun)227 { 228 ddf_msg(LVL_DEBUG, " rootvirt_fun_online()");226 static int virt_fun_online(ddf_fun_t *fun) 227 { 228 ddf_msg(LVL_DEBUG, "virt_fun_online()"); 229 229 return ddf_fun_online(fun); 230 230 } 231 231 232 static int rootvirt_fun_offline(ddf_fun_t *fun)233 { 234 ddf_msg(LVL_DEBUG, " rootvirt_fun_offline()");232 static int virt_fun_offline(ddf_fun_t *fun) 233 { 234 ddf_msg(LVL_DEBUG, "virt_fun_offline()"); 235 235 return ddf_fun_offline(fun); 236 236 } … … 241 241 242 242 ddf_log_init(NAME); 243 return ddf_driver_main(& rootvirt_driver);243 return ddf_driver_main(&virt_driver); 244 244 } 245 245
Note:
See TracChangeset
for help on using the changeset viewer.