]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/bitsy/etherwavelan.c
merge
[plan9front.git] / sys / src / 9 / bitsy / etherwavelan.c
1 /* Bitsy pcmcia code for wavelan.c */
2
3 #include "u.h"
4 #include "../port/lib.h"
5 #include "mem.h"
6 #include "dat.h"
7 #include "fns.h"
8 #include "io.h"
9 #include "../port/error.h"
10 #include "../port/netif.h"
11 #include "etherif.h"
12 #include "../pc/wavelan.h"
13
14 static int
15 wavelanpcmciareset(Ether *ether)
16 {
17         Ctlr *ctlr;
18
19         if((ctlr = malloc(sizeof(Ctlr))) == nil)
20                 return -1;
21
22         ilock(ctlr);
23         ctlr->ctlrno = ether->ctlrno;
24
25         if (ether->ports == nil){
26                 ether->ports = malloc(sizeof(Devport));
27                 ether->ports[0].port = 0;
28                 ether->ports[0].size = 0;
29                 ether->nports= 1;
30         }
31         if (ether->ports[0].port==0)
32                 ether->ports[0].port=WDfltIOB;
33         ctlr->iob = ether->ports[0].port;
34
35         if(wavelanreset(ether, ctlr) < 0){
36                 iunlock(ctlr);
37                 free(ctlr);
38                 ether->ctlr = nil;
39                 return -1;
40         }
41         iunlock(ctlr);
42         return 0;
43 }
44
45 void
46 etherwavelanlink(void)
47 {
48         addethercard("wavelan", wavelanpcmciareset);
49 }