Skip to content

Commit

Permalink
efi: Make memreserve table handling local to efi.c
Browse files Browse the repository at this point in the history
There is no need for struct efi to carry the address of the memreserve
table and share it with the world. So move it out and make it
__initdata as well.

Tested-by: Tony Luck <tony.luck@intel.com> # arch/ia64
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
  • Loading branch information
Ard Biesheuvel committed Feb 23, 2020
1 parent a17e809 commit b7846e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions drivers/firmware/efi/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ struct efi __read_mostly efi = {
.esrt = EFI_INVALID_TABLE_ADDR,
.tpm_log = EFI_INVALID_TABLE_ADDR,
.tpm_final_log = EFI_INVALID_TABLE_ADDR,
.mem_reserve = EFI_INVALID_TABLE_ADDR,
};
EXPORT_SYMBOL(efi);

static unsigned long __ro_after_init rng_seed = EFI_INVALID_TABLE_ADDR;
static unsigned long __initdata mem_reserve = EFI_INVALID_TABLE_ADDR;

struct mm_struct efi_mm = {
.mm_rb = RB_ROOT,
Expand Down Expand Up @@ -470,7 +470,7 @@ static __initdata efi_config_table_type_t common_tables[] = {
{LINUX_EFI_RANDOM_SEED_TABLE_GUID, "RNG", &rng_seed},
{LINUX_EFI_TPM_EVENT_LOG_GUID, "TPMEventLog", &efi.tpm_log},
{LINUX_EFI_TPM_FINAL_LOG_GUID, "TPMFinalLog", &efi.tpm_final_log},
{LINUX_EFI_MEMRESERVE_TABLE_GUID, "MEMRESERVE", &efi.mem_reserve},
{LINUX_EFI_MEMRESERVE_TABLE_GUID, "MEMRESERVE", &mem_reserve},
#ifdef CONFIG_EFI_RCI2_TABLE
{DELLEMC_EFI_RCI2_TABLE_GUID, NULL, &rci2_table_phys},
#endif
Expand Down Expand Up @@ -563,8 +563,8 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,

efi_tpm_eventlog_init();

if (efi.mem_reserve != EFI_INVALID_TABLE_ADDR) {
unsigned long prsv = efi.mem_reserve;
if (mem_reserve != EFI_INVALID_TABLE_ADDR) {
unsigned long prsv = mem_reserve;

while (prsv) {
struct linux_efi_memreserve *rsv;
Expand Down Expand Up @@ -939,10 +939,10 @@ static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init;

static int __init efi_memreserve_map_root(void)
{
if (efi.mem_reserve == EFI_INVALID_TABLE_ADDR)
if (mem_reserve == EFI_INVALID_TABLE_ADDR)
return -ENODEV;

efi_memreserve_root = memremap(efi.mem_reserve,
efi_memreserve_root = memremap(mem_reserve,
sizeof(*efi_memreserve_root),
MEMREMAP_WB);
if (WARN_ON_ONCE(!efi_memreserve_root))
Expand Down
1 change: 0 additions & 1 deletion include/linux/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ extern struct efi {
unsigned long esrt; /* ESRT table */
unsigned long tpm_log; /* TPM2 Event Log table */
unsigned long tpm_final_log; /* TPM2 Final Events Log table */
unsigned long mem_reserve; /* Linux EFI memreserve table */
efi_get_time_t *get_time;
efi_set_time_t *set_time;
efi_get_wakeup_time_t *get_wakeup_time;
Expand Down

0 comments on commit b7846e6

Please sign in to comment.