diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2014-01-23 18:54:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 19:36:57 -0500 |
commit | cf0744021c5d5de54d2c66e2020c6de2fe800264 (patch) | |
tree | 0d2032c3d04aabe53ac3d9a2963c41d8c0b331c1 /drivers/firmware | |
parent | 3e2a4c183ace8708c69f589505fb82bb63010ade (diff) |
firmware/dmi_scan: generalize for use by other archs
This patch makes a couple of changes to the SMBIOS/DMI scanning
code so it can be used on other archs (such as ARM and arm64):
(a) wrap the calls to ioremap()/iounmap(), this allows the use of a
flavor of ioremap() more suitable for random unaligned access;
(b) allow the non-EFI fallback probe into hardcoded physical address
0xF0000 to be disabled.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/Kconfig | 3 | ||||
-rw-r--r-- | drivers/firmware/dmi_scan.c | 20 |
2 files changed, 13 insertions, 10 deletions
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 074787281c94..5a29fac951ec 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig | |||
@@ -108,6 +108,9 @@ config DMI_SYSFS | |||
108 | under /sys/firmware/dmi when this option is enabled and | 108 | under /sys/firmware/dmi when this option is enabled and |
109 | loaded. | 109 | loaded. |
110 | 110 | ||
111 | config DMI_SCAN_MACHINE_NON_EFI_FALLBACK | ||
112 | bool | ||
113 | |||
111 | config ISCSI_IBFT_FIND | 114 | config ISCSI_IBFT_FIND |
112 | bool "iSCSI Boot Firmware Table Attributes" | 115 | bool "iSCSI Boot Firmware Table Attributes" |
113 | depends on X86 | 116 | depends on X86 |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index c7e81ff8f3ef..17afc51f3054 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -116,7 +116,7 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, | |||
116 | { | 116 | { |
117 | u8 *buf; | 117 | u8 *buf; |
118 | 118 | ||
119 | buf = dmi_ioremap(dmi_base, dmi_len); | 119 | buf = dmi_early_remap(dmi_base, dmi_len); |
120 | if (buf == NULL) | 120 | if (buf == NULL) |
121 | return -1; | 121 | return -1; |
122 | 122 | ||
@@ -124,7 +124,7 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, | |||
124 | 124 | ||
125 | add_device_randomness(buf, dmi_len); | 125 | add_device_randomness(buf, dmi_len); |
126 | 126 | ||
127 | dmi_iounmap(buf, dmi_len); | 127 | dmi_early_unmap(buf, dmi_len); |
128 | return 0; | 128 | return 0; |
129 | } | 129 | } |
130 | 130 | ||
@@ -527,18 +527,18 @@ void __init dmi_scan_machine(void) | |||
527 | * needed during early boot. This also means we can | 527 | * needed during early boot. This also means we can |
528 | * iounmap the space when we're done with it. | 528 | * iounmap the space when we're done with it. |
529 | */ | 529 | */ |
530 | p = dmi_ioremap(efi.smbios, 32); | 530 | p = dmi_early_remap(efi.smbios, 32); |
531 | if (p == NULL) | 531 | if (p == NULL) |
532 | goto error; | 532 | goto error; |
533 | memcpy_fromio(buf, p, 32); | 533 | memcpy_fromio(buf, p, 32); |
534 | dmi_iounmap(p, 32); | 534 | dmi_early_unmap(p, 32); |
535 | 535 | ||
536 | if (!dmi_present(buf)) { | 536 | if (!dmi_present(buf)) { |
537 | dmi_available = 1; | 537 | dmi_available = 1; |
538 | goto out; | 538 | goto out; |
539 | } | 539 | } |
540 | } else { | 540 | } else if (IS_ENABLED(CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK)) { |
541 | p = dmi_ioremap(0xF0000, 0x10000); | 541 | p = dmi_early_remap(0xF0000, 0x10000); |
542 | if (p == NULL) | 542 | if (p == NULL) |
543 | goto error; | 543 | goto error; |
544 | 544 | ||
@@ -554,12 +554,12 @@ void __init dmi_scan_machine(void) | |||
554 | memcpy_fromio(buf + 16, q, 16); | 554 | memcpy_fromio(buf + 16, q, 16); |
555 | if (!dmi_present(buf)) { | 555 | if (!dmi_present(buf)) { |
556 | dmi_available = 1; | 556 | dmi_available = 1; |
557 | dmi_iounmap(p, 0x10000); | 557 | dmi_early_unmap(p, 0x10000); |
558 | goto out; | 558 | goto out; |
559 | } | 559 | } |
560 | memcpy(buf, buf + 16, 16); | 560 | memcpy(buf, buf + 16, 16); |
561 | } | 561 | } |
562 | dmi_iounmap(p, 0x10000); | 562 | dmi_early_unmap(p, 0x10000); |
563 | } | 563 | } |
564 | error: | 564 | error: |
565 | pr_info("DMI not present or invalid.\n"); | 565 | pr_info("DMI not present or invalid.\n"); |
@@ -831,13 +831,13 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *), | |||
831 | if (!dmi_available) | 831 | if (!dmi_available) |
832 | return -1; | 832 | return -1; |
833 | 833 | ||
834 | buf = ioremap(dmi_base, dmi_len); | 834 | buf = dmi_remap(dmi_base, dmi_len); |
835 | if (buf == NULL) | 835 | if (buf == NULL) |
836 | return -1; | 836 | return -1; |
837 | 837 | ||
838 | dmi_table(buf, dmi_len, dmi_num, decode, private_data); | 838 | dmi_table(buf, dmi_len, dmi_num, decode, private_data); |
839 | 839 | ||
840 | iounmap(buf); | 840 | dmi_unmap(buf); |
841 | return 0; | 841 | return 0; |
842 | } | 842 | } |
843 | EXPORT_SYMBOL_GPL(dmi_walk); | 843 | EXPORT_SYMBOL_GPL(dmi_walk); |