MiscResetCapabilitiesFunction.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*++
  2. Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. Module Name:
  5. MiscResetCapabilitiesFunction.c
  6. Abstract:
  7. ResetCapabilities.
  8. SMBIOS type 23.
  9. --*/
  10. #include "CommonHeader.h"
  11. #include "MiscSubclassDriver.h"
  12. /**
  13. This function makes boot time changes to the contents of the
  14. MiscOemString (Type 11).
  15. @param RecordData Pointer to copy of RecordData from the Data Table.
  16. @retval EFI_SUCCESS All parameters were valid.
  17. @retval EFI_UNSUPPORTED Unexpected RecordType value.
  18. @retval EFI_INVALID_PARAMETER Invalid parameter was found.
  19. **/
  20. MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
  21. {
  22. EFI_STATUS Status;
  23. EFI_SMBIOS_HANDLE SmbiosHandle;
  24. SMBIOS_TABLE_TYPE23 *SmbiosRecord;
  25. EFI_MISC_RESET_CAPABILITIES *ForType23InputData;
  26. ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
  27. //
  28. // First check for invalid parameters.
  29. //
  30. if (RecordData == NULL) {
  31. return EFI_INVALID_PARAMETER;
  32. }
  33. //
  34. // Two zeros following the last string.
  35. //
  36. SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
  37. ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
  38. SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
  39. SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
  40. //
  41. // Make handle chosen by smbios protocol.add automatically.
  42. //
  43. SmbiosRecord->Hdr.Handle = 0;
  44. SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities);
  45. SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount;
  46. SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit;
  47. SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
  48. SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout;
  49. //
  50. // Now we have got the full smbios record, call smbios protocol to add this record.
  51. //
  52. SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
  53. Status = Smbios-> Add(
  54. Smbios,
  55. NULL,
  56. &SmbiosHandle,
  57. (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
  58. );
  59. FreePool(SmbiosRecord);
  60. return Status;
  61. }