|
|
357786 |
From 81a0dae65a07d9323c78c6bc9adc7f8dbbb19145 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
357786 |
Date: Mon, 7 May 2018 07:58:08 +0200
|
|
|
357786 |
Subject: [PATCH 12/13] pc-bios/s390-ccw: fix non-sequential boot entries
|
|
|
357786 |
(enum)
|
|
|
357786 |
|
|
|
357786 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
357786 |
Message-id: <1525679888-9234-7-git-send-email-thuth@redhat.com>
|
|
|
357786 |
Patchwork-id: 80054
|
|
|
357786 |
O-Subject: [RHEL-7.6 qemu-kvm-ma PATCH 6/6] pc-bios/s390-ccw: fix non-sequential boot entries (enum)
|
|
|
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 enumerated boot menu. Since we
|
|
|
357786 |
can no longer print a range of available entries to the
|
|
|
357786 |
user, we have to present a list of each available entry.
|
|
|
357786 |
|
|
|
357786 |
An example of this menu:
|
|
|
357786 |
|
|
|
357786 |
s390-ccw Enumerated Boot Menu.
|
|
|
357786 |
|
|
|
357786 |
[0] default
|
|
|
357786 |
|
|
|
357786 |
[1]
|
|
|
357786 |
[2]
|
|
|
357786 |
[7]
|
|
|
357786 |
[8]
|
|
|
357786 |
[9]
|
|
|
357786 |
[11]
|
|
|
357786 |
[12]
|
|
|
357786 |
|
|
|
357786 |
Please choose:
|
|
|
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 622b39178057289a1c8c1b5148f513e658e90ea1)
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
pc-bios/s390-ccw/bootmap.c | 12 +++++++-----
|
|
|
357786 |
pc-bios/s390-ccw/menu.c | 29 ++++++++++++++++++++---------
|
|
|
357786 |
pc-bios/s390-ccw/s390-ccw.h | 2 +-
|
|
|
357786 |
3 files changed, 28 insertions(+), 15 deletions(-)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
|
|
|
357786 |
index b767fa2..e41e715 100644
|
|
|
357786 |
--- a/pc-bios/s390-ccw/bootmap.c
|
|
|
357786 |
+++ b/pc-bios/s390-ccw/bootmap.c
|
|
|
357786 |
@@ -565,6 +565,8 @@ static void ipl_scsi(void)
|
|
|
357786 |
int program_table_entries = 0;
|
|
|
357786 |
BootMapTable *prog_table = (void *)sec;
|
|
|
357786 |
unsigned int loadparm = get_loadparm_index();
|
|
|
357786 |
+ bool valid_entries[MAX_BOOT_ENTRIES] = {false};
|
|
|
357786 |
+ size_t i;
|
|
|
357786 |
|
|
|
357786 |
/* Grab the MBR */
|
|
|
357786 |
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
|
|
|
357786 |
@@ -585,18 +587,18 @@ static void ipl_scsi(void)
|
|
|
357786 |
read_block(mbr->pt.blockno, sec, "Error reading Program Table");
|
|
|
357786 |
IPL_assert(magic_match(sec, ZIPL_MAGIC), "No zIPL magic in PT");
|
|
|
357786 |
|
|
|
357786 |
- while (program_table_entries < MAX_BOOT_ENTRIES) {
|
|
|
357786 |
- if (!prog_table->entry[program_table_entries].scsi.blockno) {
|
|
|
357786 |
- break;
|
|
|
357786 |
+ for (i = 0; i < MAX_BOOT_ENTRIES; i++) {
|
|
|
357786 |
+ if (prog_table->entry[i].scsi.blockno) {
|
|
|
357786 |
+ valid_entries[i] = true;
|
|
|
357786 |
+ program_table_entries++;
|
|
|
357786 |
}
|
|
|
357786 |
- program_table_entries++;
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
debug_print_int("program table entries", program_table_entries);
|
|
|
357786 |
IPL_assert(program_table_entries != 0, "Empty Program Table");
|
|
|
357786 |
|
|
|
357786 |
if (menu_is_enabled_enum()) {
|
|
|
357786 |
- loadparm = menu_get_enum_boot_index(program_table_entries);
|
|
|
357786 |
+ loadparm = menu_get_enum_boot_index(valid_entries);
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
debug_print_int("loadparm", loadparm);
|
|
|
357786 |
diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c
|
|
|
357786 |
index aaf5d61..82a4ae6 100644
|
|
|
357786 |
--- a/pc-bios/s390-ccw/menu.c
|
|
|
357786 |
+++ b/pc-bios/s390-ccw/menu.c
|
|
|
357786 |
@@ -228,19 +228,30 @@ int menu_get_zipl_boot_index(const char *menu_data)
|
|
|
357786 |
return get_boot_index(valid_entries);
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
-
|
|
|
357786 |
-int menu_get_enum_boot_index(int entries)
|
|
|
357786 |
+int menu_get_enum_boot_index(bool *valid_entries)
|
|
|
357786 |
{
|
|
|
357786 |
- char tmp[4];
|
|
|
357786 |
+ char tmp[3];
|
|
|
357786 |
+ int i;
|
|
|
357786 |
|
|
|
357786 |
- sclp_print("s390x Enumerated Boot Menu.\n\n");
|
|
|
357786 |
+ sclp_print("s390-ccw Enumerated Boot Menu.\n\n");
|
|
|
357786 |
|
|
|
357786 |
- sclp_print(uitoa(entries, tmp, sizeof(tmp)));
|
|
|
357786 |
- sclp_print(" entries detected. Select from boot index 0 to ");
|
|
|
357786 |
- sclp_print(uitoa(entries - 1, tmp, sizeof(tmp)));
|
|
|
357786 |
- sclp_print(".\n\n");
|
|
|
357786 |
+ for (i = 0; i < MAX_BOOT_ENTRIES; i++) {
|
|
|
357786 |
+ if (valid_entries[i]) {
|
|
|
357786 |
+ if (i < 10) {
|
|
|
357786 |
+ sclp_print(" ");
|
|
|
357786 |
+ }
|
|
|
357786 |
+ sclp_print("[");
|
|
|
357786 |
+ sclp_print(uitoa(i, tmp, sizeof(tmp)));
|
|
|
357786 |
+ sclp_print("]");
|
|
|
357786 |
+ if (i == 0) {
|
|
|
357786 |
+ sclp_print(" default\n");
|
|
|
357786 |
+ }
|
|
|
357786 |
+ sclp_print("\n");
|
|
|
357786 |
+ }
|
|
|
357786 |
+ }
|
|
|
357786 |
|
|
|
357786 |
- return get_boot_index(entries);
|
|
|
357786 |
+ sclp_print("\n");
|
|
|
357786 |
+ return get_boot_index(valid_entries);
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
void menu_set_parms(uint8_t boot_menu_flag, uint32_t boot_menu_timeout)
|
|
|
357786 |
diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
|
|
|
357786 |
index 2c9e601..a1bdb4c 100644
|
|
|
357786 |
--- a/pc-bios/s390-ccw/s390-ccw.h
|
|
|
357786 |
+++ b/pc-bios/s390-ccw/s390-ccw.h
|
|
|
357786 |
@@ -91,7 +91,7 @@ void zipl_load(void);
|
|
|
357786 |
void menu_set_parms(uint8_t boot_menu_flag, uint32_t boot_menu_timeout);
|
|
|
357786 |
int menu_get_zipl_boot_index(const char *menu_data);
|
|
|
357786 |
bool menu_is_enabled_zipl(void);
|
|
|
357786 |
-int menu_get_enum_boot_index(int entries);
|
|
|
357786 |
+int menu_get_enum_boot_index(bool *valid_entries);
|
|
|
357786 |
bool menu_is_enabled_enum(void);
|
|
|
357786 |
|
|
|
357786 |
#define MAX_BOOT_ENTRIES 31
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|