summaryrefslogtreecommitdiff
path: root/ReferenceCode/ME/At/AtAm/Dxe/AtAm.h
blob: ece69d8cf69f17796136addf7d813ac68f04ec6c (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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/** @file
  Header file for hangling AT and provide interface for creating UI.

@copyright
  Copyright (c) 2012 - 2013 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 _ATAM_H_
#define _ATAM_H_

#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
#include "EdkIIGlueDxe.h"
#include "AtHi.h"
#include "MeLib.h"
#include "AtAmHelper.h"
#include "AtPolicyLib.h"
#include "At.h"
#endif

//
// Used during initialization
//
#include EFI_PROTOCOL_CONSUMER (FirmwareVolume)
#include EFI_PROTOCOL_CONSUMER (HECI)
#include EFI_PROTOCOL_CONSUMER (At)
#include EFI_PROTOCOL_CONSUMER (AtPlatformPolicy)

//
// Driver Produced Protocols
//
#include EFI_PROTOCOL_PRODUCER (AtAm)

#define ATAM_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('A', 'T', 'A', 'M')

#define MAX_HEX_BYTES             20
#define ATAM_ENTER_SUSPEND_STATE  1
#define ATAM_EXIT_SUSPEND_STATE   0

#define PBA_FAILED_COUNT_VARIABLE_GUID \
  { \
    0x7c66ffdc, 0x423c, 0xe5d4, 0x25, 0x1b, 0x55, 0xad, 0xba, 0x95, 0x26, 0x98 \
  }

#pragma pack(1)

typedef struct {
  UINTN             Signature;
  EFI_HANDLE        Handle;
  EFI_ATAM_PROTOCOL AtAmProtocol;
} ATAM_INSTANCE;

#define ATAM_INSTANCE_FROM_ATAM_PROTOCOL(a) CR (a, ATAM_INSTANCE, AtAm, ATAM_PRIVATE_DATA_SIGNATURE)

#pragma pack()

#define NONCE_LENGTH                16
#define STR_NONCE_LENGTH            33
#define ATAM_SETUP_PASSWORD_LENGTH  49
#define ATAM_TIMER_STRING_LENGTH    10
#define ISV_PLATFORM_ID_LENGTH      16
#define SERVER_SHORTCODE_LENGTH     16
#define DEFAULT_LANGUAGE_STRING     4
#define RECOVERY_STRING_LENGTH      256
#define MX_SMS_MESSAGES             99

typedef enum _AT_AM_SELECTION
{
  AT_AM_SELECTION_ATAM = 0,
  AT_AM_SELECTION_PBAM,
  AT_AM_SELECTION_MAX
} AT_AM_SELECTION;

/**
  This function gets the ISV Strings stored by AT Server that BIOS will display.

  @param[in] This        The address of protocol
  @param[out] IsvString  Isv string pointer
  @param[out] IsvId      Intel(R) Anti-Theft service provider Id

  @retval EFI_SUCCESS   The function completed successfully.
**/
EFI_STATUS
AtAmGetIsvId (
  IN  EFI_AT_PROTOCOL             *This,
  OUT UINT8                       *IsvString,
  OUT UINT32                      *IsvId
  )
;

/**
  This function returns time left to enter password.

  @param[in] This                 The address of protocol
  @param[out] TimeLeft            Time
  @param[out] TimeInterval        Time interval

  @retval EFI_SUCCESS             The function completed
          successfully.
**/
EFI_STATUS
AtAmGetTimer (
  IN  EFI_AT_PROTOCOL             *This,
  OUT UINT32                      *TimeLeft,
  OUT UINT32                      *TimeInterval
  )
;

/**
  This function gets 16 bytes nonce from firmware and also converts it to string according to format "XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX".

  @param[in] This                 The address of protocol
  @param[out] NonceStr            Pointer to Nonce string

  @retval EFI_SUCCESS             The function completed
          successfully.
**/
EFI_STATUS
AtAmGetNonce (
  IN  EFI_AT_PROTOCOL             *This,
  OUT UINT8                       *NonceStr
  )
;

/**
  This function gets recovery config.

  @param[in]  This                The address of protocol
  @param[out] RecoveryConfig      Pointer to structure

  @retval EFI_SUCCESS             The function completed successfully.
**/
EFI_STATUS
AtAmGetRecoveryConfig (
  IN  EFI_AT_PROTOCOL             *This,
  OUT AT_BIOS_RECOVERY_CONFIG     *RecoveryConfig
  )
;

/**
  This routine receives the data (passphrase or SRTK) from UI and verifies it if the password (either passphrase or SRTK) is acceptable.

  @param[in] This                 The address of protocol
  @param[in] PasswordEntered      Pointer to string
  @param[in] PassType             Password type
  @param[out] IsAuthenticated     Pointer to result of verification

  @retval EFI_SUCCESS             The function completed successfully.
**/
EFI_STATUS
AtAmVerifyPassword (
  IN  EFI_AT_PROTOCOL             *This,
  IN  UINT8                       *PasswordEntered,
  IN  UINT32                      PassType,
  OUT UINT8                       *IsAuthenticated
  )
;

/**
  This routine receives the SSTK from UI and verifies it if the password is acceptable. This requests FW to enter or exit Suspend mode based on user input.

  @param[in] This                 The address of protocol
  @param[in] TransitionState      1- enter suspend state, 0 - exit suspend state
  @param[in] Token                Pointer to token

  @retval EFI_SUCCESS             The function completed successfully.
**/
EFI_STATUS
AtAmSetSuspendState (
  IN EFI_AT_PROTOCOL              *This,
  IN UINT32                       TransitionState,
  IN UINT8                        *Token
  )
;

/**
  This routine gets AT state.

  @param[in]  This                The address of protocol
  @param[out] AtStateInfo         State of AT

  @retval EFI_SUCCESS             The function completed
          successfully.
**/
EFI_STATUS
AtAmGetAtStateInfo (
  IN  EFI_AT_PROTOCOL             *This,
  OUT AT_STATE_INFO               *AtStateInfo
  )
;

/**
  Validate preffered AM.

  @param[in] AtState              State of AT
  @param[in] AtAmPref             Preferred AT authentication

  @retval EFI_SUCCESS             The function completed
          successfully.
**/
EFI_STATUS
AtAmValidatePreferredAM (
  IN UINT8                        *AtState,
  IN UINT16                       *AtAmPref
  )
;

/**
  This routine checks if the PbaOverrideThreshold is exceeded.

  @param[out] PbaFailedExceeded   TRUE when the PbaOverrideThreshold is exceeded
  @param[out] PbaFailedAttempts   Number of failed attempts
  @param[out] PbaFailedThreshold  Pba failed count treshold

  @retval EFI_SUCCESS             The function completed
          successfully.
**/
EFI_STATUS
AtAmGetPbaCounter (
  OUT UINT8*          PbaFailedExceeded,
  OUT UINT16*         PbaFailedAttempts,
  OUT UINT16*         PbaFailedThreshold
  )
;

#endif // _ATAM_H_