shithub: riscv

Download patch

ref: e50b5178c1f228eab254d21f7af2eecce8929ac6
parent: 028bd871a9934e74b0641aaccc145e8b6ee13b1b
parent: a71e017fcc5af7910b2407dceb011e01317abd09
author: cinap_lenrek <[email protected]>
date: Mon Apr 25 17:33:04 EDT 2011

merge

--- a/sys/lib/dist/pc/plan9.ini.cd
+++ b/sys/lib/dist/pc/plan9.ini.cd
@@ -5,3 +5,4 @@
 vgasize=ask
 cdboot=yes
 bootfile=/386/9pcf
+*nomp=1
--- a/sys/src/9/pc/etherbcm.c
+++ b/sys/src/9/pc/etherbcm.c
@@ -22,7 +22,7 @@
 
 typedef struct Ctlr Ctlr;
 struct Ctlr {
-	Lock txlock;
+	Lock txlock, imlock;
 	Ctlr *link;
 	Pcidev *pdev;
 	ulong *nic, *status;
@@ -404,6 +404,7 @@
 	
 	edev = arg;
 	ctlr = edev->ctlr;
+	ilock(&ctlr->imlock);
 	dummyread(csr32(ctlr, InterruptMailbox));
 	csr32(ctlr, InterruptMailbox) = 1;
 	status = ctlr->status[0];
@@ -416,6 +417,7 @@
 	bcmtransclean(edev);
 	bcmtransmit(edev);
 	csr32(ctlr, InterruptMailbox) = tag << 24;
+	iunlock(&ctlr->imlock);
 }
 
 static void
@@ -664,5 +666,5 @@
 void
 etherbcmlink(void)
 {
-	addethercard("BCM57xx", bcmpnp);
+	addethercard("BCM5755", bcmpnp);
 }
--- a/sys/src/9/pc/mp.c
+++ b/sys/src/9/pc/mp.c
@@ -154,6 +154,8 @@
 		return 0;
 
 	apic = &mpapic[apicno];
+	if(apic->flags != 0)
+		print("mkioapic: APIC ID conflict at %d\n", p->apicno);
 	apic->type = PcmpIOAPIC;
 	apic->apicno = apicno;
 	apic->addr = va;
@@ -484,6 +486,46 @@
 	nvramwrite(0x0F, 0x00);
 }
 
+static void
+dumpmp(uchar *p, uchar *e)
+{
+	int i;
+
+	for(i = 0; p < e; p++) {
+		if((i % 16) == 0) print("*mp%d=", i/16);
+		print("%.2x ", *p);
+		if((++i % 16) == 0) print("\n");
+	}
+	if((i % 16) != 0) print("\n");
+}
+
+static void
+mpoverride(uchar** newp, uchar** e)
+{
+	int size, i, j;
+	char buf[20];
+	uchar* p;
+	char* s;
+	
+	size = atoi(getconf("*mp"));
+	if(size == 0) panic("mpoverride: invalid size in *mp");
+	*newp = p = malloc(size);
+	if(p == nil) panic("mpoverride: can't allocate memory");
+	*e = p + size;
+	for(i = 0; ; i++){
+		snprint(buf, sizeof buf, "*mp%d", i);
+		s = getconf(buf);
+		if(s == nil) break;
+		while(*s){
+			j = strtol(s, &s, 16);
+			if(*s && *s != ' ' || j < 0 || j > 0xff) panic("mpoverride: invalid entry in %s", buf);
+			if(p >= *e) panic("mpoverride: overflow in %s", buf);
+			*p++ = j;
+		}
+	}
+	if(p != *e) panic("mpoverride: size doesn't match");
+}
+
 void
 mpinit(void)
 {
@@ -518,6 +560,10 @@
 	 */
 	p = ((uchar*)pcmp)+sizeof(PCMP);
 	e = ((uchar*)pcmp)+pcmp->length;
+	if(getconf("*dumpmp") != nil)
+		dumpmp(p, e);
+	if(getconf("*mp") != nil)
+		mpoverride(&p, &e);
 	while(p < e) switch(*p){
 
 	default:
@@ -683,7 +729,7 @@
 			break;
 	}
 	if(bus == nil){
-		print("ioapicirq: can't find bus type %d\n", type);
+		print("ioapicirq: can't find bus type %d, number %d\n", type, bno);
 		return -1;
 	}