Changes in uspace/drv/nic/rtl8139/driver.c [56fd7cf:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/rtl8139/driver.c
r56fd7cf r9d58539 27 27 */ 28 28 29 /* XXX Fix this */30 #define _DDF_DATA_IMPLANT31 32 29 #include <assert.h> 33 30 #include <errno.h> … … 47 44 #include <sysinfo.h> 48 45 #include <ipc/ns.h> 46 47 #include <net_checksum.h> 49 48 50 49 #include <str.h> … … 215 214 rtl8139_regs_lock(rtl8139->io_port); 216 215 217 async_sess_t *pci_sess =218 ddf_dev_parent_sess_get(nic_get_ddf_dev(rtl8139->nic_data));219 220 216 if (bit_val) { 217 async_sess_t *pci_sess = 218 nic_get_ddf_dev(rtl8139->nic_data)->parent_sess; 221 219 uint8_t pmen; 222 220 pci_config_space_read_8(pci_sess, 0x55, &pmen); 223 221 pci_config_space_write_8(pci_sess, 0x55, pmen | 1 | (1 << 7)); 224 222 } else { 223 async_sess_t *pci_sess = 224 nic_get_ddf_dev(rtl8139->nic_data)->parent_sess; 225 225 uint8_t pmen; 226 226 pci_config_space_read_8(pci_sess, 0x55, &pmen); … … 1054 1054 assert(dev); 1055 1055 1056 if (d df_dev_data_get(dev))1056 if (dev->driver_data) 1057 1057 nic_unbind_and_destroy(dev); 1058 1059 if (dev->parent_sess != NULL) { 1060 async_hangup(dev->parent_sess); 1061 dev->parent_sess = NULL; 1062 } 1058 1063 } 1059 1064 … … 1077 1082 1078 1083 if (hw_resources->irqs.count != 1) { 1079 ddf_msg(LVL_ERROR, "%s device: unexpected irq count", d df_dev_get_name(dev));1084 ddf_msg(LVL_ERROR, "%s device: unexpected irq count", dev->name); 1080 1085 return EINVAL; 1081 1086 }; 1082 1087 if (hw_resources->io_ranges.count != 1) { 1083 ddf_msg(LVL_ERROR, "%s device: unexpected io ranges count", d df_dev_get_name(dev));1088 ddf_msg(LVL_ERROR, "%s device: unexpected io ranges count", dev->name); 1084 1089 return EINVAL; 1085 1090 } 1086 1091 1087 1092 rtl8139->irq = hw_resources->irqs.irqs[0]; 1088 ddf_msg(LVL_DEBUG, "%s device: irq 0x%x assigned", d df_dev_get_name(dev), rtl8139->irq);1093 ddf_msg(LVL_DEBUG, "%s device: irq 0x%x assigned", dev->name, rtl8139->irq); 1089 1094 1090 1095 rtl8139->io_addr = IOADDR_TO_PTR(hw_resources->io_ranges.ranges[0].address); 1091 1096 if (hw_resources->io_ranges.ranges[0].size < RTL8139_IO_SIZE) { 1092 1097 ddf_msg(LVL_ERROR, "i/o range assigned to the device " 1093 "%s is too small.", d df_dev_get_name(dev));1098 "%s is too small.", dev->name); 1094 1099 return EINVAL; 1095 1100 } 1096 ddf_msg(LVL_DEBUG, "%s device: i/o addr %p assigned.", d df_dev_get_name(dev), rtl8139->io_addr);1101 ddf_msg(LVL_DEBUG, "%s device: i/o addr %p assigned.", dev->name, rtl8139->io_addr); 1097 1102 1098 1103 return EOK; … … 1189 1194 static int rtl8139_device_initialize(ddf_dev_t *dev) 1190 1195 { 1191 ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", d df_dev_get_name(dev));1196 ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", dev->name); 1192 1197 1193 1198 int ret = EOK; … … 1198 1203 rtl8139_t *rtl8139 = rtl8139_create_dev_data(dev); 1199 1204 if (rtl8139 == NULL) { 1200 ddf_msg(LVL_ERROR, "Not enough memory for initializing %s.", d df_dev_get_name(dev));1205 ddf_msg(LVL_ERROR, "Not enough memory for initializing %s.", dev->name); 1201 1206 return ENOMEM; 1202 1207 } … … 1243 1248 static int rtl8139_pio_enable(ddf_dev_t *dev) 1244 1249 { 1245 ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", d df_dev_get_name(dev));1250 ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", dev->name); 1246 1251 1247 1252 rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_dev(dev)); … … 1250 1255 if (pio_enable(rtl8139->io_addr, RTL8139_IO_SIZE, &rtl8139->io_port)) { 1251 1256 ddf_msg(LVL_ERROR, "Cannot gain the port %lx for device %s.", rtl8139->io_addr, 1252 d df_dev_get_name(dev));1257 dev->name); 1253 1258 return EADDRNOTAVAIL; 1254 1259 } … … 1296 1301 1297 1302 assert(dev); 1298 ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %d)", 1299 ddf_dev_get_name(dev), ddf_dev_get_handle(dev)); 1303 ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %d)", dev->name, dev->handle); 1300 1304 1301 1305 /* Init device structure for rtl8139 */ … … 1338 1342 } 1339 1343 nic_set_ddf_fun(nic_data, fun); 1340 ddf_fun_set_ops(fun, &rtl8139_dev_ops);1341 ddf_fun_data_implant(fun, nic_data);1344 fun->ops = &rtl8139_dev_ops; 1345 fun->driver_data = nic_data; 1342 1346 1343 1347 rc = ddf_fun_bind(fun); … … 1353 1357 1354 1358 ddf_msg(LVL_NOTE, "The %s device has been successfully initialized.", 1355 d df_dev_get_name(dev));1359 dev->name); 1356 1360 1357 1361 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.