mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
The __packed__ attribute is not needed for these structures as they
don't need any padding to meet the size and alignment constraints
defined in the Linux for zSeries ABI.
Reported by GCC 9.2.1 when building with '-Waddress-of-packed-member'.
stage3.c: In function 'is_verified_address':
stage3.c:241:26: warning: taking address of packed member of 'struct ipl_rb_components' may result in an unaligned pointer value [-Waddress-of-packed-member]
241 | for_each_rb_entry(comp, comps) {
| ^~~~~
stage3.c:18:15: note: in definition of macro 'for_each_rb_entry'
18 | for (entry = rb->entries; \
| ^~
CC zipl/boot/kdump3.o
CC zipl/boot/sclp_stage3.o
sclp_stage3.c: In function '__sclp_hsa_copy':
sclp_stage3.c:75:34: warning: converting a packed 'struct sdias_sccb' pointer (alignment 1) to a 'struct read_sccb' pointer (alignment 4096) may result in an unaligned pointer value [-Waddress-of-packed-member]
75 | if (sclp_hsa_copy_wait((struct read_sccb *)sccb))
| ^~~~~~~~~
In file included from sclp_stage3.c:13:
sclp_stage3.h:43:8: note: defined here
43 | struct sdias_sccb {
| ^~~~~~~~~~
In file included from sclp_stage3.c:12:
sclp.h:149:8: note: defined here
149 | struct read_sccb {
| ^~~~~~~~~
sclp_stage3.c: In function 'sclp_hsa_get_size':
sclp_stage3.c:126:34: warning: converting a packed 'struct sdias_sccb' pointer (alignment 1) to a 'struct read_sccb' pointer (alignment 4096) may result in an unaligned pointer value [-Waddress-of-packed-member]
126 | if (sclp_hsa_copy_wait((struct read_sccb *)sccb))
| ^~~~~~~~~
In file included from sclp_stage3.c:13:
sclp_stage3.h:43:8: note: defined here
43 | struct sdias_sccb {
| ^~~~~~~~~~
In file included from sclp_stage3.c:12:
sclp.h:149:8: note: defined here
149 | struct read_sccb {
| ^~~~~~~~~
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
185 lines
4.1 KiB
C
185 lines
4.1 KiB
C
/*
|
|
* zipl - zSeries Initial Program Loader tool
|
|
*
|
|
* Main program for stage3 bootloader.
|
|
*
|
|
* Copyright IBM Corp. 2013, 2017
|
|
*
|
|
* 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 STAGE3_H
|
|
#define STAGE3_H
|
|
|
|
#include "libc.h"
|
|
#include "s390.h"
|
|
|
|
#define IPL_DEVICE 0x10404
|
|
#define INITRD_START 0x10408
|
|
#define INITRD_SIZE 0x10410
|
|
#define OLDMEM_BASE 0x10418
|
|
#define OLDMEM_SIZE 0x10420
|
|
#define COMMAND_LINE 0x10480
|
|
#define COMMAND_LINE_SIZE 896
|
|
#define COMMAND_LINE_EXTRA 0xE000
|
|
|
|
#define STAGE3_FLAG_SCSI 0x0001000000000000ULL
|
|
#define STAGE3_FLAG_KDUMP 0x0002000000000000ULL
|
|
|
|
#define IPL_FLAG_SECURE 0x40
|
|
|
|
#define DEFAULT_IMAGE_ADDR 0x10000
|
|
#define DEFAULT_PSW_LOAD 0x0008000080010000L
|
|
#define PSW_ADDR_MASK 0x000000007FFFFFFFL
|
|
#define KERNEL_HEADER_SIZE 65536
|
|
|
|
#define UNSPECIFIED_ADDRESS -1ULL
|
|
|
|
|
|
/* IPL Parameter List header */
|
|
struct ipl_pl_hdr {
|
|
uint32_t len;
|
|
uint8_t flags;
|
|
uint8_t reserved1[2];
|
|
uint8_t version;
|
|
} __packed;
|
|
|
|
/* IPL Parameter Block header */
|
|
struct ipl_pb_hdr {
|
|
uint32_t len;
|
|
uint8_t pbt;
|
|
} __packed;
|
|
|
|
/* IPL Parameter Block 0 with common fields */
|
|
struct ipl_pb0_common {
|
|
uint32_t len;
|
|
uint8_t pbt;
|
|
uint8_t flags;
|
|
uint8_t reserved1[2];
|
|
uint8_t loadparm[8];
|
|
uint8_t reserved2[84];
|
|
} __packed;
|
|
|
|
/* IPL Parameter Block 0 for FCP */
|
|
struct ipl_pb0_fcp {
|
|
uint32_t len;
|
|
uint8_t pbt;
|
|
uint8_t reserved1[3];
|
|
uint8_t loadparm[8];
|
|
uint8_t reserved2[304];
|
|
uint8_t opt;
|
|
uint8_t reserved3[3];
|
|
uint8_t cssid;
|
|
uint8_t reserved4[1];
|
|
uint8_t devno;
|
|
uint8_t reserved5[4];
|
|
uint64_t wwpn;
|
|
uint64_t lun;
|
|
uint32_t bootprog;
|
|
uint8_t reserved6[12];
|
|
uint64_t br_lba;
|
|
uint32_t scp_data_len;
|
|
uint8_t reserved7[260];
|
|
uint8_t scp_data[];
|
|
} __packed;
|
|
|
|
/* IPL Parameter Block 0 for CCW */
|
|
struct ipl_pb0_ccw {
|
|
uint32_t len;
|
|
uint8_t pbt;
|
|
uint8_t flags;
|
|
uint8_t reserved1[2];
|
|
uint8_t loadparm[8];
|
|
uint8_t reserved2[84];
|
|
uint16_t reserved3 : 13;
|
|
uint8_t ssid : 3;
|
|
uint16_t devno;
|
|
uint8_t vm_flags;
|
|
uint8_t reserved4[3];
|
|
uint32_t vm_parm_len;
|
|
uint8_t nss_name[8];
|
|
uint8_t vm_parm[64];
|
|
uint8_t reserved5[8];
|
|
} __packed;
|
|
|
|
struct ipl_parameter_block {
|
|
struct ipl_pl_hdr hdr;
|
|
union {
|
|
struct ipl_pb_hdr pb0_hdr;
|
|
struct ipl_pb0_common common;
|
|
struct ipl_pb0_fcp fcp;
|
|
struct ipl_pb0_ccw ccw;
|
|
char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)];
|
|
};
|
|
} __packed __aligned(PAGE_SIZE);
|
|
|
|
/* IPL Report List header */
|
|
struct ipl_rl_hdr {
|
|
uint32_t len;
|
|
uint8_t flags;
|
|
uint8_t reserved1[2];
|
|
uint8_t version;
|
|
uint8_t reserved2[8];
|
|
} __packed;
|
|
|
|
/* IPL Report Block header */
|
|
/* Structure must not have any padding */
|
|
struct ipl_rb_hdr {
|
|
uint32_t len;
|
|
uint8_t rbt;
|
|
uint8_t reserved1[11];
|
|
};
|
|
|
|
/* IPL Report Block types */
|
|
enum ipl_rbt {
|
|
IPL_RBT_CERTIFICATES = 1,
|
|
IPL_RBT_COMPONENTS = 2,
|
|
};
|
|
|
|
/* IPL Report Block for the certificate list */
|
|
struct ipl_rb_certificate_entry {
|
|
uint64_t addr;
|
|
uint64_t len;
|
|
} __packed;
|
|
|
|
struct ipl_rb_certificates {
|
|
uint32_t len;
|
|
uint8_t rbt;
|
|
uint8_t reserved1[11];
|
|
struct ipl_rb_certificate_entry entries[];
|
|
} __packed;
|
|
|
|
/* IPL Report Block for the component list */
|
|
struct ipl_rb_component_entry {
|
|
uint64_t addr;
|
|
uint64_t len;
|
|
uint8_t flags;
|
|
uint8_t reserved1[5];
|
|
uint16_t certificate_index;
|
|
uint8_t reserved2[8];
|
|
};
|
|
|
|
#define IPL_RB_COMPONENT_FLAG_SIGNED 0x80
|
|
#define IPL_RB_COMPONENT_FLAG_VERIFIED 0x40
|
|
|
|
/* Structure must not have any padding */
|
|
struct ipl_rb_components {
|
|
uint32_t len;
|
|
uint8_t rbt;
|
|
uint8_t reserved1[11];
|
|
struct ipl_rb_component_entry entries[];
|
|
};
|
|
|
|
extern unsigned long long _parm_addr; /* address of parmline */
|
|
extern unsigned long long _initrd_addr; /* address of initrd */
|
|
extern unsigned long long _initrd_len; /* length of initrd */
|
|
extern unsigned long long _load_psw; /* load psw of kernel */
|
|
extern unsigned long long _extra_parm; /* use extra parm line mechanism? */
|
|
extern unsigned long long stage3_flags; /* flags (e.g. STAGE3_FLAG_KDUMP) */
|
|
extern unsigned long long _image_len; /* length of kernel */
|
|
extern unsigned long long _image_addr; /* target address of kernel */
|
|
extern void kdump_stage3();
|
|
|
|
#endif /* STAGE3_H */
|