From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: Ard Biesheuvel <ardb@kernel.org>,
linux-kernel@vger.kernel.org,
Arvind Sankar <nivedita@alum.mit.edu>,
Atish Patra <atish.patra@wdc.com>,
Palmer Dabbelt <palmerdabbelt@google.com>,
Zou Wei <zou_wei@huawei.com>
Subject: [PATCH 32/33] efi: Clean up config table description arrays
Date: Fri, 24 Apr 2020 15:05:30 +0200 [thread overview]
Message-ID: <20200424130531.30518-33-ardb@kernel.org> (raw)
In-Reply-To: <20200424130531.30518-1-ardb@kernel.org>
Increase legibility by adding whitespace to the efi_config_table_type_t
arrays that describe which EFI config tables we look for when going over
the firmware provided list. While at it, replace the 'name' char pointer
with a char array, which is more space efficient on relocatable 64-bit
kernels, as it avoids a 8 byte pointer and the associated relocation
data (24 bytes when using RELA format)
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/ia64/kernel/efi.c | 12 ++++++------
arch/x86/platform/efi/efi.c | 8 ++++----
drivers/firmware/efi/arm-init.c | 4 ++--
drivers/firmware/efi/efi.c | 28 ++++++++++++++--------------
include/linux/efi.h | 2 +-
5 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index f69f3fe0532e..a54eacbc61a9 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -57,12 +57,12 @@ unsigned long hcdp_phys = EFI_INVALID_TABLE_ADDR;
unsigned long sal_systab_phys = EFI_INVALID_TABLE_ADDR;
static const efi_config_table_type_t arch_tables[] __initconst = {
- {ESI_TABLE_GUID, "ESI", &esi_phys},
- {HCDP_TABLE_GUID, "HCDP", &hcdp_phys},
- {MPS_TABLE_GUID, "MPS", &mps_phys},
- {PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID, "PALO", &palo_phys},
- {SAL_SYSTEM_TABLE_GUID, "SALsystab", &sal_systab_phys},
- {NULL_GUID, NULL, 0},
+ {ESI_TABLE_GUID, &esi_phys, "ESI" },
+ {HCDP_TABLE_GUID, &hcdp_phys, "HCDP" },
+ {MPS_TABLE_GUID, &mps_phys, "MPS" },
+ {PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID, &palo_phys, "PALO" },
+ {SAL_SYSTEM_TABLE_GUID, &sal_systab_phys, "SALsystab" },
+ {},
};
extern efi_status_t efi_call_phys (void *, ...);
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 1aae5302501d..e966115d105c 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -62,12 +62,12 @@ static unsigned long efi_runtime, efi_nr_tables;
unsigned long efi_fw_vendor, efi_config_table;
static const efi_config_table_type_t arch_tables[] __initconst = {
- {EFI_PROPERTIES_TABLE_GUID, "PROP", &prop_phys},
- {UGA_IO_PROTOCOL_GUID, "UGA", &uga_phys},
+ {EFI_PROPERTIES_TABLE_GUID, &prop_phys, "PROP" },
+ {UGA_IO_PROTOCOL_GUID, &uga_phys, "UGA" },
#ifdef CONFIG_X86_UV
- {UV_SYSTEM_TABLE_GUID, "UVsystab", &uv_systab_phys},
+ {UV_SYSTEM_TABLE_GUID, &uv_systab_phys, "UVsystab" },
#endif
- {NULL_GUID, NULL, NULL},
+ {},
};
static const unsigned long * const efi_tables[] = {
diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index 9e5e62f5f94d..c697e70ca7e7 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -54,8 +54,8 @@ static phys_addr_t __init efi_to_phys(unsigned long addr)
static __initdata unsigned long screen_info_table = EFI_INVALID_TABLE_ADDR;
static const efi_config_table_type_t arch_tables[] __initconst = {
- {LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID, NULL, &screen_info_table},
- {NULL_GUID, NULL, NULL}
+ {LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID, &screen_info_table},
+ {}
};
static void __init init_screen_info(void)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 911a2bd0f6b7..e49c0b6db988 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -502,21 +502,21 @@ void __init efi_mem_reserve(phys_addr_t addr, u64 size)
}
static const efi_config_table_type_t common_tables[] __initconst = {
- {ACPI_20_TABLE_GUID, "ACPI 2.0", &efi.acpi20},
- {ACPI_TABLE_GUID, "ACPI", &efi.acpi},
- {SMBIOS_TABLE_GUID, "SMBIOS", &efi.smbios},
- {SMBIOS3_TABLE_GUID, "SMBIOS 3.0", &efi.smbios3},
- {EFI_SYSTEM_RESOURCE_TABLE_GUID, "ESRT", &efi.esrt},
- {EFI_MEMORY_ATTRIBUTES_TABLE_GUID, "MEMATTR", &efi_mem_attr_table},
- {LINUX_EFI_RANDOM_SEED_TABLE_GUID, "RNG", &efi_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", &mem_reserve},
- {EFI_RT_PROPERTIES_TABLE_GUID, "RTPROP", &rt_prop},
+ {ACPI_20_TABLE_GUID, &efi.acpi20, "ACPI 2.0" },
+ {ACPI_TABLE_GUID, &efi.acpi, "ACPI" },
+ {SMBIOS_TABLE_GUID, &efi.smbios, "SMBIOS" },
+ {SMBIOS3_TABLE_GUID, &efi.smbios3, "SMBIOS 3.0" },
+ {EFI_SYSTEM_RESOURCE_TABLE_GUID, &efi.esrt, "ESRT" },
+ {EFI_MEMORY_ATTRIBUTES_TABLE_GUID, &efi_mem_attr_table, "MEMATTR" },
+ {LINUX_EFI_RANDOM_SEED_TABLE_GUID, &efi_rng_seed, "RNG" },
+ {LINUX_EFI_TPM_EVENT_LOG_GUID, &efi.tpm_log, "TPMEventLog" },
+ {LINUX_EFI_TPM_FINAL_LOG_GUID, &efi.tpm_final_log, "TPMFinalLog" },
+ {LINUX_EFI_MEMRESERVE_TABLE_GUID, &mem_reserve, "MEMRESERVE" },
+ {EFI_RT_PROPERTIES_TABLE_GUID, &rt_prop, "RTPROP" },
#ifdef CONFIG_EFI_RCI2_TABLE
- {DELLEMC_EFI_RCI2_TABLE_GUID, NULL, &rci2_table_phys},
+ {DELLEMC_EFI_RCI2_TABLE_GUID, &rci2_table_phys },
#endif
- {NULL_GUID, NULL, NULL},
+ {},
};
static __init int match_config_table(const efi_guid_t *guid,
@@ -529,7 +529,7 @@ static __init int match_config_table(const efi_guid_t *guid,
for (i = 0; efi_guidcmp(table_types[i].guid, NULL_GUID); i++) {
if (!efi_guidcmp(*guid, table_types[i].guid)) {
*(table_types[i].ptr) = table;
- if (table_types[i].name)
+ if (table_types[i].name[0])
pr_cont(" %s=0x%lx ",
table_types[i].name, table);
return 1;
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 251f1f783cdf..9b7c7ec319ac 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -379,8 +379,8 @@ typedef union {
typedef struct {
efi_guid_t guid;
- const char *name;
unsigned long *ptr;
+ const char name[16];
} efi_config_table_type_t;
#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
--
2.17.1
next prev parent reply other threads:[~2020-04-24 13:07 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 13:04 [GIT PULL 00/33] EFI updates for v5.8 Ard Biesheuvel
2020-04-24 13:04 ` [PATCH 01/33] efi/libstub: Move arm-stub to a common file Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 02/33] efi/libstub: Make initrd file loader configurable Ard Biesheuvel
2020-04-24 13:15 ` Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 03/33] efi/libstub: Unify EFI call wrappers for non-x86 Ard Biesheuvel
2020-05-03 15:09 ` Guenter Roeck
2020-05-03 16:09 ` Arvind Sankar
2020-05-03 16:11 ` Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 04/33] efi/libstub/arm: Make install_memreserve_table static Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 05/33] efi/gop: Remove redundant current_fb_base Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 06/33] efi/gop: Move check for framebuffer before con_out Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 07/33] efi/gop: Get mode information outside the loop Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 08/33] efi/gop: Factor out locating the gop into a function Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 09/33] efi/gop: Slightly re-arrange logic of find_gop Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 10/33] efi/gop: Move variable declarations into loop block Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 11/33] efi/gop: Use helper macros for populating lfb_base Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 12/33] efi/gop: Use helper macros for find_bits Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 13/33] efi/gop: Remove unreachable code from setup_pixel_info Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 14/33] efi/gop: Add prototypes for query_mode and set_mode Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 15/33] efi/gop: Allow specifying mode number on command line Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 16/33] efi/gop: Allow specifying mode by <xres>x<yres> Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 17/33] efi/gop: Allow specifying depth as well as resolution Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 18/33] efi/gop: Allow automatically choosing the best mode Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 19/33] efi/libstub/random: Align allocate size to EFI_ALLOC_ALIGN Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 20/33] efi/libstub/random: Increase random alloc granularity Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 21/33] efi/libstub/arm64: Replace 'preferred' offset with alignment check Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 22/33] efi/libstub/arm64: Simplify randomized loading of kernel image Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 23/33] efi/libstub: Add API function to allocate aligned memory Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 24/33] efi/libstub/arm64: Switch to ordinary page allocator for kernel image Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 25/33] efi/libstub: Move efi_relocate_kernel() into separate source file Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 26/33] efi/arm: Remove __efistub_global annotation Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 27/33] efi/x86: Remove __efistub_global and add relocation check Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 28/33] efi: Kill __efistub_global Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 29/33] efi/libstub: Drop __pure getter for efi_system_table Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 30/33] efi/libstub: Drop __pure getters for EFI stub options Ard Biesheuvel
2020-04-24 13:05 ` [PATCH 31/33] efi/libstub/x86: Avoid getter function for efi_is64 Ard Biesheuvel
2020-04-24 13:05 ` Ard Biesheuvel [this message]
2020-04-24 13:05 ` [PATCH 33/33] efi: Move arch_tables check to caller Ard Biesheuvel
2020-04-25 8:27 ` [GIT PULL 00/33] EFI updates for v5.8 Ingo Molnar
2020-04-25 9:57 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200424130531.30518-33-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=atish.patra@wdc.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=nivedita@alum.mit.edu \
--cc=palmerdabbelt@google.com \
--cc=tglx@linutronix.de \
--cc=zou_wei@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).