Changes in uspace/drv/infrastructure/rootpc/rootpc.c [56fd7cf:e882e3a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/infrastructure/rootpc/rootpc.c
r56fd7cf re882e3a 54 54 #define NAME "rootpc" 55 55 56 /** Obtain function soft-state from DDF function node */ 57 #define ROOTPC_FUN(fnode) ((rootpc_fun_t *) (fnode)->driver_data) 58 56 59 typedef struct rootpc_fun { 57 60 hw_resource_list_t hw_resources; … … 72 75 }; 73 76 74 static 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 } 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 90 83 } 91 84 }; … … 93 86 static rootpc_fun_t pci_data = { 94 87 .hw_resources = { 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 */ 101 static rootpc_fun_t *rootpc_fun(ddf_fun_t *fnode) 102 { 103 return ddf_fun_data_get(fnode); 104 } 88 1, 89 &pci_conf_regs 90 } 91 }; 105 92 106 93 static hw_resource_list_t *rootpc_get_resources(ddf_fun_t *fnode) 107 94 { 108 rootpc_fun_t *fun = rootpc_fun(fnode);95 rootpc_fun_t *fun = ROOTPC_FUN(fnode); 109 96 110 97 assert(fun != NULL); … … 129 116 static bool 130 117 rootpc_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id, 131 rootpc_fun_t *fun _proto)118 rootpc_fun_t *fun) 132 119 { 133 120 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); 134 121 135 122 ddf_fun_t *fnode = NULL; 136 int rc;123 match_id_t *match_id = NULL; 137 124 138 125 /* Create new device. */ … … 141 128 goto failure; 142 129 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) 130 fnode->driver_data = fun; 131 132 /* Initialize match id list */ 133 match_id = create_match_id(); 134 if (match_id == NULL) 149 135 goto failure; 150 136 137 match_id->id = str_match_id; 138 match_id->score = 100; 139 add_match_id(&fnode->match_ids, match_id); 140 151 141 /* Set provided operations to the device. */ 152 ddf_fun_set_ops(fnode, &rootpc_fun_ops);142 fnode->ops = &rootpc_fun_ops; 153 143 154 144 /* Register function. */ … … 161 151 162 152 failure: 153 if (match_id != NULL) 154 match_id->id = NULL; 155 163 156 if (fnode != NULL) 164 157 ddf_fun_destroy(fnode); … … 183 176 { 184 177 ddf_msg(LVL_DEBUG, "rootpc_dev_add, device handle = %d", 185 (int)d df_dev_get_handle(dev));178 (int)dev->handle); 186 179 187 180 /* Register functions. */
Note:
See TracChangeset
for help on using the changeset viewer.