-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ManageabilityPkg: Add TransportLib instance for IPMI Serial
This adds ManageabilityTransportSerialLib instance following the manageability transport framework to support IPMI Serial protocol. Signed-off-by: John Chung <[email protected]>
- Loading branch information
Showing
13 changed files
with
1,245 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
...eabilityPkg/Library/ManageabilityTransportSerialLib/Common/ManageabilityTransportSerial.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/** @file | ||
Manageability transport Serial internal used definitions. | ||
Copyright (c) 2024, ARM Limited. All rights reserved.<BR> | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MANAGEABILITY_TRANSPORT_SERIAL_LIB_H_ | ||
#define MANAGEABILITY_TRANSPORT_SERIAL_LIB_H_ | ||
|
||
#include <IndustryStandard/IpmiNetFnApp.h> | ||
#include <Library/ManageabilityTransportIpmiLib.h> | ||
#include <Library/ManageabilityTransportLib.h> | ||
|
||
#define MANAGEABILITY_TRANSPORT_SERIAL_SIGNATURE SIGNATURE_32 ('M', 'T', 'S', 'E') | ||
|
||
/// | ||
/// Manageability transport Serial internal data structure. | ||
/// | ||
typedef struct { | ||
UINTN Signature; | ||
MANAGEABILITY_TRANSPORT_TOKEN Token; | ||
} MANAGEABILITY_TRANSPORT_SERIAL; | ||
|
||
/// | ||
/// IPMI Serial data structure. | ||
/// | ||
typedef struct { | ||
UINT8 ResponseAddress; | ||
UINT8 NetFn; | ||
UINT8 CheckSum; | ||
UINT8 RequestAddress; | ||
UINT8 RequestSequence; | ||
UINT8 Command; | ||
} IPMI_SERIAL_HEADER; | ||
|
||
#define MANAGEABILITY_TRANSPORT_SERIAL_FROM_LINK(a) CR (a, MANAGEABILITY_TRANSPORT_SERIAL, Token, MANAGEABILITY_TRANSPORT_SERIAL_SIGNATURE) | ||
|
||
/// | ||
/// IPMI Serial Escaped Character Definition | ||
/// | ||
#define BM_START 0xA0 | ||
#define BM_STOP 0xA5 | ||
#define BM_HANDSHAKE 0xA6 | ||
#define BM_ESCAPE 0xAA | ||
|
||
/// | ||
/// IPMI Serial State Machine | ||
/// | ||
#define MSG_IDLE 0 | ||
#define MSG_IN_PROGRESS 1 | ||
|
||
/// | ||
/// IPMI Serial | ||
/// | ||
#define IPMI_MAX_LUN 0x3 | ||
#define IPMI_MAX_NETFUNCTION 0x3F | ||
#define IPMI_SERIAL_CHECKSUM1_COUNT 2 | ||
#define IPMI_SERIAL_CHECKSUM2_COUNT 3 | ||
#define IPMI_SERIAL_MAXIMUM_PACKET_SIZE_IN_BYTES 256 | ||
#define IPMI_SERIAL_MIN_REQ 7 | ||
|
||
/// | ||
/// IPMI Serial Configure | ||
/// | ||
#define IPMI_SERIAL_RS_ADDRESS FixedPcdGet8 (PcdIpmiSerialResponseAddress) | ||
#define IPMI_SERIAL_RQ_ADDRESS FixedPcdGet8 (PcdIpmiSerialRequestAddress) | ||
#define IPMI_SERIAL_RS_LUN_NUMBER FixedPcdGet8 (PcdIpmiSerialResponseLunNumber) | ||
#define IPMI_SERIAL_RQ_LUN_NUMBER FixedPcdGet8 (PcdIpmiSerialRequestLunNumber) | ||
#define IPMI_SERIAL_RETRY_COUNT FixedPcdGet8 (PcdIpmiSerialRetryCount) | ||
#define IPMI_SERIAL_REQUEST_RETRY_INTERVAL FixedPcdGet32 (PcdIpmiSerialRequestRetryInterval) | ||
#define IPMI_SERIAL_RESPONSE_RETRY_INTERVAL FixedPcdGet32 (PcdIpmiSerialResponseRetryInterval) | ||
|
||
/** | ||
This service communicates with BMC using Serial protocol. | ||
@param[in] TransmitHeader Serial packet header. | ||
@param[in] TransmitHeaderSize Serial packet header size in byte. | ||
@param[in] TransmitTrailer Serial packet trailer. | ||
@param[in] TransmitTrailerSize Serial packet trailer size in byte. | ||
@param[in] RequestData Command Request Data. | ||
@param[in] RequestDataSize Size of Command Request Data. | ||
@param[out] ResponseData Command Response Data. The completion | ||
code is the first byte of response | ||
data. | ||
@param[in, out] ResponseDataSize Size of Command Response Data. | ||
@param[out] AdditionalStatus Additional status of this transaction. | ||
@retval EFI_SUCCESS The command byte stream was | ||
successfully submit to the device and a | ||
response was successfully received. | ||
@retval EFI_NOT_FOUND The command was not successfully sent | ||
to the device or a response was not | ||
successfully received from the device. | ||
@retval EFI_NOT_READY Ipmi Device is not ready for Ipmi | ||
command access. | ||
@retval EFI_DEVICE_ERROR Ipmi Device hardware error. | ||
@retval EFI_TIMEOUT The command time out. | ||
@retval EFI_UNSUPPORTED The command was not successfully sent to | ||
the device. | ||
@retval EFI_OUT_OF_RESOURCES The resource allocation is out of | ||
resource or data size error. | ||
**/ | ||
|
||
EFI_STATUS | ||
EFIAPI | ||
SerialTransportSendCommand ( | ||
IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader OPTIONAL, | ||
IN UINT16 TransmitHeaderSize, | ||
IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL, | ||
IN UINT16 TransmitTrailerSize, | ||
IN UINT8 *RequestData OPTIONAL, | ||
IN UINT32 RequestDataSize, | ||
OUT UINT8 *ResponseData OPTIONAL, | ||
IN OUT UINT32 *ResponseDataSize OPTIONAL, | ||
OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *AdditionalStatus | ||
); | ||
|
||
#endif |
Oops, something went wrong.