From def87d60167d13c92328b6f0f81800787eedf03a Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 12 Nov 2013 20:00:15 +0100 Subject: [PATCH] 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. --- sys/src/9/port/devsd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/src/9/port/devsd.c b/sys/src/9/port/devsd.c index 4a11d718c..6474a68f0 100644 --- a/sys/src/9/port/devsd.c +++ b/sys/src/9/port/devsd.c @@ -1072,7 +1072,9 @@ sdfakescsi(SDreq *r) * 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;