Consolidate PSW masks

While at it, rename PSW_SHORT_ADDR_MASK and PSW_ADDRESS_MASK to
PSW32_ADDR_MASK. As a side effect this removes the zipl.h dependency
of the boot loaders. While at it,

Reviewed-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2020-03-23 12:26:57 +01:00
committed by Jan Höppner
parent eb4e806cdc
commit 93a0cb254e
8 changed files with 15 additions and 16 deletions

View File

@@ -6,6 +6,7 @@
#include <glib/gi18n-lib.h>
#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)

View File

@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <string.h>
#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;

View File

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

View File

@@ -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);
}
/*

View File

@@ -22,7 +22,6 @@
#define STAGE3_FLAG_KDUMP 0x0002000000000000ULL
#define DEFAULT_PSW_LOAD 0x0008000080010000UL
#define PSW_ADDR_MASK 0x000000007FFFFFFFUL
#define UNSPECIFIED_ADDRESS -1UL

View File

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

View File

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

View File

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