diff options
author | mav <mav@FreeBSD.org> | 2009-12-10 09:26:56 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2009-12-10 09:26:56 +0000 |
commit | 8b672c944801c499931dfecae6fbb2e688fbb554 (patch) | |
tree | 2bc2dac02046ab7f7bda8e3cf7bc7843c65e0922 | |
parent | 9361b02cf62c686ccce9f0420b62f527c15ccfe8 (diff) | |
download | FreeBSD-src-8b672c944801c499931dfecae6fbb2e688fbb554.zip FreeBSD-src-8b672c944801c499931dfecae6fbb2e688fbb554.tar.gz |
Limit maximum I/O size, depending on command set supported by device.
It is required to suppot non-LBA48 devices with MAXPHYS above 128K.
Same is done in ada(4).
-rw-r--r-- | sys/dev/ata/ata-disk.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index df753c5..0cd0a0f 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -126,6 +126,10 @@ ad_attach(device_t dev) adp->disk->d_name = "ad"; adp->disk->d_drv1 = dev; adp->disk->d_maxsize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; + if (atadev->param.support.command2 & ATA_SUPPORT_ADDRESS48) + adp->disk->d_maxsize = min(adp->disk->d_maxsize, 65536 * DEV_BSIZE); + else /* 28bit ATA command limit */ + adp->disk->d_maxsize = min(adp->disk->d_maxsize, 256 * DEV_BSIZE); adp->disk->d_sectorsize = DEV_BSIZE; adp->disk->d_mediasize = DEV_BSIZE * (off_t)adp->total_secs; adp->disk->d_fwsectors = adp->sectors; |