[contrib] Allow Network Protocol header to display in rom-o-matic
[gpxe.git] / src / interface / efi / efi_smbios.c
blobf2ecd7f18da2921d622ae700f62d191cd1de2b84
1 /*
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 );
21 #include <errno.h>
22 #include <gpxe/smbios.h>
23 #include <gpxe/efi/efi.h>
24 #include <gpxe/efi/Guid/SmBios.h>
26 /** @file
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 );
36 /**
37 * Find SMBIOS
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" );
46 return -ENODEV;
49 if ( smbios_entry->signature != SMBIOS_SIGNATURE ) {
50 DBG ( "Invalid SMBIOS signature\n" );
51 return -ENODEV;
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 );
61 return 0;
64 PROVIDE_SMBIOS ( efi, find_smbios, efi_find_smbios );