]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: Move get_efi_pxe_arch() to efi_helper
authorSimon Glass <sjg@chromium.org>
Thu, 7 Nov 2024 21:31:44 +0000 (14:31 -0700)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 9 Nov 2024 09:01:46 +0000 (10:01 +0100)
Move this function from the EFI bootmeth to the common efi_helper file.
No functional change is intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/bootmeth_efi.c
include/efi.h
lib/efi_loader/efi_helper.c

index 371b36d550b2bcbeef07f3e5b136a5a0f3788937..f836aa655f573b8d4a933bf8a2f4e2ec188c02e2 100644 (file)
 
 #define EFI_DIRNAME    "/EFI/BOOT/"
 
-static int get_efi_pxe_arch(void)
-{
-       /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
-       if (IS_ENABLED(CONFIG_ARM64))
-               return 0xb;
-       else if (IS_ENABLED(CONFIG_ARM))
-               return 0xa;
-       else if (IS_ENABLED(CONFIG_X86_64))
-               return 0x6;
-       else if (IS_ENABLED(CONFIG_X86))
-               return 0x7;
-       else if (IS_ENABLED(CONFIG_ARCH_RV32I))
-               return 0x19;
-       else if (IS_ENABLED(CONFIG_ARCH_RV64I))
-               return 0x1b;
-       else if (IS_ENABLED(CONFIG_SANDBOX))
-               return 0;       /* not used */
-
-       return -EINVAL;
-}
-
 static int get_efi_pxe_vci(char *str, int max_len)
 {
        int ret;
 
-       ret = get_efi_pxe_arch();
+       ret = efi_get_pxe_arch();
        if (ret < 0)
                return ret;
 
@@ -239,7 +218,7 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
        ret = get_efi_pxe_vci(str, sizeof(str));
        if (ret)
                return log_msg_ret("vci", ret);
-       ret = get_efi_pxe_arch();
+       ret = efi_get_pxe_arch();
        if (ret < 0)
                return log_msg_ret("arc", ret);
        arch = ret;
index ecdf72107502f326b5ac811162bf03220d0f06a1..789a64eda9d0884fedb8c3c6c9c6f0922d0ec809 100644 (file)
@@ -678,4 +678,14 @@ void efi_show_tables(struct efi_system_table *systab);
  */
 const char *efi_get_basename(void);
 
+/**
+ * efi_get_pxe_arch() - Get the architecture value for PXE
+ *
+ * See:
+ * http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml
+ *
+ * Return: Architecture value
+ */
+int efi_get_pxe_arch(void);
+
 #endif /* _LINUX_EFI_H */
index 51e0c4852c524265d4f028ab9294763f228afee4..b8ece1c2e0ca4c2ac68509d65a67257a5b9ff9d4 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/libfdt.h>
 #include <linux/list.h>
 
+#undef BOOTEFI_NAME
+
 #ifdef CONFIG_SANDBOX
 
 #if HOST_ARCH == HOST_ARCH_X86_64
@@ -69,6 +71,27 @@ const char *efi_get_basename(void)
        return BOOTEFI_NAME;
 }
 
+int efi_get_pxe_arch(void)
+{
+       /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
+       if (IS_ENABLED(CONFIG_ARM64))
+               return 0xb;
+       else if (IS_ENABLED(CONFIG_ARM))
+               return 0xa;
+       else if (IS_ENABLED(CONFIG_X86_64))
+               return 0x6;
+       else if (IS_ENABLED(CONFIG_X86))
+               return 0x7;
+       else if (IS_ENABLED(CONFIG_ARCH_RV32I))
+               return 0x19;
+       else if (IS_ENABLED(CONFIG_ARCH_RV64I))
+               return 0x1b;
+       else if (IS_ENABLED(CONFIG_SANDBOX))
+               return 0;       /* not used */
+
+       return -EINVAL;
+}
+
 /**
  * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by
  *                                the value of BootCurrent