[syslinux:master] sysdump: handle the case of more than one DMI table

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sun Feb 7 12:00:43 PST 2010


Commit-ID:  f4cc3c07ffbdc3e2a429df556beb480a78988cfe
Gitweb:     http://syslinux.zytor.com/commit/f4cc3c07ffbdc3e2a429df556beb480a78988cfe
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 7 Feb 2010 11:56:19 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 7 Feb 2010 11:56:19 -0800

sysdump: handle the case of more than one DMI table

On the offchance a system has more than one valid DMI table, record
them all.  Also record the address of the signature structure and of
the table itself.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 com32/sysdump/dmi.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/com32/sysdump/dmi.c b/com32/sysdump/dmi.c
index 9e57b4b..64f95a9 100644
--- a/com32/sysdump/dmi.c
+++ b/com32/sysdump/dmi.c
@@ -64,8 +64,11 @@ static void dump_smbios(struct backend *be, size_t dptr)
 {
     const struct smbios_header *smb = (void *)dptr;
     struct smbios_header smx = *smb;
+    char filename[32];
 
-    cpio_hdr(be, MODE_FILE, smb->dmi.tbllen + 32, "dmidata");
+    snprintf(filename, sizeof filename, "dmi/%05x.%08x",
+	     dptr, smb->dmi.tbladdr);
+    cpio_hdr(be, MODE_FILE, smb->dmi.tbllen + 32, filename);
 
     /*
      * Adjust the address of the smbios table to be 32, to
@@ -86,8 +89,11 @@ static void dump_old_dmi(struct backend *be, size_t dptr)
 	struct dmi_header dmi;
 	char pad[16];
     } fake;
+    char filename[32];
 
-    cpio_hdr(be, MODE_FILE, dmi->tbllen + 32, "dmidata");
+    snprintf(filename, sizeof filename, "dmi/%05x.%08x",
+	     dptr, dmi->tbladdr);
+    cpio_hdr(be, MODE_FILE, dmi->tbllen + 32, filename);
 
     /*
      * Adjust the address of the smbios table to be 32, to
@@ -106,14 +112,15 @@ void dump_dmi(struct backend *be)
 {
     size_t dptr;
 
+    cpio_mkdir(be, "dmi");
+
     /* Search for _SM_ or _DMI_ structure */
     for (dptr = 0xf0000 ; dptr < 0x100000 ; dptr += 16) {
 	if (is_smbios(dptr)) {
 	    dump_smbios(be, dptr);
-	    break;
+	    dptr += 16;		/* Skip the subsequent DMI header */
 	} else if (is_old_dmi(dptr)) {
 	    dump_old_dmi(be, dptr);
-	    break;
 	}
     }
 }



More information about the Syslinux-commits mailing list