2 * S390 virtio-ccw loading program
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
14 char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
15 char ring_area[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
17 static struct subchannel_id blk_schid = { .one = 1 };
20 * Priniciples of Operations (SA22-7832-09) chapter 17 requires that
21 * a subsystem-identification is at 184-187 and bytes 188-191 are zero
22 * after list-directed-IPL and ccw-IPL.
24 void write_subsystem_identification(void)
26 struct subchannel_id *schid = (struct subchannel_id *) 184;
27 uint32_t *zeroes = (uint32_t *) 188;
34 void virtio_panic(const char *string)
41 static void virtio_setup(uint64_t dev_info)
47 bool check_devno = false;
52 dev_no = dev_info & 0xffff;
53 debug_print_int("device no. ", dev_no);
54 blk_schid.ssid = (dev_info >> 16) & 0x3;
55 if (blk_schid.ssid != 0) {
56 debug_print_int("ssid ", blk_schid.ssid);
57 if (enable_mss_facility() != 0) {
58 virtio_panic("Failed to enable mss facility\n");
63 for (i = 0; i < 0x10000; i++) {
65 r = stsch_err(blk_schid, &schib);
70 if (!check_devno || (schib.pmcw.dev == dev_no)) {
71 if (virtio_is_blk(blk_schid)) {
80 virtio_panic("No virtio-blk device found!\n");
83 virtio_setup_block(blk_schid);
85 if (!virtio_ipl_disk_is_valid()) {
86 virtio_panic("No valid hard disk detected.\n");
93 debug_print_int("boot reg[7] ", boot_value);
94 virtio_setup(boot_value);
96 zipl_load(); /* no return */
98 virtio_panic("Failed to load OS from hard disk\n");
99 return 0; /* make compiler happy */