shithub: riscv

Download patch

ref: ca7c413ff10f811addaf7d69b2f3864a41023a8c
parent: 520957e254c430b4f8c94495d3c29306fab9ea44
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jan 22 15:12:19 EST 2014

sdiahci: fix hardcoded 512 byte sector size

--- a/sys/src/9/pc/sdiahci.c
+++ b/sys/src/9/pc/sdiahci.c
@@ -1573,7 +1573,7 @@
 }
 
 static Alist*
-ahcibuild(Drive *d, int rw, void *data, uint n, vlong lba)
+ahcibuild(Drive *d, int rw, void *data, int nsect, vlong lba)
 {
 	uchar *c;
 	uint flags;
@@ -1581,11 +1581,11 @@
 
 	m = &d->portm;
 	c = m->ctab->cfis;
-	rwfis(m, c, rw, n, lba);
+	rwfis(m, c, rw, nsect, lba);
 	flags = Lpref;
 	if(rw == SDwrite)
 		flags |= Lwrite;
-	return mkalist(m, flags, data, 512*n);
+	return mkalist(m, flags, data, nsect * d->secsize);
 }
 
 static Alist*
@@ -1812,7 +1812,7 @@
 		}
 		try = 0;
 		count -= n;
-		lba   += n;
+		lba += n;
 		data += n * u->secsize;
 		if(count == 0)
 			return data - (uchar*)a;
@@ -2297,7 +2297,7 @@
 	p = capfmt(p, e, ctab, nelem(ctab), o->cmd);
 	p = seprint(p, e, "\n");
 	p = seprint(p, e, "mode\t%s %s\n", modes[d->mode], modes[maxmode(c)]);
-	p = seprint(p, e, "geometry %llud %lud\n", d->sectors, u->secsize);
+	p = seprint(p, e, "geometry %llud %d\n", d->sectors, d->secsize);
 	p = seprint(p, e, "alignment %d %d\n", 
 		d->secsize<<d->portm.physshift, d->portm.physalign);
 	p = seprint(p, e, "missirq\t%ud\n", c->missirq);
--