Changeset c01bb5f9 in mainline for uspace/drv/nic/ne2k/ne2k.c


Ignore:
Timestamp:
2012-02-16T21:21:39Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
39aa8ce, 856a36b, 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.
Message:

Merge from lp:~jakub/helenos/mm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ne2k/ne2k.c

    redd7c63c rc01bb5f9  
    6464#define NE2K(device) ((ne2k_t *) nic_get_specific(DRIVER_DATA(device)))
    6565
     66static irq_pio_range_t ne2k_ranges_prototype[] = {
     67        {
     68                .base = 0,
     69                .size = NE2K_IO_SIZE,
     70        }
     71};
     72
    6673/** NE2000 kernel interrupt command sequence.
    6774 *
     
    122129
    123130        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);
    126144                        return ENOMEM;
    127145                }
    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;
    131150                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);
    135159                ne2k->code.cmds = ne2k_cmds;
    136160        }
     
    148172                ne2k_t *ne2k = NE2K(dev);
    149173                if (ne2k) {
     174                        free(ne2k->code.ranges);
    150175                        free(ne2k->code.cmds);
    151176                }
Note: See TracChangeset for help on using the changeset viewer.