Browse Source

[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>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
c32b07b81b

+ 0
- 11
src/arch/x86/include/ipxe/bios_sanboot.h View File

15
 #define SANBOOT_PREFIX_pcbios __pcbios_
15
 #define SANBOOT_PREFIX_pcbios __pcbios_
16
 #endif
16
 #endif
17
 
17
 
18
-/**
19
- * Get default SAN drive number
20
- *
21
- * @ret drive		Default drive number
22
- */
23
-static inline __always_inline unsigned int
24
-SANBOOT_INLINE ( pcbios, san_default_drive ) ( void ) {
25
-	/* Default to booting from first hard disk */
26
-	return 0x80;
27
-}
28
-
29
 #endif /* _IPXE_BIOS_SANBOOT_H */
18
 #endif /* _IPXE_BIOS_SANBOOT_H */

+ 28
- 1
src/arch/x86/interface/pcbios/int13.c View File

44
 #include <ipxe/pci.h>
44
 #include <ipxe/pci.h>
45
 #include <ipxe/iso9660.h>
45
 #include <ipxe/iso9660.h>
46
 #include <ipxe/eltorito.h>
46
 #include <ipxe/eltorito.h>
47
+#include <ipxe/dhcp.h>
48
+#include <ipxe/settings.h>
47
 #include <realmode.h>
49
 #include <realmode.h>
48
 #include <bios.h>
50
 #include <bios.h>
49
 #include <biosint.h>
51
 #include <biosint.h>
1986
 	return 0;
1988
 	return 0;
1987
 }
1989
 }
1988
 
1990
 
1989
-PROVIDE_SANBOOT_INLINE ( pcbios, san_default_drive );
1991
+/** The "san-drive" setting */
1992
+const struct setting san_drive_setting __setting ( SETTING_SANBOOT_EXTRA,
1993
+						   san-drive ) = {
1994
+	.name = "san-drive",
1995
+	.description = "SAN drive number",
1996
+	.tag = DHCP_EB_SAN_DRIVE,
1997
+	.type = &setting_type_uint8,
1998
+};
1999
+
2000
+/**
2001
+ * Get default SAN drive number
2002
+ *
2003
+ * @ret drive		Default drive number
2004
+ */
2005
+static unsigned int int13_default_drive ( void ) {
2006
+	unsigned long drive;
2007
+
2008
+	/* Use "san-drive" setting, if specified */
2009
+	if ( fetch_uint_setting ( NULL, &san_drive_setting, &drive ) >= 0 )
2010
+		return drive;
2011
+
2012
+	/* Otherwise, default to booting from first hard disk */
2013
+	return 0x80;
2014
+}
2015
+
2016
+PROVIDE_SANBOOT ( pcbios, san_default_drive, int13_default_drive );
1990
 PROVIDE_SANBOOT ( pcbios, san_hook, int13_hook );
2017
 PROVIDE_SANBOOT ( pcbios, san_hook, int13_hook );
1991
 PROVIDE_SANBOOT ( pcbios, san_unhook, int13_unhook );
2018
 PROVIDE_SANBOOT ( pcbios, san_unhook, int13_unhook );
1992
 PROVIDE_SANBOOT ( pcbios, san_boot, int13_boot );
2019
 PROVIDE_SANBOOT ( pcbios, san_boot, int13_boot );

+ 3
- 3
src/include/ipxe/dhcp.h View File

403
 /** Use cached network settings (obsolete; do not reuse this value) */
403
 /** Use cached network settings (obsolete; do not reuse this value) */
404
 #define DHCP_EB_USE_CACHED DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb2 )
404
 #define DHCP_EB_USE_CACHED DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb2 )
405
 
405
 
406
-/** BIOS drive number
406
+/** SAN drive number
407
  *
407
  *
408
- * This is the drive number for a drive emulated via INT 13.  0x80 is
408
+ * This is the drive number for a SAN-hooked drive.  For BIOS, 0x80 is
409
  * the first hard disk, 0x81 is the second hard disk, etc.
409
  * the first hard disk, 0x81 is the second hard disk, etc.
410
  */
410
  */
411
-#define DHCP_EB_BIOS_DRIVE DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbd )
411
+#define DHCP_EB_SAN_DRIVE DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbd )
412
 
412
 
413
 /** Username
413
 /** Username
414
  *
414
  *

Loading…
Cancel
Save