Skip to content

Commit

Permalink
pc-bios/s390-ccw: define loadparm length
Browse files Browse the repository at this point in the history
Loadparm is defined by the s390 architecture to be 8 bytes
in length. Let's define this size in the s390-ccw bios.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
collinwalling authored and huth committed Jun 18, 2018
1 parent 2ab09bf commit a0e11b6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion pc-bios/s390-ccw/iplb.h
Expand Up @@ -12,6 +12,8 @@
#ifndef IPLB_H
#define IPLB_H

#define LOADPARM_LEN 8

struct IplBlockCcw {
uint8_t reserved0[85];
uint8_t ssid;
Expand Down Expand Up @@ -61,7 +63,7 @@ struct IplParameterBlock {
uint8_t pbt;
uint8_t flags;
uint16_t reserved01;
uint8_t loadparm[8];
uint8_t loadparm[LOADPARM_LEN];
union {
IplBlockCcw ccw;
IplBlockFcp fcp;
Expand Down
8 changes: 4 additions & 4 deletions pc-bios/s390-ccw/main.c
Expand Up @@ -15,7 +15,7 @@
char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
static SubChannelId blk_schid = { .one = 1 };
IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
static char loadparm_str[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static char loadparm_str[LOADPARM_LEN + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
QemuIplParameters qipl;

#define LOADPARM_PROMPT "PROMPT "
Expand Down Expand Up @@ -80,13 +80,13 @@ static bool find_dev(Schib *schib, int dev_no)

static void menu_setup(void)
{
if (memcmp(loadparm_str, LOADPARM_PROMPT, 8) == 0) {
if (memcmp(loadparm_str, LOADPARM_PROMPT, LOADPARM_LEN) == 0) {
menu_set_parms(QIPL_FLAG_BM_OPTS_CMD, 0);
return;
}

/* If loadparm was set to any other value, then do not enable menu */
if (memcmp(loadparm_str, LOADPARM_EMPTY, 8) != 0) {
if (memcmp(loadparm_str, LOADPARM_EMPTY, LOADPARM_LEN) != 0) {
return;
}

Expand Down Expand Up @@ -117,7 +117,7 @@ static void virtio_setup(void)
enable_mss_facility();

sclp_get_loadparm_ascii(loadparm_str);
memcpy(ldp + 10, loadparm_str, 8);
memcpy(ldp + 10, loadparm_str, LOADPARM_LEN);
sclp_print(ldp);

memcpy(&qipl, early_qipl, sizeof(QemuIplParameters));
Expand Down
2 changes: 1 addition & 1 deletion pc-bios/s390-ccw/sclp.c
Expand Up @@ -114,7 +114,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
memset((char *)_sccb, 0, sizeof(ReadInfo));
sccb->h.length = sizeof(ReadInfo);
if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
ebcdic_to_ascii((char *) sccb->loadparm, loadparm, 8);
ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
}
}

Expand Down
2 changes: 1 addition & 1 deletion pc-bios/s390-ccw/sclp.h
Expand Up @@ -56,7 +56,7 @@ typedef struct ReadInfo {
uint16_t rnmax;
uint8_t rnsize;
uint8_t reserved[13];
uint8_t loadparm[8];
uint8_t loadparm[LOADPARM_LEN];
} __attribute__((packed)) ReadInfo;

typedef struct SCCB {
Expand Down

0 comments on commit a0e11b6

Please sign in to comment.