zipl: Consolidate IMAGE macros

Combine the different macros for 0x10000 and use a consistent naming
schema.

Signed-off-by: Philipp Rudo <prudo@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:
Philipp Rudo
2019-10-31 17:04:59 +01:00
committed by Jan Höppner
parent 8face3e63e
commit cb614ed1ee
5 changed files with 22 additions and 20 deletions
+4 -3
View File
@@ -13,6 +13,7 @@
#include "s390.h"
#include "stage3.h"
#include "error.h"
#include "zipl.h"
#define for_each_rb_entry(entry, rb) \
for (entry = rb->entries; \
@@ -272,7 +273,7 @@ void start(void)
* verified component. If it is not IPL is aborted.
*/
if (secure_boot_enabled()) {
if (_image_addr != DEFAULT_IMAGE_ADDR ||
if (_image_addr != IMAGE_LOAD_ADDRESS ||
_load_psw != DEFAULT_PSW_LOAD)
panic(ESECUREBOOT, "%s", msg_sipl_inval);
@@ -283,8 +284,8 @@ void start(void)
* cut the kernel header
*/
memmove((void *)_image_addr,
(void *)_image_addr + KERNEL_HEADER_SIZE,
_image_len - KERNEL_HEADER_SIZE);
(void *)_image_addr + IMAGE_LOAD_ADDRESS,
_image_len - IMAGE_LOAD_ADDRESS);
/* store subchannel ID into low core and into new kernel space */
subchannel_id = S390_lowcore.subchannel_id;
-2
View File
@@ -29,10 +29,8 @@
#define IPL_FLAG_SECURE 0x40
#define DEFAULT_IMAGE_ADDR 0x10000
#define DEFAULT_PSW_LOAD 0x0008000080010000UL
#define PSW_ADDR_MASK 0x000000007FFFFFFFUL
#define KERNEL_HEADER_SIZE 65536
#define UNSPECIFIED_ADDRESS -1UL
+5 -3
View File
@@ -19,13 +19,15 @@
#define ZIPL_MAGIC_SIZE 4
#define DISK_LAYOUT_ID 0x00000001
#define IMAGE_ENTRY 0x10000UL
#define IMAGE_ENTRY_KDUMP 0x10010UL
#define ZIPL_STAGE2_LOAD_ADDRESS 0x2000UL
#define ZIPL_STAGE3_ENTRY_ADDRESS 0xa000UL
#define DEFAULT_IMAGE_ADDRESS 0x10000UL
#define KDUMP_IMAGE_ADDRESS 0x10010UL
#define DEFAULT_STAGE3_ADDRESS 0xa000UL
#define DEFAULT_STAGE3_PARAMS_ADDRESS 0x9000UL
#define MINIMUM_ADDRESS 0x10000UL
#define IMAGE_LOAD_ADDRESS IMAGE_ENTRY
#define ADDRESS_LIMIT 0x80000000UL
#define ADDRESS_LIMIT_KDUMP 0x2000000UL /* HSA size: 32 MiB */
#define UNSPECIFIED_ADDRESS -1UL
+4 -4
View File
@@ -644,8 +644,8 @@ add_ipl_program(int fd, struct job_ipl_data* ipl, disk_blockptr_t* program,
rc = boot_get_stage3_parms(&stage3_params, &stage3_params_size,
ipl->parm_addr, ipl->ramdisk_addr,
ramdisk_size,
ipl->is_kdump ? ipl->image_addr + 0x10 :
ipl->image_addr,
ipl->is_kdump ? IMAGE_ENTRY_KDUMP :
IMAGE_ENTRY,
(info->type == disk_type_scsi) ? 0 : 1,
flags, ipl->image_addr, image_size);
if (rc) {
@@ -1175,7 +1175,7 @@ bootmap_create(struct job_data *job, disk_blockptr_t *program_table,
ulong unused_size;
/* Use approximated stage 3 size as starting point */
size = MINIMUM_ADDRESS;
size = IMAGE_LOAD_ADDRESS;
/* Ramdisk */
if (job->data.dump.ramdisk != NULL) {
@@ -1187,7 +1187,7 @@ bootmap_create(struct job_data *job, disk_blockptr_t *program_table,
/* Kernel */
if (stat(job->data.dump.image, &st))
goto out_misc_free_temp_dev;
size += DIV_ROUND_UP(st.st_size - 0x10000,
size += DIV_ROUND_UP(st.st_size - IMAGE_LOAD_ADDRESS,
info->phy_block_size);
/* Parmfile */
size += DIV_ROUND_UP(DUMP_PARAM_MAX_LEN, info->phy_block_size);
+9 -8
View File
@@ -23,6 +23,7 @@
#include "job.h"
#include "misc.h"
#include "scan.h"
#include "zipl.h"
/* Command line options */
static struct option options[] = {
@@ -655,12 +656,12 @@ check_component_address_data(struct component_loc *cl, int num, char *name,
address_limit);
return -1;
}
if (*cl[i].addrp < MINIMUM_ADDRESS) {
if (*cl[i].addrp < IMAGE_LOAD_ADDRESS) {
if (name != NULL)
error_text("Section '%s'", name);
error_reason("Component '%s' falls below available "
"address space (limit is 0x%08x)",
cl[i].name, MINIMUM_ADDRESS);
cl[i].name, IMAGE_LOAD_ADDRESS);
return -1;
}
}
@@ -698,12 +699,12 @@ finalize_component_address_data(struct component_loc *cl, int num,
for (j = -1; j < i; j++) {
if (j < 0) {
/* Try address before first component */
addr = MINIMUM_ADDRESS;
addr = IMAGE_LOAD_ADDRESS;
} else {
/* Try address after component j */
addr = *cl[j].addrp + cl[j].size;
if (addr < MINIMUM_ADDRESS)
addr = MINIMUM_ADDRESS;
if (addr < IMAGE_LOAD_ADDRESS)
addr = IMAGE_LOAD_ADDRESS;
}
addr = ALIGN(addr, cl[i].align);
if (addr + cl[i].size > address_limit) {
@@ -897,7 +898,7 @@ check_job_dump_images(struct job_dump_data* dump, char* name)
dump->image = misc_strdup(ZFCPDUMP_IMAGE);
if (dump->image == NULL)
return -1;
dump->image_addr = DEFAULT_IMAGE_ADDRESS;
dump->image_addr = IMAGE_LOAD_ADDRESS;
/* Ramdisk is no longer required with new initramfs dump system */
if (misc_check_readable_file(ZFCPDUMP_INITRD))
@@ -1347,7 +1348,7 @@ get_job_from_section_data(char* data[], struct job_data* job, char* section)
return -1;
if (extract_address(job->data.ipl.image,
&job->data.ipl.image_addr)) {
job->data.ipl.image_addr = DEFAULT_IMAGE_ADDRESS;
job->data.ipl.image_addr = IMAGE_LOAD_ADDRESS;
}
/* Fill in parmline */
rc = get_parmline(data[(int) scan_keyword_parmfile],
@@ -1402,7 +1403,7 @@ get_job_from_section_data(char* data[], struct job_data* job, char* section)
return -1;
if (extract_address(job->data.ipl_tape.image,
&job->data.ipl_tape.image_addr)) {
job->data.ipl_tape.image_addr = DEFAULT_IMAGE_ADDRESS;
job->data.ipl_tape.image_addr = IMAGE_LOAD_ADDRESS;
}
/* Fill in parmline */
rc = get_parmline(data[(int) scan_keyword_parmfile],