]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[int13] Allow default drive to be specified via "san-drive" setting
authorMichael Brown <mcb30@ipxe.org>
Tue, 22 Mar 2016 09:35:10 +0000 (09:35 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 22 Mar 2016 09:55:09 +0000 (09:55 +0000)
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>
src/arch/x86/include/ipxe/bios_sanboot.h
src/arch/x86/interface/pcbios/int13.c
src/include/ipxe/dhcp.h

index 1a86b7d5776f7e948dd3ef05f8894ee6c6482ecc..85d698039f752b56ab4d3c6a77107a64079fe6b7 100644 (file)
@@ -15,15 +15,4 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #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 */
index 3b3f87306876d97eb01f332514c515c8baa3e6bc..6f16904df91d60067125fb917cb23e3348b0c4d2 100644 (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 );
index a11db3497a8ffbf24d9c63e9b0df19cff6dd7817..0bd7c1dca68bbcf915f6ea11a82a968ac667c27b 100644 (file)
@@ -403,12 +403,12 @@ struct dhcp_netdev_desc {
 /** Use cached network settings (obsolete; do not reuse this value) */
 #define DHCP_EB_USE_CACHED DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb2 )
 
-/** BIOS drive number
+/** SAN drive number
  *
- * This is the drive number for a drive emulated via INT 13.  0x80 is
+ * This is the drive number for a SAN-hooked drive.  For BIOS, 0x80 is
  * the first hard disk, 0x81 is the second hard disk, etc.
  */
-#define DHCP_EB_BIOS_DRIVE DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbd )
+#define DHCP_EB_SAN_DRIVE DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbd )
 
 /** Username
  *