Older PC BIOSes have various limits on disk sizes - 8GB and 33GB are common ones. Some disk manufacturers provide tricks to get around these limits - typically a jumper that restricts capacity to either 8GB or 33GB and then allows software to recover the capacity by issuing ATA READ NATIVE MAX and ATA SET MAX ADDRESS commands. The attached patch adds a new boolean boot-time tunable "hw.ata.reset_capacity". If this tunable is true, then the kernel will issue an ATA READ NATIVE MAX during the disk attach. If the returned size is greater than the size previously reported by the ATA IDENTIFY issued during the probe then an ATA SET MAX ADDRESS is issued with the updated size and the ATA IDENTIFY repeated. Note that this code does not handle the 48-bit extended command version and so only handles disks up to 137GB. This is because neither the existing ATAng nor the new ATAmkIII code includes provision for reading the 48-bit LBA result from an extended command. By ensuring that the LBA returned by the READ NATIVE result is greater than the existing LBA, the code avoids truncating a correctly probed large disk down to 137GB. Fix: Notes: 1) The patch to ata-lowlevel.c is only needed on 5.x. This fix has been implemented in 6.x but not MFC'd. 2) This patch matches the existing coding style in dev/ata rather than style(9). How-To-Repeat: I did my testing using a Seagate ST380011A disk on a Asus P5A-B motherboard. This combination will hang during the BIOS probe unless the disk is jumpered down to 33GB. 1) With the disk in 'native' mode, demonstrate that the BIOS will hang during the BIOS probe. 2) Install the "alternate capacity jumper". Verify that both the BIOS and FreeBSD report a capacity of less than 33GB (66,055,248 sectors in my case). 3) Add the line 'hw.ata.reset_capacity="1"' to /boot/loader.conf and reboot with the below patch installed. 4) Verify that the BIOS reports a capacity of less than 33GB whilst FreeBSD reports the full disk capacity (156,301,488 sectors for the above disk). 5) Using dd(1), newfs or fdisk, verify that the full disk capacity is accessible. [My first fix failed this step] 6) Verify that the system reboots correctly using reboot(8) or similar (ie resetting the system restores the limited capacity).
Responsible Changed From-To: freebsd-bugs->sos Over to maintainer.
Responsible Changed From-To: sos->freebsd-bugs sos@ is not actively working on ATA-related PRs.
State Changed From-To: open->closed seems to have been fixed a looooong time ago. Sorry for taking so long to get to this PR.