yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
016a62
From ad3b92699ba5e2280950fa9866f79673cecdb695 Mon Sep 17 00:00:00 2001
016a62
From: Thomas Huth <thuth@redhat.com>
016a62
Date: Mon, 14 Oct 2019 10:06:29 +0100
016a62
Subject: [PATCH 04/21] pc-bios/s390-ccw: define loadparm length
016a62
016a62
RH-Author: Thomas Huth <thuth@redhat.com>
016a62
Message-id: <20191014100645.22862-2-thuth@redhat.com>
016a62
Patchwork-id: 91780
016a62
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 01/17] pc-bios/s390-ccw: define loadparm length
016a62
Bugzilla: 1664376
016a62
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
016a62
RH-Acked-by: David Hildenbrand <david@redhat.com>
016a62
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
016a62
016a62
From: Collin Walling <walling@linux.ibm.com>
016a62
016a62
Loadparm is defined by the s390 architecture to be 8 bytes
016a62
in length. Let's define this size in the s390-ccw bios.
016a62
016a62
Suggested-by: Laszlo Ersek <lersek@redhat.com>
016a62
Signed-off-by: Collin Walling <walling@linux.ibm.com>
016a62
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
016a62
Reviewed-by: Thomas Huth <thuth@redhat.com>
016a62
Signed-off-by: Thomas Huth <thuth@redhat.com>
016a62
(cherry picked from commit a0e11b617b9ef41cefe8739dff4d6a7b01ca967f)
016a62
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
016a62
---
016a62
 pc-bios/s390-ccw/iplb.h | 4 +++-
016a62
 pc-bios/s390-ccw/main.c | 8 ++++----
016a62
 pc-bios/s390-ccw/sclp.c | 2 +-
016a62
 pc-bios/s390-ccw/sclp.h | 2 +-
016a62
 4 files changed, 9 insertions(+), 7 deletions(-)
016a62
016a62
diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h
016a62
index ded20c8..772d5c5 100644
016a62
--- a/pc-bios/s390-ccw/iplb.h
016a62
+++ b/pc-bios/s390-ccw/iplb.h
016a62
@@ -12,6 +12,8 @@
016a62
 #ifndef IPLB_H
016a62
 #define IPLB_H
016a62
 
016a62
+#define LOADPARM_LEN    8
016a62
+
016a62
 struct IplBlockCcw {
016a62
     uint8_t  reserved0[85];
016a62
     uint8_t  ssid;
016a62
@@ -61,7 +63,7 @@ struct IplParameterBlock {
016a62
     uint8_t  pbt;
016a62
     uint8_t  flags;
016a62
     uint16_t reserved01;
016a62
-    uint8_t  loadparm[8];
016a62
+    uint8_t  loadparm[LOADPARM_LEN];
016a62
     union {
016a62
         IplBlockCcw ccw;
016a62
         IplBlockFcp fcp;
016a62
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
016a62
index 26f9adf..544851d 100644
016a62
--- a/pc-bios/s390-ccw/main.c
016a62
+++ b/pc-bios/s390-ccw/main.c
016a62
@@ -15,7 +15,7 @@
016a62
 char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
016a62
 static SubChannelId blk_schid = { .one = 1 };
016a62
 IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
016a62
-static char loadparm_str[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
016a62
+static char loadparm_str[LOADPARM_LEN + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
016a62
 QemuIplParameters qipl;
016a62
 
016a62
 #define LOADPARM_PROMPT "PROMPT  "
016a62
@@ -80,13 +80,13 @@ static bool find_dev(Schib *schib, int dev_no)
016a62
 
016a62
 static void menu_setup(void)
016a62
 {
016a62
-    if (memcmp(loadparm_str, LOADPARM_PROMPT, 8) == 0) {
016a62
+    if (memcmp(loadparm_str, LOADPARM_PROMPT, LOADPARM_LEN) == 0) {
016a62
         menu_set_parms(QIPL_FLAG_BM_OPTS_CMD, 0);
016a62
         return;
016a62
     }
016a62
 
016a62
     /* If loadparm was set to any other value, then do not enable menu */
016a62
-    if (memcmp(loadparm_str, LOADPARM_EMPTY, 8) != 0) {
016a62
+    if (memcmp(loadparm_str, LOADPARM_EMPTY, LOADPARM_LEN) != 0) {
016a62
         return;
016a62
     }
016a62
 
016a62
@@ -117,7 +117,7 @@ static void virtio_setup(void)
016a62
     enable_mss_facility();
016a62
 
016a62
     sclp_get_loadparm_ascii(loadparm_str);
016a62
-    memcpy(ldp + 10, loadparm_str, 8);
016a62
+    memcpy(ldp + 10, loadparm_str, LOADPARM_LEN);
016a62
     sclp_print(ldp);
016a62
 
016a62
     memcpy(&qipl, early_qipl, sizeof(QemuIplParameters));
016a62
diff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c
016a62
index 3836cb4..c0223fa 100644
016a62
--- a/pc-bios/s390-ccw/sclp.c
016a62
+++ b/pc-bios/s390-ccw/sclp.c
016a62
@@ -114,7 +114,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
016a62
     memset((char *)_sccb, 0, sizeof(ReadInfo));
016a62
     sccb->h.length = sizeof(ReadInfo);
016a62
     if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
016a62
-        ebcdic_to_ascii((char *) sccb->loadparm, loadparm, 8);
016a62
+        ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
016a62
     }
016a62
 }
016a62
 
016a62
diff --git a/pc-bios/s390-ccw/sclp.h b/pc-bios/s390-ccw/sclp.h
016a62
index 0dd987f..8450161 100644
016a62
--- a/pc-bios/s390-ccw/sclp.h
016a62
+++ b/pc-bios/s390-ccw/sclp.h
016a62
@@ -56,7 +56,7 @@ typedef struct ReadInfo {
016a62
     uint16_t rnmax;
016a62
     uint8_t rnsize;
016a62
     uint8_t reserved[13];
016a62
-    uint8_t loadparm[8];
016a62
+    uint8_t loadparm[LOADPARM_LEN];
016a62
 } __attribute__((packed)) ReadInfo;
016a62
 
016a62
 typedef struct SCCB {
016a62
-- 
016a62
1.8.3.1
016a62