Changeset c01bb5f9 in mainline for uspace/drv/nic
- Timestamp:
- 2012-02-16T21:21:39Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 39aa8ce, 856a36bb, f943dd3
- Parents:
- edd7c63c (diff), 21063c2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/drv/nic
- Files:
-
- 3 edited
-
e1k/e1k.c (modified) (3 diffs)
-
ne2k/ne2k.c (modified) (3 diffs)
-
rtl8139/driver.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/e1k/e1k.c
redd7c63c rc01bb5f9 228 228 static void e1000_send_frame(nic_t *, void *, size_t); 229 229 230 /** PIO ranges used in the IRQ code. */ 231 irq_pio_range_t e1000_irq_pio_ranges[] = { 232 { 233 .base = 0, 234 .size = PAGE_SIZE, /* XXX */ 235 } 236 }; 237 230 238 /** Commands to deal with interrupt 231 239 * … … 256 264 /** Interrupt code definition */ 257 265 irq_code_t e1000_irq_code = { 266 .rangecount = sizeof(e1000_irq_pio_ranges) / 267 sizeof(irq_pio_range_t), 268 .ranges = e1000_irq_pio_ranges, 258 269 .cmdcount = sizeof(e1000_irq_commands) / sizeof(irq_cmd_t), 259 270 .cmds = e1000_irq_commands … … 1252 1263 fibril_mutex_lock(&irq_reg_mutex); 1253 1264 1254 e1000_irq_code.cmds[0].addr = e1000->reg_base_virt + E1000_ICR; 1255 e1000_irq_code.cmds[2].addr = e1000->reg_base_virt + E1000_IMC; 1265 e1000_irq_code.ranges[0].base = (uintptr_t) e1000->reg_base_phys; 1266 e1000_irq_code.cmds[0].addr = e1000->reg_base_phys + E1000_ICR; 1267 e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC; 1256 1268 1257 1269 int rc = register_interrupt_handler(nic_get_ddf_dev(nic), -
uspace/drv/nic/ne2k/ne2k.c
redd7c63c rc01bb5f9 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 } -
uspace/drv/nic/rtl8139/driver.c
redd7c63c rc01bb5f9 661 661 662 662 663 irq_pio_range_t rtl8139_irq_pio_ranges[] = { 664 { 665 .base = 0, 666 .size = RTL8139_IO_SIZE 667 } 668 }; 663 669 664 670 /** Commands to deal with interrupt … … 670 676 */ 671 677 irq_cmd_t rtl8139_irq_commands[] = { 672 {673 /* Get the interrupt status */674 .cmd = CMD_PIO_READ_16,675 .addr = NULL,676 .dstarg = 2677 },678 {679 .cmd = CMD_PREDICATE,680 .value = 3,681 .srcarg = 2682 },683 {684 /* Mark interrupts as solved */685 .cmd = CMD_PIO_WRITE_16,686 .addr = NULL,687 .value = 0xFFFF688 },689 {690 /* Disable interrupts until interrupt routine is finished */691 .cmd = CMD_PIO_WRITE_16,692 .addr = NULL,693 .value = 0x0000694 },695 {696 .cmd = CMD_ACCEPT697 }678 { 679 /* Get the interrupt status */ 680 .cmd = CMD_PIO_READ_16, 681 .addr = NULL, 682 .dstarg = 2 683 }, 684 { 685 .cmd = CMD_PREDICATE, 686 .value = 3, 687 .srcarg = 2 688 }, 689 { 690 /* Mark interrupts as solved */ 691 .cmd = CMD_PIO_WRITE_16, 692 .addr = NULL, 693 .value = 0xFFFF 694 }, 695 { 696 /* Disable interrupts until interrupt routine is finished */ 697 .cmd = CMD_PIO_WRITE_16, 698 .addr = NULL, 699 .value = 0x0000 700 }, 701 { 702 .cmd = CMD_ACCEPT 703 } 698 704 }; 699 705 700 706 /** Interrupt code definition */ 701 707 irq_code_t rtl8139_irq_code = { 702 .cmdcount = sizeof(rtl8139_irq_commands)/sizeof(irq_cmd_t), 708 .rangecount = sizeof(rtl8139_irq_pio_ranges) / sizeof(irq_pio_range_t), 709 .ranges = rtl8139_irq_pio_ranges, 710 .cmdcount = sizeof(rtl8139_irq_commands) / sizeof(irq_cmd_t), 703 711 .cmds = rtl8139_irq_commands 704 712 }; … … 890 898 RTL8139_IRQ_STRUCT_LOCK(); 891 899 892 rtl8139_irq_code.cmds[0].addr = rtl8139->io_port + ISR; 893 rtl8139_irq_code.cmds[2].addr = rtl8139->io_port + ISR; 894 rtl8139_irq_code.cmds[3].addr = rtl8139->io_port + IMR; 900 rtl8139_irq_code.ranges[0].base = (uintptr_t) rtl8139->io_addr; 901 rtl8139_irq_code.cmds[0].addr = rtl8139->io_addr + ISR; 902 rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR; 903 rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR; 895 904 int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data), 896 rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code);905 rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code); 897 906 898 907 RTL8139_IRQ_STRUCT_UNLOCK();
Note:
See TracChangeset
for help on using the changeset viewer.
