3 Copyright (c) 2017-2018, Arm Limited. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
7 System Control and Management Interface V1.0
8 http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
9 DEN0056A_System_Control_and_Management_Interface.pdf
12 #ifndef ARM_MTL_LIB_H_
13 #define ARM_MTL_LIB_H_
15 #include <Uefi/UefiBaseType.h>
17 // Ideally we don't need packed struct. However we can't rely on compilers.
28 // NOTE: Since EDK2 does not allow flexible array member [] we declare
29 // here array of 1 element length. However below is used as a variable
31 UINT32 Payload
[1]; // size less object gives offset to payload.
36 // Channel Type, Low-priority, and High-priority
38 MTL_CHANNEL_TYPE_LOW
= 0,
39 MTL_CHANNEL_TYPE_HIGH
= 1
43 UINT64 PhysicalAddress
;
49 MTL_CHANNEL_TYPE ChannelType
;
50 MTL_MAILBOX
* CONST MailBox
;
51 MTL_DOORBELL DoorBell
;
54 /** Wait until channel is free.
56 @param[in] Channel Pointer to a channel.
57 @param[in] TimeOutInMicroSeconds Time out in micro seconds.
59 @retval EFI_SUCCESS Channel is free.
60 @retval EFI_TIMEOUT Time out error.
63 MtlWaitUntilChannelFree (
64 IN MTL_CHANNEL
*Channel
,
65 IN UINTN TimeOutInMicroSeconds
68 /** Return the address of the message payload.
70 @param[in] Channel Pointer to a channel.
72 @retval UINT32* Pointer to the payload.
75 MtlGetChannelPayload (
76 IN MTL_CHANNEL
*Channel
79 /** Return pointer to a channel for the requested channel type.
81 @param[in] ChannelType ChannelType, Low or High priority channel.
82 MTL_CHANNEL_TYPE_LOW or
85 @param[out] Channel Holds pointer to the channel.
87 @retval EFI_SUCCESS Pointer to channel is returned.
88 @retval EFI_UNSUPPORTED Requested channel type not supported.
92 IN MTL_CHANNEL_TYPE ChannelType
,
93 OUT MTL_CHANNEL
**Channel
96 /** Mark the channel busy and ring the doorbell.
98 @param[in] Channel Pointer to a channel.
99 @param[in] MessageHeader Message header.
101 @param[out] PayloadLength Message length.
103 @retval EFI_SUCCESS Message sent successfully.
104 @retval EFI_DEVICE_ERROR Channel is busy.
108 IN MTL_CHANNEL
*Channel
,
109 IN UINT32 MessageHeader
,
110 OUT UINT32 PayloadLength
113 /** Wait for a response on a channel.
115 If channel is free after sending message, it implies SCP responded
116 with a response on the channel.
118 @param[in] Channel Pointer to a channel.
120 @retval EFI_SUCCESS Message received successfully.
121 @retval EFI_TIMEOUT Time out error.
125 IN MTL_CHANNEL
*Channel
,
126 OUT UINT32
*MessageHeader
,
127 OUT UINT32
*PayloadLength
130 #endif /* ARM_MTL_LIB_H_ */