]>
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); | |
19 | while (1) { } | |
20 | } | |
21 | ||
22 | static void virtio_setup(void) | |
23 | { | |
24 | struct irb irb; | |
25 | int i; | |
26 | int r; | |
27 | bool found = false; | |
28 | ||
29 | blk_schid.one = 1; | |
30 | ||
31 | for (i = 0; i < 0x10000; i++) { | |
32 | blk_schid.sch_no = i; | |
33 | r = tsch(blk_schid, &irb); | |
34 | if (r != 3) { | |
35 | if (virtio_is_blk(blk_schid)) { | |
36 | found = true; | |
37 | break; | |
38 | } | |
39 | } | |
40 | } | |
41 | ||
42 | if (!found) { | |
43 | virtio_panic("No virtio-blk device found!\n"); | |
44 | } | |
45 | ||
46 | virtio_setup_block(blk_schid); | |
47 | } | |
48 | ||
49 | int main(void) | |
50 | { | |
51 | sclp_setup(); | |
52 | virtio_setup(); | |
53 | if (zipl_load() < 0) | |
54 | sclp_print("Failed to load OS from hard disk\n"); | |
55 | while (1) { } | |
56 | } |