freebsd-skq/stand
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
..
arm Go back to one loader.conf 2018-02-26 03:16:47 +00:00
arm64 No need to make objects here. 2018-04-27 22:15:18 +00:00
common Collapse zfsloader functionality back down into loader. 2018-07-20 05:17:37 +00:00
defaults Default loader.conf: Drop efi_max_resolution to 1x1 2018-04-03 02:41:32 +00:00
efi loader.efi: clean up misleading noise from missing block devices 2018-08-03 07:59:29 +00:00
fdt Eliminate bsd.stand.mk and -fPIC 32-bit intel builds 2018-02-16 00:17:32 +00:00
ficl Prefer uintXX_t to u_intXX_t 2018-03-13 16:33:00 +00:00
ficl32
forth check-password.4th(8): Fix manual [in]accuracy 2018-06-24 19:29:29 +00:00
i386 Some drives report a geometry that is inconsisetent with the total 2018-08-03 19:11:00 +00:00
kshim A more definitions to kernel emulation shim in order to build stand/usb. 2018-02-07 18:50:36 +00:00
liblua Use M. Warner Losh everywhere on my copyrights. 2018-05-01 16:29:22 +00:00
liblua32 Add Lua as a scripting langauge to /boot/loader 2018-02-12 15:31:53 +00:00
libsa libsa: dereferencing type-punned pointer in cd9660 2018-08-02 06:22:10 +00:00
libsa32
lua lualoader: "nextboot_file" should be spelled "nextboot_conf" 2018-07-27 11:35:58 +00:00
man Follow up to r336919 and r336921: s/efi.rt_disabled/efi.rt.disabled/ 2018-07-30 18:13:20 +00:00
mips Don't use CCACHE for linking. 2018-06-27 19:29:15 +00:00
ofw Stop using ../zfs/libzfs.h but instead use libzfs.h. 2018-07-08 07:42:58 +00:00
powerpc bootprog_info is generated in vers.c. Move it's definition to 2018-06-14 06:41:33 +00:00
sparc64 Older zfs boot blocks don't support symlinks. install the link to 2018-07-23 06:04:05 +00:00
uboot ubldr: Bump heap size, 1MB -> 2MB 2018-08-01 20:08:20 +00:00
usb Move the stand/usb test loader into its own directory. 2018-02-07 19:20:59 +00:00
userboot Extend loader(8) geli support to all architectures and all disk-like devices. 2018-07-13 17:50:25 +00:00
defs.mk Disable 'C'-compressed ISA extension. 2018-07-25 16:07:35 +00:00
fdt.mk
ficl.mk Remove redundant defs.mk includes. They aren't needed. 2018-06-14 06:14:48 +00:00
loader.mk Collapse zfsloader functionality back down into loader. 2018-07-20 05:17:37 +00:00
lua.mk Do not include float interfaces when using libsa. 2018-02-23 04:04:25 +00:00
Makefile Move ZFS files into libsa 2018-07-08 07:42:49 +00:00
Makefile.amd64 Create LOADER_UBOOT, and LOADER_OFW. Move these options out of 2018-03-01 19:50:55 +00:00
Makefile.inc Minor flags cleanup 2017-12-02 00:06:58 +00:00
uboot.mk Unify metadata load files for arm, mips, powerpc, sparc64 2018-02-13 03:44:50 +00:00