include/dump: Create a global header s390_dump.h

Move common dump related structures and constants to the global header
"dump/s390_dump.h" in order to get rid of many duplicates in zgetdump code.

Adjust zipl include statements and update Copyright statements.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Mikhail Zaslonko
2023-05-25 17:29:15 +02:00
committed by Jan Höppner
parent 1057f13cdc
commit 775495c7e7
9 changed files with 101 additions and 75 deletions

83
include/dump/s390_dump.h Normal file
View File

@@ -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 <stdint.h>
#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 */

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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
*/

View File

@@ -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"