mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl/boot: Move struct os_info to the separate header
- Move struct os_info from kdump.h to the new header os_info.h. - Place os_info.h to include/boot in order to use it in zgetdump code as well. - Replace hardcoded value of OS_INFO_CSUM_SIZE with a properly calculated one. - Rename os_info_check() of kdump.h to kdump_os_info_check(). Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
ea3529e624
commit
5af2e30d9a
41
include/boot/os_info.h
Normal file
41
include/boot/os_info.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* zipl - zSeries Initial Program Loader tool
|
||||
*
|
||||
* os-info definitions
|
||||
*
|
||||
* 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 OS_INFO_H
|
||||
#define OS_INFO_H
|
||||
|
||||
#include "lib/zt_common.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define OS_INFO_MAGIC 0x4f53494e464f535aULL /* OSINFOSZ */
|
||||
#define OS_INFO_CSUM_SIZE (sizeof(struct os_info) - offsetof(struct os_info, version_major))
|
||||
|
||||
#define OS_INFO_VMCOREINFO 0
|
||||
#define OS_INFO_REIPL_BLOCK 1
|
||||
|
||||
struct os_info_entry {
|
||||
uint64_t addr;
|
||||
uint64_t size;
|
||||
uint32_t csum;
|
||||
} __packed;
|
||||
|
||||
struct os_info {
|
||||
uint64_t magic;
|
||||
uint32_t csum;
|
||||
uint16_t version_major;
|
||||
uint16_t version_minor;
|
||||
uint64_t crashkernel_addr;
|
||||
uint64_t crashkernel_size;
|
||||
struct os_info_entry entry[2];
|
||||
uint8_t reserved[4024];
|
||||
} __packed;
|
||||
|
||||
#endif /* OS_INFO_H */
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Stand-alone kdump support
|
||||
*
|
||||
* 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,13 +14,14 @@
|
||||
#include "libc.h"
|
||||
#include "menu.h"
|
||||
#include "boot/s390.h"
|
||||
#include "boot/os_info.h"
|
||||
|
||||
void kdump_failed(unsigned long reason)
|
||||
{
|
||||
panic(reason, "Dump failed: Check disabled wait code");
|
||||
}
|
||||
|
||||
void os_info_check(struct os_info *os_info)
|
||||
void kdump_os_info_check(struct os_info *os_info)
|
||||
{
|
||||
if (os_info == NULL)
|
||||
kdump_failed(EOS_INFO_MISSING);
|
||||
@@ -30,7 +31,7 @@ void os_info_check(struct os_info *os_info)
|
||||
kdump_failed(EOS_INFO_MISSING);
|
||||
if (os_info->magic != OS_INFO_MAGIC)
|
||||
kdump_failed(EOS_INFO_MISSING);
|
||||
if (csum_partial(&os_info->version_major, OS_INF0_CSUM_SIZE, 0) !=
|
||||
if (csum_partial(&os_info->version_major, OS_INFO_CSUM_SIZE, 0) !=
|
||||
os_info->csum)
|
||||
kdump_failed(EOS_INFO_CSUM_FAILED);
|
||||
if (os_info->version_major > OS_INFO_VERSION_MAJOR_SUPPORTED)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Stand-alone kdump definitions
|
||||
*
|
||||
* 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.
|
||||
@@ -13,34 +13,11 @@
|
||||
#ifndef KDUMP_H
|
||||
#define KDUMP_H
|
||||
|
||||
#include "libc.h"
|
||||
#include "boot/s390.h"
|
||||
#include "boot/os_info.h"
|
||||
|
||||
#define OS_INFO_VERSION_MAJOR_SUPPORTED 1
|
||||
#define OS_INFO_MAGIC 0x4f53494e464f535aULL /* OSINFOSZ */
|
||||
#define OS_INF0_CSUM_SIZE 4084
|
||||
|
||||
#define OS_INFO_VMCOREINFO 0
|
||||
#define OS_INFO_REIPL_BLOCK 1
|
||||
|
||||
struct os_info_entry {
|
||||
uint64_t addr;
|
||||
uint64_t size;
|
||||
uint32_t csum;
|
||||
} __packed;
|
||||
|
||||
struct os_info {
|
||||
uint64_t magic;
|
||||
uint32_t csum;
|
||||
uint16_t version_major;
|
||||
uint16_t version_minor;
|
||||
uint64_t crashkernel_addr;
|
||||
uint64_t crashkernel_size;
|
||||
struct os_info_entry entry[2];
|
||||
uint8_t reserved[4024];
|
||||
} __packed;
|
||||
|
||||
void os_info_check(struct os_info *os_info);
|
||||
void kdump_os_info_check(struct os_info *os_info);
|
||||
void kdump_failed(unsigned long reason);
|
||||
|
||||
#endif /* KDUMP_H */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Stand-alone kdump support (stage 2)
|
||||
*
|
||||
* 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 "libc.h"
|
||||
#include "menu.h"
|
||||
#include "stage2.h"
|
||||
#include "boot/os_info.h"
|
||||
|
||||
/*
|
||||
* Copy crashkernel memory from [0, crash size] to
|
||||
@@ -31,7 +32,7 @@ void kdump_stage2(unsigned long config_nr)
|
||||
|
||||
if (!(__stage2_params.config_kdump & (0x1 << config_nr)))
|
||||
return;
|
||||
os_info_check(os_info);
|
||||
kdump_os_info_check(os_info);
|
||||
|
||||
/* Copy crashkernel memory */
|
||||
crash_base = (void *) os_info->crashkernel_addr;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Stand-alone kdump support (stage 3)
|
||||
*
|
||||
* 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,7 +14,7 @@
|
||||
#include "libc.h"
|
||||
#include "sclp_stage3.h"
|
||||
#include "stage3.h"
|
||||
|
||||
#include "boot/os_info.h"
|
||||
|
||||
/*
|
||||
* Copy memory from HSA and exit in case of an error
|
||||
@@ -54,7 +54,7 @@ static void kdump_stage3_scsi(unsigned long *base, unsigned long *size)
|
||||
} else {
|
||||
os_info = (void *) os_info_addr;
|
||||
}
|
||||
os_info_check(os_info);
|
||||
kdump_os_info_check(os_info);
|
||||
crash_base = os_info->crashkernel_addr;
|
||||
crash_size = os_info->crashkernel_size;
|
||||
crash_end = crash_base + crash_size;
|
||||
|
||||
Reference in New Issue
Block a user