MFC r200353:

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).
This commit is contained in:
Alexander Motin 2009-12-11 12:44:44 +00:00
parent 68d2ef77eb
commit 248e8fd706
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=200409

View File

@ -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;