freebsd-dev/stand/i386
Cy Schubert ca237cc5e1 Some drives report a geometry that is inconsisetent with the total
number of sectors reported through the BIOS. Cylinders * heads *
sectors may not necessarily be equal to the total number of sectors
reported through int13h function 48h.

An example of this is when a Mediasonic HD3-U2B PATA to USB enclosure
with a 80 GB disk is attached. Loader hangs at line 506 of
stand/i386/libi386/biosdisk.c while attempting to read sectors beyond
the end of the disk, sector 156906855. I discovered that the Mediasonic
enclosure was reporting the disk with 9767 cylinders, 255 heads, 63
sectors/track. That's 156906855 sectors. However camcontrol and
Windows 10 both report report the disk having 156301488 sectors, not
the calculated value. At line 280 biosdisk.c sets the sectors to the
higher of either bd->bd_sectors or the total calculated at line 276
(156906855) instead of the lower and correct value of 156301488 reported
by int 13h 48h.

This was tested on all three of my Mediasonic HD3-U2B PATA to USB
enclosures.

Instead of using the higher of bd_sectors (returned by int13h) or the
calculated value, this patch uses the lower and safer of the values.

Reviewed by:	tsoome@
Differential Revision:	https://reviews.freebsd.org/D16577
2018-08-03 19:11:00 +00:00
..
boot0 Centralize several variables. 2018-02-02 06:32:26 +00:00
boot0sio
boot2 NM and OBJCOPY are already defined for all builds. There's no need to 2018-07-20 05:17:56 +00:00
btx Prefer uintXX_t to u_intXX_t 2018-03-13 16:33:00 +00:00
cdboot Centralize several variables. 2018-02-02 06:32:26 +00:00
common Remove the 'mini libstand in libstand' that util.[ch] provided. These 2017-12-15 23:16:53 +00:00
gptboot NM and OBJCOPY are already defined for all builds. There's no need to 2018-07-20 05:17:56 +00:00
gptzfsboot NM and OBJCOPY are already defined for all builds. There's no need to 2018-07-20 05:17:56 +00:00
isoboot NM and OBJCOPY are already defined for all builds. There's no need to 2018-07-20 05:17:56 +00:00
kgzldr Catch up to the inflate renaming. 2018-07-13 20:08:18 +00:00
libfirewire fwohcireg.h is 99% the same between the boot loader and the 2018-03-31 22:02:59 +00:00
libi386 Some drives report a geometry that is inconsisetent with the total 2018-08-03 19:11:00 +00:00
loader Older zfs boot blocks don't support symlinks. install the link to 2018-07-23 06:04:05 +00:00
mbr Centralize several variables. 2018-02-02 06:32:26 +00:00
pmbr Centralize several variables. 2018-02-02 06:32:26 +00:00
pxeldr
zfsboot NM and OBJCOPY are already defined for all builds. There's no need to 2018-07-20 05:17:56 +00:00
boot.ldscript
Makefile Collapse zfsloader functionality back down into loader. 2018-07-20 05:17:37 +00:00
Makefile.inc Add support for linker-type-specific flags 2018-04-19 20:58:09 +00:00