s390-bios: decouple common boot logic from virtio

Create a boot_setup function to handle getting boot information from
the machine/hypervisor. This decouples common boot logic from the
virtio code path and allows us to make use of it for the real dasd boot
scenario.

Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
Acked-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <1554388475-18329-4-git-send-email-jjherne@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Jason J. Herne 2019-04-04 10:34:22 -04:00 committed by Thomas Huth
parent 87f910c142
commit a5f6e0975b

View File

@ -14,16 +14,17 @@
char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
static SubChannelId blk_schid = { .one = 1 }; static SubChannelId blk_schid = { .one = 1 };
IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
static char loadparm_str[LOADPARM_LEN + 1] = { 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; QemuIplParameters qipl;
IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
static bool have_iplb;
#define LOADPARM_PROMPT "PROMPT " #define LOADPARM_PROMPT "PROMPT "
#define LOADPARM_EMPTY " " #define LOADPARM_EMPTY " "
#define BOOT_MENU_FLAG_MASK (QIPL_FLAG_BM_OPTS_CMD | QIPL_FLAG_BM_OPTS_ZIPL) #define BOOT_MENU_FLAG_MASK (QIPL_FLAG_BM_OPTS_CMD | QIPL_FLAG_BM_OPTS_ZIPL)
/* /*
* Priniciples of Operations (SA22-7832-09) chapter 17 requires that * Principles of Operations (SA22-7832-09) chapter 17 requires that
* a subsystem-identification is at 184-187 and bytes 188-191 are zero * a subsystem-identification is at 184-187 and bytes 188-191 are zero
* after list-directed-IPL and ccw-IPL. * after list-directed-IPL and ccw-IPL.
*/ */
@ -111,23 +112,33 @@ static void css_setup(void)
enable_mss_facility(); enable_mss_facility();
} }
/*
* Collect various pieces of information from the hypervisor/hardware that
* we'll use to determine exactly how we'll boot.
*/
static void boot_setup(void)
{
char lpmsg[] = "LOADPARM=[________]\n";
sclp_get_loadparm_ascii(loadparm_str);
memcpy(lpmsg + 10, loadparm_str, 8);
sclp_print(lpmsg);
have_iplb = store_iplb(&iplb);
}
static void virtio_setup(void) static void virtio_setup(void)
{ {
Schib schib; Schib schib;
int ssid; int ssid;
bool found = false; bool found = false;
uint16_t dev_no; uint16_t dev_no;
char ldp[] = "LOADPARM=[________]\n";
VDev *vdev = virtio_get_device(); VDev *vdev = virtio_get_device();
QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS; QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS;
sclp_get_loadparm_ascii(loadparm_str);
memcpy(ldp + 10, loadparm_str, LOADPARM_LEN);
sclp_print(ldp);
memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); memcpy(&qipl, early_qipl, sizeof(QemuIplParameters));
if (store_iplb(&iplb)) { if (have_iplb) {
switch (iplb.pbt) { switch (iplb.pbt) {
case S390_IPL_TYPE_CCW: case S390_IPL_TYPE_CCW:
dev_no = iplb.ccw.devno; dev_no = iplb.ccw.devno;
@ -174,6 +185,7 @@ int main(void)
{ {
sclp_setup(); sclp_setup();
css_setup(); css_setup();
boot_setup();
virtio_setup(); virtio_setup();
zipl_load(); /* no return */ zipl_load(); /* no return */