git: 66b9db032ba9 - main - stand: move efi's bi_load into loader_efi.h

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 05 Dec 2024 00:18:51 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=66b9db032ba9bc0fe6f79083c7eb2891a2aac60f

commit 66b9db032ba9bc0fe6f79083c7eb2891a2aac60f
Author:     Ahmad Khalifa <ahmadkhalifa570@gmail.com>
AuthorDate: 2024-09-27 15:38:01 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-12-05 00:19:17 +0000

    stand: move efi's bi_load into loader_efi.h
    
    For kboot, we still have to declare it manually since we don't always
    include loader_efi.h
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
---
 stand/efi/loader/arch/amd64/elf64_freebsd.c  | 3 ---
 stand/efi/loader/arch/amd64/multiboot2.c     | 2 --
 stand/efi/loader/arch/arm/exec.c             | 2 --
 stand/efi/loader/arch/arm64/exec.c           | 3 ---
 stand/efi/loader/arch/i386/elf64_freebsd.c   | 3 ---
 stand/efi/loader/arch/riscv/exec.c           | 2 --
 stand/efi/loader/bootinfo.c                  | 3 ---
 stand/efi/loader/loader_efi.h                | 3 +++
 stand/kboot/kboot/arch/aarch64/exec.c        | 3 +++
 stand/kboot/kboot/arch/amd64/elf64_freebsd.c | 7 ++++---
 10 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c
index 91dd979a677e..7413d18aab2a 100644
--- a/stand/efi/loader/arch/amd64/elf64_freebsd.c
+++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c
@@ -42,9 +42,6 @@
 
 #include "loader_efi.h"
 
-extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
-    bool exit_bs);
-
 static int	elf64_exec(struct preloaded_file *amp);
 static int	elf64_obj_exec(struct preloaded_file *amp);
 
diff --git a/stand/efi/loader/arch/amd64/multiboot2.c b/stand/efi/loader/arch/amd64/multiboot2.c
index 130caa82aa49..d09b01fce1fc 100644
--- a/stand/efi/loader/arch/amd64/multiboot2.c
+++ b/stand/efi/loader/arch/amd64/multiboot2.c
@@ -57,8 +57,6 @@ extern int elf32_loadfile_raw(char *filename, uint64_t dest,
 extern int elf64_load_modmetadata(struct preloaded_file *fp, uint64_t dest);
 extern int elf64_obj_loadfile(char *filename, uint64_t dest,
     struct preloaded_file **result);
-extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
-    bool exit_bs);
 
 extern void multiboot2_exec(void *entry, uint64_t multiboot_info,
     uint64_t stack);
diff --git a/stand/efi/loader/arch/arm/exec.c b/stand/efi/loader/arch/arm/exec.c
index 85a8c26ade30..c2a79523c02a 100644
--- a/stand/efi/loader/arch/arm/exec.c
+++ b/stand/efi/loader/arch/arm/exec.c
@@ -40,8 +40,6 @@
 #include "bootstrap.h"
 #include "loader_efi.h"
 
-extern int bi_load(char *, vm_offset_t *, vm_offset_t *, bool);
-
 static int
 __elfN(arm_load)(char *filename, uint64_t dest,
     struct preloaded_file **result)
diff --git a/stand/efi/loader/arch/arm64/exec.c b/stand/efi/loader/arch/arm64/exec.c
index 877cff658d1e..91a0503a976f 100644
--- a/stand/efi/loader/arch/arm64/exec.c
+++ b/stand/efi/loader/arch/arm64/exec.c
@@ -42,9 +42,6 @@
 static int elf64_exec(struct preloaded_file *amp);
 static int elf64_obj_exec(struct preloaded_file *amp);
 
-int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
-    bool exit_bs);
-
 static struct file_format arm64_elf = {
 	elf64_loadfile,
 	elf64_exec
diff --git a/stand/efi/loader/arch/i386/elf64_freebsd.c b/stand/efi/loader/arch/i386/elf64_freebsd.c
index ba5117b37016..b8bc925576e7 100644
--- a/stand/efi/loader/arch/i386/elf64_freebsd.c
+++ b/stand/efi/loader/arch/i386/elf64_freebsd.c
@@ -37,9 +37,6 @@
 
 #include "loader_efi.h"
 
-extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
-    bool exit_bs);
-
 static int	elf64_exec(struct preloaded_file *amp);
 static int	elf64_obj_exec(struct preloaded_file *amp);
 
diff --git a/stand/efi/loader/arch/riscv/exec.c b/stand/efi/loader/arch/riscv/exec.c
index 3c40517ea968..0fc28cba78c1 100644
--- a/stand/efi/loader/arch/riscv/exec.c
+++ b/stand/efi/loader/arch/riscv/exec.c
@@ -40,8 +40,6 @@
 #include "bootstrap.h"
 #include "loader_efi.h"
 
-extern int bi_load(char *, vm_offset_t *, vm_offset_t *, bool);
-
 static int
 __elfN(exec)(struct preloaded_file *fp)
 {
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
index 2961b8b97fb7..99a7b1444aca 100644
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -64,9 +64,6 @@
 #include "geliboot.h"
 #endif
 
-int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
-    bool exit_bs);
-
 static int
 bi_getboothowto(char *kargs)
 {
diff --git a/stand/efi/loader/loader_efi.h b/stand/efi/loader/loader_efi.h
index c9dfefcd4c74..8d4e352eec79 100644
--- a/stand/efi/loader/loader_efi.h
+++ b/stand/efi/loader/loader_efi.h
@@ -55,4 +55,7 @@ void * efi_translate(vm_offset_t ptr);
 void	efi_copy_finish(void);
 void	efi_copy_finish_nop(void);
 
+int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
+    bool exit_bs);
+
 #endif	/* _LOADER_EFI_COPY_H_ */
diff --git a/stand/kboot/kboot/arch/aarch64/exec.c b/stand/kboot/kboot/arch/aarch64/exec.c
index 0aa0e7b8408f..585ccffbd42c 100644
--- a/stand/kboot/kboot/arch/aarch64/exec.c
+++ b/stand/kboot/kboot/arch/aarch64/exec.c
@@ -70,8 +70,11 @@ extern uint32_t efi_map_size;
 extern vm_paddr_t efi_map_phys_src;	/* From DTB */
 extern vm_paddr_t efi_map_phys_dst;	/* From our memory map metadata module */
 
+/* Usually provided by loader_efi.h */
+#ifndef EFI
 int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
     bool exit_bs);
+#endif
 
 static struct file_format arm64_elf = {
 	elf64_loadfile,
diff --git a/stand/kboot/kboot/arch/amd64/elf64_freebsd.c b/stand/kboot/kboot/arch/amd64/elf64_freebsd.c
index f6574b4cbd0d..8618f132126b 100644
--- a/stand/kboot/kboot/arch/amd64/elf64_freebsd.c
+++ b/stand/kboot/kboot/arch/amd64/elf64_freebsd.c
@@ -56,6 +56,10 @@
 
 static EFI_GUID acpi_guid = ACPI_TABLE_GUID;
 static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID;
+#else
+/* Usually provided by loader_efi.h */
+extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
+    bool exit_bs);
 #endif
 
 #ifdef EFI
@@ -64,9 +68,6 @@ static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID;
 #define LOADER_PAGE_SIZE PAGE_SIZE
 #endif
 
-extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
-    bool exit_bs);
-
 static int	elf64_exec(struct preloaded_file *amp);
 static int	elf64_obj_exec(struct preloaded_file *amp);