diff --git a/genprotimg/src/common.h b/genprotimg/src/common.h index 88c50e32..401d690f 100644 --- a/genprotimg/src/common.h +++ b/genprotimg/src/common.h @@ -6,6 +6,7 @@ #include #include "boot/linux_layout.h" +#include "boot/s390.h" #include "lib/zt_common.h" static const gchar tool_name[] = "genprotimg"; @@ -15,11 +16,6 @@ static const gchar copyright_notice[] = "Copyright IBM Corp. 2020"; #define GENPROTIMG_STAGE3A_PATH (STRINGIFY(PKGDATADIR) "/stage3a.bin") #define GENPROTIMG_STAGE3B_PATH (STRINGIFY(PKGDATADIR) "/stage3b_reloc.bin") -#define PSW_SHORT_ADDR_MASK 0x000000007FFFFFFFULL -#define PSW_MASK_BA 0x0000000080000000ULL -#define PSW_MASK_EA 0x0000000100000000ULL -#define PSW_MASK_BIT_12 0x0008000000000000ULL - #define DEFAULT_INITIAL_PSW_ADDR IMAGE_ENTRY #define DEFAULT_INITIAL_PSW_MASK (PSW_MASK_EA | PSW_MASK_BA) diff --git a/genprotimg/src/pv/pv_image.c b/genprotimg/src/pv/pv_image.c index 8e28df8f..7ec5fe9c 100644 --- a/genprotimg/src/pv/pv_image.c +++ b/genprotimg/src/pv/pv_image.c @@ -14,6 +14,7 @@ #include #include +#include "boot/s390.h" #include "boot/stage3a.h" #include "common.h" #include "include/pv_crypto_def.h" @@ -741,7 +742,7 @@ static gint convert_psw_to_short_psw(const struct psw_t *psw, uint64_t *dst, uint64_t psw_mask = psw->mask; /* test if PSW mask can be converted */ - if (psw_mask & PSW_SHORT_ADDR_MASK) { + if (psw_mask & PSW32_ADDR_MASK) { g_set_error(err, PV_ERROR, PV_ERROR_INTERNAL, _("Failed to convert PSW to short PSW")); return -1; @@ -755,7 +756,7 @@ static gint convert_psw_to_short_psw(const struct psw_t *psw, uint64_t *dst, } /* test if PSW addr can be converted */ - if (psw_addr & ~PSW_SHORT_ADDR_MASK) { + if (psw_addr & ~PSW32_ADDR_MASK) { g_set_error(err, PV_ERROR, PV_ERROR_INTERNAL, _("Failed to convert PSW to short PSW")); return -1; diff --git a/include/boot/s390.h b/include/boot/s390.h index 704f1dbb..8262f5af 100644 --- a/include/boot/s390.h +++ b/include/boot/s390.h @@ -24,6 +24,13 @@ /* 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__ diff --git a/zipl/boot/stage3.c b/zipl/boot/stage3.c index 3185448c..018dacb4 100644 --- a/zipl/boot/stage3.c +++ b/zipl/boot/stage3.c @@ -18,7 +18,6 @@ #include "stage3.h" #include "error.h" -#include "zipl.h" #include "ebcdic.h" #include "ebcdic_conv.h" @@ -152,7 +151,7 @@ void start(void) _stage3_parms.load_psw != DEFAULT_PSW_LOAD) panic(ESECUREBOOT, "%s", msg_sipl_inval); - if (!is_verified_address(_stage3_parms.load_psw & PSW_ADDR_MASK)) + if (!is_verified_address(_stage3_parms.load_psw & PSW32_ADDR_MASK)) panic(ESECUREBOOT, "%s", msg_sipl_unverified); } /* diff --git a/zipl/boot/stage3.h b/zipl/boot/stage3.h index 5ac4623d..a11257e8 100644 --- a/zipl/boot/stage3.h +++ b/zipl/boot/stage3.h @@ -22,7 +22,6 @@ #define STAGE3_FLAG_KDUMP 0x0002000000000000ULL #define DEFAULT_PSW_LOAD 0x0008000080010000UL -#define PSW_ADDR_MASK 0x000000007FFFFFFFUL #define UNSPECIFIED_ADDRESS -1UL diff --git a/zipl/include/zipl.h b/zipl/include/zipl.h index 2465010b..8ed839ec 100644 --- a/zipl/include/zipl.h +++ b/zipl/include/zipl.h @@ -26,10 +26,6 @@ #define MAXIMUM_PARMLINE_SIZE 0x380UL #define MAXIMUM_PHYSICAL_BLOCKSIZE 0x1000UL -#define PSW_ADDRESS_MASK 0x000000007fffffffUL -#define PSW_LOAD 0x0008000080000000UL -#define PSW_DISABLED_WAIT 0x000a000000000000UL - #define BOOTMAP_FILENAME "bootmap" #define BOOTMAP_TEMPLATE_FILENAME "bootmap_temp.XXXXXX" diff --git a/zipl/src/boot.c b/zipl/src/boot.c index 300fa99a..281b5b2c 100644 --- a/zipl/src/boot.c +++ b/zipl/src/boot.c @@ -87,7 +87,7 @@ boot_get_stage3_parms(void **buffer, size_t *bytecount, address_t parm_addr, struct stage3_parms params; void* data; - if (entry != (entry & PSW_ADDRESS_MASK)) { + if (entry != (entry & PSW32_ADDR_MASK)) { error_reason("Kernel image entry point to high (31 bit " "addressing mode)"); return -1; @@ -238,7 +238,7 @@ boot_get_tape_ipl(void** data, size_t* size, address_t parm_addr, struct boot_tape_ipl_params params; void* buffer; - if (image_addr != (image_addr & PSW_ADDRESS_MASK)) { + if (image_addr != (image_addr & PSW32_ADDR_MASK)) { error_reason("Kernel image load address to high (31 bit " "addressing mode)"); return -1; diff --git a/zipl/src/bootmap.c b/zipl/src/bootmap.c index 584da539..30128c9a 100644 --- a/zipl/src/bootmap.c +++ b/zipl/src/bootmap.c @@ -21,6 +21,7 @@ #include "lib/zt_common.h" #include "lib/util_part.h" #include "lib/util_path.h" +#include "boot/s390.h" #include "stage3.h" #include "boot.h"