Browse Source

AHCI: it's 64 bits, not 32 bits

It was never setting the hi 32 bits in any DMA address.
I moved the driver to amd64 from 386 to indicate that
it's really a 64 bit driver now.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 7 years ago
parent
commit
99e8cc7dee

+ 0 - 1
sys/src/9/386/386.json

@@ -9,7 +9,6 @@
 			"../386/etherm10g.c",
 			"../386/i8042.c",
 			"../386/pci.c",
-			"../386/sdiahci.c",
 			"../386/uarti8250.c",
 			"../386/uartpci.c",
 			"../386/vgavesa.c"

+ 0 - 0
sys/src/9/386/ahci.h → sys/src/9/amd64/ahci.h


+ 1 - 0
sys/src/9/amd64/build.json

@@ -126,6 +126,7 @@
 			"cpu.c",
 			"mouse.c",
 			"screen.c",
+			"sdiahci.c",
 			"usbehcipc.c",
 			"usbohci.c",
 			"usbuhci.c",

+ 8 - 8
sys/src/9/386/sdiahci.c → sys/src/9/amd64/sdiahci.c

@@ -335,7 +335,7 @@ listsetup(Aportc *pc, int flags)
 	list->flags = flags | 5;
 	list->len = 0;
 	list->ctab = PCIWADDR(pc->pm->ctab);
-	list->ctabhi = 0;
+	list->ctabhi = PCIWADDR(pc->pm->ctab)>>32;
 }
 
 static int
@@ -517,7 +517,7 @@ ahciidentify0(Aportc *pc, void *id, int atapi)
 	memset(id, 0, 0x100);			/* magic */
 	p = &pc->pm->ctab->prdt;
 	p->dba = PCIWADDR(id);
-	p->dbahi = 0;
+	p->dbahi = PCIWADDR(id)>>32;
 	p->count = 1<<31 | (0x200-2) | 1;
 	return ahciwait(pc, 3*1000);
 }
@@ -765,9 +765,9 @@ ahciconfigdrive(Drive *d)
 	p->serror = SerrAll;
 
 	p->list = PCIWADDR(pm->list);
-	p->listhi = 0;
+	p->listhi = PCIWADDR(pm->list)>>32;
 	p->fis = PCIWADDR(pm->fis.base);
-	p->fishi = 0;
+	p->fishi = PCIWADDR(pm->fis.base)>>32;
 	p->cmd |= Afre|Ast;
 
 	/* drive coming up in slumbering? */
@@ -1585,11 +1585,11 @@ ahcibuild(Drive *d, unsigned char *cmd, void *data, int n, int64_t lba)
 		l->flags |= Lwrite;
 	l->len = 0;
 	l->ctab = PCIWADDR(t);
-	l->ctabhi = 0;
+	l->ctabhi = PCIWADDR(t)>>32;
 
 	p = &t->prdt;
 	p->dba = PCIWADDR(data);
-	p->dbahi = 0;
+	p->dbahi = PCIWADDR(data)>>32;
 	if(d->unit == nil)
 		panic("ahcibuild: nil d->unit");
 	p->count = 1<<31 | (d->unit->secsize*n - 2) | 1;
@@ -1639,14 +1639,14 @@ ahcibuildpkt(Aportm *pm, SDreq *r, void *data, int n)
 		l->flags |= Lwrite;
 	l->len = 0;
 	l->ctab = PCIWADDR(t);
-	l->ctabhi = 0;
+	l->ctabhi = PCIWADDR(t)>>32;
 
 	if(data == 0)
 		return l;
 
 	p = &t->prdt;
 	p->dba = PCIWADDR(data);
-	p->dbahi = 0;
+	p->dbahi = PCIWADDR(data)>>32;
 	p->count = 1<<31 | (n - 2) | 1;
 
 	return l;

+ 1 - 0
sys/src/9/amd64/syscall.c

@@ -345,6 +345,7 @@ syscall(unsigned int scallnr, Ureg *ureg)
 	}
 	else{
 		/* failure: save the error buffer for errstr */
+print("waserror errstr '%s' syserrstr '%s'\n", up->errstr, up->syserrstr);
 		e = up->syserrstr;
 		up->syserrstr = up->errstr;
 		up->errstr = e;