Changes in uspace/drv/nic/ne2k/ne2k.c [9571230:56fd7cf] in mainline
- File:
-
- 1 edited
-
uspace/drv/nic/ne2k/ne2k.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ne2k/ne2k.c
r9571230 r56fd7cf 38 38 */ 39 39 40 /* XXX Fix this */ 41 #define _DDF_DATA_IMPLANT 42 40 43 #include <stdio.h> 41 44 #include <errno.h> … … 61 64 #define IRQ_GET_TSR(call) ((int) IPC_GET_ARG3(call)) 62 65 63 #define DRIVER_DATA(dev) ((nic_t *) ((dev)->driver_data))66 #define DRIVER_DATA(dev) ((nic_t *) ddf_dev_data_get(dev)) 64 67 #define NE2K(device) ((ne2k_t *) nic_get_specific(DRIVER_DATA(device))) 65 68 … … 83 86 { 84 87 /* Mask supported interrupt causes */ 85 .cmd = CMD_ BTEST,88 .cmd = CMD_AND, 86 89 .value = (ISR_PRX | ISR_PTX | ISR_RXE | ISR_TXE | ISR_OVW | 87 90 ISR_CNT | ISR_RDC), … … 169 172 static void ne2k_dev_cleanup(ddf_dev_t *dev) 170 173 { 171 if (d ev->driver_data!= NULL) {174 if (ddf_dev_data_get(dev) != NULL) { 172 175 ne2k_t *ne2k = NE2K(dev); 173 176 if (ne2k) { … … 177 180 nic_unbind_and_destroy(dev); 178 181 } 179 if (dev->parent_sess != NULL) {180 async_hangup(dev->parent_sess);181 dev->parent_sess = NULL;182 }183 182 } 184 183 … … 279 278 static int ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address) 280 279 { 281 nic_t *nic_data = DRIVER_DATA( fun);280 nic_t *nic_data = DRIVER_DATA(ddf_fun_get_dev(fun)); 282 281 int rc = nic_report_address(nic_data, address); 283 282 if (rc != EOK) { … … 286 285 /* Note: some frame with previous physical address may slip to NIL here 287 286 * (for a moment the filtering is not exact), but ethernet should be OK with 288 * that. Some packetmay also be lost, but this is not a problem.287 * that. Some frames may also be lost, but this is not a problem. 289 288 */ 290 289 ne2k_set_physical_address((ne2k_t *) nic_get_specific(nic_data), address); … … 363 362 static int ne2k_dev_add(ddf_dev_t *dev) 364 363 { 364 ddf_fun_t *fun; 365 365 366 /* Allocate driver data for the device. */ 366 367 nic_t *nic_data = nic_create_and_bind(dev); … … 396 397 } 397 398 398 rc = nic_ register_as_ddf_fun(nic_data, &ne2k_dev_ops);399 rc = nic_connect_to_services(nic_data); 399 400 if (rc != EOK) { 400 401 ne2k_dev_cleanup(dev); … … 402 403 } 403 404 404 rc = nic_connect_to_services(nic_data);405 if ( rc != EOK) {405 fun = ddf_fun_create(nic_get_ddf_dev(nic_data), fun_exposed, "port0"); 406 if (fun == NULL) { 406 407 ne2k_dev_cleanup(dev); 408 return ENOMEM; 409 } 410 nic_set_ddf_fun(nic_data, fun); 411 ddf_fun_set_ops(fun, &ne2k_dev_ops); 412 ddf_fun_data_implant(fun, nic_data); 413 414 rc = ddf_fun_bind(fun); 415 if (rc != EOK) { 416 ddf_fun_destroy(fun); 417 ne2k_dev_cleanup(dev); 418 return rc; 419 } 420 421 rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC); 422 if (rc != EOK) { 423 ddf_fun_unbind(fun); 424 ddf_fun_destroy(fun); 407 425 return rc; 408 426 }
Note:
See TracChangeset
for help on using the changeset viewer.
