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