[PATCH v3 05/46] x86: Rename state to bmi
Simon Glass
sjg at chromium.org
Fri Dec 6 03:35:44 CET 2024
Use the common name for the struct, in preparation for passing it around
between functions.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
(no changes since v1)
arch/x86/include/asm/zimage.h | 2 +-
arch/x86/lib/zimage.c | 48 +++++++++++++++++------------------
cmd/x86/zboot.c | 4 +--
3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h
index 13a08850dfb..b592057e58b 100644
--- a/arch/x86/include/asm/zimage.h
+++ b/arch/x86/include/asm/zimage.h
@@ -42,7 +42,7 @@ enum {
ZBOOT_STATE_COUNT = 5,
};
-extern struct bootm_info state;
+extern struct bootm_info bmi;
/**
* zboot_load() - Load a zimage
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index c2cf52658e9..1afd3084144 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -56,7 +56,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define COMMAND_LINE_SIZE 2048
/* Current state of the boot */
-struct bootm_info state;
+struct bootm_info bmi;
static void build_command_line(char *command_line, int auto_boot)
{
@@ -371,8 +371,8 @@ int zboot_load(void)
struct boot_params *base_ptr;
int ret;
- if (state.base_ptr) {
- struct boot_params *from = (struct boot_params *)state.base_ptr;
+ if (bmi.base_ptr) {
+ struct boot_params *from = (struct boot_params *)bmi.base_ptr;
base_ptr = (struct boot_params *)DEFAULT_SETUP_BASE;
log_debug("Building boot_params at 0x%8.8lx\n",
@@ -380,18 +380,18 @@ int zboot_load(void)
memset(base_ptr, '\0', sizeof(*base_ptr));
base_ptr->hdr = from->hdr;
} else {
- base_ptr = load_zimage((void *)state.bzimage_addr, state.bzimage_size,
- &state.load_address);
+ base_ptr = load_zimage((void *)bmi.bzimage_addr, bmi.bzimage_size,
+ &bmi.load_address);
if (!base_ptr) {
puts("## Kernel loading failed ...\n");
return -EINVAL;
}
}
- state.base_ptr = base_ptr;
+ bmi.base_ptr = base_ptr;
- ret = env_set_hex("zbootbase", map_to_sysmem(state.base_ptr));
+ ret = env_set_hex("zbootbase", map_to_sysmem(bmi.base_ptr));
if (!ret)
- ret = env_set_hex("zbootaddr", state.load_address);
+ ret = env_set_hex("zbootaddr", bmi.load_address);
if (ret)
return ret;
@@ -400,12 +400,12 @@ int zboot_load(void)
int zboot_setup(void)
{
- struct boot_params *base_ptr = state.base_ptr;
+ struct boot_params *base_ptr = bmi.base_ptr;
int ret;
ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
- 0, state.initrd_addr, state.initrd_size,
- (ulong)state.cmdline);
+ 0, bmi.initrd_addr, bmi.initrd_size,
+ (ulong)bmi.cmdline);
if (ret)
return -EINVAL;
@@ -414,7 +414,7 @@ int zboot_setup(void)
int zboot_go(void)
{
- struct boot_params *params = state.base_ptr;
+ struct boot_params *params = bmi.base_ptr;
struct setup_header *hdr = ¶ms->hdr;
bool image_64bit;
ulong entry;
@@ -422,7 +422,7 @@ int zboot_go(void)
disable_interrupts();
- entry = state.load_address;
+ entry = bmi.load_address;
image_64bit = false;
if (IS_ENABLED(CONFIG_X86_RUN_64BIT) &&
(hdr->xloadflags & XLF_KERNEL_64)) {
@@ -431,7 +431,7 @@ int zboot_go(void)
}
/* we assume that the kernel is in place */
- ret = boot_linux_kernel((ulong)state.base_ptr, entry, image_64bit);
+ ret = boot_linux_kernel((ulong)bmi.base_ptr, entry, image_64bit);
return ret;
}
@@ -597,7 +597,7 @@ void zimage_dump(struct boot_params *base_ptr, bool show_cmdline)
print_num("Start sys seg", hdr->start_sys_seg);
print_num("Kernel version", hdr->kernel_version);
version = zimage_get_kernel_version(base_ptr,
- (void *)state.bzimage_addr);
+ (void *)bmi.bzimage_addr);
if (version)
printf(" @%p: %s\n", version, version);
print_num("Type of loader", hdr->type_of_loader);
@@ -643,22 +643,22 @@ void zimage_dump(struct boot_params *base_ptr, bool show_cmdline)
void zboot_start(ulong bzimage_addr, ulong bzimage_size, ulong initrd_addr,
ulong initrd_size, ulong base_addr, const char *cmdline)
{
- bootm_init(&state);
+ bootm_init(&bmi);
- state.bzimage_size = bzimage_size;
- state.initrd_addr = initrd_addr;
- state.initrd_size = initrd_size;
+ bmi.bzimage_size = bzimage_size;
+ bmi.initrd_addr = initrd_addr;
+ bmi.initrd_size = initrd_size;
if (base_addr) {
- state.base_ptr = map_sysmem(base_addr, 0);
- state.load_address = bzimage_addr;
+ bmi.base_ptr = map_sysmem(base_addr, 0);
+ bmi.load_address = bzimage_addr;
} else {
- state.bzimage_addr = bzimage_addr;
+ bmi.bzimage_addr = bzimage_addr;
}
- state.cmdline = cmdline;
+ bmi.cmdline = cmdline;
}
void zboot_info(void)
{
printf("Kernel loaded at %08lx, setup_base=%p\n",
- state.load_address, state.base_ptr);
+ bmi.load_address, bmi.base_ptr);
}
diff --git a/cmd/x86/zboot.c b/cmd/x86/zboot.c
index 40f67a75593..0d0a8e53172 100644
--- a/cmd/x86/zboot.c
+++ b/cmd/x86/zboot.c
@@ -57,7 +57,7 @@ static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc,
static int do_zboot_setup(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
- if (!state.base_ptr) {
+ if (!bmi.base_ptr) {
printf("base is not set: use 'zboot load' first\n");
return CMD_RET_FAILURE;
}
@@ -97,7 +97,7 @@ static int do_zboot_go(struct cmd_tbl *cmdtp, int flag, int argc,
static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
- struct boot_params *base_ptr = state.base_ptr;
+ struct boot_params *base_ptr = bmi.base_ptr;
if (argc > 1)
base_ptr = (void *)hextoul(argv[1], NULL);
--
2.34.1
More information about the U-Boot
mailing list