• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisione8d79dcb72f7625af8ad5d6542982f6a3b86dfc8 (tree)
Zeit2016-05-22 22:22:56
AutorYoshinori Sato <ysato@user...>
CommiterYoshinori Sato

Log Message

ne2000: private data for dynamic allocation

driver private data assigned to heap

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

Ändern Zusammenfassung

Diff

--- a/drivers/net/8390.h
+++ b/drivers/net/8390.h
@@ -41,8 +41,8 @@ are GPL, so this is, of course, GPL.
4141 * - removed AMIGA_PCMCIA from this list, handled as ISA io now
4242 */
4343
44-#define n2k_inb(port) (*((volatile unsigned char *)(port+CONFIG_DRIVER_NE2000_BASE)))
45-#define n2k_outb(val,port) (*((volatile unsigned char *)(port+CONFIG_DRIVER_NE2000_BASE)) = val)
44+#define n2k_inb(base, port) (*((volatile unsigned char *)(port+base)))
45+#define n2k_outb(val, base, port) (*((volatile unsigned char *)(port+base)) = val)
4646
4747 #define EI_SHIFT(x) (x)
4848
--- a/drivers/net/ne2000.c
+++ b/drivers/net/ne2000.c
@@ -178,23 +178,23 @@ static void pcnet_reset_8390(u8* addr)
178178 {
179179 int i, r;
180180
181- n2k_outb(E8390_NODMA + E8390_PAGE0+E8390_STOP, E8390_CMD);
182- PRINTK("cmd (at %lx) is %x\n", addr + E8390_CMD, n2k_inb(E8390_CMD));
183- n2k_outb(E8390_NODMA+E8390_PAGE1+E8390_STOP, E8390_CMD);
184- PRINTK("cmd (at %lx) is %x\n", addr + E8390_CMD, n2k_inb(E8390_CMD));
185- n2k_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD);
186- PRINTK("cmd (at %lx) is %x\n", addr + E8390_CMD, n2k_inb(E8390_CMD));
187- n2k_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD);
181+ n2k_outb(E8390_NODMA + E8390_PAGE0+E8390_STOP, addr, E8390_CMD);
182+ PRINTK("cmd (at %lx) is %x\n", addr + E8390_CMD, n2k_inb(addr,E8390_CMD));
183+ n2k_outb(E8390_NODMA+E8390_PAGE1+E8390_STOP, addr, E8390_CMD);
184+ PRINTK("cmd (at %lx) is %x\n", addr + E8390_CMD, n2k_inb(addr, E8390_CMD));
185+ n2k_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr, E8390_CMD);
186+ PRINTK("cmd (at %lx) is %x\n", addr + E8390_CMD, n2k_inb(addr, E8390_CMD));
187+ n2k_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr, E8390_CMD);
188188
189- n2k_outb(n2k_inb(PCNET_RESET), PCNET_RESET);
189+ n2k_outb(n2k_inb(addr, PCNET_RESET), addr, PCNET_RESET);
190190
191191 for (i = 0; i < 100; i++) {
192- if ((r = (n2k_inb(EN0_ISR) & ENISR_RESET)) != 0)
192+ if ((r = (n2k_inb(addr, EN0_ISR) & ENISR_RESET)) != 0)
193193 break;
194194 PRINTK("got %x in reset\n", r);
195195 udelay(100);
196196 }
197- n2k_outb(ENISR_RESET, EN0_ISR); /* Ack intr. */
197+ n2k_outb(ENISR_RESET, addr, EN0_ISR); /* Ack intr. */
198198
199199 if (i == 100)
200200 printf("pcnet_reset_8390() did not complete.\n");
@@ -229,11 +229,11 @@ int get_prom(u8* mac_addr, u8* base_addr)
229229 mdelay (10);
230230
231231 for (i = 0; i < ARRAY_SIZE(program_seq); i++)
232- n2k_outb (program_seq[i].value, program_seq[i].offset);
232+ n2k_outb (program_seq[i].value, base_addr, program_seq[i].offset);
233233
234234 PRINTK ("PROM:");
235235 for (i = 0; i < 32; i++) {
236- prom[i] = n2k_inb (PCNET_DATAPORT);
236+ prom[i] = n2k_inb (base_addr, PCNET_DATAPORT);
237237 PRINTK (" %02x", prom[i]);
238238 }
239239 PRINTK ("\n");
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -78,10 +78,6 @@ Add SNMP
7878 #include <malloc.h>
7979 #include <linux/compiler.h>
8080
81-/* forward definition of function used for the uboot interface */
82-void uboot_push_packet_len(int len);
83-void uboot_push_tx_done(int key, int val);
84-
8581 /* NE2000 base header file */
8682 #include "ne2000_base.h"
8783
@@ -93,24 +89,23 @@ void uboot_push_tx_done(int key, int val);
9389 #include "ne2000.h"
9490 #endif
9591
96-static dp83902a_priv_data_t nic; /* just one instance of the card supported */
92+/* forward definition of function used for the uboot interface */
93+static void uboot_push_packet_len(dp83902a_priv_data_t *dp, u8 *base, int len);
94+static void uboot_push_tx_done(dp83902a_priv_data_t *dp, int key, int val);
9795
9896 /**
9997 * This function reads the MAC address from the serial EEPROM,
10098 * used if PROM read fails. Does nothing for ax88796 chips (sh boards)
10199 */
102100 static bool
103-dp83902a_init(unsigned char *enetaddr)
101+dp83902a_init(u8 *base, u8 enetaddr[])
104102 {
105- dp83902a_priv_data_t *dp = &nic;
106- u8* base;
107103 #if defined(NE2000_BASIC_INIT)
108104 int i;
109105 #endif
110106
111107 DEBUG_FUNCTION();
112108
113- base = dp->base;
114109 if (!base)
115110 return false; /* No device found */
116111
@@ -122,29 +117,25 @@ dp83902a_init(unsigned char *enetaddr)
122117 DP_OUT(base, DP_CR, DP_CR_NODMA | DP_CR_PAGE1); /* Select page 1 */
123118 /* Use the address from the serial EEPROM */
124119 for (i = 0; i < 6; i++)
125- DP_IN(base, DP_P1_PAR0+i, dp->esa[i]);
120+ DP_IN(base, DP_P1_PAR0+i, enetaddr[i]);
126121 DP_OUT(base, DP_CR, DP_CR_NODMA | DP_CR_PAGE0); /* Select page 0 */
127122
128123 printf("NE2000 - %s ESA: %02x:%02x:%02x:%02x:%02x:%02x\n",
129124 "eeprom",
130- dp->esa[0],
131- dp->esa[1],
132- dp->esa[2],
133- dp->esa[3],
134- dp->esa[4],
135- dp->esa[5] );
136-
137- memcpy(enetaddr, dp->esa, 6); /* Use MAC from serial EEPROM */
125+ enetaddr[0],
126+ enetaddr[1],
127+ enetaddr[2],
128+ enetaddr[3],
129+ enetaddr[4],
130+ enetaddr[5] );
131+
138132 #endif /* NE2000_BASIC_INIT */
139133 return true;
140134 }
141135
142136 static void
143-dp83902a_stop(void)
137+dp83902a_stop(dp83902a_priv_data_t *dp, u8 *base)
144138 {
145- dp83902a_priv_data_t *dp = &nic;
146- u8 *base = dp->base;
147-
148139 DEBUG_FUNCTION();
149140
150141 DP_OUT(base, DP_CR, DP_CR_PAGE0 | DP_CR_NODMA | DP_CR_STOP); /* Brutal */
@@ -161,13 +152,11 @@ dp83902a_stop(void)
161152 * the hardware ready to send/receive packets.
162153 */
163154 static void
164-dp83902a_start(u8 * enaddr)
155+dp83902a_start(dp83902a_priv_data_t *dp, u8 *base, u8 enetaddr[])
165156 {
166- dp83902a_priv_data_t *dp = &nic;
167- u8 *base = dp->base;
168157 int i;
169158
170- debug("The MAC is %pM\n", enaddr);
159+ debug("The MAC is %pM\n", enetaddr);
171160
172161 DEBUG_FUNCTION();
173162
@@ -196,7 +185,7 @@ dp83902a_start(u8 * enaddr)
196185 /* FIXME */
197186 /*((vu_short*)( base + ((DP_P1_PAR0 + i) * 2) +
198187 * 0x1400)) = enaddr[i];*/
199- DP_OUT(base, DP_P1_PAR0+i, enaddr[i]);
188+ DP_OUT(base, DP_P1_PAR0+i, enetaddr[i]);
200189 }
201190 /* Enable and start device */
202191 DP_OUT(base, DP_CR, DP_CR_PAGE0 | DP_CR_NODMA | DP_CR_START);
@@ -212,10 +201,9 @@ dp83902a_start(u8 * enaddr)
212201 */
213202
214203 static void
215-dp83902a_start_xmit(int start_page, int len)
204+dp83902a_start_xmit(dp83902a_priv_data_t *dp, u8 *base,
205+ int start_page, int len)
216206 {
217- dp83902a_priv_data_t *dp = (dp83902a_priv_data_t *) &nic;
218- u8 *base = dp->base;
219207
220208 DEBUG_FUNCTION();
221209
@@ -240,10 +228,9 @@ dp83902a_start_xmit(int start_page, int len)
240228 * that there is free buffer space (dp->tx_next).
241229 */
242230 static void
243-dp83902a_send(u8 *data, int total_len, u32 key)
231+dp83902a_send(dp83902a_priv_data_t *dp, u8 *base,
232+ u8 *data, int total_len, u32 key)
244233 {
245- struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
246- u8 *base = dp->base;
247234 int len, start_page, pkt_len, i, isr;
248235 #if DEBUG & 4
249236 int dx;
@@ -288,7 +275,7 @@ dp83902a_send(u8 *data, int total_len, u32 key)
288275 DP_OUT(base, DP_RBCL, len);
289276 DP_OUT(base, DP_RBCH, 0);
290277 DP_OUT(base, DP_CR, DP_CR_PAGE0 | DP_CR_RDMA | DP_CR_START);
291- DP_IN_DATA(dp->data, tmp);
278+ DP_IN_DATA(base + DP_DATA, tmp);
292279 }
293280
294281 #ifdef CYGHWR_NS_DP83902A_PLF_BROKEN_TX_DMA
@@ -317,7 +304,7 @@ dp83902a_send(u8 *data, int total_len, u32 key)
317304 if (0 == (++dx % 16)) printf("\n ");
318305 #endif
319306
320- DP_OUT_DATA(dp->data, *data++);
307+ DP_OUT_DATA(base + DP_DATA, *data++);
321308 len--;
322309 }
323310 #if DEBUG & 4
@@ -330,7 +317,7 @@ dp83902a_send(u8 *data, int total_len, u32 key)
330317 /* Padding to 802.3 length was required */
331318 for (i = total_len; i < pkt_len;) {
332319 i++;
333- DP_OUT_DATA(dp->data, 0);
320+ DP_OUT_DATA(base + DP_DATA, 0);
334321 }
335322 }
336323
@@ -358,7 +345,7 @@ dp83902a_send(u8 *data, int total_len, u32 key)
358345 } else {
359346 dp->tx_int = 2; /* Expecting interrupt from BUF2 */
360347 }
361- dp83902a_start_xmit(start_page, pkt_len);
348+ dp83902a_start_xmit(dp, base, start_page, pkt_len);
362349 }
363350 }
364351
@@ -370,10 +357,8 @@ dp83902a_send(u8 *data, int total_len, u32 key)
370357 * 'dp83902a_recv' will be called to actually fetch it from the hardware.
371358 */
372359 static void
373-dp83902a_RxEvent(void)
360+dp83902a_RxEvent(dp83902a_priv_data_t *dp, u8 *base)
374361 {
375- struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
376- u8 *base = dp->base;
377362 __maybe_unused u8 rsr;
378363 u8 rcv_hdr[4];
379364 int i, len, pkt, cur;
@@ -415,7 +400,7 @@ dp83902a_RxEvent(void)
415400
416401 /* read header (get data size)*/
417402 for (i = 0; i < sizeof(rcv_hdr);) {
418- DP_IN_DATA(dp->data, rcv_hdr[i++]);
403+ DP_IN_DATA(base + DP_DATA, rcv_hdr[i++]);
419404 }
420405
421406 #if DEBUG & 5
@@ -425,7 +410,7 @@ dp83902a_RxEvent(void)
425410 len = ((rcv_hdr[3] << 8) | rcv_hdr[2]) - sizeof(rcv_hdr);
426411
427412 /* data read */
428- uboot_push_packet_len(len);
413+ uboot_push_packet_len(dp, base, len);
429414
430415 if (rcv_hdr[1] == dp->rx_buf_start)
431416 DP_OUT(base, DP_BNDRY, dp->rx_buf_end - 1);
@@ -442,10 +427,8 @@ dp83902a_RxEvent(void)
442427 * efficient processing in the upper layers of the stack.
443428 */
444429 static void
445-dp83902a_recv(u8 *data, int len)
430+dp83902a_recv(dp83902a_priv_data_t *dp, u8 *base, u8 *data, int len)
446431 {
447- struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
448- u8 *base = dp->base;
449432 int i, mlen;
450433 u8 saved_char = 0;
451434 bool saved;
@@ -490,7 +473,7 @@ dp83902a_recv(u8 *data, int len)
490473
491474 {
492475 u8 tmp;
493- DP_IN_DATA(dp->data, tmp);
476+ DP_IN_DATA(base + DP_DATA, tmp);
494477 #if DEBUG & 4
495478 printf(" %02x", tmp);
496479 if (0 == (++dx % 16)) printf("\n ");
@@ -507,10 +490,8 @@ dp83902a_recv(u8 *data, int len)
507490 }
508491
509492 static void
510-dp83902a_TxEvent(void)
493+dp83902a_TxEvent(dp83902a_priv_data_t *dp, u8 *base)
511494 {
512- struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
513- u8 *base = dp->base;
514495 __maybe_unused u8 tsr;
515496 u32 key;
516497
@@ -527,16 +508,16 @@ dp83902a_TxEvent(void)
527508 /* Start next packet if one is ready */
528509 dp->tx_started = false;
529510 if (dp->tx1) {
530- dp83902a_start_xmit(dp->tx1, dp->tx1_len);
511+ dp83902a_start_xmit(dp, base, dp->tx1, dp->tx1_len);
531512 dp->tx_int = 1;
532513 } else if (dp->tx2) {
533- dp83902a_start_xmit(dp->tx2, dp->tx2_len);
514+ dp83902a_start_xmit(dp, base, dp->tx2, dp->tx2_len);
534515 dp->tx_int = 2;
535516 } else {
536517 dp->tx_int = 0;
537518 }
538519 /* Tell higher level we sent this packet */
539- uboot_push_tx_done(key, 0);
520+ uboot_push_tx_done(dp, key, 0);
540521 }
541522
542523 /*
@@ -544,10 +525,8 @@ dp83902a_TxEvent(void)
544525 * interrupt.
545526 */
546527 static void
547-dp83902a_ClearCounters(void)
528+dp83902a_ClearCounters(u8 *base)
548529 {
549- struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
550- u8 *base = dp->base;
551530 __maybe_unused u8 cnt1, cnt2, cnt3;
552531
553532 DP_IN(base, DP_FER, cnt1);
@@ -561,10 +540,8 @@ dp83902a_ClearCounters(void)
561540 * out in section 7.0 of the datasheet.
562541 */
563542 static void
564-dp83902a_Overflow(void)
543+dp83902a_Overflow(dp83902a_priv_data_t *dp, u8 *base)
565544 {
566- struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *)&nic;
567- u8 *base = dp->base;
568545 u8 isr;
569546
570547 /* Issue a stop command and wait 1.6ms for it to complete. */
@@ -584,7 +561,7 @@ dp83902a_Overflow(void)
584561 * interrupts. Since the buffer has overflowed, a receive event of
585562 * some kind will have occurred.
586563 */
587- dp83902a_RxEvent();
564+ dp83902a_RxEvent(dp, base);
588565 DP_OUT(base, DP_ISR, DP_ISR_RxP|DP_ISR_RxE);
589566
590567 /* Clear the overflow condition and leave loopback mode. */
@@ -602,10 +579,8 @@ dp83902a_Overflow(void)
602579 }
603580
604581 static void
605-dp83902a_poll(void)
582+dp83902a_poll(dp83902a_priv_data_t *dp, u8 *base)
606583 {
607- struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
608- u8 *base = dp->base;
609584 u8 isr;
610585
611586 DP_OUT(base, DP_CR, DP_CR_NODMA | DP_CR_PAGE0 | DP_CR_START);
@@ -617,7 +592,7 @@ dp83902a_poll(void)
617592 * we should read their values to reset them.
618593 */
619594 if (isr & DP_ISR_CNT) {
620- dp83902a_ClearCounters();
595+ dp83902a_ClearCounters(base);
621596 }
622597 /*
623598 * Check for overflow. It's a special case, since there's a
@@ -625,7 +600,7 @@ dp83902a_poll(void)
625600 * a running state.a
626601 */
627602 if (isr & DP_ISR_OFLW) {
628- dp83902a_Overflow();
603+ dp83902a_Overflow(dp, base);
629604 } else {
630605 /*
631606 * Other kinds of interrupts can be acknowledged simply by
@@ -639,10 +614,10 @@ dp83902a_poll(void)
639614 * spuriously it seems.
640615 */
641616 if (isr & (DP_ISR_TxP|DP_ISR_TxE) && dp->tx_started) {
642- dp83902a_TxEvent();
617+ dp83902a_TxEvent(dp, base);
643618 }
644619 if (isr & (DP_ISR_RxP|DP_ISR_RxE)) {
645- dp83902a_RxEvent();
620+ dp83902a_RxEvent(dp, base);
646621 }
647622 }
648623 DP_IN(base, DP_ISR, isr);
@@ -651,26 +626,24 @@ dp83902a_poll(void)
651626
652627
653628 /* U-Boot specific routines */
654-static u8 *pbuf = NULL;
655-
656-static int pkey = -1;
657-static int initialized = 0;
658629
659-void uboot_push_packet_len(int len) {
630+static void uboot_push_packet_len(dp83902a_priv_data_t *dp, u8 *base, int len)
631+{
660632 PRINTK("pushed len = %d\n", len);
661633 if (len >= 2000) {
662634 printf("NE2000: packet too big\n");
663635 return;
664636 }
665- dp83902a_recv(&pbuf[0], len);
637+ dp83902a_recv(dp, base, dp->pbuf, len);
666638
667639 /*Just pass it to the upper layer*/
668- net_process_received_packet(&pbuf[0], len);
640+ net_process_received_packet(dp->pbuf, len);
669641 }
670642
671-void uboot_push_tx_done(int key, int val) {
643+void uboot_push_tx_done(dp83902a_priv_data_t *dp, int key, int val)
644+{
672645 PRINTK("pushed key = %d\n", key);
673- pkey = key;
646+ dp->pkey = key;
674647 }
675648
676649 /**
@@ -680,13 +653,13 @@ void uboot_push_tx_done(int key, int val) {
680653 * @param struct ethdevice of this instance of the driver for dev->enetaddr
681654 * @return 0 on success, -1 on error (causing caller to print error msg)
682655 */
683-static int ne2k_setup_driver(struct eth_device *dev)
656+static int ne2k_setup_driver(dp83902a_priv_data_t *dp, u8 *base, u8 enetaddr[])
684657 {
685658 PRINTK("### ne2k_setup_driver\n");
686659
687- if (!pbuf) {
688- pbuf = malloc(2000);
689- if (!pbuf) {
660+ if (!dp->pbuf) {
661+ dp->pbuf = malloc(2000);
662+ if (!dp->pbuf) {
690663 printf("Cannot allocate rx buffer\n");
691664 return -1;
692665 }
@@ -702,66 +675,70 @@ static int ne2k_setup_driver(struct eth_device *dev)
702675 }
703676 #endif
704677
705- nic.base = (u8 *) CONFIG_DRIVER_NE2000_BASE;
706-
707- nic.data = nic.base + DP_DATA;
708- nic.tx_buf1 = START_PG;
709- nic.tx_buf2 = START_PG2;
710- nic.rx_buf_start = RX_START;
711- nic.rx_buf_end = RX_END;
678+ dp->tx_buf1 = START_PG;
679+ dp->tx_buf2 = START_PG2;
680+ dp->rx_buf_start = RX_START;
681+ dp->rx_buf_end = RX_END;
712682
713683 /*
714684 * According to doc/README.enetaddr, drivers shall give priority
715685 * to the MAC address value in the environment, so we do not read
716686 * it from the prom or eeprom if it is specified in the environment.
717687 */
718- if (!eth_getenv_enetaddr("ethaddr", dev->enetaddr)) {
688+ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
719689 /* If the MAC address is not in the environment, get it: */
720- if (!get_prom(dev->enetaddr, nic.base)) /* get MAC from prom */
721- dp83902a_init(dev->enetaddr); /* fallback: seeprom */
690+ if (!get_prom(enetaddr, base)) /* get MAC from prom */
691+ dp83902a_init(base, enetaddr); /* fallback: seeprom */
722692 /* And write it into the environment otherwise eth_write_hwaddr
723693 * returns -1 due to eth_getenv_enetaddr_by_index() failing,
724694 * and this causes "Warning: failed to set MAC address", and
725695 * cmd_bdinfo has no ethaddr value which it can show: */
726- eth_setenv_enetaddr("ethaddr", dev->enetaddr);
696+ eth_setenv_enetaddr("ethaddr", enetaddr);
727697 }
728698 return 0;
729699 }
730700
731701 static int ne2k_init(struct eth_device *dev, bd_t *bd)
732702 {
733- dp83902a_start(dev->enetaddr);
734- initialized = 1;
703+ struct dp83902a_priv_data *dp = dev->priv;
704+
705+ dp83902a_start(dp, (u8 *)dev->iobase, dev->enetaddr);
706+ dp->initialized = 1;
735707 return 0;
736708 }
737709
738710 static void ne2k_halt(struct eth_device *dev)
739711 {
712+ struct dp83902a_priv_data *dp = dev->priv;
713+
740714 debug("### ne2k_halt\n");
741- if(initialized)
742- dp83902a_stop();
743- initialized = 0;
715+ if(dp->initialized)
716+ dp83902a_stop(dp, (u8 *)dev->iobase);
717+ dp->initialized = 0;
744718 }
745719
746720 static int ne2k_recv(struct eth_device *dev)
747721 {
748- dp83902a_poll();
722+ struct dp83902a_priv_data *dp = dev->priv;
723+
724+ dp83902a_poll(dp, (u8 *)dev->iobase);
749725 return 1;
750726 }
751727
752728 static int ne2k_send(struct eth_device *dev, void *packet, int length)
753729 {
730+ struct dp83902a_priv_data *dp = dev->priv;
754731 int tmo;
755732
756733 debug("### ne2k_send\n");
757734
758- pkey = -1;
735+ dp->pkey = -1;
759736
760- dp83902a_send((u8 *) packet, length, 666);
737+ dp83902a_send(dp, (u8 *)dev->iobase, (u8 *) packet, length, 666);
761738 tmo = get_timer (0) + TOUT * CONFIG_SYS_HZ;
762739 while(1) {
763- dp83902a_poll();
764- if (pkey != -1) {
740+ dp83902a_poll(dp, (u8 *)dev->iobase);
741+ if (dp->pkey != -1) {
765742 PRINTK("Packet sucesfully sent\n");
766743 return 0;
767744 }
@@ -785,8 +762,14 @@ int ne2k_register(void)
785762 dev = calloc(sizeof(*dev), 1);
786763 if (dev == NULL)
787764 return -1;
765+ dev->priv = calloc(sizeof(struct dp83902a_priv_data), 1);
766+ if (dev == NULL)
767+ return -1;
788768
789- if (ne2k_setup_driver(dev))
769+ dev->iobase = CONFIG_DRIVER_NE2000_BASE;
770+ if (ne2k_setup_driver((struct dp83902a_priv_data *)dev->priv,
771+ (u8 *)dev->iobase,
772+ dev->enetaddr))
790773 return -1;
791774
792775 dev->init = ne2k_init;
--- a/drivers/net/ne2000_base.h
+++ b/drivers/net/ne2000_base.h
@@ -122,9 +122,6 @@ typedef struct hw_info_t {
122122 } hw_info_t;
123123
124124 typedef struct dp83902a_priv_data {
125- u8* base;
126- u8* data;
127- u8* reset;
128125 int tx_next; /* First free Tx page */
129126 int tx_int; /* Expecting interrupt from this buffer */
130127 int rx_next; /* First free Rx page */
@@ -132,12 +129,15 @@ typedef struct dp83902a_priv_data {
132129 u32 tx1_key, tx2_key; /* Used to ack when packet sent */
133130 int tx1_len, tx2_len;
134131 bool tx_started, running, hardwired_esa;
135- u8 esa[6];
136132 void* plf_priv;
137133
138134 /* Buffer allocation */
139135 int tx_buf1, tx_buf2;
140136 int rx_buf_start, rx_buf_end;
137+ unsigned char *pbuf;
138+ int initialized;
139+ int pkey;
140+
141141 } dp83902a_priv_data_t;
142142
143143 /* ------------------------------------------------------------------------ */