diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index ee2039dc69700dfe9ee6e36a81cc052ed5e15c14..c12e460a7f1cafeb053aebbe478d6f58b2056d00 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -241,6 +241,11 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl) switch (ipl->iplb.pbt) { case S390_IPL_TYPE_CCW: + /* In the absence of -boot menu, use zipl parameters */ + if (!qemu_opt_get(opts, "menu")) { + *flags |= QIPL_FLAG_BM_OPTS_ZIPL; + return; + } break; default: error_report("boot menu is not supported for this device type."); diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index d6c6f75b768ae9e6ff5225273f970392d0f790df..0570d0ad7555a76a67410ecb0b218901fd5f8285 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -93,6 +93,7 @@ void s390_reipl_request(void); /* Boot Menu flags */ #define QIPL_FLAG_BM_OPTS_CMD 0x80 +#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 /* * The QEMU IPL Parameters will be stored at absolute address diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h index 832bb944400950a5431a748567cd4b4dd21d3929..7dfce4fbcf74cfee2f7c7618e5581f6773163c82 100644 --- a/pc-bios/s390-ccw/iplb.h +++ b/pc-bios/s390-ccw/iplb.h @@ -76,6 +76,7 @@ extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); /* Boot Menu flags */ #define QIPL_FLAG_BM_OPTS_CMD 0x80 +#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 /* * This definition must be kept in sync with the defininition diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 32ed70ebdd88c6464b6efdebe7334ccafdecbb4b..a7473b039772e79a8ac17d0523e572c26bfe010e 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -20,6 +20,7 @@ QemuIplParameters qipl; #define LOADPARM_PROMPT "PROMPT " #define LOADPARM_EMPTY "........" +#define BOOT_MENU_FLAG_MASK (QIPL_FLAG_BM_OPTS_CMD | QIPL_FLAG_BM_OPTS_ZIPL) /* * Priniciples of Operations (SA22-7832-09) chapter 17 requires that @@ -91,7 +92,7 @@ static void menu_setup(void) switch (iplb.pbt) { case S390_IPL_TYPE_CCW: - menu_set_parms(qipl.qipl_flags & QIPL_FLAG_BM_OPTS_CMD, + menu_set_parms(qipl.qipl_flags & BOOT_MENU_FLAG_MASK, qipl.boot_menu_timeout); return; } diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c index 8d55869448e49a6b15ff78400732b383f07ebf92..ee56939c2114bf12f47b8c2b401136c739bcdcc9 100644 --- a/pc-bios/s390-ccw/menu.c +++ b/pc-bios/s390-ccw/menu.c @@ -18,6 +18,10 @@ #define KEYCODE_BACKSP '\177' #define KEYCODE_ENTER '\r' +/* Offsets from zipl fields to zipl banner start */ +#define ZIPL_TIMEOUT_OFFSET 138 +#define ZIPL_FLAG_OFFSET 140 + #define TOD_CLOCK_MILLISECOND 0x3e8000 #define LOW_CORE_EXTERNAL_INT_ADDR 0x86 @@ -187,6 +191,16 @@ int menu_get_zipl_boot_index(const char *menu_data) { size_t len; int entries; + uint16_t zipl_flag = *(uint16_t *)(menu_data - ZIPL_FLAG_OFFSET); + uint16_t zipl_timeout = *(uint16_t *)(menu_data - ZIPL_TIMEOUT_OFFSET); + + if (flag == QIPL_FLAG_BM_OPTS_ZIPL) { + if (!zipl_flag) { + return 0; /* Boot default */ + } + /* zipl stores timeout as seconds */ + timeout = zipl_timeout * 1000; + } /* Print and count all menu items, including the banner */ for (entries = 0; *menu_data; entries++) { @@ -211,5 +225,5 @@ void menu_set_parms(uint8_t boot_menu_flag, uint32_t boot_menu_timeout) bool menu_is_enabled_zipl(void) { - return flag & QIPL_FLAG_BM_OPTS_CMD; + return flag & (QIPL_FLAG_BM_OPTS_CMD | QIPL_FLAG_BM_OPTS_ZIPL); }