aboutsummaryrefslogtreecommitdiff
path: root/hw/s390-virtio.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-04-20 19:37:13 +0200
committerAurelien Jarno <aurelien@aurel32.net>2010-05-18 21:12:48 +0200
commitfe270d044d512a308fb1fdf02cb11db46df29cdb (patch)
tree199821b6acfbf0e2eba05025d65067ebb0c13b2a /hw/s390-virtio.c
parentc821c2bd4f5fcd3e91e3cd1e2bef76a408677425 (diff)
target-s390: add firmware code
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 <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/s390-virtio.c')
-rw-r--r--hw/s390-virtio.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index c36a8b2336..898f442355 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -52,6 +52,10 @@
#define INITRD_PARM_SIZE 0x010410UL
#define PARMFILE_START 0x001000UL
+#define ZIPL_START 0x009000UL
+#define ZIPL_LOAD_ADDR 0x009000UL
+#define ZIPL_FILENAME "s390-zipl.rom"
+
#define MAX_BLK_DEVS 10
static VirtIOS390Bus *s390_bus;
@@ -188,6 +192,28 @@ static void s390_init(ram_addr_t ram_size,
env->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) {