Browse Source

Plan 9 from Bell Labs 2008-01-09

David du Colombier 16 years ago
parent
commit
286c202774

+ 7 - 11
dist/replica/_plan9.db

@@ -86,7 +86,7 @@
 386/bin/aux/antiword - 775 sys sys 1070288096 511478
 386/bin/aux/apm - 775 sys sys 1184731231 179071
 386/bin/aux/astarld - 775 sys sys 1168402277 64918
-386/bin/aux/cddb - 775 sys sys 1168402277 72541
+386/bin/aux/cddb - 775 sys sys 1199766029 72478
 386/bin/aux/clog - 775 sys sys 1178568252 65225
 386/bin/aux/consolefs - 775 sys sys 1184731231 154795
 386/bin/aux/conswdir - 775 sys sys 1062080411 38855
@@ -344,10 +344,10 @@
 386/bin/ndb - 20000000775 sys sys 985743147 0
 386/bin/ndb/cs - 775 sys sys 1188530160 148982
 386/bin/ndb/csquery - 775 sys sys 1176488418 61652
-386/bin/ndb/dns - 775 sys sys 1196742502 296310
-386/bin/ndb/dnsdebug - 775 sys sys 1196742508 270471
+386/bin/ndb/dns - 775 sys sys 1199766036 296379
+386/bin/ndb/dnsdebug - 775 sys sys 1199766042 270540
 386/bin/ndb/dnsquery - 775 sys sys 1185334136 64350
-386/bin/ndb/dnstcp - 775 sys sys 1196742512 268352
+386/bin/ndb/dnstcp - 775 sys sys 1199766049 268421
 386/bin/ndb/ipquery - 775 sys sys 1178568296 95524
 386/bin/ndb/mkdb - 775 sys sys 1168402340 64211
 386/bin/ndb/mkhash - 775 sys sys 1178568296 83312
@@ -8166,7 +8166,7 @@ sys/src/9/pc/sd53c8xx.c - 664 sys sys 1170456695 55276
 sys/src/9/pc/sd53c8xx.i - 664 sys sys 1128547230 28453
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sdata.c - 664 sys sys 1186361525 52991
-sys/src/9/pc/sdiahci.c - 664 sys sys 1191889849 37571
+sys/src/9/pc/sdiahci.c - 664 sys sys 1199838426 38374
 sys/src/9/pc/sdmv50xx.c - 664 sys sys 1184467229 33837
 sys/src/9/pc/sdmylex.c - 664 sys sys 1189229947 28395
 sys/src/9/pc/sdscsi.c - 664 sys sys 1186618532 7957
@@ -9180,7 +9180,7 @@ sys/src/boot/pc/ether8003.c - 664 sys sys 1015007950 6446
 sys/src/boot/pc/ether8139.c - 664 sys sys 1121393459 14823
 sys/src/boot/pc/ether8169.c - 664 sys sys 1156429147 21582
 sys/src/boot/pc/ether82557.c - 664 sys sys 1140802406 19090
-sys/src/boot/pc/ether82563.c - 664 sys sys 1198011456 25413
+sys/src/boot/pc/ether82563.c - 664 sys sys 1199772483 25481
 sys/src/boot/pc/ether83815.c - 664 sys sys 1144961190 21993
 sys/src/boot/pc/ether8390.c - 664 sys sys 1112382847 16209
 sys/src/boot/pc/ether8390.h - 664 sys sys 1015007951 1392
@@ -9229,7 +9229,7 @@ sys/src/boot/pc/sd53c8xx.i - 664 sys sys 1015007955 27245
 sys/src/boot/pc/sdaoe.c - 664 sys sys 1193341405 11270
 sys/src/boot/pc/sdata.c - 664 sys sys 1175564193 38846
 sys/src/boot/pc/sdbios.c - 664 sys sys 1194145651 3282
-sys/src/boot/pc/sdiahci.c - 664 sys sys 1199493064 27056
+sys/src/boot/pc/sdiahci.c - 664 sys sys 1199773527 28014
 sys/src/boot/pc/sdmylex.c - 664 sys sys 1171783051 28694
 sys/src/boot/pc/sdscsi.c - 664 sys sys 1144961224 7006
 sys/src/boot/pc/trap.c - 664 sys sys 1193167011 7497
@@ -15856,7 +15856,3 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
-386/bin/aux/cddb - 775 sys sys 1199766029 72478
-386/bin/ndb/dns - 775 sys sys 1199766036 296379
-386/bin/ndb/dnsdebug - 775 sys sys 1199766042 270540
-386/bin/ndb/dnstcp - 775 sys sys 1199766049 268421

+ 3 - 3
dist/replica/plan9.db

@@ -8166,7 +8166,7 @@ sys/src/9/pc/sd53c8xx.c - 664 sys sys 1170456695 55276
 sys/src/9/pc/sd53c8xx.i - 664 sys sys 1128547230 28453
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sdata.c - 664 sys sys 1186361525 52991
-sys/src/9/pc/sdiahci.c - 664 sys sys 1191889849 37571
+sys/src/9/pc/sdiahci.c - 664 sys sys 1199838426 38374
 sys/src/9/pc/sdmv50xx.c - 664 sys sys 1184467229 33837
 sys/src/9/pc/sdmylex.c - 664 sys sys 1189229947 28395
 sys/src/9/pc/sdscsi.c - 664 sys sys 1186618532 7957
@@ -9180,7 +9180,7 @@ sys/src/boot/pc/ether8003.c - 664 sys sys 1015007950 6446
 sys/src/boot/pc/ether8139.c - 664 sys sys 1121393459 14823
 sys/src/boot/pc/ether8169.c - 664 sys sys 1156429147 21582
 sys/src/boot/pc/ether82557.c - 664 sys sys 1140802406 19090
-sys/src/boot/pc/ether82563.c - 664 sys sys 1198011456 25413
+sys/src/boot/pc/ether82563.c - 664 sys sys 1199772483 25481
 sys/src/boot/pc/ether83815.c - 664 sys sys 1144961190 21993
 sys/src/boot/pc/ether8390.c - 664 sys sys 1112382847 16209
 sys/src/boot/pc/ether8390.h - 664 sys sys 1015007951 1392
@@ -9229,7 +9229,7 @@ sys/src/boot/pc/sd53c8xx.i - 664 sys sys 1015007955 27245
 sys/src/boot/pc/sdaoe.c - 664 sys sys 1193341405 11270
 sys/src/boot/pc/sdata.c - 664 sys sys 1175564193 38846
 sys/src/boot/pc/sdbios.c - 664 sys sys 1194145651 3282
-sys/src/boot/pc/sdiahci.c - 664 sys sys 1199493064 27056
+sys/src/boot/pc/sdiahci.c - 664 sys sys 1199773527 28014
 sys/src/boot/pc/sdmylex.c - 664 sys sys 1171783051 28694
 sys/src/boot/pc/sdscsi.c - 664 sys sys 1144961224 7006
 sys/src/boot/pc/trap.c - 664 sys sys 1193167011 7497

+ 3 - 0
dist/replica/plan9.log

@@ -18237,3 +18237,6 @@
 1199766605 1 c 386/bin/ndb/dns - 775 sys sys 1199766036 296379
 1199766605 2 c 386/bin/ndb/dnsdebug - 775 sys sys 1199766042 270540
 1199766605 3 c 386/bin/ndb/dnstcp - 775 sys sys 1199766049 268421
+1199772005 0 c sys/src/boot/pc/ether82563.c - 664 sys sys 1199772483 25481
+1199773804 0 c sys/src/boot/pc/sdiahci.c - 664 sys sys 1199773527 28014
+1199838604 0 c sys/src/9/pc/sdiahci.c - 664 sys sys 1199838426 38374

+ 89 - 39
sys/src/9/pc/sdiahci.c

@@ -15,7 +15,7 @@
 
 #define	dprint(...)	if(debug)	iprint(__VA_ARGS__); else USED(debug)
 #define	idprint(...)	if(prid)	print(__VA_ARGS__);  else USED(prid)
-#define	aprint(...)	if(datapi)	iprint(__VA_ARGS__); else USED(datapi)
+#define	aprint(...)	if(datapi)	print(__VA_ARGS__);  else USED(datapi)
 #define Tname(c)	tname[(c)->type]
 
 enum {
@@ -111,6 +111,7 @@ typedef struct {
 
 	uvlong	sectors;
 	ulong	intick;
+	ulong	lastseen;
 	int	wait;
 	uchar	mode;	/* DMautoneg, satai or sataii. */
 	uchar	active;
@@ -439,7 +440,7 @@ smartrs(Aportc *pc)
 }
 
 static int
-flushcache(Aportc *pc)
+ahciflushcache(Aportc *pc)
 {
 	uchar *c, llba;
 	Actab *t;
@@ -463,7 +464,7 @@ flushcache(Aportc *pc)
 	l->ctabhi = 0;
 
 	if(ahciwait(pc, 60000) == -1 || pc->p->task & (1|32)){
-		dprint("flushcache fail %ux\n", pc->p->task);
+		dprint("ahciflushcache fail %ux\n", pc->p->task);
 //		preg( pc->m->fis.r, 20);
 		return -1;
 	}
@@ -1085,6 +1086,7 @@ resetdisk(Drive *d)
 		d->portm.flag |= Ferror;
 	clearci(p);			/* satisfy sleep condition. */
 	wakeup(&d->portm);
+	d->state = Derror;
 	iunlock(d);
 
 	qlock(&d->portm);
@@ -1146,10 +1148,14 @@ newdrive(Drive *d)
 		s = "L";
 	idprint("%s: %sLBA %,lld sectors\n", d->unit->name, s, d->sectors);
 	idprint("  %s %s %s %s\n", d->model, d->firmware, d->serial,
-		d->mediachange?"[mediachange]":"");
+		d->mediachange? "[mediachange]": "");
 	return 0;
 
 lose:
+	idprint("%s: can't be initialized\n", d->unit->name);
+	ilock(d);
+	d->state = Dnull;
+	iunlock(d);
 	qunlock(c->m);
 	return -1;
 }
@@ -1165,7 +1171,7 @@ static void
 westerndigitalhung(Drive *d)
 {
 	if((d->portm.feat&Datapi) == 0 && d->active &&
-	    TK2MS(MACHP(0)->ticks-d->intick) > 5000){
+	    TK2MS(MACHP(0)->ticks - d->intick) > 5000){
 		dprint("%s: drive hung; resetting [%ux] ci=%x\n",
 			d->unit->name, d->port->task, d->port->ci);
 		d->state = Dreset;
@@ -1200,6 +1206,8 @@ checkdrive(Drive *d, int i)
 	ilock(d);
 	name = d->unit->name;
 	s = d->port->sstatus;
+	if(s)
+		d->lastseen = MACHP(0)->ticks;
 	if(s != olds[i]){
 		dprint("%s: status: %04ux -> %04ux: %s\n",
 			name, olds[i], s, diskstates[d->state]);
@@ -1339,6 +1347,7 @@ iaverify(SDunit *u)
 	d->unit = u;
 	iunlock(d);
 	iunlock(c);
+	checkdrive(d, d->driveno);
 	return 1;
 }
 
@@ -1531,21 +1540,23 @@ ahcibuildpkt(Aportm *m, SDreq *r, void *data, int n)
 static int
 waitready(Drive *d)
 {
-	u32int s, t, i;
+	u32int s, i, δ;
 
-	for(i = 0; i < 120; i++){
+	for(i = 0; i < 15000; i += 250){
+		if(d->state == Dreset || d->state == Dportreset ||
+		    d->state == Dnew)
+			return 1;
+		δ = MACHP(0)->ticks - d->lastseen;
+		if(d->state == Dnull || δ > 10*1000)
+			return -1;
 		ilock(d);
 		s = d->port->sstatus;
-		t = d->port->task;
 		iunlock(d);
-		if((s & 0x100) == 0)
-			return -1;	/* not active */
+		if((s & 0x700) == 0 && δ > 1500)
+			return -1;	/* no detect */
 		if(d->state == Dready && (s & 7) == 3)
 			return 0;	/* ready, present & phy. comm. */
-		if((i+1) % 30 == 0)
-			print("%s: waitready: [%s] task=%ux sstat=%ux\n",
-				d->unit->name, diskstates[d->state], t, s);
-		esleep(1000);
+		esleep(250);
 	}
 	print("%s: not responding; offline\n", d->unit->name);
 	ilock(d);
@@ -1554,6 +1565,32 @@ waitready(Drive *d)
 	return -1;
 }
 
+static int
+lockready(Drive *d)
+{
+	int i;
+
+	qlock(&d->portm);
+	while ((i = waitready(d)) == 1) {
+		qunlock(&d->portm);
+		esleep(1);
+		qlock(&d->portm);
+	}
+	return i;
+}
+
+static int
+flushcache(Drive *d)
+{
+	int i;
+
+	i = -1;
+	if(lockready(d) == 0)
+		i = ahciflushcache(&d->portc);
+	qunlock(&d->portm);
+	return i;
+}
+
 static int
 iariopkt(SDreq *r, Drive *d)
 {
@@ -1577,14 +1614,22 @@ iariopkt(SDreq *r, Drive *d)
 
 	try = 0;
 retry:
-	if(waitready(d) == -1)
-		return SDeio;
 	data = r->data;
 	n = count;
 	if(n > max)
 		n = max;
 	d->active++;
 	ahcibuildpkt(&d->portm, r, data, n);
+	switch(waitready(d)){
+	case -1:
+		qunlock(&d->portm);
+		return SDeio;
+	case 1:
+		qunlock(&d->portm);
+		esleep(1);
+		goto retry;
+	}
+
 	ilock(d);
 	d->portm.flag = 0;
 	iunlock(d);
@@ -1605,9 +1650,10 @@ retry:
 	iunlock(d);
 
 	if(task & (Efatal<<8) || task & (ASbsy|ASdrq) && d->state == Dready){
-		d->port->ci = 0;		/* @? */
+		d->port->ci = 0;		/* clearci? */
 		ahcirecover(&d->portc);
 		task = d->port->task;
+		flag &= ~Fdone;		/* either an error or do-over */
 	}
 	d->active--;
 	qunlock(&d->portm);
@@ -1617,12 +1663,12 @@ retry:
 			r->status = SDcheck;
 			return SDcheck;
 		}
-		iprint("%s: retry\n", name);
-		esleep(1000);
+		print("%s: retry\n", name);
 		goto retry;
 	}
 	if(flag & Ferror){
-		iprint("%s: i/o error %ux\n", name, task);
+		if((task&Eidnf) == 0)
+			print("%s: i/o error %ux\n", name, task);
 		r->status = SDcheck;
 		return SDcheck;
 	}
@@ -1657,10 +1703,7 @@ iario(SDreq *r)
 	p = d->port;
 
 	if(r->cmd[0] == 0x35 || r->cmd[0] == 0x91){
-		qlock(&d->portm);
-		i = flushcache(&d->portc);
-		qunlock(&d->portm);
-		if(i == 0)
+		if(flushcache(d) == 0)
 			return sdsetsense(r, SDok, 0, 0, 0);
 		return sdsetsense(r, SDcheck, 3, 0xc, 2);
 	}
@@ -1686,8 +1729,6 @@ iario(SDreq *r)
 
 	try = 0;
 retry:
-	if(waitready(d) == -1)
-		return SDeio;
 	data = r->data;
 	while(count > 0){
 		n = count;
@@ -1695,6 +1736,15 @@ retry:
 			n = max;
 		d->active++;
 		ahcibuild(&d->portm, cmd, data, n, lba);
+		switch(waitready(d)){
+		case -1:
+			qunlock(&d->portm);
+			return SDeio;
+		case 1:
+			qunlock(&d->portm);
+			esleep(1);
+			goto retry;
+		}
 		ilock(d);
 		d->portm.flag = 0;
 		iunlock(d);
@@ -1729,7 +1779,6 @@ retry:
 				return SDeio;
 			}
 			iprint("%s: retry %lld\n", name, lba);
-			esleep(1000);
 			goto retry;
 		}
 		if(flag & Ferror){
@@ -1857,8 +1906,8 @@ loop:
 			d->portc.p = d->port;
 			d->portc.m = &d->portm;
 			d->driveno = n++;
-			c->drive[i] = d;
-			iadrive[d->driveno] = d;
+			c->drive[d->driveno] = d;
+			iadrive[niadrive + d->driveno] = d;
 		}
 		for(i = 0; i < n; i++)
 			if(ahciidle(c->drive[i]->port) == -1){
@@ -1945,10 +1994,9 @@ runflushcache(Drive *d)
 	long t0;
 
 	t0 = MACHP(0)->ticks;
-	qlock(&d->portm);
-	flushcache(&d->portc);
-	qunlock(&d->portm);
-	dprint("flush in %ldms\n", TK2MS(MACHP(0)->ticks-t0));
+	if(flushcache(d) != 0)
+		error(Eio);
+	dprint("flush in %ldms\n", MACHP(0)->ticks - t0);
 }
 
 static void
@@ -1974,7 +2022,8 @@ runsmartable(Drive *d, int i)
 		d->smartrs = 0;
 		nexterror();
 	}
-	qlock(&d->portm);
+	if(lockready(d) == -1)
+		error(Eio);
 	d->smartrs = smart(&d->portc, i);
 	d->portm.smart = 0;
 	qunlock(&d->portm);
@@ -2008,6 +2057,7 @@ iawctl(SDunit *u, Cmdbuf *cmd)
 	char **f;
 	Ctlr *c;
 	Drive *d;
+	uint i;
 
 	c = u->dev->ctlr;
 	d = c->drive[u->subno];
@@ -2016,8 +2066,6 @@ iawctl(SDunit *u, Cmdbuf *cmd)
 	if(strcmp(f[0], "flushcache") == 0)
 		runflushcache(d);
 	else if(strcmp(f[0], "identify") ==  0){
-		uint i;
-
 		i = strtoul(f[1]? f[1]: "0", 0, 0);
 		if(i > 0xff)
 			i = 0;
@@ -2026,14 +2074,15 @@ iawctl(SDunit *u, Cmdbuf *cmd)
 		forcemode(d, f[1]? f[1]: "satai");
 	else if(strcmp(f[0], "nop") == 0){
 		if((d->portm.feat & Dnop) == 0){
-			cmderror(cmd, "nop command not supported");
+			cmderror(cmd, "no drive support");
 			return -1;
 		}
 		if(waserror()){
 			qunlock(&d->portm);
 			nexterror();
 		}
-		qlock(&d->portm);
+		if(lockready(d) == -1)
+			error(Eio);
 		nop(&d->portc);
 		qunlock(&d->portm);
 		poperror();
@@ -2049,7 +2098,8 @@ iawctl(SDunit *u, Cmdbuf *cmd)
 			d->smartrs = 0;
 			nexterror();
 		}
-		qlock(&d->portm);
+		if(lockready(d) == -1)
+			error(Eio);
 		d->portm.smart = 2 + smartrs(&d->portc);
 		qunlock(&d->portm);
 		poperror();

+ 5 - 3
sys/src/boot/pc/ether82563.c

@@ -382,7 +382,7 @@ enum {
 	Ntdesc		= 128,		/* multiple of 8 */
 };
 
-enum{
+enum {
 	i82563,
 	i82571,
 	i82573,
@@ -855,10 +855,12 @@ i82563pci(void)
 	while(p = pcimatch(p, 0x8086, 0)){
 		switch(p->did){
 		case 0x1096:
+		case 0x10ba:
 			type = i82563;
 			break;
-		case 0x108c:
-		case 0x109a:
+		case 0x108b:		/*  e */
+		case 0x108c:		/*  e (iamt) */
+		case 0x109a:		/*  l */
 			type = i82573;
 			break;
 		default:

+ 58 - 16
sys/src/boot/pc/sdiahci.c

@@ -14,11 +14,7 @@
 #include "sd.h"
 #include "ahci.h"
 
-/*
- * the dprint delay seems to be necessary to make drive detection work.
- * so if we don't print, we must sleep.
- */
-#define	dprint(...)	if(debug == 1)	print(__VA_ARGS__); else delay(100)
+#define	dprint(...)	if(debug == 1)	print(__VA_ARGS__); else USED(debug)
 #define	idprint(...)	if(prid == 1)	print(__VA_ARGS__); else USED(prid)
 #define	aprint(...)	if(datapi == 1)	print(__VA_ARGS__); else USED(datapi)
 
@@ -541,6 +537,24 @@ setupfis(Afis *f)
 	f->devicebits = (u32int*)(f->base + 0x58);
 }
 
+static void
+ahciwakeup(Aport *p)
+{
+	ushort s;
+
+	s = p->sstatus;
+	if((s & 0x700) != 0x600)
+		return;
+	if((s & 7) != 1){
+		print("ahci: slumbering drive unwakeable %ux\n", s);
+		return;
+	}
+	p->sctl = 3*Aipm | 0*Aspd | Adet;
+	delay(1);
+	p->sctl &= ~7;
+//	iprint("ahci: wake %ux -> %ux\n", s, p->sstatus);
+}
+
 static int
 ahciconfigdrive(Ahba *h, Aportc *c, int mode)
 {
@@ -570,6 +584,9 @@ ahciconfigdrive(Ahba *h, Aportc *c, int mode)
 	p->fishi = 0;
 	p->cmd |= Afre | Ast;
 
+	if((p->sstatus & 0x707) == 0x601) /* drive coming up in slumbering? */
+		ahciwakeup(p);
+
 	/* disable power managment sequence from book. */
 	p->sctl = (3*Aipm) | (mode*Aspd) | (0*Adet);
 	p->cmd &= ~Aalpe;
@@ -754,7 +771,10 @@ updatedrive(Drive *d)
 			d->state = Dmissing;
 			break;
 		case 1:
-			d->state = Derror;
+			if((p->sstatus & 0x700) == 0x600)
+				d->state = Dnew;
+			else
+				d->state = Derror;
 			break;
 		case 3:
 			/* power mgnt crap for surprise removal */
@@ -799,6 +819,9 @@ pstatus(Drive *d, ulong s)
 	case 4:
 		d->state = Doffline;
 		break;
+	case 6:
+		d->state = Dnew;
+		break;
 	}
 }
 
@@ -962,13 +985,13 @@ checkdrive(Drive *d, int i)
 	westerndigitalhung(d);
 	switch(d->state){
 	case Dnull:
-	case Dready:
 		break;
 	case Dmissing:
 	case Dnew:
 		switch(s & 0x107){
+		case 1:
+			ahciwakeup(d->port);
 		case 0:
-//		case 1:
 			break;
 		default:
 			dprint("%s: unknown status %04ux\n", name, s);
@@ -988,12 +1011,9 @@ reset:
 			resetdisk(d);
 			ilock(d);
 			break;
-		case 1:
-			if (d->state != Dnew)
-				break;
 		case 0x103:
 			if((++d->wait&Midwait) == 0){
-				dprint("%s: slow reset %04ux task=%ux; %d\n",
+				dprint("%s: slow reset %#ux task=%#ux; %d\n",
 					name, s, d->port->task, d->wait);
 				goto reset;
 			}
@@ -1012,7 +1032,7 @@ reset:
 			break;
 	case Derror:
 	case Dreset:
-		dprint("%s: reset [%s]: mode %d; status %04ux\n",
+		dprint("%s: reset [%s]: mode %d; status %#ux\n",
 			name, diskstates[d->state], d->mode, s);
 		iunlock(d);
 		resetdisk(d);
@@ -1067,6 +1087,7 @@ iainterrupt(Ureg*, void *a)
 static int
 iaverify(SDunit *u)
 {
+	int i;
 	Ctlr *c;
 	Drive *d;
 
@@ -1077,7 +1098,24 @@ iaverify(SDunit *u)
 	d->unit = u;
 	iunlock(d);
 	iunlock(c);
-	checkdrive(d, d->driveno);
+	for(i = 0; i < 10; i++){
+		checkdrive(d, d->driveno);
+		switch(d->state){
+		case Dmissing:
+			if(i < 4 || d->port->sstatus & 0x733)
+				break;
+			/* fall through */
+		case Dnull:
+		case Dready:
+		case Doffline:
+			print("sdiahci: drive %d in state %s after %d resets\n",
+				d->driveno, diskstates[d->state], i);
+			return 1;
+		}
+		delay(100);
+	}
+	print("sdiahci: drive %d won't come up; in state %s after %d resets\n",
+		d->driveno, diskstates[d->state], i);
 	return 1;
 }
 
@@ -1502,6 +1540,10 @@ loop:
 			type = Tesb;
 		else if(p->vid == 0x8086 && (p->did & 0xfffe) == 0x27c4)
 			type = Tich;		/* 82801g[bh]m */
+		else if(p->vid == 0x8086 && (p->did & 0xfeff) == 0x2829)
+			type = Tich;		/* ich8 */
+		else if(p->vid == 0x8086 && (p->did & 0xfffe) == 0x2922)
+			type = Tich;		/* ich8 */
 		else if(p->vid == 0x1002 && p->did == 0x4380)
 			type = Tsb600;
 		else
@@ -1557,7 +1599,7 @@ loop:
 			d->ctlr = c;
 			if((c->hba->pi & (1<<i)) == 0)
 				continue;
-			d->state = Dnew;
+//			d->state = Dnew;
 			d->port = (Aport*)(c->mmio + 0x80*i + 0x100);
 			d->portc.p = d->port;
 			d->portc.m = &d->portm;
@@ -1566,7 +1608,7 @@ loop:
 		}
 		for(i = 0; i < n; i++)
 			if(ahciidle(c->drive[i]->port) == -1){
-				dprint("%s: port %d wedged; abort\n",
+				print("%s: port %d wedged; abort\n",
 					tname[c->type], i);
 				goto loop;
 			}