]> Git Repo - J-u-boot.git/blobdiff - arch/x86/lib/bootm.c
command: Remove the cmd_tbl_t typedef
[J-u-boot.git] / arch / x86 / lib / bootm.c
index 86030cf52aab1c3994d805d47d16c17e27178f05..1569d30f8ed0aa3aec13a02371c8af438e55a0ca 100644 (file)
@@ -1,15 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2002
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  * Marius Groeger <[email protected]>
  *
  * Copyright (C) 2001  Erik Mouw ([email protected])
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
+#include <hang.h>
+#include <dm/device.h>
+#include <dm/root.h>
 #include <errno.h>
 #include <fdt_support.h>
 #include <image.h>
 #include <asm/arch/timestamp.h>
 #endif
 
-#define COMMAND_LINE_OFFSET 0x9000
+DECLARE_GLOBAL_DATA_PTR;
 
-/*
- * Implement a weak default function for boards that optionally
- * need to clean up the system before jumping to the kernel.
- */
-__weak void board_final_cleanup(void)
-{
-}
+#define COMMAND_LINE_OFFSET 0x9000
 
 void bootm_announce_and_cleanup(void)
 {
@@ -40,10 +37,16 @@ void bootm_announce_and_cleanup(void)
        timestamp_add_now(TS_U_BOOT_START_KERNEL);
 #endif
        bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#ifdef CONFIG_BOOTSTAGE_REPORT
+#if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT)
        bootstage_report();
 #endif
-       board_final_cleanup();
+
+       /*
+        * Call remove function of all devices with a removal flag set.
+        * This may be useful for last-stage operations, like cancelling
+        * of DMA operation or releasing device internal buffers.
+        */
+       dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
 }
 
 #if defined(CONFIG_OF_LIBFDT) && !defined(CONFIG_OF_NO_KERNEL)
@@ -115,6 +118,10 @@ static int boot_prep_linux(bootm_headers_t *images)
                char *base_ptr;
 
                base_ptr = (char *)load_zimage(data, len, &load_address);
+               if (!base_ptr) {
+                       puts("## Kernel loading failed ...\n");
+                       goto error;
+               }
                images->os.load = load_address;
                cmd_line_dest = base_ptr + COMMAND_LINE_OFFSET;
                images->ep = (ulong)base_ptr;
@@ -153,16 +160,27 @@ int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit)
                        puts("Cannot boot 64-bit kernel on 32-bit machine\n");
                        return -EFAULT;
                }
+               /* At present 64-bit U-Boot does not support booting a
+                * kernel.
+                * TODO([email protected]): Support booting both 32-bit and
+                * 64-bit kernels from 64-bit U-Boot.
+                */
+#if !CONFIG_IS_ENABLED(X86_64)
                return cpu_jump_to_64bit(setup_base, load_address);
+#endif
        } else {
                /*
                * Set %ebx, %ebp, and %edi to 0, %esi to point to the
                * boot_params structure, and then jump to the kernel. We
                * assume that %cs is 0x10, 4GB flat, and read/execute, and
                * the data segments are 0x18, 4GB flat, and read/write.
-               * U-boot is setting them up that way for itself in
+               * U-Boot is setting them up that way for itself in
                * arch/i386/cpu/cpu.c.
+               *
+               * Note that we cannot currently boot a kernel while running as
+               * an EFI application. Please use the payload option for that.
                */
+#ifndef CONFIG_EFI_APP
                __asm__ __volatile__ (
                "movl $0, %%ebp\n"
                "cli\n"
@@ -171,6 +189,7 @@ int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit)
                [boot_params] "S"(setup_base),
                "b"(0), "D"(0)
                );
+#endif
        }
 
        /* We can't get to here */
@@ -187,8 +206,8 @@ static int boot_jump_linux(bootm_headers_t *images)
                                 images->os.arch == IH_ARCH_X86_64);
 }
 
-int do_bootm_linux(int flag, int argc, char * const argv[],
-               bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char *const argv[],
+                  bootm_headers_t *images)
 {
        /* No need for those on x86 */
        if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
This page took 0.026696 seconds and 4 git commands to generate.