From 740590240bec03dc6ca208963112d3c2999f353e Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 9 Oct 2020 10:08:42 -0400 Subject: [PATCH 06/14] pc-bios/s390-ccw: Move ipl-related code from main() into a separate function RH-Author: Thomas Huth Message-id: <20201009100849.264994-3-thuth@redhat.com> Patchwork-id: 98596 O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 2/9] pc-bios/s390-ccw: Move ipl-related code from main() into a separate function Bugzilla: 1846975 RH-Acked-by: Jens Freimann RH-Acked-by: David Hildenbrand RH-Acked-by: Cornelia Huck Let's move this part of the code into a separate function to be able to use it from multiple spots later. Reviewed-by: Claudio Imbrenda Reviewed-by: Cornelia Huck Reviewed-by: Janosch Frank Message-Id: <20200806105349.632-3-thuth@redhat.com> Signed-off-by: Thomas Huth (cherry picked from commit d1f060a8b515a0b1d14c38f2c8f86ab54e79c3dc) Signed-off-by: Danilo C. L. de Paula --- pc-bios/s390-ccw/main.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 4e65b411e1..5e565be5b1 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -232,14 +232,8 @@ static void virtio_setup(void) } } -int main(void) +static void ipl_boot_device(void) { - sclp_setup(); - css_setup(); - boot_setup(); - find_boot_device(); - enable_subchannel(blk_schid); - switch (cutype) { case CU_TYPE_DASD_3990: case CU_TYPE_DASD_2107: @@ -251,8 +245,18 @@ int main(void) break; default: print_int("Attempting to boot from unexpected device type", cutype); - panic(""); + panic("\nBoot failed.\n"); } +} + +int main(void) +{ + sclp_setup(); + css_setup(); + boot_setup(); + find_boot_device(); + enable_subchannel(blk_schid); + ipl_boot_device(); panic("Failed to load OS from hard disk\n"); return 0; /* make compiler happy */ -- 2.27.0