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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 FILE_LICENCE ( GPL2_OR_LATER
);
22 #include <gpxe/smbios.h>
23 #include <gpxe/efi/efi.h>
24 #include <gpxe/efi/Guid/SmBios.h>
28 * gPXE SMBIOS API for EFI
32 /** SMBIOS configuration table */
33 static struct smbios_entry
*smbios_entry
;
34 EFI_USE_TABLE ( SMBIOS_TABLE
, &smbios_entry
, 0 );
39 * @v smbios SMBIOS entry point descriptor structure to fill in
40 * @ret rc Return status code
42 static int efi_find_smbios ( struct smbios
*smbios
) {
44 if ( ! smbios_entry
) {
45 DBG ( "No SMBIOS table provided\n" );
49 if ( smbios_entry
->signature
!= SMBIOS_SIGNATURE
) {
50 DBG ( "Invalid SMBIOS signature\n" );
54 smbios
->address
= phys_to_user ( smbios_entry
->smbios_address
);
55 smbios
->len
= smbios_entry
->smbios_len
;
56 smbios
->count
= smbios_entry
->smbios_count
;
57 DBG ( "Found SMBIOS v%d.%d entry point at %p (%x+%zx)\n",
58 smbios_entry
->major
, smbios_entry
->minor
, smbios_entry
,
59 smbios_entry
->smbios_address
, smbios
->len
);
64 PROVIDE_SMBIOS ( efi
, find_smbios
, efi_find_smbios
);