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