~kris/9p

9hist

f84a76ce2b7ace61a7777259c1e4dbc2c55f6834 — David du Colombier 25 years ago 3caf1cf
Plan 9 from Bell Labs 2001-09-07
5 files changed, 55 insertions(+), 46 deletions(-)

M pc/devpccard.c
M pc/etherwavelan.c
M pc/sdata.c
M pc/sdmylex.c
M port/devsd.c
M pc/devpccard.c => pc/devpccard.c +16 -15
@@ 329,8 329,8 @@ engine(cb_t *cb, int message)
			powerdown(cb);
			break;
		default:
			print("#Y%d: Invalid message %s in SlotFull state\n",
				(int)(cb - cbslots), messages[message]);
			//print("#Y%d: Invalid message %s in SlotFull state\n",
			//	(int)(cb - cbslots), messages[message]);
			break;
		}
		break;


@@ 453,8 453,12 @@ interrupt(Ureg *, void *)

		if (event & SE_CCD) {
			cb->cb_regs[SocketEvent] |= SE_CCD;	/* Ack interrupt */
			if (state & SE_CCD)
				iengine(cb, CardEjected);
			if (state & SE_CCD) {
				if (cb->cb_state != SlotEmpty) {
					print("#Y: take cardejected interrupt\n");
					iengine(cb, CardEjected);
				}
			}
			else
				iengine(cb, CardDetected);
		}


@@ 525,11 529,8 @@ devpccardlink(void)
		/* Don't really know what to do with this... */
		i82365probe(cb, LegacyAddr, LegacyAddr + 1);

		print("#Y%ld: %s, %.8ulX intl %d (%s%s)\n", cb - cbslots, 
			 variant[i].r_name, baddr, pci->intl,
			 states[cb->cb_state], 
			 (cb->cb_state == SlotEmpty)? "": 
			 (cb->cb_type == PC16)? "PCMCIA": "CB");
		print("#Y%ld: %s, %.8ulX intl %d\n", cb - cbslots, 
			 variant[i].r_name, baddr, pci->intl);
	}

	if (nslots == 0)


@@ 564,7 565,7 @@ powerup(cb_t *cb)

	if ((state = cb->cb_regs[SocketState]) & SS_PC16) {
	
		print("#Y%ld: Probed a PC16 card, powering up card\n", cb - cbslots);
		// print("#Y%ld: Probed a PC16 card, powering up card\n", cb - cbslots);
		cb->cb_type = PC16;
		memset(&cb->cb_linfo, 0, sizeof(pcminfo_t));



@@ 600,9 601,9 @@ powerup(cb_t *cb)
		return 0;
	}

	print("#Y%ld: card %spowered at %d volt\n", cb - cbslots, 
		(state & SS_POWER)? "": "not ", 
		(state & SS_3V)? 3: (state & SS_5V)? 5: -1);
	//print("#Y%ld: card %spowered at %d volt\n", cb - cbslots, 
	//	(state & SS_POWER)? "": "not ", 
	//	(state & SS_3V)? 3: (state & SS_5V)? 5: -1);

	/* Power up the card
	 * and make sure the secondary bus is not in reset.


@@ 645,7 646,7 @@ configure(cb_t *cb)
	int i;
	Pcidev *pci;

	print("configuring slot %d (%s)\n", (int)(cb - cbslots), states[cb->cb_state]);
	//print("configuring slot %d (%s)\n", (int)(cb - cbslots), states[cb->cb_state]);
	if (cb->cb_state == SlotConfigured)
		return;
	engine(cb, CardConfigured);


@@ 882,7 883,7 @@ pccard_pcmspecial(char *idstr, ISAConf *isa)
	}

	if (i == nslots) {
		print("#Y: %s not found\n", idstr);
		// print("#Y: %s not found\n", idstr);
		return -1;
	}


M pc/etherwavelan.c => pc/etherwavelan.c +22 -12
@@ 29,7 29,7 @@

#define DEBUG	if(1)print

#define SEEKEYS 1
#define SEEKEYS 0

typedef struct Ctlr	Ctlr;
typedef struct Wltv	Wltv;


@@ 114,7 114,9 @@ enum
	WTyp_Prom	= 0xfc85,
	WTyp_Keys	= 0xfcb0,
	WTyp_TxKey	= 0xfcb1,
	WTyp_StationID	= 0xfd20,
	WTyp_CurName	= 0xfd41,
	WTyp_BaseID	= 0xfd42,	// ID of the currently connected-to base station
	WTyp_CurTxRate	= 0xfd44,	// Current TX rate
	WTyp_HasCrypt	= 0xfd4f,
};


@@ 432,7 434,10 @@ ltv_outstr(Ctlr* ctlr, int type, char* val)
	memset(&ltv, 0, sizeof(ltv));
	ltv.len = (sizeof(ltv.type)+sizeof(ltv.slen)+sizeof(ltv.s))/2;
	ltv.type = type;

//	This should be ltv.slen = len; according to Axel Belinfante
	ltv.slen = (len+1) & ~1;

	strncpy(ltv.s, val, len);
	w_outltv(ctlr, &ltv);
}


@@ 912,7 917,7 @@ ifstat(Ether* ether, void* a, long n, ulong offset)
	k = ((ctlr->txbusy)? ", txbusy" : "");
	PRINTSTAT("%s\n", k);

	if (ctlr->txkey){
	if (ctlr->hascrypt){
		PRINTSTR("Keys: ");
		for (i = 0; i < WNKeys; i++){
			if (ctlr->keys.keys[i].len == 0)


@@ 940,8 945,16 @@ ifstat(Ether* ether, void* a, long n, ulong offset)
	PRINTSTAT("Promiscuous mode: %d\n", ltv_ins(ctlr, WTyp_Prom));
	if(i == 3)
		PRINTSTAT("SSID name: %s\n", ltv_inname(ctlr, WTyp_NetName));
	else
	else {
		Wltv ltv;
		PRINTSTAT("Current name: %s\n", ltv_inname(ctlr, WTyp_CurName));
		ltv.type = WTyp_BaseID;
		ltv.len = 4;
		if (w_inltv(ctlr, &ltv))
			print("#l%d: unable to read base station mac addr\n", ether->ctlrno);
		l += snprint(p+l, READSTR-l, "Base station: %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
			ltv.addr[0], ltv.addr[1], ltv.addr[2], ltv.addr[3], ltv.addr[4], ltv.addr[5]);
	}
	PRINTSTAT("Net name: %s\n", ltv_inname(ctlr, WTyp_WantName));
	PRINTSTAT("Node name: %s\n", ltv_inname(ctlr, WTyp_NodeName));
	if (ltv_ins(ctlr, WTyp_HasCrypt) == 0)


@@ 1168,11 1181,6 @@ reset(Ether* ether)
	Ctlr* ctlr;
	char *p;

	if (ether->ctlr){
		print("#l%d: only one card supported\n", ether->ctlrno);
		return -1;
	}

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



@@ 1191,11 1199,13 @@ reset(Ether* ether)
	}

	if ((ctlr->slot = pcmspecial("WaveLAN/IEEE", ether))<0){
		DEBUG("no wavelan found\n");
		goto abort;
		if ((ctlr->slot = pcmspecial("TrueMobile 1150", ether))<0){
			DEBUG("no wavelan found\n");
			goto abort;
		}
	}
//	DEBUG("#l%d: port=0x%lx irq=%ld\n",
//			ether->ctlrno, ether->port, ether->irq);
	// DEBUG("#l%d: port=0x%lx irq=%ld\n",
	//		ether->ctlrno, ether->port, ether->irq);

	w_intdis(ctlr);
	if (w_cmd(ctlr,WCmdIni,0)){

M pc/sdata.c => pc/sdata.c +4 -17
@@ 756,21 756,6 @@ tryedd1:
		goto release;
	}
	memset(sdev, 0, sizeof(SDev));
	if ((sdev->unit = (SDunit **)malloc(2 * sizeof(SDunit *))) == nil) {
		free(sdev);
		free(ctlr);
		free(drive);
		goto release;
	}
	memset(sdev->unit, 0, sizeof(SDunit *) * 2);
	if ((sdev->unitflg = (int *)malloc(2 * sizeof(int))) == nil) {
		free(sdev->unit);
		free(sdev);
		free(ctlr);
		free(drive);
		goto release;
	}
	memset(sdev->unitflg, 0, sizeof(int) * 2);
	drive->ctlr = ctlr;
	if(dev == Dev0){
		ctlr->drive[0] = drive;


@@ 825,8 810,10 @@ ataclear(SDev *sdev)
		free(ctlr->drive[1]);
	if (sdev->name)
		free(sdev->name);
	free(sdev->unitflg);
	free(sdev->unit);
	if (sdev->unitflg)
		free(sdev->unitflg);
	if (sdev->unit)
		free(sdev->unit);
	free(ctlr);
	free(sdev);
}

M pc/sdmylex.c => pc/sdmylex.c +3 -1
@@ 831,7 831,7 @@ mylexprobe(int port, int irq)
	if(ioalloc(port, 0x3, 0, "mylex") < 0)
		return nil;
	ctlr = nil;

	sdev = nil;
	/*
	 * Attempt to hard-reset the board and reset
	 * the SCSI bus. If the board state doesn't settle to


@@ 852,6 852,8 @@ mylexprobe(int port, int irq)
buggery:
		if(ctlr != nil)
			free(ctlr);
		if (sdev != nil)
			free(sdev);
		iofree(port);
		return nil;
	}

M port/devsd.c => port/devsd.c +10 -1
@@ 323,8 323,14 @@ sdreset(void)
			tail->next = sdev;
		else
			sdlist = sdev;
		for(tail = sdev; tail->next != nil; tail = tail->next)
		for(tail = sdev; tail->next != nil; tail = tail->next) {
			tail->unit = (SDunit **)malloc(tail->nunit * sizeof(SDunit *));
			tail->unitflg = (int *)malloc(tail->nunit * sizeof(int));
			assert(tail->unit && tail->unitflg);
			ndevs++;
		}
		tail->unit = (SDunit **)malloc(tail->nunit * sizeof(SDunit *));
		tail->unitflg = (int *)malloc(tail->nunit * sizeof(int));
		ndevs++;
	}
	


@@ 566,6 572,9 @@ sdgen(Chan* c, char*, Dirtab*, int, int s, Dir* dp)
		qunlock(&unit->ctl);
		decref(&sdev->r);
		return r;
	case Qtopctl:
	case Qtopstat:
		return sd1gen(c, TYPE(c->qid), dp);
	default:
		break;
	}