summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorMichael Brown2013-03-20 01:12:30 +0100
committerMichael Brown2013-03-20 01:12:30 +0100
commit4f742bcd95373425fde52b0d3b354bb020446542 (patch)
treea04bc2e8d2874ca1d4b7b2ac236f6bfb0ed4f47e /src/interface
parent[int13] Split out ISO9660 and El Torito definitions to separate header files (diff)
downloadipxe-4f742bcd95373425fde52b0d3b354bb020446542.tar.gz
ipxe-4f742bcd95373425fde52b0d3b354bb020446542.tar.xz
ipxe-4f742bcd95373425fde52b0d3b354bb020446542.zip
[smbios] Provide SMBIOS version number via smbios_version()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_smbios.c2
-rw-r--r--src/interface/smbios/smbios.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/src/interface/efi/efi_smbios.c b/src/interface/efi/efi_smbios.c
index 506b04e77..304f95a56 100644
--- a/src/interface/efi/efi_smbios.c
+++ b/src/interface/efi/efi_smbios.c
@@ -55,6 +55,8 @@ static int efi_find_smbios ( struct smbios *smbios ) {
smbios->address = phys_to_user ( smbios_entry->smbios_address );
smbios->len = smbios_entry->smbios_len;
smbios->count = smbios_entry->smbios_count;
+ smbios->version =
+ SMBIOS_VERSION ( smbios_entry->major, smbios_entry->minor );
DBG ( "Found SMBIOS v%d.%d entry point at %p (%x+%zx)\n",
smbios_entry->major, smbios_entry->minor, smbios_entry,
smbios_entry->smbios_address, smbios->len );
diff --git a/src/interface/smbios/smbios.c b/src/interface/smbios/smbios.c
index 8ed24dd66..2adaa53d9 100644
--- a/src/interface/smbios/smbios.c
+++ b/src/interface/smbios/smbios.c
@@ -179,3 +179,20 @@ int read_smbios_string ( struct smbios_structure *structure,
DBG ( "SMBIOS string index %d not found\n", index );
return -ENOENT;
}
+
+/**
+ * Get SMBIOS version
+ *
+ * @ret version Version, or negative error
+ */
+int smbios_version ( void ) {
+ int rc;
+
+ /* Find SMBIOS */
+ if ( ( smbios.address == UNULL ) &&
+ ( ( rc = find_smbios ( &smbios ) ) != 0 ) )
+ return rc;
+ assert ( smbios.address != UNULL );
+
+ return smbios.version;
+}