3 Copyright (c) 2017-2018, Arm Limited. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 System Control and Management Interface V1.0
14 http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
15 DEN0056A_System_Control_and_Management_Interface.pdf
18 #ifndef ARM_MTL_LIB_H_
19 #define ARM_MTL_LIB_H_
21 #include <Uefi/UefiBaseType.h>
23 // Ideally we don't need packed struct. However we can't rely on compilers.
34 // NOTE: Since EDK2 does not allow flexible array member [] we declare
35 // here array of 1 element length. However below is used as a variable
37 UINT32 Payload
[1]; // size less object gives offset to payload.
42 // Channel Type, Low-priority, and High-priority
44 MTL_CHANNEL_TYPE_LOW
= 0,
45 MTL_CHANNEL_TYPE_HIGH
= 1
49 UINT64 PhysicalAddress
;
55 MTL_CHANNEL_TYPE ChannelType
;
56 MTL_MAILBOX
* CONST MailBox
;
57 MTL_DOORBELL DoorBell
;
60 /** Wait until channel is free.
62 @param[in] Channel Pointer to a channel.
63 @param[in] TimeOutInMicroSeconds Time out in micro seconds.
65 @retval EFI_SUCCESS Channel is free.
66 @retval EFI_TIMEOUT Time out error.
69 MtlWaitUntilChannelFree (
70 IN MTL_CHANNEL
*Channel
,
71 IN UINT64 TimeOutInMicroSeconds
74 /** Return the address of the message payload.
76 @param[in] Channel Pointer to a channel.
78 @retval UINT32* Pointer to the payload.
81 MtlGetChannelPayload (
82 IN MTL_CHANNEL
*Channel
85 /** Return pointer to a channel for the requested channel type.
87 @param[in] ChannelType ChannelType, Low or High priority channel.
88 MTL_CHANNEL_TYPE_LOW or
91 @param[out] Channel Holds pointer to the channel.
93 @retval EFI_SUCCESS Pointer to channel is returned.
94 @retval EFI_UNSUPPORTED Requested channel type not supported.
98 IN MTL_CHANNEL_TYPE ChannelType
,
99 OUT MTL_CHANNEL
**Channel
102 /** Mark the channel busy and ring the doorbell.
104 @param[in] Channel Pointer to a channel.
105 @param[in] MessageHeader Message header.
107 @param[out] PayloadLength Message length.
109 @retval EFI_SUCCESS Message sent successfully.
110 @retval EFI_DEVICE_ERROR Channel is busy.
114 IN MTL_CHANNEL
*Channel
,
115 IN UINT32 MessageHeader
,
116 OUT UINT32 PayloadLength
119 /** Wait for a response on a channel.
121 If channel is free after sending message, it implies SCP responded
122 with a response on the channel.
124 @param[in] Channel Pointer to a channel.
126 @retval EFI_SUCCESS Message received successfully.
127 @retval EFI_TIMEOUT Time out error.
131 IN MTL_CHANNEL
*Channel
,
132 OUT UINT32
*MessageHeader
,
133 OUT UINT32
*PayloadLength
136 #endif /* ARM_MTL_LIB_H_ */