From 923863e826faf98bf5755be50c533b2ea80f4a38 Mon Sep 17 00:00:00 2001 From: Jiewen Yao Date: Sun, 4 Mar 2018 22:08:25 +0800 Subject: Add IPMI support. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- .../IpmiCommandLib/IpmiCommandLibNetFnApp.c | 255 +++++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c (limited to 'Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c') diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c new file mode 100644 index 0000000000..f11b23a439 --- /dev/null +++ b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c @@ -0,0 +1,255 @@ +/** @file + IPMI Command - NetFnApp. + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include + +#include +#include + +EFI_STATUS +EFIAPI +IpmiGetDeviceId ( + OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*DeviceId); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_DEVICE_ID, + NULL, + 0, + (VOID *)DeviceId, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiGetSelfTestResult ( + OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*SelfTestResult); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_SELFTEST_RESULTS, + NULL, + 0, + (VOID *)SelfTestResult, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiResetWatchdogTimer ( + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*CompletionCode); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_RESET_WATCHDOG_TIMER, + NULL, + 0, + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiSetWatchdogTimer ( + IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*CompletionCode); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_SET_WATCHDOG_TIMER, + (VOID *)SetWatchdogTimer, + sizeof(*SetWatchdogTimer), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiGetWatchdogTimer ( + OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*GetWatchdogTimer); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_WATCHDOG_TIMER, + NULL, + 0, + (VOID *)GetWatchdogTimer, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiSetBmcGlobalEnables ( + IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*CompletionCode); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_SET_BMC_GLOBAL_ENABLES, + (VOID *)SetBmcGlobalEnables, + sizeof(*SetBmcGlobalEnables), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiGetBmcGlobalEnables ( + OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*GetBmcGlobalEnables); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_BMC_GLOBAL_ENABLES, + NULL, + 0, + (VOID *)GetBmcGlobalEnables, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiClearMessageFlags ( + IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*CompletionCode); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_CLEAR_MESSAGE_FLAGS, + (VOID *)ClearMessageFlagsRequest, + sizeof(*ClearMessageFlagsRequest), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiGetMessageFlags ( + OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize = sizeof(*GetMessageFlagsResponse); + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_MESSAGE_FLAGS, + NULL, + 0, + (VOID *)GetMessageFlagsResponse, + &DataSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiGetMessage ( + OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, + IN OUT UINT32 *GetMessageResponseSize + ) +{ + EFI_STATUS Status; + + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_MESSAGE, + NULL, + 0, + (VOID *)GetMessageResponse, + GetMessageResponseSize + ); + return Status; +} + +EFI_STATUS +EFIAPI +IpmiSendMessage ( + IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, + IN UINT32 SendMessageRequestSize, + OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, + IN OUT UINT32 *SendMessageResponseSize + ) +{ + EFI_STATUS Status; + + Status = IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_SEND_MESSAGE, + (VOID *)SendMessageRequest, + SendMessageRequestSize, + (VOID *)SendMessageResponse, + SendMessageResponseSize + ); + return Status; +} -- cgit v1.2.3