Changes in uspace/drv/infrastructure/rootmac/rootmac.c [56fd7cf:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/infrastructure/rootmac/rootmac.c
r56fd7cf r9d58539 44 44 #define NAME "rootmac" 45 45 46 /** Obtain function soft-state from DDF function node */ 47 #define ROOTMAC_FUN(fnode) \ 48 ((rootmac_fun_t *) (fnode)->driver_data) 49 46 50 typedef struct { 47 51 hw_resource_list_t hw_resources; 48 52 } rootmac_fun_t; 49 53 50 static hw_resource_t pci_conf_regs[] = { 51 { 52 .type = IO_RANGE, 53 .res.io_range = { 54 .address = 0xfec00000, 55 .size = 4, 56 .endianness = LITTLE_ENDIAN 57 } 58 }, 59 { 60 .type = IO_RANGE, 61 .res.io_range = { 62 .address = 0xfee00000, 63 .size = 4, 64 .endianness = LITTLE_ENDIAN 65 } 54 static hw_resource_t pci_conf_regs = { 55 .type = IO_RANGE, 56 .res.io_range = { 57 .address = 0xCF8, 58 .size = 8, 59 .endianness = LITTLE_ENDIAN 66 60 } 67 61 }; … … 69 63 static rootmac_fun_t pci_data = { 70 64 .hw_resources = { 71 2,72 pci_conf_regs65 1, 66 &pci_conf_regs 73 67 } 74 68 }; … … 76 70 static ddf_dev_ops_t rootmac_fun_ops; 77 71 78 /** Obtain function soft-state from DDF function node */79 static rootmac_fun_t *rootmac_fun(ddf_fun_t *fnode)80 {81 return ddf_fun_data_get(fnode);82 }83 84 72 static bool rootmac_add_fun(ddf_dev_t *dev, const char *name, 85 const char *str_match_id, rootmac_fun_t *fun _proto)73 const char *str_match_id, rootmac_fun_t *fun) 86 74 { 87 75 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); 88 76 89 77 ddf_fun_t *fnode = NULL; 90 int rc;78 match_id_t *match_id = NULL; 91 79 92 80 /* Create new device. */ … … 95 83 goto failure; 96 84 97 rootmac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootmac_fun_t)); 98 *fun = *fun_proto; 85 fnode->driver_data = fun; 99 86 100 /* Add match ID*/101 rc = ddf_fun_add_match_id(fnode, str_match_id, 100);102 if ( rc != EOK)87 /* Initialize match id list */ 88 match_id = create_match_id(); 89 if (match_id == NULL) 103 90 goto failure; 104 91 92 match_id->id = str_match_id; 93 match_id->score = 100; 94 add_match_id(&fnode->match_ids, match_id); 95 105 96 /* Set provided operations to the device. */ 106 ddf_fun_set_ops(fnode, &rootmac_fun_ops);97 fnode->ops = &rootmac_fun_ops; 107 98 108 99 /* Register function. */ … … 115 106 116 107 failure: 108 if (match_id != NULL) 109 match_id->id = NULL; 110 117 111 if (fnode != NULL) 118 112 ddf_fun_destroy(fnode); … … 133 127 static int rootmac_dev_add(ddf_dev_t *dev) 134 128 { 135 #if 0136 129 /* Register functions */ 137 if (!rootmac_add_fun(dev, "pci0", " intel_pci", &pci_data))130 if (!rootmac_add_fun(dev, "pci0", "pangea_pci", &pci_data)) 138 131 ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform."); 139 #else140 (void)pci_data;141 (void)rootmac_add_fun;142 #endif143 132 144 133 return EOK; … … 158 147 static hw_resource_list_t *rootmac_get_resources(ddf_fun_t *fnode) 159 148 { 160 rootmac_fun_t *fun = rootmac_fun(fnode);149 rootmac_fun_t *fun = ROOTMAC_FUN(fnode); 161 150 assert(fun != NULL); 162 151
Note:
See TracChangeset
for help on using the changeset viewer.