aboutsummaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-12-29 19:38:12 +0000
committerMichael Brown <mcb30@ipxe.org>2023-12-29 19:38:47 +0000
commitfa62213231a882eb6bbcefa7ad1106bdb9aaeae2 (patch)
treed21bf32e896b29ee636268c8d8d46562eab7533d /src/arch
parent119c415ee47aaef2717104fea493377aa9a65874 (diff)
downloadipxe-fa62213231a882eb6bbcefa7ad1106bdb9aaeae2.tar.gz
[smbios] Support scanning for the 64-bit SMBIOS3 entry point
Support scanning for the 64-bit SMBIOS3 entry point in addition to the 32-bit SMBIOS2 entry point. Prefer use of the 32-bit entry point if present, since this is guaranteed to be within accessible memory. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/interface/pcbios/bios_smbios.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/src/arch/x86/interface/pcbios/bios_smbios.c b/src/arch/x86/interface/pcbios/bios_smbios.c
index a8c0fc325..366679d36 100644
--- a/src/arch/x86/interface/pcbios/bios_smbios.c
+++ b/src/arch/x86/interface/pcbios/bios_smbios.c
@@ -44,11 +44,11 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* @v smbios SMBIOS entry point descriptor structure to fill in
* @ret rc Return status code
*/
-static int bios_find_smbios ( struct smbios *smbios ) {
+static int bios_find_smbios2 ( struct smbios *smbios ) {
struct smbios_entry entry;
int rc;
- /* Scan through BIOS segment to find SMBIOS entry point */
+ /* Scan through BIOS segment to find SMBIOS 32-bit entry point */
if ( ( rc = find_smbios_entry ( real_to_user ( BIOS_SEG, 0 ), 0x10000,
&entry ) ) != 0 )
return rc;
@@ -62,4 +62,55 @@ static int bios_find_smbios ( struct smbios *smbios ) {
return 0;
}
+/**
+ * Find SMBIOS
+ *
+ * @v smbios SMBIOS entry point descriptor structure to fill in
+ * @ret rc Return status code
+ */
+static int bios_find_smbios3 ( struct smbios *smbios ) {
+ struct smbios3_entry entry;
+ int rc;
+
+ /* Scan through BIOS segment to find SMBIOS 64-bit entry point */
+ if ( ( rc = find_smbios3_entry ( real_to_user ( BIOS_SEG, 0 ), 0x10000,
+ &entry ) ) != 0 )
+ return rc;
+
+ /* Check that address is accessible */
+ if ( entry.smbios_address > ~( ( physaddr_t ) 0 ) ) {
+ DBG ( "SMBIOS3 at %08llx is inaccessible\n",
+ ( ( unsigned long long ) entry.smbios_address ) );
+ return -ENOTSUP;
+ }
+
+ /* Fill in entry point descriptor structure */
+ smbios->address = phys_to_user ( entry.smbios_address );
+ smbios->len = entry.smbios_len;
+ smbios->count = 0;
+ smbios->version = SMBIOS_VERSION ( entry.major, entry.minor );
+
+ return 0;
+}
+
+/**
+ * Find SMBIOS
+ *
+ * @v smbios SMBIOS entry point descriptor structure to fill in
+ * @ret rc Return status code
+ */
+static int bios_find_smbios ( struct smbios *smbios ) {
+ int rc;
+
+ /* Use 32-bit table if present */
+ if ( ( rc = bios_find_smbios2 ( smbios ) ) == 0 )
+ return 0;
+
+ /* Otherwise, use 64-bit table if present and accessible */
+ if ( ( rc = bios_find_smbios3 ( smbios ) ) == 0 )
+ return 0;
+
+ return rc;
+}
+
PROVIDE_SMBIOS ( pcbios, find_smbios, bios_find_smbios );