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