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 00:34:24 +0000 (02:34 +0200)
commit09e5fa07c78a9f63a62b8070731e3cbe5371ad39
tree77d5d582673263bc8a8b0c575a05a931a0c1a3b4
parentfe6091088cb5a4c06da7b95725adc4cb00cb95e4
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