Reorganize boot-loader header files

include/boot/s390.h relies on s390 specific kernel headers. However,
some tools used this header for non-s390 code (outside of boot-loaders).
To solve this the PSW and PAGE_SIZE definitions are now in separate
header files. All includes for s390.h which are not in boot-loader code
are replaced with one of psw.h or page.h.

This fixes the compilation failure on ppc64le due to conflicting types
for `__vector128`.

Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/151
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Steffen Eiden
2023-06-21 12:29:57 +02:00
parent bb8e0e1047
commit 8058921f58
23 changed files with 64 additions and 41 deletions

View File

@@ -11,7 +11,6 @@
#include "stage3a.h"
#include "lib/zt_common.h"
#include "boot/s390.h"
#include "boot/ipl.h"
#include "sclp.h"
#include "error.h"

View File

@@ -11,7 +11,7 @@
#include "stage3b.h"
#include "lib/zt_common.h"
#include "boot/s390.h"
#include "boot/psw.h"
#include "boot/linux_layout.h"
#include "boot/loaders_layout.h"
#include "sclp.h"

View File

@@ -21,7 +21,7 @@
#include <stdint.h>
#include "boot/s390.h"
#include "boot/psw.h"
/* Must not have any padding included */
struct memblob {

View File

@@ -13,7 +13,6 @@
#include <glib/gi18n.h>
#include "boot/linux_layout.h"
#include "boot/s390.h"
#include "lib/zt_common.h"
static const gchar tool_name[] = "genprotimg";

View File

@@ -12,7 +12,7 @@
#include <openssl/sha.h>
#include "boot/s390.h"
#include "boot/psw.h"
#include "lib/zt_common.h"
#include "utils/crypto.h"

View File

@@ -15,7 +15,6 @@
#include <stdio.h>
#include <string.h>
#include "boot/s390.h"
#include "common.h"
#include "utils/align.h"
#include "utils/buffer.h"

View File

@@ -12,7 +12,7 @@
#include <openssl/evp.h>
#include <stdint.h>
#include "boot/s390.h"
#include "boot/psw.h"
#include "boot/stage3b.h"
#include "common.h"
#include "utils/align.h"

View File

@@ -14,7 +14,7 @@
#include <openssl/evp.h>
#include <stdint.h>
#include "boot/s390.h"
#include "boot/psw.h"
#include "boot/stage3b.h"
#include "utils/buffer.h"

View File

@@ -14,7 +14,7 @@
#include <stdint.h>
#include <string.h>
#include "boot/s390.h"
#include "boot/psw.h"
#include "include/pv_crypto_def.h"
#include "utils/buffer.h"
#include "utils/crypto.h"

View File

@@ -13,7 +13,6 @@
#include <glib.h>
#include <stdint.h>
#include "boot/s390.h"
#include "include/pv_hdr_def.h"
#include "utils/crypto.h"
#include "utils/buffer.h"

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <string.h>
#include "boot/s390.h"
#include "boot/psw.h"
#include "boot/stage3a.h"
#include "common.h"
#include "include/pv_crypto_def.h"

View File

@@ -15,7 +15,7 @@
#include <openssl/evp.h>
#include <stdint.h>
#include "boot/s390.h"
#include "boot/psw.h"
#include "utils/buffer.h"
#include "pv_args.h"

View File

@@ -13,7 +13,6 @@
#include <stdio.h>
#include "boot/ipl.h"
#include "boot/s390.h"
#include "common.h"
#include "include/pv_hdr_def.h"
#include "lib/zt_common.h"

View File

@@ -15,7 +15,6 @@
#include <stdint.h>
#include "boot/ipl.h"
#include "boot/s390.h"
#include "boot/stage3b.h"
#include "utils/buffer.h"

View File

@@ -10,8 +10,8 @@
#ifndef PV_UTILS_ALIGN_H
#define PV_UTILS_ALIGN_H
#include "boot/s390.h"
#include "lib/zt_common.h"
#include "boot/page.h"
#define IS_ALIGNED(addr, size) (!(addr & (size - 1)))

View File

@@ -24,7 +24,7 @@
#include <stdint.h>
#include <string.h>
#include "boot/s390.h"
#include "boot/page.h"
#include "common.h"
#include "include/pv_crypto_def.h"
#include "pv/pv_error.h"

View File

@@ -11,7 +11,7 @@
#define IPL_H
#include "lib/zt_common.h"
#include "s390.h"
#include "page.h"
#define IPL_FLAG_SECURE 0x40

15
include/boot/page.h Normal file
View File

@@ -0,0 +1,15 @@
/*
* Page related definitions and functions.
*
* Copyright IBM Corp. 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 BOOT_PAGE_H
#define BOOT_PAGE_H
#include "lib/zt_common.h"
#define PAGE_SIZE _AC(4096, UL)
#endif

31
include/boot/psw.h Normal file
View File

@@ -0,0 +1,31 @@
/*
* Program Status Word related definitions and functions.
*
* Copyright IBM Corp. 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 BOOT_PSW_H
#define BOOT_PSW_H
#include "lib/zt_common.h"
#define PSW32_ADDR_MASK _AC(0x000000007fffffff, UL)
#define PSW_MASK_BA _AC(0x0000000080000000, UL)
#define PSW_MASK_EA _AC(0x0000000100000000, UL)
#define PSW_MASK_BIT_12 _AC(0x0008000000000000, UL)
#define PSW_LOAD _AC(0x0008000080000000, UL)
#define PSW_DISABLED_WAIT _AC(0x000a000000000000, UL)
#ifndef __ASSEMBLER__
#include <stdint.h>
struct psw_t {
uint64_t mask;
uint64_t addr;
} __aligned(8);
#endif
#endif

View File

@@ -1,7 +1,8 @@
/*
* s390 related definitions and functions.
* Should only be used for code targeting s390 (bootloader code)
*
* Copyright IBM Corp. 2013, 2020
* 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,29 +13,22 @@
#include "lib/zt_common.h"
#include "boot/sigp.h"
#include "boot/psw.h"
#include "boot/page.h"
#define __LC_IPLDEV 0x0c6c
#define __LC_OS_INFO 0x0e18
#define LOWCORE_SIZE _AC(0x2000, UL)
#define PAGE_SIZE _AC(4096, UL)
/* Minimum size of a stack frame in bytes */
#define STACK_FRAME_OVERHEAD _AC(160, U)
/* Facilities */
#define UNPACK_FACILITY _AC(161, U)
#define PSW32_ADDR_MASK _AC(0x000000007fffffff, UL)
#define PSW_MASK_BA _AC(0x0000000080000000, UL)
#define PSW_MASK_EA _AC(0x0000000100000000, UL)
#define PSW_MASK_BIT_12 _AC(0x0008000000000000, UL)
#define PSW_LOAD _AC(0x0008000080000000, UL)
#define PSW_DISABLED_WAIT _AC(0x000a000000000000, UL)
#ifndef __ASSEMBLER__
#include <stdint.h>
/*
* Helper macro for exception table entries
@@ -46,16 +40,6 @@
".long (" #_target ")\n" \
".previous\n"
struct psw_t {
uint64_t mask;
uint64_t addr;
} __aligned(8);
struct psw32_t {
uint32_t mask;
uint32_t addr;
} __aligned(8);
void load_wait_psw(uint64_t, struct psw_t *);
struct subchannel_id {

View File

@@ -13,7 +13,7 @@
#include <openssl/sha.h>
#include "boot/s390.h"
#include "boot/psw.h"
#include "libpv/crypto.h"
#include "libpv/macros.h"

View File

@@ -8,7 +8,7 @@
* it under the terms of the MIT license. See LICENSE for details.
*
*/
#include "boot/s390.h" /* for PAGE_SIZE */
#include "boot/page.h"
#define ZIPL_ENVBLK_SIGNATURE "# zIPL Environment Block\n"
#define ENVBLK_DEFAULT_IMPORT_SOURCE "/etc/ziplenv"

View File

@@ -25,7 +25,6 @@
#include "lib/util_libc.h"
#include "lib/util_part.h"
#include "lib/util_path.h"
#include "boot/s390.h"
#include "stage3.h"
#include "boot.h"