shithub: riscv

Download patch

ref: ad3da2fac222b42f06576262130b9f1f201b585c
parent: c3938067180ed707828cdbcd0b2d430a13323dd9
parent: 55033d9aedd86ab398644d188ae826cb537a52c7
author: Alex Musolino <[email protected]>
date: Wed Apr 1 18:57:15 EDT 2020

merge

--- a/sys/man/3/kbd
+++ b/sys/man/3/kbd
@@ -7,7 +7,6 @@
 
 .B /dev/scancode
 .B /dev/leds
-.B /dev/repeat
 .fi
 .SH DESCRIPTION
 .PP
@@ -14,10 +13,9 @@
 The
 .I kbd
 device serves a one-level directory containing the files
-.BR scancode ,
-.BR leds
+.BR scancode
 and
-.BR repeat .
+.BR leds .
 .PP
 Reading the
 .BR scancode
@@ -31,26 +29,13 @@
 .PP
 Writing a number to the write-only 
 .BR leds
-file changes the status leds on the keyboard. The value of the
+file changes the status leds on the keyboard. the value of the
 number is the addition of 1, 2 and 4 representing activated
 Scroll, Num and Caps leds.
-.PP
-The
-.BR repeat
-file sets typematic rate and delay.  The value of the number is a
-bitmask where first 5 bits set the repeat rate (ranging from 0b00000
-for 30Hz to 0b11111 for 2Hz).  Bits 6 and 7 set the delay before the
-first repeat is activated (ranging from 0b00 for 250Hz to 0b11 for
-1000Hz).
 .SH EXAMPLE 
 Set the Scroll and Caps leds:
 .EX
 echo 5 >/dev/leds
-.EE
-.PP
-Enable fast repeat rate and the least delay:
-.EX
-echo 0 >/dev/repeat
 .EE
 .SH "SEE ALSO"
 .IR kbdfs (8)
--- a/sys/src/9/pc/audiohda.c
+++ b/sys/src/9/pc/audiohda.c
@@ -1775,6 +1775,7 @@
 
 		case (0x1022 << 16) | 0x780d:	/* AMD FCH Azalia Controller */
 		case (0x1022 << 16) | 0x1457:	/* AMD Family 17h (Models 00h-0fh) HD Audio Controller */
+		case (0x1022 << 16) | 0x15e3:	/* AMD Raven HD Audio Controller */
 
 		case (0x15ad << 16) | 0x1977:	/* Vmware */
 			return p;
--- a/sys/src/9/pc/devkbd.c
+++ b/sys/src/9/pc/devkbd.c
@@ -40,7 +40,6 @@
 	Qdir,
 	Qscancode,
 	Qleds,
-	Qrepeat,
 };
 
 static Dirtab kbdtab[] = {
@@ -47,7 +46,6 @@
 	".",		{Qdir, 0, QTDIR},	0,	0555,
 	"scancode",	{Qscancode, 0},		0,	0440,
 	"leds",		{Qleds, 0},		0,	0220,
-	"repeat",	{Qrepeat, 0},		0,	0220,
 };
 
 static Lock i8042lock;
@@ -195,28 +193,6 @@
 	iunlock(&i8042lock);
 }
 
-static void
-setrepeat(int repeat)
-{
-	if(nokbd)
-		return;
-
-	repeat &= 0x7f;
-	ilock(&i8042lock);
-	for(;;){
-		if(outready() < 0)
-			break;
-		outb(Data, 0xf3);		/* `set typematic rate and delay' */
-		if(outready() < 0)
-			break;
-		outb(Data, repeat);
-		if(outready() < 0)
-			break;
-		break;
-	}
-	iunlock(&i8042lock);
-}
-
 /*
  *  keyboard interrupt
  */
@@ -381,6 +357,9 @@
 {
 	char tmp[8+1], *p;
 
+	if(c->qid.path != Qleds)
+		error(Egreg);
+
 	p = tmp + n;
 	if(n >= sizeof(tmp))
 		p = tmp + sizeof(tmp)-1;
@@ -387,12 +366,7 @@
 	memmove(tmp, a, p - tmp);
 	*p = 0;
 
-	if(c->qid.path == Qleds)
-		setleds(atoi(tmp));
-	else if(c->qid.path == Qrepeat)
-		setrepeat(atoi(tmp));
-	else
-		error(Egreg);
+	setleds(atoi(tmp));
 
 	return n;
 }
--- a/sys/src/cmd/ip/dhcp6d.c
+++ b/sys/src/cmd/ip/dhcp6d.c
@@ -31,7 +31,8 @@
 	Udphdr		*udp;
 	Ipifc		*ifc;
 
-	uchar		mac[Eaddrlen];
+	int		ncid;
+	uchar		cid[256];
 	uchar		ips[IPaddrlen*8];
 	int		nips;
 
@@ -236,6 +237,31 @@
 	return r;
 }
 
+static uchar*
+clientea(Req *r)
+{
+	static uchar ea[Eaddrlen];
+	u32int type;
+ 	uchar *ip;
+
+	if(r->ncid >= 4+Eaddrlen){
+		type = r->cid[0]<<24 | r->cid[1]<<16 | r->cid[2]<<8 | r->cid[3];
+		switch(type){
+		case 0x00010001:
+		case 0x00030001:
+			return r->cid + r->ncid - Eaddrlen;
+		}
+	}
+	ip = r->udp->raddr;
+	ea[0] = ip[8] ^ 2;
+	ea[1] = ip[9];
+	ea[2] = ip[10];
+	ea[3] = ip[13];
+	ea[4] = ip[14];
+	ea[5] = ip[15];
+	return ea;
+}
+
 static void
 clearotab(void)
 {
@@ -387,7 +413,7 @@
 
 		if((r->db = opendb()) == nil)
 			continue;
-		r->nips = lookupips(r->ips, sizeof(r->ips), r->db, r->mac)/IPaddrlen;
+		r->nips = lookupips(r->ips, sizeof(r->ips), r->db, clientea(r))/IPaddrlen;
 		if(debug){
 			for(i=0; i<r->nips; i++)
 				fprint(2, "ip=%I\n", r->ips+i*IPaddrlen);
@@ -411,10 +437,11 @@
 
 	if((p = gettlv(1, &len, r->req.p, r->req.e)) == nil)
 		return -1;
-	if(len < 4+4+Eaddrlen || n < len)
+	if(len > sizeof(r->cid) || n < len)
 		return -1;
-	memmove(r->mac, p+len-Eaddrlen, Eaddrlen);
 	memmove(w, p, len);
+	memmove(r->cid, p, len);
+	r->ncid = len;
 
 	return len;
 }