diff options
Diffstat (limited to 'drivers/firmware/dmi_scan.c')
-rw-r--r-- | drivers/firmware/dmi_scan.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index eb760a218da4..232fa8fce26a 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -419,6 +419,13 @@ static void __init dmi_format_ids(char *buf, size_t len) | |||
419 | dmi_get_system_info(DMI_BIOS_DATE)); | 419 | dmi_get_system_info(DMI_BIOS_DATE)); |
420 | } | 420 | } |
421 | 421 | ||
422 | /* | ||
423 | * Check for DMI/SMBIOS headers in the system firmware image. Any | ||
424 | * SMBIOS header must start 16 bytes before the DMI header, so take a | ||
425 | * 32 byte buffer and check for DMI at offset 16 and SMBIOS at offset | ||
426 | * 0. If the DMI header is present, set dmi_ver accordingly (SMBIOS | ||
427 | * takes precedence) and return 0. Otherwise return 1. | ||
428 | */ | ||
422 | static int __init dmi_present(const u8 *buf) | 429 | static int __init dmi_present(const u8 *buf) |
423 | { | 430 | { |
424 | int smbios_ver; | 431 | int smbios_ver; |
@@ -506,6 +513,13 @@ void __init dmi_scan_machine(void) | |||
506 | if (p == NULL) | 513 | if (p == NULL) |
507 | goto error; | 514 | goto error; |
508 | 515 | ||
516 | /* | ||
517 | * Iterate over all possible DMI header addresses q. | ||
518 | * Maintain the 32 bytes around q in buf. On the | ||
519 | * first iteration, substitute zero for the | ||
520 | * out-of-range bytes so there is no chance of falsely | ||
521 | * detecting an SMBIOS header. | ||
522 | */ | ||
509 | memset(buf, 0, 16); | 523 | memset(buf, 0, 16); |
510 | for (q = p; q < p + 0x10000; q += 16) { | 524 | for (q = p; q < p + 0x10000; q += 16) { |
511 | memcpy_fromio(buf + 16, q, 16); | 525 | memcpy_fromio(buf + 16, q, 16); |