]>
Commit | Line | Data |
---|---|---|
92f2ca38 AG |
1 | /* |
2 | * S390 virtio-ccw loading program | |
3 | * | |
4 | * Copyright (c) 2013 Alexander Graf <[email protected]> | |
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 | ||
13 | struct subchannel_id blk_schid; | |
14 | char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); | |
15 | ||
16 | void virtio_panic(const char *string) | |
17 | { | |
18 | sclp_print(string); | |
7f61cbc1 | 19 | disabled_wait(); |
92f2ca38 AG |
20 | while (1) { } |
21 | } | |
22 | ||
23 | static void virtio_setup(void) | |
24 | { | |
25 | struct irb irb; | |
26 | int i; | |
27 | int r; | |
28 | bool found = false; | |
29 | ||
30 | blk_schid.one = 1; | |
31 | ||
32 | for (i = 0; i < 0x10000; i++) { | |
33 | blk_schid.sch_no = i; | |
34 | r = tsch(blk_schid, &irb); | |
35 | if (r != 3) { | |
36 | if (virtio_is_blk(blk_schid)) { | |
37 | found = true; | |
38 | break; | |
39 | } | |
40 | } | |
41 | } | |
42 | ||
43 | if (!found) { | |
44 | virtio_panic("No virtio-blk device found!\n"); | |
45 | } | |
46 | ||
47 | virtio_setup_block(blk_schid); | |
48 | } | |
49 | ||
50 | int main(void) | |
51 | { | |
52 | sclp_setup(); | |
53 | virtio_setup(); | |
54 | if (zipl_load() < 0) | |
55 | sclp_print("Failed to load OS from hard disk\n"); | |
7f61cbc1 | 56 | disabled_wait(); |
92f2ca38 AG |
57 | while (1) { } |
58 | } |