Bhyve.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2020, Rebecca Cran <rebecca@bsdio.com>
  3. * Copyright (c) 2014, Pluribus Networks, Inc.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause-Patent
  6. */
  7. #include "SmbiosPlatformDxe.h"
  8. #define BHYVE_SMBIOS_PHYSICAL_ADDRESS 0x000F0000
  9. #define BHYVE_SMBIOS_PHYSICAL_END 0x000FFFFF
  10. /**
  11. Locates the bhyve SMBIOS data if it exists
  12. @return SMBIOS_TABLE_ENTRY_POINT Address of bhyve SMBIOS data
  13. **/
  14. SMBIOS_TABLE_ENTRY_POINT *
  15. GetBhyveSmbiosTables (
  16. VOID
  17. )
  18. {
  19. UINT8 *BhyveSmbiosPtr;
  20. SMBIOS_TABLE_ENTRY_POINT *BhyveSmbiosEntryPointStructure;
  21. for (BhyveSmbiosPtr = (UINT8 *)(UINTN)BHYVE_SMBIOS_PHYSICAL_ADDRESS;
  22. BhyveSmbiosPtr < (UINT8 *)(UINTN)BHYVE_SMBIOS_PHYSICAL_END;
  23. BhyveSmbiosPtr += 0x10)
  24. {
  25. BhyveSmbiosEntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)BhyveSmbiosPtr;
  26. if (!AsciiStrnCmp ((CHAR8 *)BhyveSmbiosEntryPointStructure->AnchorString, "_SM_", 4) &&
  27. !AsciiStrnCmp ((CHAR8 *)BhyveSmbiosEntryPointStructure->IntermediateAnchorString, "_DMI_", 5) &&
  28. IsEntryPointStructureValid (BhyveSmbiosEntryPointStructure))
  29. {
  30. return BhyveSmbiosEntryPointStructure;
  31. }
  32. }
  33. return NULL;
  34. }