[int13] Allow default drive to be specified via "san-drive" setting

The DHCP option 175.189 has been defined (by us) since 2006 as
containing the drive number to be used for a SAN boot, but has never
been automatically used as such by iPXE.

Use this option (if specified) to override the default SAN drive
number.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2016-03-22 09:35:10 +00:00
parent ab5b3abbba
commit c32b07b81b
3 changed files with 31 additions and 15 deletions

View File

@@ -44,6 +44,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/pci.h>
#include <ipxe/iso9660.h>
#include <ipxe/eltorito.h>
#include <ipxe/dhcp.h>
#include <ipxe/settings.h>
#include <realmode.h>
#include <bios.h>
#include <biosint.h>
@@ -1986,7 +1988,32 @@ static int int13_describe ( unsigned int drive ) {
return 0;
}
PROVIDE_SANBOOT_INLINE ( pcbios, san_default_drive );
/** The "san-drive" setting */
const struct setting san_drive_setting __setting ( SETTING_SANBOOT_EXTRA,
san-drive ) = {
.name = "san-drive",
.description = "SAN drive number",
.tag = DHCP_EB_SAN_DRIVE,
.type = &setting_type_uint8,
};
/**
* Get default SAN drive number
*
* @ret drive Default drive number
*/
static unsigned int int13_default_drive ( void ) {
unsigned long drive;
/* Use "san-drive" setting, if specified */
if ( fetch_uint_setting ( NULL, &san_drive_setting, &drive ) >= 0 )
return drive;
/* Otherwise, default to booting from first hard disk */
return 0x80;
}
PROVIDE_SANBOOT ( pcbios, san_default_drive, int13_default_drive );
PROVIDE_SANBOOT ( pcbios, san_hook, int13_hook );
PROVIDE_SANBOOT ( pcbios, san_unhook, int13_unhook );
PROVIDE_SANBOOT ( pcbios, san_boot, int13_boot );