You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

efi_smbios.c 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  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.
  8. *
  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.
  13. *
  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
  17. * 02110-1301, USA.
  18. */
  19. FILE_LICENCE ( GPL2_OR_LATER );
  20. #include <errno.h>
  21. #include <ipxe/smbios.h>
  22. #include <ipxe/efi/efi.h>
  23. #include <ipxe/efi/Guid/SmBios.h>
  24. /** @file
  25. *
  26. * iPXE SMBIOS API for EFI
  27. *
  28. */
  29. /** SMBIOS configuration table */
  30. static struct smbios_entry *smbios_entry;
  31. EFI_USE_TABLE ( SMBIOS_TABLE, &smbios_entry, 0 );
  32. /**
  33. * Find SMBIOS
  34. *
  35. * @v smbios SMBIOS entry point descriptor structure to fill in
  36. * @ret rc Return status code
  37. */
  38. static int efi_find_smbios ( struct smbios *smbios ) {
  39. if ( ! smbios_entry ) {
  40. DBG ( "No SMBIOS table provided\n" );
  41. return -ENODEV;
  42. }
  43. if ( smbios_entry->signature != SMBIOS_SIGNATURE ) {
  44. DBG ( "Invalid SMBIOS signature\n" );
  45. return -ENODEV;
  46. }
  47. smbios->address = phys_to_user ( smbios_entry->smbios_address );
  48. smbios->len = smbios_entry->smbios_len;
  49. smbios->count = smbios_entry->smbios_count;
  50. smbios->version =
  51. SMBIOS_VERSION ( smbios_entry->major, smbios_entry->minor );
  52. DBG ( "Found SMBIOS v%d.%d entry point at %p (%x+%zx)\n",
  53. smbios_entry->major, smbios_entry->minor, smbios_entry,
  54. smbios_entry->smbios_address, smbios->len );
  55. return 0;
  56. }
  57. PROVIDE_SMBIOS ( efi, find_smbios, efi_find_smbios );