ソースを参照

[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 8年前
コミット
c32b07b81b
3個のファイルの変更31行の追加15行の削除
  1. 0
    11
      src/arch/x86/include/ipxe/bios_sanboot.h
  2. 28
    1
      src/arch/x86/interface/pcbios/int13.c
  3. 3
    3
      src/include/ipxe/dhcp.h

+ 0
- 11
src/arch/x86/include/ipxe/bios_sanboot.h ファイルの表示

@@ -15,15 +15,4 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
15 15
 #define SANBOOT_PREFIX_pcbios __pcbios_
16 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 18
 #endif /* _IPXE_BIOS_SANBOOT_H */

+ 28
- 1
src/arch/x86/interface/pcbios/int13.c ファイルの表示

@@ -44,6 +44,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
44 44
 #include <ipxe/pci.h>
45 45
 #include <ipxe/iso9660.h>
46 46
 #include <ipxe/eltorito.h>
47
+#include <ipxe/dhcp.h>
48
+#include <ipxe/settings.h>
47 49
 #include <realmode.h>
48 50
 #include <bios.h>
49 51
 #include <biosint.h>
@@ -1986,7 +1988,32 @@ static int int13_describe ( unsigned int drive ) {
1986 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 2017
 PROVIDE_SANBOOT ( pcbios, san_hook, int13_hook );
1991 2018
 PROVIDE_SANBOOT ( pcbios, san_unhook, int13_unhook );
1992 2019
 PROVIDE_SANBOOT ( pcbios, san_boot, int13_boot );

+ 3
- 3
src/include/ipxe/dhcp.h ファイルの表示

@@ -403,12 +403,12 @@ struct dhcp_netdev_desc {
403 403
 /** Use cached network settings (obsolete; do not reuse this value) */
404 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 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 413
 /** Username
414 414
  *

読み込み中…
キャンセル
保存