.PHONY : all clean build-all distclean
OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
- virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o
+ virtio.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o
+
+SLOF_DIR := $(SRC_PATH)/../../roms/SLOF
+
+LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include
EXTRA_CFLAGS += -Wall
EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE
EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables
EXTRA_CFLAGS += -msoft-float
EXTRA_CFLAGS += -std=gnu99
+EXTRA_CFLAGS += $(LIBC_INC)
LDFLAGS += -Wl,-pie -nostdlib -z noexecstack
cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
$(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak
-include config-cc.mak
+include $(SRC_PATH)/netboot.mak
+
build-all: s390-ccw.img s390-netboot.img
-s390-ccw.elf: $(OBJECTS)
- $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),Linking)
+s390-ccw.elf: $(OBJECTS) libc.a
+ $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^,Linking)
s390-ccw.img: s390-ccw.elf
$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into)
$(OBJECTS): Makefile
-include $(SRC_PATH)/netboot.mak
-
ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
-include $(ALL_OBJS:%.o=%.d)
* directory.
*/
-#include "libc.h"
+#include <string.h>
+#include <stdio.h>
#include "s390-ccw.h"
#include "s390-arch.h"
#include "bootmap.h"
#ifdef DEBUG_FALLBACK
#define dputs(txt) \
- do { sclp_print("zipl: " txt); } while (0)
+ do { printf("zipl: " txt); } while (0)
#else
#define dputs(fmt, ...) \
do { } while (0)
prev_block_nr = cur_block_nr;
}
- sclp_print("No zipl boot menu data found. Booting default entry.");
+ printf("No zipl boot menu data found. Booting default entry.");
return 0;
}
block_number_t bmt_block_nr, s1b_block_nr;
/* we have just read the block #0 and recognized it as "IPL1" */
- sclp_print("CDL\n");
+ puts("CDL");
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
read_block(1, ipl2, "Cannot read IPL2 record at block 1");
mbr = &ipl2->mbr;
if (!magic_match(mbr, ZIPL_MAGIC)) {
- sclp_print("No zIPL section in IPL2 record.\n");
+ puts("No zIPL section in IPL2 record.");
return;
}
if (!block_size_ok(mbr->blockptr.xeckd.bptr.size)) {
- sclp_print("Bad block size in zIPL section of IPL2 record.\n");
+ puts("Bad block size in zIPL section of IPL2 record.");
return;
}
if (mbr->dev_type != DEV_TYPE_ECKD) {
- sclp_print("Non-ECKD device type in zIPL section of IPL2 record.\n");
+ puts("Non-ECKD device type in zIPL section of IPL2 record.");
return;
}
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
read_block(2, vlbl, "Cannot read Volume Label at block 2");
if (!magic_match(vlbl->key, VOL1_MAGIC)) {
- sclp_print("Invalid magic of volume label block.\n");
+ puts("Invalid magic of volume label block.");
return;
}
if (!magic_match(vlbl->f.key, VOL1_MAGIC)) {
- sclp_print("Invalid magic of volser block.\n");
+ puts("Invalid magic of volser block.");
return;
}
print_volser(vlbl->f.volser);
LDL_VTOC *vlbl = (void *)sec; /* already read, 3rd block */
char msg[4] = { '?', '.', '\n', '\0' };
- sclp_print((mode == ECKD_CMS) ? "CMS" : "LDL");
- sclp_print(" version ");
+ printf((mode == ECKD_CMS) ? "CMS" : "LDL");
+ printf(" version ");
switch (vlbl->LDL_version) {
case LDL1_VERSION:
msg[0] = '1';
msg[1] = '?';
break;
}
- sclp_print(msg);
+ printf("%s", msg);
print_volser(vlbl->volser);
}
if (!magic_match(ipl1->bip.magic, ZIPL_MAGIC)) {
return; /* not applicable layout */
}
- sclp_print("unlabeled LDL.\n");
+ puts("unlabeled LDL.");
}
verify_boot_info(&ipl1->bip);
*p-- = ' ';
}
}
- sclp_print(msg);
+ printf("%s", msg);
}
static void ipl_eckd(void)
if (eckd_valid_address((ExtEckdBlockPtr *)&vlbl->f.br, 0)) {
ldipl_bmt = eckd_find_bmt((ExtEckdBlockPtr *)&vlbl->f.br);
if (ldipl_bmt) {
- sclp_print("List-Directed\n");
+ puts("List-Directed");
/* LD-IPL does not use the S1B bock, just make it NULL */
run_eckd_boot_script(ldipl_bmt, NULL_BLOCK_NR);
/* Only return in error, retry as CCW-IPL */
- sclp_print("Retrying IPL ");
+ printf("Retrying IPL ");
print_eckd_msg();
}
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
return;
}
- sclp_print("Using SCSI scheme.\n");
+ puts("Using SCSI scheme.");
debug_print_int("MBR Version", mbr->version_id);
IPL_check(mbr->version_id == 1,
"Unknown MBR layout version, assuming version 1");
if (cur_record->file_flags & 0x2) {
/* Subdirectory */
if (level == ISO9660_MAX_DIR_DEPTH - 1) {
- sclp_print("ISO-9660 directory depth limit exceeded\n");
+ puts("ISO-9660 directory depth limit exceeded");
} else {
level++;
sec_loc[level] = iso_733_to_u32(cur_record->ext_loc);
if (real_size) {
/* Round up blocks to load */
blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE;
- sclp_print("ISO boot image size verified\n");
+ puts("ISO boot image size verified");
} else {
- sclp_print("ISO boot image size could not be verified\n");
+ puts("ISO boot image size could not be verified");
}
read_iso_boot_image(bswap32(s.load_rba),
}
if (blksize != VIRTIO_DASD_DEFAULT_BLOCK_SIZE) {
- sclp_print("Using guessed DASD geometry.\n");
+ puts("Using guessed DASD geometry.");
virtio_assume_eckd();
}
ipl_eckd();
ipl_iso_el_torito();
}
- sclp_print("Using guessed DASD geometry.\n");
+ puts("Using guessed DASD geometry.");
virtio_assume_eckd();
ipl_eckd();
}
panic("\n! Unknown IPL device type !\n");
}
- sclp_print("zIPL load failed.\n");
+ puts("zIPL load failed.");
}
ebcdic_to_ascii((char *)volser, ascii, 6);
ascii[6] = '\0';
- sclp_print("VOLSER=[");
- sclp_print(ascii);
- sclp_print("]\n");
+ printf("VOLSER=[%s]\n", ascii);
}
static inline bool unused_space(const void *p, size_t size)
* directory.
*/
-#include "libc.h"
+#include <string.h>
+#include <stdio.h>
#include "s390-ccw.h"
#include "s390-arch.h"
#include "helper.h"
char msgline[512];
if (sd->config_info & 0x8000) {
- sclp_print("Eckd Dasd Sense Data (fmt 24-bytes):\n");
+ puts("Eckd Dasd Sense Data (fmt 24-bytes):");
} else {
- sclp_print("Eckd Dasd Sense Data (fmt 32-bytes):\n");
+ puts("Eckd Dasd Sense Data (fmt 32-bytes):");
}
strcat(msgline, " Sense Condition Flags :");
if (sd->status[1] & SNS_STAT2_IMPRECISE_END) {
strcat(msgline, " [Imprecise-End]");
}
- strcat(msgline, "\n");
- sclp_print(msgline);
-
- print_int(" Residual Count =", sd->res_count);
- print_int(" Phys Drive ID =", sd->phys_drive_id);
- print_int(" low cyl address =", sd->low_cyl_addr);
- print_int(" head addr & hi cyl =", sd->head_high_cyl_addr);
- print_int(" format/message =", sd->fmt_msg);
- print_int(" fmt-dependent[0-7] =", sd->fmt_dependent_info[0]);
- print_int(" fmt-dependent[8-15]=", sd->fmt_dependent_info[1]);
- print_int(" prog action code =", sd->program_action_code);
- print_int(" Configuration info =", sd->config_info);
- print_int(" mcode / hi-cyl =", sd->mcode_hicyl);
- print_int(" cyl & head addr [0]=", sd->cyl_head_addr[0]);
- print_int(" cyl & head addr [1]=", sd->cyl_head_addr[1]);
- print_int(" cyl & head addr [2]=", sd->cyl_head_addr[2]);
+ puts(msgline);
+
+ printf(" Residual Count = 0x%X\n", sd->res_count);
+ printf(" Phys Drive ID = 0x%X\n", sd->phys_drive_id);
+ printf(" low cyl address = 0x%X\n", sd->low_cyl_addr);
+ printf(" head addr & hi cyl = 0x%X\n", sd->head_high_cyl_addr);
+ printf(" format/message = 0x%X\n", sd->fmt_msg);
+ printf(" fmt-dependent[0-7] = 0x%llX\n", sd->fmt_dependent_info[0]);
+ printf(" fmt-dependent[8-15]= 0x%llX\n", sd->fmt_dependent_info[1]);
+ printf(" prog action code = 0x%X\n", sd->program_action_code);
+ printf(" Configuration info = 0x%X\n", sd->config_info);
+ printf(" mcode / hi-cyl = 0x%X\n", sd->mcode_hicyl);
+ printf(" cyl & head addr [0]= 0x%X\n", sd->cyl_head_addr[0]);
+ printf(" cyl & head addr [1]= 0x%X\n", sd->cyl_head_addr[1]);
+ printf(" cyl & head addr [2]= 0x%X\n", sd->cyl_head_addr[2]);
}
static void print_irb_err(Irb *irb)
uint64_t prev_ccw = *(uint64_t *)u32toptr(irb->scsw.cpa - 8);
char msgline[256];
- sclp_print("Interrupt Response Block Data:\n");
+ puts("Interrupt Response Block Data:");
strcat(msgline, " Function Ctrl :");
if (irb->scsw.ctrl & SCSW_FCTL_START_FUNC) {
if (irb->scsw.ctrl & SCSW_FCTL_CLEAR_FUNC) {
strcat(msgline, " [Clear]");
}
- strcat(msgline, "\n");
- sclp_print(msgline);
+ puts(msgline);
msgline[0] = '\0';
strcat(msgline, " Activity Ctrl :");
if (irb->scsw.ctrl & SCSW_ACTL_SUSPENDED) {
strcat(msgline, " [Suspended]");
}
- strcat(msgline, "\n");
- sclp_print(msgline);
+ puts(msgline);
msgline[0] = '\0';
strcat(msgline, " Status Ctrl :");
if (irb->scsw.ctrl & SCSW_SCTL_STATUS_PEND) {
strcat(msgline, " [Status-Pending]");
}
-
- strcat(msgline, "\n");
- sclp_print(msgline);
+ puts(msgline);
msgline[0] = '\0';
strcat(msgline, " Device Status :");
if (irb->scsw.dstat & SCSW_DSTAT_UEXCP) {
strcat(msgline, " [Unit-Exception]");
}
- strcat(msgline, "\n");
- sclp_print(msgline);
+ puts(msgline);
msgline[0] = '\0';
strcat(msgline, " Channel Status :");
if (irb->scsw.cstat & SCSW_CSTAT_CHAINCHK) {
strcat(msgline, " [Chaining-Check]");
}
- strcat(msgline, "\n");
- sclp_print(msgline);
+ puts(msgline);
- print_int(" cpa=", irb->scsw.cpa);
- print_int(" prev_ccw=", prev_ccw);
- print_int(" this_ccw=", this_ccw);
+ printf(" cpa= 0x%X\n", irb->scsw.cpa);
+ printf(" prev_ccw= 0x%llX\n", prev_ccw);
+ printf(" this_ccw= 0x%llX\n", this_ccw);
}
/*
return -1;
}
if (rc) {
- print_int("ssch failed with cc=", rc);
+ printf("ssch failed with cc= 0x%x\n", rc);
return rc;
}
/* collect status */
rc = tsch(schid, irb);
if (rc) {
- print_int("tsch failed with cc=", rc);
+ printf("tsch failed with cc= 0x%X\n", rc);
}
return rc;
continue;
}
- sclp_print("cio device error\n");
- print_int(" ssid ", schid.ssid);
- print_int(" cssid ", schid.cssid);
- print_int(" sch_no", schid.sch_no);
- print_int(" ctrl-unit type", cutype);
- sclp_print("\n");
+ printf("cio device error\n");
+ printf(" ssid 0x%X\n", schid.ssid);
+ printf(" cssid 0x%X\n", schid.cssid);
+ printf(" sch_no 0x%X\n", schid.sch_no);
+ printf(" ctrl-unit type 0x%X\n", cutype);
+ printf("\n");
print_irb_err(&irb);
if (cutype == CU_TYPE_DASD_3990 || cutype == CU_TYPE_DASD_2107 ||
cutype == CU_TYPE_UNKNOWN) {
* directory.
*/
-#include "libc.h"
+#include <string.h>
+#include <stdio.h>
#include "s390-ccw.h"
#include "s390-arch.h"
#include "dasd-ipl.h"
do {
has_next = dynamic_cp_fixup(cpa, &next_cpa);
- print_int("executing ccw chain at ", cpa);
+ printf("executing ccw chain at 0x%X\n", cpa);
enable_prefixing();
rc = do_cio(schid, cutype, cpa, CCW_FMT0);
disable_prefixing();
* directory.
*/
-#include "libc.h"
+#include <string.h>
+#include <stdio.h>
#include "s390-ccw.h"
#include "s390-arch.h"
debug_print_int("set IPL addr to", address ?: *reset_psw & PSW_MASK_SHORT_ADDR);
/* Ensure the guest output starts fresh */
- sclp_print("\n");
+ printf("\n");
/*
* HACK ALERT.
+++ /dev/null
-/*
- * libc-style definitions and functions
- *
- * Copyright 2018 IBM Corp.
- * Author(s): Collin L. Walling <walling@linux.vnet.ibm.com>
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- */
-
-#include "libc.h"
-#include "s390-ccw.h"
-
-/**
- * atoui:
- * @str: the string to be converted.
- *
- * Given a string @str, convert it to an integer. Leading spaces are
- * ignored. Any other non-numerical value will terminate the conversion
- * and return 0. This function only handles numbers between 0 and
- * UINT64_MAX inclusive.
- *
- * Returns: an integer converted from the string @str, or the number 0
- * if an error occurred.
- */
-uint64_t atoui(const char *str)
-{
- int val = 0;
-
- if (!str || !str[0]) {
- return 0;
- }
-
- while (*str == ' ') {
- str++;
- }
-
- while (*str) {
- if (!isdigit(*(unsigned char *)str)) {
- break;
- }
- val = val * 10 + *str - '0';
- str++;
- }
-
- return val;
-}
-
-/**
- * uitoa:
- * @num: an integer (base 10) to be converted.
- * @str: a pointer to a string to store the conversion.
- * @len: the length of the passed string.
- *
- * Given an integer @num, convert it to a string. The string @str must be
- * allocated beforehand. The resulting string will be null terminated and
- * returned. This function only handles numbers between 0 and UINT64_MAX
- * inclusive.
- *
- * Returns: the string @str of the converted integer @num
- */
-char *uitoa(uint64_t num, char *str, size_t len)
-{
- long num_idx = 1; /* account for NUL */
- uint64_t tmp = num;
-
- IPL_assert(str != NULL, "uitoa: no space allocated to store string");
-
- /* Count indices of num */
- while ((tmp /= 10) != 0) {
- num_idx++;
- }
-
- /* Check if we have enough space for num and NUL */
- IPL_assert(len > num_idx, "uitoa: array too small for conversion");
-
- str[num_idx--] = '\0';
-
- /* Convert int to string */
- while (num_idx >= 0) {
- str[num_idx--] = num % 10 + '0';
- num /= 10;
- }
-
- return str;
-}
+++ /dev/null
-/*
- * libc-style definitions and functions
- *
- * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- */
-
-#ifndef S390_CCW_LIBC_H
-#define S390_CCW_LIBC_H
-
-typedef unsigned long size_t;
-typedef int bool;
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-
-static inline void *memset(void *s, int c, size_t n)
-{
- size_t i;
- unsigned char *p = s;
-
- for (i = 0; i < n; i++) {
- p[i] = c;
- }
-
- return s;
-}
-
-static inline void *memcpy(void *s1, const void *s2, size_t n)
-{
- uint8_t *dest = s1;
- const uint8_t *src = s2;
- size_t i;
-
- for (i = 0; i < n; i++) {
- dest[i] = src[i];
- }
-
- return s1;
-}
-
-static inline int memcmp(const void *s1, const void *s2, size_t n)
-{
- size_t i;
- const uint8_t *p1 = s1, *p2 = s2;
-
- for (i = 0; i < n; i++) {
- if (p1[i] != p2[i]) {
- return p1[i] > p2[i] ? 1 : -1;
- }
- }
-
- return 0;
-}
-
-static inline size_t strlen(const char *str)
-{
- size_t i;
- for (i = 0; *str; i++) {
- str++;
- }
- return i;
-}
-
-static inline char *strcat(char *dest, const char *src)
-{
- int i;
- char *dest_end = dest + strlen(dest);
-
- for (i = 0; i <= strlen(src); i++) {
- dest_end[i] = src[i];
- }
- return dest;
-}
-
-static inline int isdigit(int c)
-{
- return (c >= '0') && (c <= '9');
-}
-
-uint64_t atoui(const char *str);
-char *uitoa(uint64_t num, char *str, size_t len);
-
-#endif
* directory.
*/
-#include "libc.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
#include "helper.h"
#include "s390-arch.h"
#include "s390-ccw.h"
unsigned int get_loadparm_index(void)
{
- return atoui(loadparm_str);
+ return atoi(loadparm_str);
}
static int is_dev_possibly_bootable(int dev_no, int sch_no)
sclp_get_loadparm_ascii(loadparm_str);
memcpy(lpmsg + 10, loadparm_str, 8);
- sclp_print(lpmsg);
+ puts(lpmsg);
/*
* Clear out any potential S390EP magic (see jump_to_low_kernel()),
switch (vdev->senseid.cu_model) {
case VIRTIO_ID_NET:
- sclp_print("Network boot device detected\n");
+ puts("Network boot device detected");
vdev->netboot_start_addr = qipl.netboot_start_addr;
return 0;
case VIRTIO_ID_BLOCK:
}
break;
default:
- print_int("Attempting to boot from unexpected device type", cutype);
+ printf("Attempting to boot from unexpected device type 0x%X\n", cutype);
panic("\nBoot failed.\n");
}
}
}
}
- sclp_print("Could not find a suitable boot device (none specified)\n");
+ puts("Could not find a suitable boot device (none specified)");
}
void main(void)
* directory.
*/
-#include "libc.h"
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "s390-ccw.h"
#include "sclp.h"
#include "s390-time.h"
case KEYCODE_BACKSP:
if (idx > 0) {
buf[--idx] = 0;
- sclp_print("\b \b");
+ printf("\b \b");
}
continue;
case KEYCODE_ENTER:
/* Echo input and add to buffer */
if (idx < len) {
buf[idx++] = inp[0];
- sclp_print(inp);
+ printf("%s", inp);
}
}
}
}
}
- return atoui(buf);
+ return atoi(buf);
}
static void boot_menu_prompt(bool retry)
{
- char tmp[11];
-
if (retry) {
- sclp_print("\nError: undefined configuration"
+ printf("\nError: undefined configuration"
"\nPlease choose:\n");
} else if (timeout > 0) {
- sclp_print("Please choose (default will boot in ");
- sclp_print(uitoa(timeout / 1000, tmp, sizeof(tmp)));
- sclp_print(" seconds):\n");
+ printf("Please choose (default will boot in %d seconds):\n",
+ (int)(timeout / 1000));
} else {
- sclp_print("Please choose:\n");
+ puts("Please choose:");
}
}
{
int boot_index;
bool retry = false;
- char tmp[5];
do {
boot_menu_prompt(retry);
} while (boot_index < 0 || boot_index >= MAX_BOOT_ENTRIES ||
!valid_entries[boot_index]);
- sclp_print("\nBooting entry #");
- sclp_print(uitoa(boot_index, tmp, sizeof(tmp)));
+ printf("\nBooting entry #%d", boot_index);
return boot_index;
}
buf[len] = '\n';
buf[len + 1] = '\0';
- sclp_print(buf);
+ printf("%s", buf);
- return buf[0] == ' ' ? atoui(buf + 1) : atoui(buf);
+ return buf[0] == ' ' ? atoi(buf + 1) : atoi(buf);
}
int menu_get_zipl_boot_index(const char *menu_data)
}
/* Print banner */
- sclp_print("s390-ccw zIPL Boot Menu\n\n");
+ puts("s390-ccw zIPL Boot Menu\n");
menu_data += strlen(menu_data) + 1;
/* Print entries */
valid_entries[entry] = true;
if (entry == 0) {
- sclp_print("\n");
+ printf("\n");
}
}
- sclp_print("\n");
+ printf("\n");
return get_boot_index(valid_entries);
}
int menu_get_enum_boot_index(bool *valid_entries)
{
- char tmp[3];
int i;
- sclp_print("s390-ccw Enumerated Boot Menu.\n\n");
+ puts("s390-ccw Enumerated Boot Menu.\n");
for (i = 0; i < MAX_BOOT_ENTRIES; i++) {
if (valid_entries[i]) {
if (i < 10) {
- sclp_print(" ");
+ printf(" ");
}
- sclp_print("[");
- sclp_print(uitoa(i, tmp, sizeof(tmp)));
- sclp_print("]");
+ printf("[%d]", i);
if (i == 0) {
- sclp_print(" default\n");
+ printf(" default\n");
}
- sclp_print("\n");
+ printf("\n");
}
}
- sclp_print("\n");
+ printf("\n");
return get_boot_index(valid_entries);
}
-SLOF_DIR := $(SRC_PATH)/../../roms/SLOF
-
NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o
-LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include
LIBNET_INC := -I$(SLOF_DIR)/lib/libnet
NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000
printf("Loading pxelinux.cfg entry '%s'\n", entry->label);
if (!entry->kernel) {
- printf("Kernel entry is missing!\n");
+ puts("Kernel entry is missing!\n");
return -1;
}
int rc, fnlen;
sclp_setup();
- sclp_print("Network boot starting...\n");
+ puts("Network boot starting...");
virtio_setup();
rc = net_init(&fn_ip);
if (rc) {
- panic("Network initialization failed. Halting.\n");
+ panic("Network initialization failed. Halting.");
}
fnlen = strlen(fn_ip.filename);
net_release(&fn_ip);
if (rc > 0) {
- sclp_print("Network loading done, starting kernel...\n");
+ puts("Network loading done, starting kernel...");
jump_to_low_kernel();
}
- panic("Failed to load OS from network\n");
+ panic("Failed to load OS from network.");
}
/* #define DEBUG */
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#define EBUSY 2
#define ENODEV 3
-#ifndef NULL
-#define NULL 0
-#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
__attribute__ ((__noreturn__))
static inline void panic(const char *string)
{
- sclp_print(string);
+ printf("ERROR: %s\n ", string);
disabled_wait();
}
}
}
-static inline void print_int(const char *desc, u64 addr)
-{
- char out[] = ": 0xffffffffffffffff\n";
-
- fill_hex_val(&out[4], &addr, sizeof(addr));
-
- sclp_print(desc);
- sclp_print(out);
-}
-
static inline void debug_print_int(const char *desc, u64 addr)
{
#ifdef DEBUG
- print_int(desc, addr);
+ printf("%s 0x%X\n", desc, addr);
#endif
}
static inline void IPL_assert(bool term, const char *message)
{
if (!term) {
- sclp_print("\n! ");
- sclp_print(message);
- panic(" !\n"); /* no return */
+ panic(message); /* no return */
}
}
static inline void IPL_check(bool term, const char *message)
{
if (!term) {
- sclp_print("\n! WARNING: ");
- sclp_print(message);
- sclp_print(" !\n");
+ printf("WARNING: %s\n", message);
}
}
* directory.
*/
-#include "libc.h"
+#include <string.h>
#include "s390-ccw.h"
#include "sclp.h"
return len;
}
-void sclp_print(const char *str)
-{
- write(1, str, strlen(str));
-}
-
void sclp_get_loadparm_ascii(char *loadparm)
{
* directory.
*/
-#include "libc.h"
+#include <stdio.h>
#include "s390-ccw.h"
#include "virtio.h"
#include "virtio-scsi.h"
return -1;
}
- sclp_print(".");
+ printf(".");
status = virtio_read_many(sec, (void *)addr, sec_num);
if (status) {
panic("I/O Error");
vdev->schid = schid;
virtio_setup_ccw(vdev);
- sclp_print("Using virtio-blk.\n");
+ puts("Using virtio-blk.");
return 0;
}
* directory.
*/
-#include "libc.h"
+#include <string.h>
+#include <stdio.h>
#include "s390-ccw.h"
#include "virtio.h"
#include "scsi.h"
if (!term) {
int i = 0;
- sclp_print("\n! ");
+ printf("\n! ");
while (msgs[i]) {
- sclp_print(msgs[i++]);
+ printf("%s", msgs[i++]);
}
panic(" !\n");
}
if (resp.response == VIRTIO_SCSI_S_BAD_TARGET) {
continue;
}
- print_int("target", target);
+ printf("target 0x%X\n", target);
virtio_scsi_verify_response(&resp, "SCSI cannot report LUNs");
}
if (r->lun_list_len == 0) {
- print_int("no LUNs for target", target);
+ printf("no LUNs for target 0x%X\n", target);
continue;
}
luns = r->lun_list_len / 8;
}
}
- sclp_print("Warning: Could not locate a usable virtio-scsi device\n");
+ puts("Warning: Could not locate a usable virtio-scsi device");
return -ENODEV;
}
}
if (virtio_scsi_inquiry_response_is_cdrom(scsi_inquiry_std_response)) {
- sclp_print("SCSI CD-ROM detected.\n");
+ puts("SCSI CD-ROM detected.");
vdev->is_cdrom = true;
vdev->scsi_block_size = VIRTIO_ISO_BLOCK_SIZE;
}
IPL_assert(vdev->config.scsi.cdb_size == VIRTIO_SCSI_CDB_SIZE,
"Config: CDB size mismatch");
- sclp_print("Using virtio-scsi.\n");
+ puts("Using virtio-scsi.");
return virtio_scsi_setup(vdev);
}
* directory.
*/
-#include "libc.h"
+#include <string.h>
#include "s390-ccw.h"
#include "cio.h"
#include "virtio.h"
# EXTFLAGS can be passed by the user, e.g. to override the --accel
QEMU_OPTS+=-action panic=exit-failure -nographic -serial chardev:output $(EXTFLAGS) -kernel
LINK_SCRIPT=$(S390X_SRC)/softmmu.ld
-CFLAGS+=-ggdb -O0
+CFLAGS+=-ggdb -O0 -I$(SRC_PATH)/include/hw/s390x/ipl/
LDFLAGS=-nostdlib -static
%.o: %.S
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+
#include "../../../pc-bios/s390-ccw/sclp.c"
+#include "../../../roms/SLOF/lib/libc/string/memset.c"
+#include "../../../roms/SLOF/lib/libc/string/memcpy.c"
void __sys_outc(char c)
{