From 5d2802e4030ed9177c01e751fd89c898eaf90f88 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 23 Apr 2011 09:50:38 +0100 Subject: [sanboot] Add "sanhook" and "sanunhook" commands Expose the multiple-SAN-drive capability of the iPXE core via the iPXE command line by adding commands to hook and unhook additional drives. Signed-off-by: Michael Brown --- src/arch/i386/include/int13.h | 3 --- src/arch/i386/include/ipxe/bios_sanboot.h | 11 +++++++++++ src/arch/i386/interface/pcbios/int13.c | 12 +++++------- 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src/arch') diff --git a/src/arch/i386/include/int13.h b/src/arch/i386/include/int13.h index a14ebb2e9..315cd1b8d 100644 --- a/src/arch/i386/include/int13.h +++ b/src/arch/i386/include/int13.h @@ -261,7 +261,4 @@ struct master_boot_record { uint16_t magic; } __attribute__ (( packed )); -/** Use natural BIOS drive number */ -#define INT13_USE_NATURAL_DRIVE 0xff - #endif /* INT13_H */ diff --git a/src/arch/i386/include/ipxe/bios_sanboot.h b/src/arch/i386/include/ipxe/bios_sanboot.h index 097945487..689227b70 100644 --- a/src/arch/i386/include/ipxe/bios_sanboot.h +++ b/src/arch/i386/include/ipxe/bios_sanboot.h @@ -15,4 +15,15 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define SANBOOT_PREFIX_pcbios __pcbios_ #endif +/** + * Get default SAN drive number + * + * @ret drive Default drive number + */ +static inline __always_inline unsigned int +SANBOOT_INLINE ( pcbios, san_default_drive ) ( void ) { + /* Default to booting from first hard disk */ + return 0x80; +} + #endif /* _IPXE_BIOS_SANBOOT_H */ diff --git a/src/arch/i386/interface/pcbios/int13.c b/src/arch/i386/interface/pcbios/int13.c index 392dbd5fb..b764139e3 100644 --- a/src/arch/i386/interface/pcbios/int13.c +++ b/src/arch/i386/interface/pcbios/int13.c @@ -1164,8 +1164,8 @@ static void int13_free ( struct refcnt *refcnt ) { * Hook INT 13 emulated drive * * @v uri URI - * @v drive Requested drive number - * @ret drive Assigned drive number, or negative error + * @v drive Drive number + * @ret rc Return status code * * Registers the drive with the INT 13 emulation subsystem, and hooks * the INT 13 interrupt vector (if not already hooked). @@ -1176,12 +1176,9 @@ static int int13_hook ( struct uri *uri, unsigned int drive ) { unsigned int natural_drive; int rc; - /* Calculate drive number */ + /* Calculate natural drive number */ get_real ( num_drives, BDA_SEG, BDA_NUM_DRIVES ); natural_drive = ( num_drives | 0x80 ); - if ( drive == INT13_USE_NATURAL_DRIVE ) - drive = natural_drive; - drive |= 0x80; /* Check that drive number is not in use */ list_for_each_entry ( int13, &int13s, list ) { @@ -1231,7 +1228,7 @@ static int int13_hook ( struct uri *uri, unsigned int drive ) { /* Update BIOS drive count */ int13_set_num_drives(); - return int13->drive; + return 0; err_guess_geometry: err_reopen_block: @@ -1428,6 +1425,7 @@ static int int13_describe ( unsigned int drive ) { return 0; } +PROVIDE_SANBOOT_INLINE ( pcbios, san_default_drive ); PROVIDE_SANBOOT ( pcbios, san_hook, int13_hook ); PROVIDE_SANBOOT ( pcbios, san_unhook, int13_unhook ); PROVIDE_SANBOOT ( pcbios, san_boot, int13_boot ); -- cgit v1.2.3-55-g7522