Changes in uspace/drv/nic/ne2k/ne2k.c [80099c19:9571230] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ne2k/ne2k.c
r80099c19 r9571230 64 64 #define NE2K(device) ((ne2k_t *) nic_get_specific(DRIVER_DATA(device))) 65 65 66 static irq_pio_range_t ne2k_ranges_prototype[] = { 67 { 68 .base = 0, 69 .size = NE2K_IO_SIZE, 70 } 71 }; 72 66 73 /** NE2000 kernel interrupt command sequence. 67 74 * … … 122 129 123 130 if (ne2k->code.cmdcount == 0) { 124 irq_cmd_t *ne2k_cmds = malloc(sizeof(ne2k_cmds_prototype)); 125 if (ne2k_cmds == NULL) { 131 irq_pio_range_t *ne2k_ranges; 132 irq_cmd_t *ne2k_cmds; 133 134 ne2k_ranges = malloc(sizeof(ne2k_ranges_prototype)); 135 if (!ne2k_ranges) 136 return ENOMEM; 137 memcpy(ne2k_ranges, ne2k_ranges_prototype, 138 sizeof(ne2k_ranges_prototype)); 139 ne2k_ranges[0].base = (uintptr_t) ne2k->base_port; 140 141 ne2k_cmds = malloc(sizeof(ne2k_cmds_prototype)); 142 if (!ne2k_cmds) { 143 free(ne2k_ranges); 126 144 return ENOMEM; 127 145 } 128 memcpy(ne2k_cmds, ne2k_cmds_prototype, sizeof (ne2k_cmds_prototype)); 129 ne2k_cmds[0].addr = ne2k->port + DP_ISR; 130 ne2k_cmds[3].addr = ne2k->port + DP_IMR; 146 memcpy(ne2k_cmds, ne2k_cmds_prototype, 147 sizeof(ne2k_cmds_prototype)); 148 ne2k_cmds[0].addr = ne2k->base_port + DP_ISR; 149 ne2k_cmds[3].addr = ne2k->base_port + DP_IMR; 131 150 ne2k_cmds[4].addr = ne2k_cmds[0].addr; 132 ne2k_cmds[5].addr = ne2k->port + DP_TSR; 133 134 ne2k->code.cmdcount = sizeof(ne2k_cmds_prototype) / sizeof(irq_cmd_t); 151 ne2k_cmds[5].addr = ne2k->base_port + DP_TSR; 152 153 ne2k->code.rangecount = sizeof(ne2k_ranges_prototype) / 154 sizeof(irq_pio_range_t); 155 ne2k->code.ranges = ne2k_ranges; 156 157 ne2k->code.cmdcount = sizeof(ne2k_cmds_prototype) / 158 sizeof(irq_cmd_t); 135 159 ne2k->code.cmds = ne2k_cmds; 136 160 } … … 148 172 ne2k_t *ne2k = NE2K(dev); 149 173 if (ne2k) { 174 free(ne2k->code.ranges); 150 175 free(ne2k->code.cmds); 151 176 } … … 336 361 } 337 362 338 static int ne2k_ add_device(ddf_dev_t *dev)363 static int ne2k_dev_add(ddf_dev_t *dev) 339 364 { 340 365 /* Allocate driver data for the device. */ … … 343 368 return ENOMEM; 344 369 345 nic_set_ write_packet_handler(nic_data, ne2k_send);370 nic_set_send_frame_handler(nic_data, ne2k_send); 346 371 nic_set_state_change_handlers(nic_data, 347 372 ne2k_on_activating, NULL, ne2k_on_stopping); … … 391 416 392 417 static driver_ops_t ne2k_driver_ops = { 393 . add_device = ne2k_add_device418 .dev_add = ne2k_dev_add 394 419 }; 395 420
Note:
See TracChangeset
for help on using the changeset viewer.