~kris/9p

9hist

ref: cf9231140406536603da3b1517c38e4e159e8921 9hist/bitsy/etherwavelan.c -rw-r--r-- 869 bytes
cf923114 — David du Colombier Plan 9 from Bell Labs 2003-01-18 23 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Bitsy pcmcia code for wavelan.c */

#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"
#include "../port/error.h"
#include "../port/netif.h"
#include "etherif.h"
#include "../pc/wavelan.h"

static int
wavelanpcmciareset(Ether *ether)
{
	Ctlr *ctlr;

	if((ctlr = malloc(sizeof(Ctlr))) == nil)
		return -1;

	ilock(ctlr);
	ctlr->ctlrno = ether->ctlrno;

	if (ether->ports == nil){
		ether->ports = malloc(sizeof(port_t));
		ether->ports[0].port = 0;
		ether->ports[0].size = 0;
		ether->nports= 1;
	}
	if (ether->ports[0].port==0)
		ether->ports[0].port=WDfltIOB;
	ctlr->iob = ether->ports[0].port;

	if(wavelanreset(ether, ctlr) < 0){
		iunlock(ctlr);
		free(ctlr);
		ether->ctlr = nil;
		return -1;
	}
	iunlock(ctlr);
	return 0;
}

void
etherwavelanlink(void)
{
	addethercard("wavelan", wavelanpcmciareset);
}