mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl: consolidate boot and dump type definitions
Consolidate type definitions in order to avoid duplicated code, getting better compiler support, and to avoid confusing namings for the same thing - e.g. `blk_end` vs. `blockcnt` field name used in the old `struct fba_dump_param` definitions. It also allows us to get rid of two `uint64_t` casts. While at it, fix the documentation of `struct eckd_blockptr`. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
9aa368af54
commit
b41ac66f36
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Boot and dump related definitions
|
||||
*
|
||||
* Copyright IBM Corp. 2022
|
||||
*
|
||||
* 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 BOOT_DEFS_H
|
||||
#define BOOT_DEFS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "lib/zt_common.h"
|
||||
|
||||
/*
|
||||
* ECKD dump parameter
|
||||
*/
|
||||
struct eckd_dump_param {
|
||||
uint32_t blk_start;
|
||||
uint32_t blk_end;
|
||||
uint16_t blk_size;
|
||||
uint8_t num_heads;
|
||||
uint8_t bpt;
|
||||
char reserved[4];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* FBA dump parameter
|
||||
*/
|
||||
struct fba_dump_param {
|
||||
uint32_t res1;
|
||||
uint32_t blk_start;
|
||||
uint32_t res2;
|
||||
uint32_t blk_end;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* SCSI dump parameter
|
||||
*/
|
||||
struct scsi_dump_param {
|
||||
uint64_t block;
|
||||
uint64_t reserved;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Layout of block pointer for linear devices
|
||||
* e.g. SCSI
|
||||
*/
|
||||
struct linear_blockptr {
|
||||
uint64_t blockno;
|
||||
uint16_t size;
|
||||
uint16_t blockct;
|
||||
uint8_t reserved[4];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Layout of block pointer for cylinder/head/sector devices
|
||||
* e.g. ECKD
|
||||
*/
|
||||
struct eckd_blockptr {
|
||||
uint16_t cyl;
|
||||
uint16_t head;
|
||||
uint8_t sec;
|
||||
uint16_t size;
|
||||
uint8_t blockct;
|
||||
uint8_t reserved[8];
|
||||
} __packed;
|
||||
|
||||
#endif /* BOOT_DEFS_H */
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "lib/zt_common.h"
|
||||
#include "boot/boot_defs.h"
|
||||
|
||||
#include "eckd2dump.h"
|
||||
#include "error.h"
|
||||
@@ -20,18 +21,6 @@
|
||||
*/
|
||||
uint64_t __section(.stage2.head) magic = 0x5845434b44363401ULL; /* "XECKD64", version 1 */
|
||||
|
||||
/*
|
||||
* ECKD parameter block passed by zipl
|
||||
*/
|
||||
struct eckd_dump_param {
|
||||
uint32_t blk_start;
|
||||
uint32_t blk_end;
|
||||
uint16_t blk_size;
|
||||
uint8_t num_heads;
|
||||
uint8_t bpt;
|
||||
char reserved[4];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Get device characteristics from zipl parameter block
|
||||
*/
|
||||
|
||||
+2
-10
@@ -10,6 +10,8 @@
|
||||
*/
|
||||
|
||||
#include "lib/zt_common.h"
|
||||
#include "boot/boot_defs.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "fba.h"
|
||||
#include "stage2dump.h"
|
||||
@@ -72,16 +74,6 @@ static struct {
|
||||
unsigned long ida_list[BLK_PWRT * BLK_SIZE / 4096];
|
||||
} ccw_program __aligned(8);
|
||||
|
||||
/*
|
||||
* FBA parameter block passed by zipl
|
||||
*/
|
||||
struct fba_dump_param {
|
||||
uint32_t res1;
|
||||
uint32_t blk_start;
|
||||
uint32_t res2;
|
||||
uint32_t blk_end;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Convert memory size to number of blocks
|
||||
*/
|
||||
|
||||
+2
-17
@@ -19,28 +19,13 @@
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include "boot/boot_defs.h"
|
||||
|
||||
#include "libc.h"
|
||||
#include "boot/s390.h"
|
||||
#include "cio.h"
|
||||
#include "error.h"
|
||||
|
||||
/* Layout of ECKD disk block pointer */
|
||||
struct eckd_blockptr {
|
||||
uint16_t cyl;
|
||||
uint16_t head;
|
||||
uint8_t sec;
|
||||
uint16_t size;
|
||||
uint8_t blockct;
|
||||
uint8_t reserved[8];
|
||||
} __packed;
|
||||
|
||||
struct linear_blockptr {
|
||||
uint64_t blockno;
|
||||
uint16_t size;
|
||||
uint16_t blockct;
|
||||
uint8_t reserved[4];
|
||||
} __packed;
|
||||
|
||||
typedef union {
|
||||
struct eckd_blockptr eckd;
|
||||
struct linear_blockptr linear;
|
||||
|
||||
+1
-50
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "boot/boot_defs.h"
|
||||
#include "lib/zt_common.h"
|
||||
|
||||
#include "disk.h"
|
||||
@@ -60,30 +61,6 @@ struct scsi_dump_sb {
|
||||
#define SCSI_DUMP_SB_SEED 0x12345678
|
||||
#define SCSI_DUMP_SB_CSUM_SIZE 4096
|
||||
|
||||
/* SCSI dump parameter */
|
||||
|
||||
struct scsi_dump_param {
|
||||
uint64_t block;
|
||||
uint64_t reserved;
|
||||
} __packed;
|
||||
/* ECKD dump parameter */
|
||||
|
||||
struct eckd_dump_param {
|
||||
uint32_t start_blk;
|
||||
uint32_t end_blk;
|
||||
uint16_t blocksize;
|
||||
uint8_t num_heads;
|
||||
uint8_t bpt;
|
||||
char reserved[4];
|
||||
} __packed __may_alias;
|
||||
|
||||
/* FBA dump parameter */
|
||||
|
||||
struct fba_dump_param {
|
||||
uint64_t start_blk;
|
||||
uint64_t blockct;
|
||||
} __packed;
|
||||
|
||||
struct boot_info_bp_dump {
|
||||
union {
|
||||
struct eckd_dump_param eckd;
|
||||
@@ -93,32 +70,6 @@ struct boot_info_bp_dump {
|
||||
uint8_t unused[16];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Layout of block pointer for linear devices
|
||||
* e.g. SCSI
|
||||
*/
|
||||
/* Layout of SCSI disk block pointer */
|
||||
struct linear_blockptr {
|
||||
uint64_t blockno;
|
||||
uint16_t size;
|
||||
uint16_t blockct;
|
||||
uint8_t reserved[4];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Layout of block pointer for cylinder/head/sector devices
|
||||
* e.g. SCSI or FBA
|
||||
*/
|
||||
/* Layout of ECKD disk block pointer */
|
||||
struct eckd_blockptr {
|
||||
uint16_t cyl;
|
||||
uint16_t head;
|
||||
uint8_t sec;
|
||||
uint16_t size;
|
||||
uint8_t blockct;
|
||||
uint8_t reserved[8];
|
||||
} __packed;
|
||||
|
||||
struct boot_info_bp_ipl {
|
||||
union {
|
||||
struct eckd_blockptr eckd;
|
||||
|
||||
+5
-5
@@ -687,10 +687,10 @@ static int check_eckd_dump_partition(struct disk_info* info)
|
||||
static void eckd_dump_store_param(struct eckd_dump_param *param,
|
||||
struct disk_info *info, blocknum_t count)
|
||||
{
|
||||
param->start_blk = info->geo.start;
|
||||
param->end_blk = info->geo.start + info->phy_blocks - 1 - count;
|
||||
param->blk_start = info->geo.start;
|
||||
param->blk_end = info->geo.start + info->phy_blocks - 1 - count;
|
||||
param->num_heads = info->geo.heads;
|
||||
param->blocksize = info->phy_block_size;
|
||||
param->blk_size = info->phy_block_size;
|
||||
param->bpt = info->geo.sectors;
|
||||
}
|
||||
|
||||
@@ -901,8 +901,8 @@ install_svdump_fba(int fd, struct disk_info *info, uint64_t mem)
|
||||
if (boot_init_fba_stage0(&stage0, stage1b_list, stage1b_count))
|
||||
goto out_free_stage1b_list;
|
||||
|
||||
param.start_blk = (uint64_t) info->geo.start;
|
||||
param.blockct = (uint64_t) blk - 1;
|
||||
param.blk_start = info->geo.start;
|
||||
param.blk_end = blk - 1;
|
||||
boot_get_dump_info(&stage0.boot_info, BOOT_INFO_DEV_TYPE_FBA, ¶m);
|
||||
|
||||
if (DRY_RUN_FUNC(misc_pwrite(fd, &stage0, sizeof(stage0), 0)))
|
||||
|
||||
Reference in New Issue
Block a user