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