Commit 0fca0812 authored by Robert Richter's avatar Robert Richter Committed by Ingo Molnar

efi: Unify DMI setup code over the arm/arm64, ia64 and x86 architectures

All architectures (arm/arm64, ia64 and x86) do the same here, so unify
the code.

Note: We do not need to call dump_stack_set_arch_desc() in case of
!dmi_available. Both strings, dmi_ids_string and dump_stack_arch_
desc_str are initialized zero and thus nothing would change.
Signed-off-by: default avatarRobert Richter <rrichter@marvell.com>
Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: default avatarJean Delvare <jdelvare@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20190328193429.21373-5-ard.biesheuvel@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 5e83cfe9
...@@ -1058,9 +1058,7 @@ check_bugs (void) ...@@ -1058,9 +1058,7 @@ check_bugs (void)
static int __init run_dmi_scan(void) static int __init run_dmi_scan(void)
{ {
dmi_scan_machine(); dmi_setup();
dmi_memdev_walk();
dmi_set_dump_stack_arch_desc();
return 0; return 0;
} }
core_initcall(run_dmi_scan); core_initcall(run_dmi_scan);
...@@ -1005,13 +1005,11 @@ void __init setup_arch(char **cmdline_p) ...@@ -1005,13 +1005,11 @@ void __init setup_arch(char **cmdline_p)
if (efi_enabled(EFI_BOOT)) if (efi_enabled(EFI_BOOT))
efi_init(); efi_init();
dmi_scan_machine(); dmi_setup();
dmi_memdev_walk();
dmi_set_dump_stack_arch_desc();
/* /*
* VMware detection requires dmi to be available, so this * VMware detection requires dmi to be available, so this
* needs to be done after dmi_scan_machine(), for the boot CPU. * needs to be done after dmi_setup(), for the boot CPU.
*/ */
init_hypervisor_platform(); init_hypervisor_platform();
......
...@@ -416,11 +416,8 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) ...@@ -416,11 +416,8 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v)
nr++; nr++;
} }
void __init dmi_memdev_walk(void) static void __init dmi_memdev_walk(void)
{ {
if (!dmi_available)
return;
if (dmi_walk_early(count_mem_devices) == 0 && dmi_memdev_nr) { if (dmi_walk_early(count_mem_devices) == 0 && dmi_memdev_nr) {
dmi_memdev = dmi_alloc(sizeof(*dmi_memdev) * dmi_memdev_nr); dmi_memdev = dmi_alloc(sizeof(*dmi_memdev) * dmi_memdev_nr);
if (dmi_memdev) if (dmi_memdev)
...@@ -614,7 +611,7 @@ static int __init dmi_smbios3_present(const u8 *buf) ...@@ -614,7 +611,7 @@ static int __init dmi_smbios3_present(const u8 *buf)
return 1; return 1;
} }
void __init dmi_scan_machine(void) static void __init dmi_scan_machine(void)
{ {
char __iomem *p, *q; char __iomem *p, *q;
char buf[32]; char buf[32];
...@@ -769,15 +766,20 @@ static int __init dmi_init(void) ...@@ -769,15 +766,20 @@ static int __init dmi_init(void)
subsys_initcall(dmi_init); subsys_initcall(dmi_init);
/** /**
* dmi_set_dump_stack_arch_desc - set arch description for dump_stack() * dmi_setup - scan and setup DMI system information
* *
* Invoke dump_stack_set_arch_desc() with DMI system information so that * Scan the DMI system information. This setups DMI identifiers
* DMI identifiers are printed out on task dumps. Arch boot code should * (dmi_system_id) for printing it out on task dumps and prepares
* call this function after dmi_scan_machine() if it wants to print out DMI * DIMM entry information (dmi_memdev_info) from the SMBIOS table
* identifiers on task dumps. * for using this when reporting memory errors.
*/ */
void __init dmi_set_dump_stack_arch_desc(void) void __init dmi_setup(void)
{ {
dmi_scan_machine();
if (!dmi_available)
return;
dmi_memdev_walk();
dump_stack_set_arch_desc("%s", dmi_ids_string); dump_stack_set_arch_desc("%s", dmi_ids_string);
} }
...@@ -841,7 +843,7 @@ static bool dmi_is_end_of_table(const struct dmi_system_id *dmi) ...@@ -841,7 +843,7 @@ static bool dmi_is_end_of_table(const struct dmi_system_id *dmi)
* returns non zero or we hit the end. Callback function is called for * returns non zero or we hit the end. Callback function is called for
* each successful match. Returns the number of matches. * each successful match. Returns the number of matches.
* *
* dmi_scan_machine must be called before this function is called. * dmi_setup must be called before this function is called.
*/ */
int dmi_check_system(const struct dmi_system_id *list) int dmi_check_system(const struct dmi_system_id *list)
{ {
...@@ -871,7 +873,7 @@ EXPORT_SYMBOL(dmi_check_system); ...@@ -871,7 +873,7 @@ EXPORT_SYMBOL(dmi_check_system);
* Walk the blacklist table until the first match is found. Return the * Walk the blacklist table until the first match is found. Return the
* pointer to the matching entry or NULL if there's no match. * pointer to the matching entry or NULL if there's no match.
* *
* dmi_scan_machine must be called before this function is called. * dmi_setup must be called before this function is called.
*/ */
const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list) const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list)
{ {
......
...@@ -162,14 +162,11 @@ void efi_virtmap_unload(void) ...@@ -162,14 +162,11 @@ void efi_virtmap_unload(void)
static int __init arm_dmi_init(void) static int __init arm_dmi_init(void)
{ {
/* /*
* On arm64/ARM, DMI depends on UEFI, and dmi_scan_machine() needs to * On arm64/ARM, DMI depends on UEFI, and dmi_setup() needs to
* be called early because dmi_id_init(), which is an arch_initcall * be called early because dmi_id_init(), which is an arch_initcall
* itself, depends on dmi_scan_machine() having been called already. * itself, depends on dmi_scan_machine() having been called already.
*/ */
dmi_scan_machine(); dmi_setup();
dmi_memdev_walk();
if (dmi_available)
dmi_set_dump_stack_arch_desc();
return 0; return 0;
} }
core_initcall(arm_dmi_init); core_initcall(arm_dmi_init);
...@@ -102,9 +102,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list); ...@@ -102,9 +102,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
extern const char * dmi_get_system_info(int field); extern const char * dmi_get_system_info(int field);
extern const struct dmi_device * dmi_find_device(int type, const char *name, extern const struct dmi_device * dmi_find_device(int type, const char *name,
const struct dmi_device *from); const struct dmi_device *from);
extern void dmi_scan_machine(void); extern void dmi_setup(void);
extern void dmi_memdev_walk(void);
extern void dmi_set_dump_stack_arch_desc(void);
extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
extern int dmi_get_bios_year(void); extern int dmi_get_bios_year(void);
extern int dmi_name_in_vendors(const char *str); extern int dmi_name_in_vendors(const char *str);
...@@ -122,9 +120,7 @@ static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; ...@@ -122,9 +120,7 @@ static inline int dmi_check_system(const struct dmi_system_id *list) { return 0;
static inline const char * dmi_get_system_info(int field) { return NULL; } static inline const char * dmi_get_system_info(int field) { return NULL; }
static inline const struct dmi_device * dmi_find_device(int type, const char *name, static inline const struct dmi_device * dmi_find_device(int type, const char *name,
const struct dmi_device *from) { return NULL; } const struct dmi_device *from) { return NULL; }
static inline void dmi_scan_machine(void) { return; } static inline void dmi_setup(void) { }
static inline void dmi_memdev_walk(void) { }
static inline void dmi_set_dump_stack_arch_desc(void) { }
static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
{ {
if (yearp) if (yearp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment