zipl/boot: add struct tpi_info to the lowcore struct

Use the `tpi_info` struct definition, similar to the Linux kernel, in
the lowcore struct. This change allows us to use simple assignments
instead of using casts. Additionally, there is the advantage that the
lowcore definition from the s390-tools now looks more similar to the
lowcore definition used by the Linux kernel.

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:
Marc Hartmayer
2022-02-03 17:10:08 +00:00
committed by Jan Höppner
parent 47fcc71f96
commit ae27066c15
4 changed files with 31 additions and 15 deletions

View File

@@ -58,6 +58,26 @@ struct psw32_t {
void load_wait_psw(uint64_t, struct psw_t *);
struct subchannel_id {
uint32_t cssid:8;
uint32_t:4;
uint32_t m:1;
uint32_t ssid:2;
uint32_t one:1;
uint32_t sch_no:16;
} __packed __aligned(4);
struct tpi_info {
struct subchannel_id schid;
uint32_t intparm;
uint32_t adapter_IO:1;
uint32_t directed_irq:1;
uint32_t isc:3;
uint32_t:12;
uint32_t type:3;
uint32_t:12;
} __packed __aligned(4);
struct _lowcore {
uint8_t pad_0x0000[0x0014-0x0000]; /* 0x0000 */
uint32_t ipl_parmblock_ptr; /* 0x0014 */
@@ -80,10 +100,15 @@ struct _lowcore {
uint8_t pad_0x00a4[0x00a8-0x00a4]; /* 0x00a4 */
uint64_t trans_exc_code; /* 0x00a8 */
uint64_t monitor_code; /* 0x00b0 */
uint16_t subchannel_id; /* 0x00b8 */
uint16_t subchannel_nr; /* 0x00ba */
uint32_t io_int_parm; /* 0x00bc */
uint32_t io_int_word; /* 0x00c0 */
union {
struct {
uint16_t subchannel_id; /* 0x00b8 */
uint16_t subchannel_nr; /* 0x00ba */
uint32_t io_int_parm; /* 0x00bc */
uint32_t io_int_word; /* 0x00c0 */
};
struct tpi_info tpi_info; /* 0x00b8 */
};
uint8_t pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
uint32_t stfl_fac_list; /* 0x00c8 */
uint8_t pad_0x00cc[0x00e8-0x00cc]; /* 0x00cc */

View File

@@ -32,15 +32,6 @@
#define MAX_RETRIES 255
struct subchannel_id {
uint32_t cssid:8;
uint32_t:4;
uint32_t m:1;
uint32_t ssid:2;
uint32_t one:1;
uint32_t sch_no:16;
} __packed __aligned(4);
struct ccw1 {
uint8_t cmd_code;
uint8_t flags;

View File

@@ -95,7 +95,7 @@ void __noreturn start(void)
void *load_page;
int config_nr;
subchannel_id = *(struct subchannel_id *)&S390_lowcore.subchannel_id;
subchannel_id = S390_lowcore.tpi_info.schid;
stage2_descr = *(struct stage2_descr*)STAGE2_DESC;
/* print menu and get configuration number */

View File

@@ -15,7 +15,7 @@
#include "libc.h"
#include "boot/s390.h"
#define IPL_SC *((struct subchannel_id *) &S390_lowcore.subchannel_id)
#define IPL_SC S390_lowcore.tpi_info.schid
#define ROUND_DOWN(x, a) ((x) & ~((typeof(x))(a) - 1))
#define IS_ALIGNED(x, a) ~((x) & ((typeof(x))(a) - 1))