Changeset 2a37b9f in mainline for uspace/drv/platform/malta/malta.c
- Timestamp:
- 2014-08-28T19:54:48Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f2a9be
- Parents:
- 0ddb84b
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.