SPDX: Convert all of our single license tags to Linux Kernel style
[oweals/u-boot.git] / lib / efi / efi_stub.c
index d4d3e496899fafe201416e9f1a24712cb9653cf5..3138739ee56a154a5e58d7af8a2da072d953bbd9 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2015 Google, Inc
  *
- * SPDX-License-Identifier:    GPL-2.0+
- *
  * EFI information obtained here:
  * http://wiki.phoenix.com/wiki/index.php/EFI_BOOT_SERVICES
  *
@@ -21,8 +20,6 @@
 #include <linux/err.h>
 #include <linux/types.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #ifndef CONFIG_X86
 /*
  * Problem areas:
@@ -59,12 +56,15 @@ struct __packed desctab_info {
  * considering if we start needing more U-Boot functionality. Note that we
  * could then move get_codeseg32() to arch/x86/cpu/cpu.c.
  */
-void debug_uart_init(void)
+void _debug_uart_init(void)
 {
 }
 
 void putc(const char ch)
 {
+       if (ch == '\n')
+               putc('\r');
+
        if (use_uart) {
                NS16550_t com_port = (NS16550_t)0x3f8;
 
@@ -74,8 +74,6 @@ void putc(const char ch)
        } else {
                efi_putc(global_priv, ch);
        }
-       if (ch == '\n')
-               putc('\r');
 }
 
 void puts(const char *str)
@@ -181,7 +179,7 @@ static int get_codeseg32(void)
                                << 16;
                base <<= 12;    /* 4KB granularity */
                limit <<= 12;
-               if ((desc & GDT_PRESENT) && (desc && GDT_NOTSYS) &&
+               if ((desc & GDT_PRESENT) && (desc & GDT_NOTSYS) &&
                    !(desc & GDT_LONG) && (desc & GDT_4KB) &&
                    (desc & GDT_32BIT) && (desc & GDT_CODE) &&
                    CONFIG_SYS_TEXT_BASE > base &&
@@ -276,7 +274,7 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
        struct efi_boot_services *boot = sys_table->boottime;
        struct efi_mem_desc *desc;
        struct efi_entry_memmap map;
-       ulong key, desc_size, size;
+       efi_uintn_t key, desc_size, size;
        efi_status_t ret;
        u32 version;
        int cs32;
@@ -353,9 +351,9 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
        /* The EFI UART won't work now, switch to a debug one */
        use_uart = true;
 
-       memcpy((void *)CONFIG_SYS_TEXT_BASE, _binary_u_boot_dtb_bin_start,
-              (ulong)_binary_u_boot_dtb_bin_end -
-              (ulong)_binary_u_boot_dtb_bin_start);
+       memcpy((void *)CONFIG_SYS_TEXT_BASE, _binary_u_boot_bin_start,
+              (ulong)_binary_u_boot_bin_end -
+              (ulong)_binary_u_boot_bin_start);
 
 #ifdef DEBUG
        puts("EFI table at ");