|
|
357786 |
From 3ded1fcf70af2fa1a3a785b777e7f724bd285fc3 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
357786 |
Date: Mon, 7 May 2018 07:58:07 +0200
|
|
|
357786 |
Subject: [PATCH 11/13] pc-bios/s390-ccw: fix non-sequential boot entries
|
|
|
357786 |
(eckd)
|
|
|
357786 |
|
|
|
357786 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
357786 |
Message-id: <1525679888-9234-6-git-send-email-thuth@redhat.com>
|
|
|
357786 |
Patchwork-id: 80053
|
|
|
357786 |
O-Subject: [RHEL-7.6 qemu-kvm-ma PATCH 5/6] pc-bios/s390-ccw: fix non-sequential boot entries (eckd)
|
|
|
357786 |
Bugzilla: 1523857
|
|
|
357786 |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
357786 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
357786 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
From: Collin Walling <walling@linux.ibm.com>
|
|
|
357786 |
|
|
|
357786 |
zIPL boot menu entries can be non-sequential. Let's account
|
|
|
357786 |
for this issue for the s390 zIPL boot menu. Since this boot
|
|
|
357786 |
menu is actually an imitation and is not completely capable
|
|
|
357786 |
of everything the real zIPL menu can do, let's also print a
|
|
|
357786 |
different banner to the user.
|
|
|
357786 |
|
|
|
357786 |
Signed-off-by: Collin Walling <walling@linux.ibm.com>
|
|
|
357786 |
Reported-by: Vasily Gorbik <gor@linux.ibm.com>
|
|
|
357786 |
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
|
|
357786 |
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
|
|
|
357786 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
357786 |
(cherry picked from commit 7385e947fc65a44dd05abb86c874beb915c1989c)
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
pc-bios/s390-ccw/menu.c | 29 ++++++++++++++++++++---------
|
|
|
357786 |
1 file changed, 20 insertions(+), 9 deletions(-)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c
|
|
|
357786 |
index 96eec81..aaf5d61 100644
|
|
|
357786 |
--- a/pc-bios/s390-ccw/menu.c
|
|
|
357786 |
+++ b/pc-bios/s390-ccw/menu.c
|
|
|
357786 |
@@ -158,7 +158,7 @@ static void boot_menu_prompt(bool retry)
|
|
|
357786 |
}
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
-static int get_boot_index(int entries)
|
|
|
357786 |
+static int get_boot_index(bool *valid_entries)
|
|
|
357786 |
{
|
|
|
357786 |
int boot_index;
|
|
|
357786 |
bool retry = false;
|
|
|
357786 |
@@ -168,7 +168,8 @@ static int get_boot_index(int entries)
|
|
|
357786 |
boot_menu_prompt(retry);
|
|
|
357786 |
boot_index = get_index();
|
|
|
357786 |
retry = true;
|
|
|
357786 |
- } while (boot_index < 0 || boot_index >= entries);
|
|
|
357786 |
+ } while (boot_index < 0 || boot_index >= MAX_BOOT_ENTRIES ||
|
|
|
357786 |
+ !valid_entries[boot_index]);
|
|
|
357786 |
|
|
|
357786 |
sclp_print("\nBooting entry #");
|
|
|
357786 |
sclp_print(uitoa(boot_index, tmp, sizeof(tmp)));
|
|
|
357786 |
@@ -176,7 +177,8 @@ static int get_boot_index(int entries)
|
|
|
357786 |
return boot_index;
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
-static void zipl_println(const char *data, size_t len)
|
|
|
357786 |
+/* Returns the entry number that was printed */
|
|
|
357786 |
+static int zipl_print_entry(const char *data, size_t len)
|
|
|
357786 |
{
|
|
|
357786 |
char buf[len + 2];
|
|
|
357786 |
|
|
|
357786 |
@@ -185,12 +187,15 @@ static void zipl_println(const char *data, size_t len)
|
|
|
357786 |
buf[len + 1] = '\0';
|
|
|
357786 |
|
|
|
357786 |
sclp_print(buf);
|
|
|
357786 |
+
|
|
|
357786 |
+ return buf[0] == ' ' ? atoui(buf + 1) : atoui(buf);
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
int menu_get_zipl_boot_index(const char *menu_data)
|
|
|
357786 |
{
|
|
|
357786 |
size_t len;
|
|
|
357786 |
- int entries;
|
|
|
357786 |
+ int entry;
|
|
|
357786 |
+ bool valid_entries[MAX_BOOT_ENTRIES] = {false};
|
|
|
357786 |
uint16_t zipl_flag = *(uint16_t *)(menu_data - ZIPL_FLAG_OFFSET);
|
|
|
357786 |
uint16_t zipl_timeout = *(uint16_t *)(menu_data - ZIPL_TIMEOUT_OFFSET);
|
|
|
357786 |
|
|
|
357786 |
@@ -202,19 +207,25 @@ int menu_get_zipl_boot_index(const char *menu_data)
|
|
|
357786 |
timeout = zipl_timeout * 1000;
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
- /* Print and count all menu items, including the banner */
|
|
|
357786 |
- for (entries = 0; *menu_data; entries++) {
|
|
|
357786 |
+ /* Print banner */
|
|
|
357786 |
+ sclp_print("s390-ccw zIPL Boot Menu\n\n");
|
|
|
357786 |
+ menu_data += strlen(menu_data) + 1;
|
|
|
357786 |
+
|
|
|
357786 |
+ /* Print entries */
|
|
|
357786 |
+ while (*menu_data) {
|
|
|
357786 |
len = strlen(menu_data);
|
|
|
357786 |
- zipl_println(menu_data, len);
|
|
|
357786 |
+ entry = zipl_print_entry(menu_data, len);
|
|
|
357786 |
menu_data += len + 1;
|
|
|
357786 |
|
|
|
357786 |
- if (entries < 2) {
|
|
|
357786 |
+ valid_entries[entry] = true;
|
|
|
357786 |
+
|
|
|
357786 |
+ if (entry == 0) {
|
|
|
357786 |
sclp_print("\n");
|
|
|
357786 |
}
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
sclp_print("\n");
|
|
|
357786 |
- return get_boot_index(entries - 1); /* subtract 1 to exclude banner */
|
|
|
357786 |
+ return get_boot_index(valid_entries);
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|