From patchwork Tue Apr 20 16:56:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [S390] Add firmware code From: Alexander Graf X-Patchwork-Id: 50549 Message-Id: <1271782579-16476-1-git-send-email-agraf@suse.de> To: qemu-devel Developers Cc: Bastian Blank , Carsten Otte , Aurelien Jarno Date: Tue, 20 Apr 2010 18:56:19 +0200 This patch adds a firmware blob to the S390 target. The blob is a simple implementation of a virtio client that tries to read the second stage bootloader from sectors described as of offset 0x20 in the MBR. In combination with an updated zipl this allows for booting from virtio block devices. This firmware is built from the same sources as the second stage bootloader. You can find a virtio capable s390-tools in this repo: git://repo.or.cz/s390-tools.git Signed-off-by: Alexander Graf --- v1 -> v2: - Update bootloader code to support booting from non-virtio aware zipl disks. Now you don't need to modify zipl in the guest anymore just to boot. - Add safety checks - Add documentation on where to find the sources - Make bios optional --- hw/s390-virtio.c | 25 +++++++++++++++++++++++++ pc-bios/README | 5 +++++ pc-bios/s390-zipl.rom | Bin 0 -> 3344 bytes 3 files changed, 30 insertions(+), 0 deletions(-) create mode 100755 pc-bios/s390-zipl.rom diff --git a/pc-bios/s390-zipl.rom b/pc-bios/s390-zipl.rom new file mode 100755 index 0000000000000000000000000000000000000000..915995087824864cfa362176886e94c4473d8c6f GIT binary patch literal 3344 zcmZuzdvH|M8UOC?hP%xJ4gtdQD4v7`l7hGiv0$LMH$WPE;37(cwKWR~A(EFNp#nu# zjrGx5msD)4?YIcxbf7IeIIT_5@%rc=j5CFH8Xolzf_G>;?jK$-r6`Zv-*+|vE!~-W z_nhy3&)@erM_t@PYRLbQ*=nFYQ3JN$; zNmQiDh@6P<(a!#-DcoN~CAATIRHlRsDu`ByK%KAyY!Q?I6{yK%IMNPMFm!9*{HtEb zQY*=bkqkzK9POl`F&vG^{1~KQDG$7`R4b&9CBfr!gdL)Q_AL;N3ZHp3bJVQ|e#ZdB zfV$+>!OLnqs}AKbK5mL5CCZdjKIJ=t+2Cn0ICAj3(;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%({~ z3ANLcJtK@PbtX^m0VjKBLB1iOZN_wcnzjv1%Mj6gNAR}+zxbk#$(lF7)(75Eb;y0K zG3W@kYej^viwH0xvyg8mdu48Y^_n_n?^;Ed19FBm;Wj4d2z<_68sBvABks%hp< zoT8UGqwrV6%K*Q|PcSD-@5!F0Qsxhy-uvyji%Mq~&wS#UXP?{sBlGz)-wA)MY~gor zzQz18SYJr=nR8}5wD@*2$&#koQC~GZI_n!HW_<0shQ{?x8=8N65ae?gAKuu~+ScCj zNasGa)9f|>@z|!W?#&hLWcXqe6F@0-uM+psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; + } else { + ram_addr_t bios_size = 0; + char *bios_filename; + + /* Load zipl bootloader */ + if (bios_name == NULL) + bios_name = ZIPL_FILENAME; + + bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); + + if ((long)bios_size < 0) { + hw_error("could not load bootloader '%s'\n", bios_name); + } + + if (bios_size > 4096) { + hw_error("stage1 bootloader is > 4k\n"); + } + + env->psw.addr = ZIPL_START; + env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { diff --git a/pc-bios/README b/pc-bios/README index 437ef1c..be86dde 100644 --- a/pc-bios/README +++ b/pc-bios/README @@ -28,3 +28,8 @@ virtio 1af4:1000 http://rom-o-matic.net/ + +- The S390 zipl loader is an addition to the official IBM s390-tools + package. That fork is maintained in its own git repository at: + git://repo.or.cz/s390-tools.git +