summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorMichael Brown2016-03-20 10:16:13 +0100
committerMichael Brown2016-03-22 10:55:09 +0100
commitab5b3abbbac98eb52109c34058e1999df7dd0b86 (patch)
treedd5564fe02cc6ac8f69c21ad98142edf75f7c69e /src/usr
parent[gdb] Add support for x86_64 (diff)
downloadipxe-ab5b3abbbac98eb52109c34058e1999df7dd0b86.tar.gz
ipxe-ab5b3abbbac98eb52109c34058e1999df7dd0b86.tar.xz
ipxe-ab5b3abbbac98eb52109c34058e1999df7dd0b86.zip
[int13] Allow drive to be hooked using the natural drive number
Interpret the maximum drive number (0xff for hard disks, 0x7f for floppy disks) as meaning "use natural drive number". Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/autoboot.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index e93b0150..57bf96ef 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -127,7 +127,9 @@ int uriboot ( struct uri *filename, struct uri *root_path, int drive,
/* Hook SAN device, if applicable */
if ( root_path ) {
- if ( ( rc = san_hook ( root_path, drive ) ) != 0 ) {
+ drive = san_hook ( root_path, drive );
+ if ( drive < 0 ) {
+ rc = drive;
printf ( "Could not open SAN device: %s\n",
strerror ( rc ) );
goto err_san_hook;
@@ -136,7 +138,7 @@ int uriboot ( struct uri *filename, struct uri *root_path, int drive,
}
/* Describe SAN device, if applicable */
- if ( ( drive >= 0 ) && ! ( flags & URIBOOT_NO_SAN_DESCRIBE ) ) {
+ if ( ! ( flags & URIBOOT_NO_SAN_DESCRIBE ) ) {
if ( ( rc = san_describe ( drive ) ) != 0 ) {
printf ( "Could not describe SAN device %#02x: %s\n",
drive, strerror ( rc ) );
@@ -170,7 +172,7 @@ int uriboot ( struct uri *filename, struct uri *root_path, int drive,
}
/* Attempt SAN boot if applicable */
- if ( ( drive >= 0 ) && ! ( flags & URIBOOT_NO_SAN_BOOT ) ) {
+ if ( ! ( flags & URIBOOT_NO_SAN_BOOT ) ) {
if ( fetch_intz_setting ( NULL, &skip_san_boot_setting) == 0 ) {
printf ( "Booting from SAN device %#02x\n", drive );
rc = san_boot ( drive );
@@ -188,7 +190,7 @@ int uriboot ( struct uri *filename, struct uri *root_path, int drive,
err_download:
err_san_describe:
/* Unhook SAN device, if applicable */
- if ( ( drive >= 0 ) && ! ( flags & URIBOOT_NO_SAN_UNHOOK ) ) {
+ if ( ! ( flags & URIBOOT_NO_SAN_UNHOOK ) ) {
if ( fetch_intz_setting ( NULL, &keep_san_setting ) == 0 ) {
san_unhook ( drive );
printf ( "Unregistered SAN device %#02x\n", drive );