shithub: riscv

Download patch

ref: def87d60167d13c92328b6f0f81800787eedf03a
parent: 983413de75dafe1794f131274bc18c5e30429e51
author: cinap_lenrek <[email protected]>
date: Tue Nov 12 15:00:15 EST 2013

devsd: fix scsi emulation for disks bigger than 4 billion sectors (from erik quanstros 9atom)

for read capacity (10 (0x25) if we have more than
4 billion sectors, we must not return nsectors % (1<<32),
we must return 0xffffffff.

--- a/sys/src/9/port/devsd.c
+++ b/sys/src/9/port/devsd.c
@@ -1072,7 +1072,9 @@
 		 * Read capacity returns the LBA of the last sector.
 		 */
 		len = unit->sectors;
-		if(len > 0)
+		if(len >= 0xffffffff)
+			len = 0xffffffff;
+		else if(len > 0)
 			len--;
 		p = r->data;
 		*p++ = len>>24;