ahci(4)/sili(4): Fix for drives >2TB.
authorSascha Wildner <saw@online.de>
Mon, 13 Aug 2012 00:33:30 +0000 (02:33 +0200)
committerSascha Wildner <saw@online.de>
Mon, 13 Aug 2012 01:20:18 +0000 (03:20 +0200)
commit0d92877ac3b7bf4b9127049da7d2b82f83638ed4
treeb15c6498eb943bc6d5a4e9973e2c4049338f710f
parente7bc212b7ad5908cf6bbc000520ead34d124d540
ahci(4)/sili(4): Fix for drives >2TB.

CAM will issue the 16 byte version of the READ CAPACITY command when
maxsector is 0xffffffff:

----- scsi_da.c -----
if (maxsector == 0xffffffff) {
softc->state = DA_STATE_PROBE2;
kfree(rdcap, M_SCSIDA);
xpt_release_ccb(done_ccb);
xpt_schedule(periph, /*priority*/5);
return;
}
---------------------

However, we are subtracting 1 from it (presumably because it's a "last
sector on the device" value starting at 0) so in CAM, it ended up being
0xfffffffe, resulting in disks attached via ahci(4) and sili(4) to be
limited to 2TB.

To fix, set the local var to 0 in this case, so that after subtracting 1
from the value (cast to 32 bit) CAM gets 0xffffffff.

Fix-by: dillon
sys/dev/disk/ahci/ahci_cam.c
sys/dev/disk/sili/sili_cam.c