diff --git a/include/dump/s390_dump.h b/include/dump/s390_dump.h new file mode 100644 index 00000000..1a625f9a --- /dev/null +++ b/include/dump/s390_dump.h @@ -0,0 +1,83 @@ +/* + * s390 related definitions and functions. + * + * Copyright IBM Corp. 2013, 2023 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef S390_DUMP_H +#define S390_DUMP_H + +#include + +#include "lib/zt_common.h" + +/* + * S390 dump format defines + */ +#define DF_S390_MAGIC 0xa8190173618f23fdULL +#define DF_S390_MAGIC_EXT 0xa8190173618f23feULL +#define DF_S390_HDR_SIZE 0x1000 +#define DF_S390_EM_SIZE 16 +#define DF_S390_EM_MAGIC 0x44554d505f454e44ULL +#define DF_S390_CPU_MAX 512 +#define DF_S390_MAGIC_BLK_ECKD 3 + +/* + * Architecture of dumped system + */ +enum df_s390_arch { + DF_S390_ARCH_32 = 1, + DF_S390_ARCH_64 = 2, +}; + +/* + * s390 dump header format + */ +struct df_s390_hdr { + uint64_t magic; /* 0x000 */ + uint32_t version; /* 0x008 */ + uint32_t hdr_size; /* 0x00c */ + uint32_t dump_level; /* 0x010 */ + uint32_t page_size; /* 0x014 */ + uint64_t mem_size; /* 0x018 */ + uint64_t mem_start; /* 0x020 */ + uint64_t mem_end; /* 0x028 */ + uint32_t num_pages; /* 0x030 */ + uint32_t pad; /* 0x034 */ + uint64_t tod; /* 0x038 */ + uint64_t cpu_id; /* 0x040 */ + uint32_t arch; /* 0x048 */ + uint32_t volnr; /* 0x04c */ + uint32_t build_arch; /* 0x050 */ + uint64_t mem_size_real; /* 0x054 */ + uint8_t mvdump; /* 0x05c */ + uint16_t cpu_cnt; /* 0x05d */ + uint16_t real_cpu_cnt; /* 0x05f */ + uint8_t end_pad1[0x200 - 0x061]; /* 0x061 */ + uint64_t mvdump_sign; /* 0x200 */ + uint64_t mvdump_zipl_time; /* 0x208 */ + uint8_t end_pad2[0x800 - 0x210]; /* 0x210 */ + uint32_t lc_vec[DF_S390_CPU_MAX]; /* 0x800 */ +} __packed __aligned(16); + +/* + * End marker: Should be at the end of every valid s390 crash dump + */ +struct df_s390_em { + uint64_t magic; + uint64_t tod; +} __packed __aligned(16); + +/* + * Dump segment header + */ +struct df_s390_dump_segm_hdr { + uint64_t start; + uint64_t len; + uint64_t stop_marker; +}; + +#endif /* S390_DUMP_H */ diff --git a/zipl/boot/eckd2dump.c b/zipl/boot/eckd2dump.c index eaa8e4f6..c02b2e71 100644 --- a/zipl/boot/eckd2dump.c +++ b/zipl/boot/eckd2dump.c @@ -3,12 +3,14 @@ * * Common ECKD dump I/O functions * - * Copyright IBM Corp. 2013, 2018 + * Copyright IBM Corp. 2013, 2023 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. */ +#include "dump/s390_dump.h" + #include "cio.h" #include "eckd2dump.h" #include "boot/error.h" diff --git a/zipl/boot/eckd2dump.h b/zipl/boot/eckd2dump.h index 6b630e83..f7dc5701 100644 --- a/zipl/boot/eckd2dump.h +++ b/zipl/boot/eckd2dump.h @@ -3,7 +3,7 @@ * * Common ECKD dump I/O functions * - * Copyright IBM Corp. 2013, 2018 + * Copyright IBM Corp. 2013, 2023 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -11,6 +11,8 @@ #ifndef ECKD2DUMP_H #define ECKD2DUMP_H +#include "dump/s390_dump.h" + #include "cio.h" #include "stage2dump.h" diff --git a/zipl/boot/eckd2dump_mv.c b/zipl/boot/eckd2dump_mv.c index 6b6ea49b..4ade82bd 100644 --- a/zipl/boot/eckd2dump_mv.c +++ b/zipl/boot/eckd2dump_mv.c @@ -3,7 +3,7 @@ * * Multi-volume ECKD DASD dump tool * - * Copyright IBM Corp. 2013, 2018 + * Copyright IBM Corp. 2013, 2023 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -11,6 +11,7 @@ #include "lib/zt_common.h" #include "boot/error.h" +#include "dump/s390_dump.h" #include "eckd2dump.h" #include "stage2dump.h" diff --git a/zipl/boot/eckd2dump_sv.c b/zipl/boot/eckd2dump_sv.c index 27e01552..f69076a8 100644 --- a/zipl/boot/eckd2dump_sv.c +++ b/zipl/boot/eckd2dump_sv.c @@ -3,7 +3,7 @@ * * Single-volume ECKD DASD dump tool * - * Copyright IBM Corp. 2013, 2018 + * Copyright IBM Corp. 2013, 2023 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -12,6 +12,7 @@ #include "lib/zt_common.h" #include "boot/boot_defs.h" #include "boot/error.h" +#include "dump/s390_dump.h" #include "eckd2dump.h" #include "stage2dump.h" diff --git a/zipl/boot/fba2dump.c b/zipl/boot/fba2dump.c index 196cfa8d..0bcd1258 100644 --- a/zipl/boot/fba2dump.c +++ b/zipl/boot/fba2dump.c @@ -3,7 +3,7 @@ * * Single-volume FBA DASD dump tool * - * Copyright IBM Corp. 2013, 2018 + * Copyright IBM Corp. 2013, 2023 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -12,6 +12,7 @@ #include "lib/zt_common.h" #include "boot/boot_defs.h" #include "boot/error.h" +#include "dump/s390_dump.h" #include "fba.h" #include "stage2dump.h" diff --git a/zipl/boot/stage2dump.c b/zipl/boot/stage2dump.c index 6b1082e4..a641d44a 100644 --- a/zipl/boot/stage2dump.c +++ b/zipl/boot/stage2dump.c @@ -3,7 +3,7 @@ * * Common functions for stand-alone dump tools * - * Copyright IBM Corp. 2013, 2018 + * Copyright IBM Corp. 2013, 2023 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -13,6 +13,7 @@ #include "lib/zt_common.h" #include "boot/error.h" +#include "dump/s390_dump.h" #include "libc.h" #include "sclp.h" diff --git a/zipl/boot/stage2dump.h b/zipl/boot/stage2dump.h index bd9f2519..8a92d34e 100644 --- a/zipl/boot/stage2dump.h +++ b/zipl/boot/stage2dump.h @@ -3,7 +3,7 @@ * * Common dump functions * - * Copyright IBM Corp. 2013, 2018 + * Copyright IBM Corp. 2013, 2023 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -12,8 +12,8 @@ #ifndef STAGE2DUMP_H #define STAGE2DUMP_H -#include "libc.h" #include "boot/s390.h" +#include "dump/s390_dump.h" #define IPL_SC S390_lowcore.tpi_info.schid #define ROUND_DOWN(x, a) ((x) & ~((typeof(x))(a) - 1)) @@ -30,72 +30,6 @@ struct stage2dump_parm_tail { extern struct stage2dump_parm_tail __section(.stage2dump.tail) parm_tail; -/* - * S390 dump format defines - */ -#define DF_S390_MAGIC 0xa8190173618f23fdULL -#define DF_S390_MAGIC_EXT 0xa8190173618f23feULL -#define DF_S390_HDR_SIZE 0x1000 -#define DF_S390_EM_SIZE 16 -#define DF_S390_EM_MAGIC 0x44554d505f454e44ULL -#define DF_S390_CPU_MAX 512 -#define DF_S390_MAGIC_BLK_ECKD 3 - -/* - * Architecture of dumped system - */ -enum df_s390_arch { - DF_S390_ARCH_32 = 1, - DF_S390_ARCH_64 = 2, -}; - -/* - * s390 dump header format - */ -struct df_s390_hdr { - uint64_t magic; /* 0x000 */ - uint32_t version; /* 0x008 */ - uint32_t hdr_size; /* 0x00c */ - uint32_t dump_level; /* 0x010 */ - uint32_t page_size; /* 0x014 */ - uint64_t mem_size; /* 0x018 */ - uint64_t mem_start; /* 0x020 */ - uint64_t mem_end; /* 0x028 */ - uint32_t num_pages; /* 0x030 */ - uint32_t pad; /* 0x034 */ - uint64_t tod; /* 0x038 */ - uint64_t cpu_id; /* 0x040 */ - uint32_t arch; /* 0x048 */ - uint32_t volnr; /* 0x04c */ - uint32_t build_arch; /* 0x050 */ - uint64_t mem_size_real; /* 0x054 */ - uint8_t mvdump; /* 0x05c */ - uint16_t cpu_cnt; /* 0x05d */ - uint16_t real_cpu_cnt; /* 0x05f */ - uint8_t end_pad1[0x200-0x061]; /* 0x061 */ - uint64_t mvdump_sign; /* 0x200 */ - uint64_t mvdump_zipl_time; /* 0x208 */ - uint8_t end_pad2[0x800-0x210]; /* 0x210 */ - uint32_t lc_vec[DF_S390_CPU_MAX]; /* 0x800 */ -} __packed __aligned(16); - -/* - * End marker: Should be at the end of every valid s390 crash dump - */ -struct df_s390_em { - uint64_t magic; - uint64_t tod; -} __packed __aligned(16); - -/* - * Dump segment header - */ -struct df_s390_dump_segm_hdr { - uint64_t start; - uint64_t len; - uint64_t stop_marker; -}; - /* * Linker script defined symbols */ diff --git a/zipl/boot/tape2dump.c b/zipl/boot/tape2dump.c index d71e7944..d12ed9f0 100644 --- a/zipl/boot/tape2dump.c +++ b/zipl/boot/tape2dump.c @@ -3,7 +3,7 @@ * * Dump tool for channel-attached tape devices * - * Copyright IBM Corp. 2013, 2017 + * Copyright IBM Corp. 2013, 2023 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -14,6 +14,7 @@ #include "boot/error.h" #include "boot/loaders_layout.h" #include "boot/s390.h" +#include "dump/s390_dump.h" #include "cio.h" #include "stage2dump.h"