2 * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 FILE_LICENCE ( GPL2_OR_LATER );
23 #include <ipxe/smbios.h>
24 #include <ipxe/efi/efi.h>
25 #include <ipxe/efi/Guid/SmBios.h>
29 * iPXE SMBIOS API for EFI
33 /** SMBIOS configuration table */
34 static struct smbios_entry *smbios_entry;
35 EFI_USE_TABLE ( SMBIOS_TABLE, &smbios_entry, 0 );
40 * @v smbios SMBIOS entry point descriptor structure to fill in
41 * @ret rc Return status code
43 static int efi_find_smbios ( struct smbios *smbios ) {
45 if ( ! smbios_entry ) {
46 DBG ( "No SMBIOS table provided\n" );
50 if ( smbios_entry->signature != SMBIOS_SIGNATURE ) {
51 DBG ( "Invalid SMBIOS signature\n" );
55 smbios->address = phys_to_user ( smbios_entry->smbios_address );
56 smbios->len = smbios_entry->smbios_len;
57 smbios->count = smbios_entry->smbios_count;
59 SMBIOS_VERSION ( smbios_entry->major, smbios_entry->minor );
60 DBG ( "Found SMBIOS v%d.%d entry point at %p (%x+%zx)\n",
61 smbios_entry->major, smbios_entry->minor, smbios_entry,
62 smbios_entry->smbios_address, smbios->len );
67 PROVIDE_SMBIOS ( efi, find_smbios, efi_find_smbios );