diff options
| author | Tejun Heo <tj@kernel.org> | 2013-04-30 18:27:14 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:04:02 -0400 |
| commit | c90fe6bc0343f7c26b30c9f503b1d061636ac8ee (patch) | |
| tree | 185d629958e4c256e8bd16be2f1a8654a4fa6697 /drivers/firmware | |
| parent | 196779b9b4ce1922afabdc20d0270720603bd46c (diff) | |
dmi: morph dmi_dump_ids() into dmi_format_ids() which formats into a buffer
We're goning to use DMI identification for other purposes too. Morph
dmi_dump_ids() which is used to print DMI identification as a debug
message during boot into dmi_format_ids() which formats the same
information sans the leading "DMI:" tag into a string buffer.
dmi_present() is updated to format the information into dmi_ids_string[]
using the new function and print it with "DMI:" prefix.
dmi_ids_string[] will be used for another purpose by a future patch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
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/dmi_scan.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 4cd392dbf115..862b1d27a85b 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
| @@ -22,6 +22,9 @@ static u16 __initdata dmi_ver; | |||
| 22 | */ | 22 | */ |
| 23 | static int dmi_initialized; | 23 | static int dmi_initialized; |
| 24 | 24 | ||
| 25 | /* DMI system identification string used during boot */ | ||
| 26 | static char dmi_ids_string[128] __initdata; | ||
| 27 | |||
| 25 | static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s) | 28 | static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s) |
| 26 | { | 29 | { |
| 27 | const u8 *bp = ((u8 *) dm) + dm->length; | 30 | const u8 *bp = ((u8 *) dm) + dm->length; |
| @@ -376,38 +379,44 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy) | |||
| 376 | } | 379 | } |
| 377 | } | 380 | } |
| 378 | 381 | ||
| 379 | static void __init print_filtered(const char *info) | 382 | static int __init print_filtered(char *buf, size_t len, const char *info) |
| 380 | { | 383 | { |
| 384 | int c = 0; | ||
| 381 | const char *p; | 385 | const char *p; |
| 382 | 386 | ||
| 383 | if (!info) | 387 | if (!info) |
| 384 | return; | 388 | return c; |
| 385 | 389 | ||
| 386 | for (p = info; *p; p++) | 390 | for (p = info; *p; p++) |
| 387 | if (isprint(*p)) | 391 | if (isprint(*p)) |
| 388 | printk(KERN_CONT "%c", *p); | 392 | c += scnprintf(buf + c, len - c, "%c", *p); |
| 389 | else | 393 | else |
| 390 | printk(KERN_CONT "\\x%02x", *p & 0xff); | 394 | c += scnprintf(buf + c, len - c, "\\x%02x", *p & 0xff); |
| 395 | return c; | ||
| 391 | } | 396 | } |
| 392 | 397 | ||
| 393 | static void __init dmi_dump_ids(void) | 398 | static void __init dmi_format_ids(char *buf, size_t len) |
| 394 | { | 399 | { |
| 400 | int c = 0; | ||
| 395 | const char *board; /* Board Name is optional */ | 401 | const char *board; /* Board Name is optional */ |
| 396 | 402 | ||
| 397 | printk(KERN_DEBUG "DMI: "); | 403 | c += print_filtered(buf + c, len - c, |
| 398 | print_filtered(dmi_get_system_info(DMI_SYS_VENDOR)); | 404 | dmi_get_system_info(DMI_SYS_VENDOR)); |
| 399 | printk(KERN_CONT " "); | 405 | c += scnprintf(buf + c, len - c, " "); |
| 400 | print_filtered(dmi_get_system_info(DMI_PRODUCT_NAME)); | 406 | c += print_filtered(buf + c, len - c, |
| 407 | dmi_get_system_info(DMI_PRODUCT_NAME)); | ||
| 408 | |||
| 401 | board = dmi_get_system_info(DMI_BOARD_NAME); | 409 | board = dmi_get_system_info(DMI_BOARD_NAME); |
| 402 | if (board) { | 410 | if (board) { |
| 403 | printk(KERN_CONT "/"); | 411 | c += scnprintf(buf + c, len - c, "/"); |
| 404 | print_filtered(board); | 412 | c += print_filtered(buf + c, len - c, board); |
| 405 | } | 413 | } |
| 406 | printk(KERN_CONT ", BIOS "); | 414 | c += scnprintf(buf + c, len - c, ", BIOS "); |
| 407 | print_filtered(dmi_get_system_info(DMI_BIOS_VERSION)); | 415 | c += print_filtered(buf + c, len - c, |
| 408 | printk(KERN_CONT " "); | 416 | dmi_get_system_info(DMI_BIOS_VERSION)); |
| 409 | print_filtered(dmi_get_system_info(DMI_BIOS_DATE)); | 417 | c += scnprintf(buf + c, len - c, " "); |
| 410 | printk(KERN_CONT "\n"); | 418 | c += print_filtered(buf + c, len - c, |
| 419 | dmi_get_system_info(DMI_BIOS_DATE)); | ||
| 411 | } | 420 | } |
| 412 | 421 | ||
| 413 | static int __init dmi_present(const char __iomem *p) | 422 | static int __init dmi_present(const char __iomem *p) |
| @@ -431,7 +440,8 @@ static int __init dmi_present(const char __iomem *p) | |||
| 431 | pr_info("Legacy DMI %d.%d present.\n", | 440 | pr_info("Legacy DMI %d.%d present.\n", |
| 432 | dmi_ver >> 8, dmi_ver & 0xFF); | 441 | dmi_ver >> 8, dmi_ver & 0xFF); |
| 433 | } | 442 | } |
| 434 | dmi_dump_ids(); | 443 | dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); |
| 444 | printk(KERN_DEBUG "DMI: %s\n", dmi_ids_string); | ||
| 435 | return 0; | 445 | return 0; |
| 436 | } | 446 | } |
| 437 | } | 447 | } |
