diff options
Diffstat (limited to 'pc-bios')
-rw-r--r-- | pc-bios/s390-ccw.img | bin | 26456 -> 26472 bytes | |||
-rw-r--r-- | pc-bios/s390-ccw/Makefile | 2 | ||||
-rw-r--r-- | pc-bios/s390-ccw/bootmap.c | 34 | ||||
-rw-r--r-- | pc-bios/s390-ccw/bootmap.h | 24 | ||||
-rw-r--r-- | pc-bios/s390-ccw/main.c | 38 | ||||
-rw-r--r-- | pc-bios/s390-ccw/s390-ccw.h | 17 | ||||
-rw-r--r-- | pc-bios/s390-ccw/sclp.c (renamed from pc-bios/s390-ccw/sclp-ascii.c) | 12 | ||||
-rw-r--r-- | pc-bios/s390-ccw/sclp.h | 2 |
8 files changed, 92 insertions, 37 deletions
diff --git a/pc-bios/s390-ccw.img b/pc-bios/s390-ccw.img Binary files differindex 2a4adfa654..0b01d49495 100644 --- a/pc-bios/s390-ccw.img +++ b/pc-bios/s390-ccw.img diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index 0339c24789..79a46b6735 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -9,7 +9,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all -OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o virtio-scsi.o +OBJECTS = start.o main.o bootmap.o sclp.o virtio.o virtio-scsi.o QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index b21c877b53..523fa78c5f 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -183,15 +183,21 @@ static block_number_t load_eckd_segments(block_number_t blk, uint64_t *address) static void run_eckd_boot_script(block_number_t mbr_block_nr) { int i; + unsigned int loadparm = get_loadparm_index(); block_number_t block_nr; uint64_t address; - ScsiMbr *scsi_mbr = (void *)sec; + ScsiMbr *bte = (void *)sec; /* Eckd bootmap table entry */ BootMapScript *bms = (void *)sec; + debug_print_int("loadparm", loadparm); + IPL_assert(loadparm < 31, "loadparm value greater than" + " maximum number of boot entries allowed"); + memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(mbr_block_nr, sec, "Cannot read MBR"); - block_nr = eckd_block_num((void *)&(scsi_mbr->blockptr)); + block_nr = eckd_block_num((void *)&(bte->blockptr[loadparm])); + IPL_assert(block_nr != -1, "No Boot Map"); memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(block_nr, sec, "Cannot read Boot Map Script"); @@ -444,7 +450,8 @@ static void ipl_scsi(void) uint8_t *ns, *ns_end; int program_table_entries = 0; const int pte_len = sizeof(ScsiBlockPtr); - ScsiBlockPtr *prog_table_entry; + ScsiBlockPtr *prog_table_entry = NULL; + unsigned int loadparm = get_loadparm_index(); /* Grab the MBR */ memset(sec, FREE_SPACE_FILLER, sizeof(sec)); @@ -458,15 +465,16 @@ static void ipl_scsi(void) debug_print_int("MBR Version", mbr->version_id); IPL_check(mbr->version_id == 1, "Unknown MBR layout version, assuming version 1"); - debug_print_int("program table", mbr->blockptr.blockno); - IPL_assert(mbr->blockptr.blockno, "No Program Table"); + debug_print_int("program table", mbr->blockptr[0].blockno); + IPL_assert(mbr->blockptr[0].blockno, "No Program Table"); /* Parse the program table */ - read_block(mbr->blockptr.blockno, sec, + read_block(mbr->blockptr[0].blockno, sec, "Error reading Program Table"); IPL_assert(magic_match(sec, ZIPL_MAGIC), "No zIPL magic in PT"); + debug_print_int("loadparm index", loadparm); ns_end = sec + virtio_get_block_size(); for (ns = (sec + pte_len); (ns + pte_len) < ns_end; ns += pte_len) { prog_table_entry = (ScsiBlockPtr *)ns; @@ -475,16 +483,15 @@ static void ipl_scsi(void) } program_table_entries++; + if (program_table_entries == loadparm + 1) { + break; /* selected entry found */ + } } debug_print_int("program table entries", program_table_entries); IPL_assert(program_table_entries != 0, "Empty Program Table"); - /* Run the default entry */ - - prog_table_entry = (ScsiBlockPtr *)(sec + pte_len); - zipl_run(prog_table_entry); /* no return */ } @@ -648,6 +655,7 @@ static IsoBcSection *find_iso_bc_entry(void) IsoBcEntry *e = (IsoBcEntry *)sec; uint32_t offset = find_iso_bc(); int i; + unsigned int loadparm = get_loadparm_index(); if (!offset) { return NULL; @@ -668,7 +676,11 @@ static IsoBcSection *find_iso_bc_entry(void) for (i = 1; i < ISO_BC_ENTRY_PER_SECTOR; i++) { if (e[i].id == ISO_BC_BOOTABLE_SECTION) { if (is_iso_bc_entry_compatible(&e[i].body.sect)) { - return &e[i].body.sect; + if (loadparm <= 1) { + /* found, default, or unspecified */ + return &e[i].body.sect; + } + loadparm--; } } } diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h index bea168714b..7f367820f3 100644 --- a/pc-bios/s390-ccw/bootmap.h +++ b/pc-bios/s390-ccw/bootmap.h @@ -70,7 +70,7 @@ typedef struct ScsiMbr { uint8_t magic[4]; uint32_t version_id; uint8_t reserved[8]; - ScsiBlockPtr blockptr; + ScsiBlockPtr blockptr[]; } __attribute__ ((packed)) ScsiMbr; #define ZIPL_MAGIC "zIPL" @@ -264,28 +264,6 @@ typedef enum { /* utility code below */ -static const unsigned char ebc2asc[256] = - /* 0123456789abcdef0123456789abcdef */ - "................................" /* 1F */ - "................................" /* 3F */ - " ...........<(+|&.........!$*);." /* 5F first.chr.here.is.real.space */ - "-/.........,%_>?.........`:#@'=\""/* 7F */ - ".abcdefghi.......jklmnopqr......" /* 9F */ - "..stuvwxyz......................" /* BF */ - ".ABCDEFGHI.......JKLMNOPQR......" /* DF */ - "..STUVWXYZ......0123456789......";/* FF */ - -static inline void ebcdic_to_ascii(const char *src, - char *dst, - unsigned int size) -{ - unsigned int i; - for (i = 0; i < size; i++) { - unsigned c = src[i]; - dst[i] = ebc2asc[c]; - } -} - static inline void print_volser(const void *volser) { char ascii[8]; diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 0946766d86..1cacc1b46f 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -14,6 +14,18 @@ char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); static SubChannelId blk_schid = { .one = 1 }; IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); +static char loadparm[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +const unsigned char ebc2asc[256] = + /* 0123456789abcdef0123456789abcdef */ + "................................" /* 1F */ + "................................" /* 3F */ + " ...........<(+|&.........!$*);." /* 5F first.chr.here.is.real.space */ + "-/.........,%_>?.........`:#@'=\""/* 7F */ + ".abcdefghi.......jklmnopqr......" /* 9F */ + "..stuvwxyz......................" /* BF */ + ".ABCDEFGHI.......JKLMNOPQR......" /* DF */ + "..STUVWXYZ......0123456789......";/* FF */ /* * Priniciples of Operations (SA22-7832-09) chapter 17 requires that @@ -29,7 +41,6 @@ void write_subsystem_identification(void) *zeroes = 0; } - void panic(const char *string) { sclp_print(string); @@ -37,6 +48,26 @@ void panic(const char *string) while (1) { } } +unsigned int get_loadparm_index(void) +{ + const char *lp = loadparm; + int i; + unsigned int idx = 0; + + for (i = 0; i < 8; i++) { + char c = lp[i]; + + if (c < '0' || c > '9') { + break; + } + + idx *= 10; + idx += c - '0'; + } + + return idx; +} + static bool find_dev(Schib *schib, int dev_no) { int i, r; @@ -73,6 +104,7 @@ static void virtio_setup(void) int ssid; bool found = false; uint16_t dev_no; + char ldp[] = "LOADPARM=[________]\n"; VDev *vdev = virtio_get_device(); /* @@ -82,6 +114,10 @@ static void virtio_setup(void) */ enable_mss_facility(); + sclp_get_loadparm_ascii(loadparm); + memcpy(ldp + 10, loadparm, 8); + sclp_print(ldp); + if (store_iplb(&iplb)) { switch (iplb.pbt) { case S390_IPL_TYPE_CCW: diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index ded67bcbc6..07d8cbcb20 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -62,10 +62,12 @@ void consume_sclp_int(void); void panic(const char *string); void write_subsystem_identification(void); extern char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); +unsigned int get_loadparm_index(void); -/* sclp-ascii.c */ +/* sclp.c */ void sclp_print(const char *string); void sclp_setup(void); +void sclp_get_loadparm_ascii(char *loadparm); /* virtio.c */ unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2, @@ -189,4 +191,17 @@ static inline void IPL_check(bool term, const char *message) } } +extern const unsigned char ebc2asc[256]; +static inline void ebcdic_to_ascii(const char *src, + char *dst, + unsigned int size) +{ + unsigned int i; + + for (i = 0; i < size; i++) { + unsigned c = src[i]; + dst[i] = ebc2asc[c]; + } +} + #endif /* S390_CCW_H */ diff --git a/pc-bios/s390-ccw/sclp-ascii.c b/pc-bios/s390-ccw/sclp.c index dc1c3e4f4d..a1639baed7 100644 --- a/pc-bios/s390-ccw/sclp-ascii.c +++ b/pc-bios/s390-ccw/sclp.c @@ -80,3 +80,15 @@ void sclp_print(const char *str) sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb); } + +void sclp_get_loadparm_ascii(char *loadparm) +{ + + ReadInfo *sccb = (void *)_sccb; + + 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); + } +} diff --git a/pc-bios/s390-ccw/sclp.h b/pc-bios/s390-ccw/sclp.h index 3cbfb78930..0dd987ff5d 100644 --- a/pc-bios/s390-ccw/sclp.h +++ b/pc-bios/s390-ccw/sclp.h @@ -55,6 +55,8 @@ typedef struct ReadInfo { SCCBHeader h; uint16_t rnmax; uint8_t rnsize; + uint8_t reserved[13]; + uint8_t loadparm[8]; } __attribute__((packed)) ReadInfo; typedef struct SCCB { |