git: a2c48b865e97 - main - stand: move 'staging' to loader_efi.h

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

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

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

    stand: move 'staging' to loader_efi.h
    
    On amd64, we need this to setup the page tables.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
---
 stand/efi/loader/arch/amd64/elf64_freebsd.c  | 2 --
 stand/efi/loader/arch/i386/elf64_freebsd.c   | 2 --
 stand/efi/loader/loader_efi.h                | 5 +++++
 stand/kboot/kboot/arch/amd64/elf64_freebsd.c | 2 --
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c
index 7413d18aab2a..3883c309e724 100644
--- a/stand/efi/loader/arch/amd64/elf64_freebsd.c
+++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c
@@ -71,8 +71,6 @@ static pdp_entry_t *PT3_l, *PT3_u;
 static pd_entry_t *PT2;
 static pd_entry_t *PT2_l0, *PT2_l1, *PT2_l2, *PT2_l3, *PT2_u0, *PT2_u1;
 
-extern EFI_PHYSICAL_ADDRESS staging;
-
 static void (*trampoline)(uint64_t stack, void *copy_finish, uint64_t kernend,
     uint64_t modulep, pml4_entry_t *pagetable, uint64_t entry);
 
diff --git a/stand/efi/loader/arch/i386/elf64_freebsd.c b/stand/efi/loader/arch/i386/elf64_freebsd.c
index b8bc925576e7..2c6be607dc4d 100644
--- a/stand/efi/loader/arch/i386/elf64_freebsd.c
+++ b/stand/efi/loader/arch/i386/elf64_freebsd.c
@@ -86,8 +86,6 @@ static p2_entry_t *PT2;
 static p2_entry_t *PT2_l0, *PT2_l1, *PT2_l2, *PT2_l3, *PT2_u0, *PT2_u1;
 static gdt_t *GDT;
 
-extern EFI_PHYSICAL_ADDRESS staging;
-
 static void (*trampoline)(uint32_t stack, void *copy_finish, uint32_t kernend,
     uint32_t modulep, uint64_t *pagetable, struct gdtr *gdtr, uint64_t entry);
 
diff --git a/stand/efi/loader/loader_efi.h b/stand/efi/loader/loader_efi.h
index 8d4e352eec79..b2d7817b87dd 100644
--- a/stand/efi/loader/loader_efi.h
+++ b/stand/efi/loader/loader_efi.h
@@ -55,6 +55,11 @@ void * efi_translate(vm_offset_t ptr);
 void	efi_copy_finish(void);
 void	efi_copy_finish_nop(void);
 
+#if defined(__amd64__) || defined(__i386__)
+/* Need this to setup page tables */
+extern EFI_PHYSICAL_ADDRESS staging;
+#endif
+
 int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
     bool exit_bs);
 
diff --git a/stand/kboot/kboot/arch/amd64/elf64_freebsd.c b/stand/kboot/kboot/arch/amd64/elf64_freebsd.c
index 8618f132126b..b0efbfe09629 100644
--- a/stand/kboot/kboot/arch/amd64/elf64_freebsd.c
+++ b/stand/kboot/kboot/arch/amd64/elf64_freebsd.c
@@ -122,8 +122,6 @@ static pd_entry_t *PT2_l0, *PT2_l1, *PT2_l2, *PT2_l3, *PT2_u0, *PT2_u1;
 static pdp_entry_t *PT3;
 static pd_entry_t *PT2;
 
-extern EFI_PHYSICAL_ADDRESS staging;
-
 static void (*trampoline)(uint64_t stack, void *copy_finish, uint64_t kernend,
     uint64_t modulep, pml4_entry_t *pagetable, uint64_t entry);
 #endif