]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/PeiIpmiLibIpmiPpi/PeiIpmiLibIpmiPpi.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Library / PeiIpmiLibIpmiPpi / PeiIpmiLibIpmiPpi.c
CommitLineData
0f2bca76
DB
1/** @file\r
2 Implementation of Ipmi Library in PEI Phase for SMS.\r
3\r
4 Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
0f2bca76
DB
6\r
7**/\r
8\r
9#include <PiPei.h>\r
10#include <Ppi/IpmiPpi.h>\r
11#include <Library/IpmiLib.h>\r
12#include <Library/PeiServicesLib.h>\r
13#include <Library/DebugLib.h>\r
14\r
15\r
16/**\r
17 This service enables submitting commands via Ipmi.\r
18\r
19 @param[in] NetFunction Net function of the command.\r
20 @param[in] Command IPMI Command.\r
21 @param[in] RequestData Command Request Data.\r
22 @param[in] RequestDataSize Size of Command Request Data.\r
23 @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.\r
24 @param[in, out] ResponseDataSize Size of Command Response Data.\r
25\r
26 @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.\r
27 @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.\r
28 @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.\r
29 @retval EFI_DEVICE_ERROR Ipmi Device hardware error.\r
30 @retval EFI_TIMEOUT The command time out.\r
31 @retval EFI_UNSUPPORTED The command was not successfully sent to the device.\r
32 @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error.\r
33**/\r
34EFI_STATUS\r
35EFIAPI\r
36IpmiSubmitCommand (\r
37 IN UINT8 NetFunction,\r
38 IN UINT8 Command,\r
39 IN UINT8 *RequestData,\r
40 IN UINT32 RequestDataSize,\r
41 OUT UINT8 *ResponseData,\r
42 IN OUT UINT32 *ResponseDataSize\r
43 )\r
44{\r
45 EFI_STATUS Status;\r
46 PEI_IPMI_PPI *IpmiPpi;\r
47\r
48 Status = PeiServicesLocatePpi(\r
49 &gPeiIpmiPpiGuid,\r
50 0,\r
51 NULL,\r
52 (VOID **) &IpmiPpi\r
53 );\r
54 if (EFI_ERROR (Status)) {\r
55 //\r
56 // Ipmi Ppi is not installed. So, IPMI device is not present.\r
57 //\r
58 DEBUG ((EFI_D_ERROR, "IpmiSubmitCommand in Pei Phase under SMS Status - %r\n", Status));\r
59 return EFI_NOT_FOUND;\r
60 }\r
61\r
62 Status = IpmiPpi->IpmiSubmitCommand (\r
63 IpmiPpi,\r
64 NetFunction,\r
65 Command,\r
66 RequestData,\r
67 RequestDataSize,\r
68 ResponseData,\r
69 ResponseDataSize\r
70 );\r
71 if (EFI_ERROR (Status)) {\r
72 return Status;\r
73 }\r
74 return EFI_SUCCESS;\r
75}\r