~kris/9p

9hist

c08e139ce921c071191b458c6388678300e24253 — David du Colombier 24 years ago 7fdc2a2
Plan 9 from Bell Labs 2002-02-16
3 files changed, 34 insertions(+), 30 deletions(-)

M pc/devusb.c
M pc/usb.h
M pc/usbuhci.c
M pc/devusb.c => pc/devusb.c +13 -12
@@ 1827,21 1827,24 @@ isoio(Endpt *e, void *a, long n, ulong offset, int w)
			if (e->psize > e->maxpkt)
				panic("packet size > maximum");
		}
		if((i = n) >= e->psize)
			i = e->psize;
		if (w)
			e->buffered += i;
		else{
			e->buffered -= i;
			if (e->buffered < 0)
				e->buffered = 0;
		}
		isolock = 0;
		iunlock(&activends);
		td->flags &= ~IsoClean;
		bp = e->bp0 + (td - e->td0) * e->maxpkt / e->pollms;
		q = bp + e->off;
		if((i = n) >= e->psize)
			i = e->psize;
		if (w){
			memmove(q, p, i);
			e->buffered += i;
		}else{
			memmove(p, q, i);
			e->buffered -= i;
			if (e->buffered < 0){
				XPRINT("e->buffered %d?\n", e->buffered);
				e->buffered = 0;
			}
		}
		p += i;
		n -= i;


@@ 1860,11 1863,9 @@ isoio(Endpt *e, void *a, long n, ulong offset, int w)
	} while(n > 0);
	n = p-(uchar*)a;
	e->foffset += n;
	if (isolock){
		isolock = 0;
		iunlock(&activends);
	}
	poperror();
	if (isolock)
		iunlock(&activends);
	qunlock(&e->rlock);
	return n;
}

M pc/usb.h => pc/usb.h +10 -6
@@ 116,7 116,6 @@ struct Udev
	int		state;
	int		id;
	uchar	port;		/* port number on connecting hub */
	uchar	root;
	ulong	csp;
	int		ls;
	int		npt;


@@ 125,14 124,19 @@ struct Udev
	Udev*	next;		/* next device on this hub */
};

/*
 * One of these per active Host Controller Interface (HCI)
 */
struct Usbhost
{
	ISAConf;			/* hardware info */
	ISAConf;					/* hardware info */
	int	tbdf;					/* type+busno+devno+funcno */

	int	ctlrno;
	int	tbdf;			/* type+busno+devno+funcno */
	QLock;					/* protects namespace state */
	int		idgen;			/* version number to distinguish new connections */
	Udev*	dev[MaxUsbDev];	/* device endpoints managed by this HCI */

	void	(*init)(Usbhost*);	/* filled in by reset routine */
	void	(*init)(Usbhost*);
	void	(*interrupt)(Ureg*, void*);

	void	(*portinfo)(Usbhost*, char*, char*);


@@ 151,4 155,4 @@ struct Usbhost
	void	*ctlr;
};

extern void addusbhost(char*, int(*)(Usbhost*));
extern void addusbtype(char*, int(*)(Usbhost*));

M pc/usbuhci.c => pc/usbuhci.c +11 -12
@@ 80,14 80,14 @@ static struct
}
portstatus[] =
{
	{ Suspend,		"Suspend", },
	{ PortReset,		"PortReset", },
	{ SlowDevice,		"SlowDevice", },
	{ ResumeDetect,	"ResumeDetect", },
	{ PortChange,		"PortChange", },
	{ PortEnable,		"PortEnable", },
	{ StatusChange,	"StatusChange", },
	{ DevicePresent,	"DevicePresent", },
	{ Suspend,		"suspend", },
	{ PortReset,		"reset", },
	{ SlowDevice,		"lowspeed", },
	{ ResumeDetect,	"resume", },
	{ PortChange,		"portchange", },
	{ PortEnable,		"enable", },
	{ StatusChange,	"statuschange", },
	{ DevicePresent,	"present", },
};

typedef struct Ctlr Ctlr;


@@ 396,9 396,8 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
	err = t->status & (AnyError&~NAKed);
	/* TO DO: on t->status&AnyError, q->entries will not have advanced */
	if (err) {
//		XPRINT("cleanTD: Error %8.8lux %8.8lux %8.8lux %8.8lux\n", t->link, t->status, t->dev, t->buffer);
		print("cleanTD: Error %8.8lux %8.8lux %8.8lux %8.8lux\n", t->link, t->status, t->dev, t->buffer);
print("real maxlen %d\n", t->ep->maxpkt);
		XPRINT("cleanTD: Error %8.8lux %8.8lux %8.8lux %8.8lux\n", t->link, t->status, t->dev, t->buffer);
//		print("cleanTD: Error %8.8lux %8.8lux %8.8lux %8.8lux\n", t->link, t->status, t->dev, t->buffer);
	}
	switch(t->dev&0xFF){
	case TokIN:


@@ 1527,5 1526,5 @@ reset(Usbhost *uh)
void
usbuhcilink(void)
{
	addusbhost("uhci", reset);
	addusbtype("uhci", reset);
}