]> git.proxmox.com Git - qemu.git/blame - pc-bios/s390-ccw/main.c
virtio-net: add virtio_net_set_netclient_name.
[qemu.git] / pc-bios / s390-ccw / main.c
CommitLineData
92f2ca38
AG
1/*
2 * S390 virtio-ccw loading program
3 *
4 * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or (at
7 * your option) any later version. See the COPYING file in the top-level
8 * directory.
9 */
10
11#include "s390-ccw.h"
12
13struct subchannel_id blk_schid;
14char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
ff151f4e 15uint64_t boot_value;
92f2ca38
AG
16
17void virtio_panic(const char *string)
18{
19 sclp_print(string);
7f61cbc1 20 disabled_wait();
92f2ca38
AG
21 while (1) { }
22}
23
ff151f4e 24static void virtio_setup(uint64_t dev_info)
92f2ca38 25{
22d67ab5 26 struct schib schib;
92f2ca38
AG
27 int i;
28 int r;
29 bool found = false;
ff151f4e
DD
30 bool check_devno = false;
31 uint16_t dev_no = -1;
92f2ca38
AG
32 blk_schid.one = 1;
33
ff151f4e
DD
34 if (dev_info != -1) {
35 check_devno = true;
36 dev_no = dev_info & 0xffff;
37 debug_print_int("device no. ", dev_no);
38 }
39
92f2ca38
AG
40 for (i = 0; i < 0x10000; i++) {
41 blk_schid.sch_no = i;
22d67ab5
CH
42 r = stsch_err(blk_schid, &schib);
43 if (r == 3) {
44 break;
45 }
46 if (schib.pmcw.dnv) {
ff151f4e
DD
47 if (!check_devno || (schib.pmcw.dev == dev_no)) {
48 if (virtio_is_blk(blk_schid)) {
49 found = true;
50 break;
51 }
92f2ca38
AG
52 }
53 }
54 }
55
56 if (!found) {
57 virtio_panic("No virtio-blk device found!\n");
58 }
59
60 virtio_setup_block(blk_schid);
61}
62
63int main(void)
64{
65 sclp_setup();
ff151f4e
DD
66 debug_print_int("boot reg[7] ", boot_value);
67 virtio_setup(boot_value);
68
92f2ca38
AG
69 if (zipl_load() < 0)
70 sclp_print("Failed to load OS from hard disk\n");
7f61cbc1 71 disabled_wait();
92f2ca38
AG
72 while (1) { }
73}