summaryrefslogtreecommitdiff
path: root/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.h
blob: 00ceec0bf52b5d5d2ee8bd750ac98825fb4febec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/** @file
  Header file for functions to get Intel ME information

@copyright
  Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
  This software and associated documentation (if any) is furnished
  under a license and may only be used or copied in accordance
  with the terms of the license. Except as permitted by such
  license, no part of this software or documentation may be
  reproduced, stored in a retrieval system, or transmitted in any
  form or by any means without the express written consent of
  Intel Corporation.

  This file contains an 'Intel Peripheral Driver' and uniquely
  identified as "Intel Reference Module" and is
  licensed for Intel CPUs and chipsets under the terms of your
  license agreement with Intel or your vendor.  This file may
  be modified by the user, subject to additional terms of the
  license agreement
**/
#ifndef _ME_LIB_H_
#define _ME_LIB_H_

#include "MePolicyLib.h"
#include "HeciMsgLib.h"
#include "MeChipset.h"
#include "HeciRegs.h"
#include EFI_PROTOCOL_CONSUMER (MeBiosPayloadData)

#define MBP_PRESENT_MASK  0x00000020
#define FIVE_MS_TIMEOUT   5000

extern EFI_GUID gExitPmAuthProtocolGuid;

#pragma pack(push, 1)

typedef union _MBP_HEADER {
  UINT32  Data;
  struct {
    UINT32  MbpSize : 8;    ///< Byte 0 - MBP Size in DW including Header
    UINT32  NumEntries : 8; ///< Byte 1 - Number of Entries (Data Items) in MBP
    UINT32  Rsvd : 16;      ///< Byte 3:2 - Reserved
  } Fields;
} MBP_HEADER;

typedef union _MBP_ITEM_HEADER {
  UINT32  Data;
  struct {
    UINT32  AppId : 8;      ///< Byte 0 - Application ID
    UINT32  ItemId : 8;     ///< Byte 1 - Item ID
    UINT32  Length : 8;     ///< Byte 2 - Length in DW
    UINT32  Rsvd : 8;       ///< Byte 3 - Reserved
  } Fields;
} MBP_ITEM_HEADER;

#pragma pack(pop)

/**
  Check if Me is enabled

  @param[in] None.

  @retval None
**/
EFI_STATUS
MeLibInit (
  VOID
  )
;

/**
  Send Get Firmware SKU Request to ME

  @param[in] FwCapsSku            Return Data from Get Firmware Capabilities MKHI Request

  @retval EFI_SUCCESS             The function completed successfully.
**/
EFI_STATUS
HeciGetFwCapsSku (
  MEFWCAPS_SKU                    *FwCapsSku
  )
;

/**
  This message is sent by the BIOS or Intel(R) MEBX prior to the End of Post (EOP) on the boot
  where host wants to get Lynx Point platform type. One of usages is to utilize this command to
  determine if the platform runs in 1.5M or 5M size firmware.

  @param[out] RuleData            PlatformBrand,
                                  IntelMeFwImageType,
                                  SuperSku,
                                  PlatformTargetMarketType,
                                  PlatformTargetUsageType

  @retval EFI_SUCCESS             The function completed successfully.
**/
EFI_STATUS
HeciGetPlatformType (
  OUT PLATFORM_TYPE_RULE_DATA     *RuleData
  )
;

/**
  Routine checks whether MBP buffer has been cleared form HECI buffer or not.
  BIOS must check this before executing any 3rd paty code or Oprom

  @param[in] Event                The event that triggered this notification function
  @param[in] Context              Pointer to the notification functions context
**/
VOID
EFIAPI
MbpCleared (
  IN EFI_EVENT                    Event,
  IN VOID                         *Context
  )
;

/**
  This routine returns ME-BIOS Payload information from HECI buffer

  @param[out] MbpPtr              ME-BIOS Payload information.

  @retval EFI_SUCCESS             The function completed successfully.
  @retval EFI_DEVICE_ERROR        Failed to consume MBP
**/
EFI_STATUS
PrepareMeBiosPayload (
  OUT ME_BIOS_PAYLOAD             *MbpPtr
  )
;

/**
  Send Get Firmware Version Request to ME

  @param[in] MsgGenGetFwVersionAckData  Return themessage of FW version

  @retval EFI_SUCCESS             The function completed successfully.
**/
EFI_STATUS
HeciGetFwVersion (
  IN OUT GEN_GET_FW_VER_ACK_DATA  *MsgGenGetFwVersionAckData
  )
;

/**
  Host client gets Firmware update info from ME client for SMBIOS Table 131

  @param[in][out] MECapability    Structure of FirmwareUpdateInfo

  @exception EFI_UNSUPPORTED      No MBP Data Protocol available
**/
EFI_STATUS
HeciGetMeFwInfo (
  IN OUT ME_CAP                   *MECapability
  )
;

/**
  This is a dummy event to be hooked to provide ME or Platform
  code before EOP Heci message is sent

  @param[in] Event                The event that triggered this notification function
  @param[in] Context              Pointer to the notification functions context
**/
VOID
EFIAPI
MeEmptyEvent (
  IN  EFI_EVENT                   Event,
  IN  VOID                        *Context
  )
;

/**
  Get AT State Information From ME FW

  @param[in] AtState              Pointer to AT State Information
  @param[in] AtLastTheftTrigger   Pointer to Variable holding the cause of last AT Stolen Stae
  @param[in] AtLockState          Pointer to variable indicating whether AT is locked or not
  @param[in] AtAmPref             Pointer to variable indicating whether ATAM or PBA should be used

  @retval EFI_SUCCESS             The function completed successfully
  @exception EFI_UNSUPPORTED      No MBP Data Protocol available
**/
EFI_STATUS
GetAtStateInfo (
  IN AT_STATE_INFO                *AtStateInfo
  )
;

/**
  Dump DXE_MBP_DATA_PROTOCOL

  @param[in] MbpData              Pointer to DXE_MBP_DATA_PROTOCOL

  @retval None
**/
VOID
DxeMbpDebugDump (
  IN DXE_MBP_DATA_PROTOCOL        *MbpPtr
  )
;

#endif