summaryrefslogtreecommitdiff
path: root/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h
blob: 3d4bf3b3c01135a80095488bdeba302807fe4907 (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
/** @file
  Definition of Alert Standard Format (ASF) 2.0

@copyright
  Copyright (c) 2005 - 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 a 'Sample Driver' and is licensed as such
  under the terms of your license agreement with Intel or your
  vendor.  This file may be modified by the user, subject to
  the additional terms of the license agreement
**/
#ifndef __ALERT_STANDARD_FORMAT_PROTOCOL_H__
#define __ALERT_STANDARD_FORMAT_PROTOCOL_H__

///
/// Alert Standard Format Protocol
/// This protocol provides interfaces to get ASF Boot Options and send ASF messages
///
#define EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID \
  { \
    0xcc93a70b, 0xec27, 0x49c5, 0x8b, 0x34, 0x13, 0x93, 0x1e, 0xfe, 0xd6, 0xe2 \
  }

typedef struct _EFI_ALERT_STANDARD_FORMAT_PROTOCOL  EFI_ALERT_STANDARD_FORMAT_PROTOCOL;

#pragma pack(1)
typedef struct {
  UINT8   SubCommand;
  UINT8   Version;
  UINT32  IanaId;
  UINT8   SpecialCommand;
  UINT16  SpecialCommandParam;
  UINT16  BootOptions;
  UINT16  OemParameters;
} EFI_ASF_BOOT_OPTIONS;

typedef struct {
  UINT8 SubCommand;
  UINT8 Version;
  UINT8 EventSensorType;
  UINT8 EventType;
  UINT8 EventOffset;
  UINT8 EventSourceType;
  UINT8 EventSeverity;
  UINT8 SensorDevice;
  UINT8 SensorNumber;
  UINT8 Entity;
  UINT8 EntityInstance;
  UINT8 Data0;
  UINT8 Data1;
} EFI_ASF_MESSAGE;

typedef struct {
  UINT8 SubCommand;
  UINT8 Version;
} EFI_ASF_CLEAR_BOOT_OPTIONS;
#pragma pack()
//
// Special Command Attributes
//
#define NOP               0x00
#define FORCE_PXE         0x01
#define FORCE_HARDDRIVE   0x02
#define FORCE_SAFEMODE    0x03
#define FORCE_DIAGNOSTICS 0x04
#define FORCE_CDDVD       0x05

//
// Boot Options Mask
//
#define LOCK_POWER_BUTTON             0x0002  ///< 0000 0000 0000 0010 - bit 1
#define LOCK_RESET_BUTTON             0x0004  ///< 0000 0000 0000 0200 - bit 2
#define LOCK_KEYBOARD                 0x0020  ///< 0000 0000 0010 0000 - bit 5
#define LOCK_SLEEP_BUTTON             0x0040  ///< 0000 0000 0100 0000 - bit 6
#define USER_PASSWORD_BYPASS          0x0800  ///< 0000 1000 0000 0000 - bit 3
#define FORCE_PROGRESS_EVENTS         0x1000  ///< 0001 0000 0000 0000 - bit 4
#define FIRMWARE_VERBOSITY_DEFAULT    0x0000  ///< 0000 0000 0000 0000 - bit 6:5
#define FIRMWARE_VERBOSITY_QUIET      0x2000  ///< 0010 0000 0000 0000 - bit 6:5
#define FIRMWARE_VERBOSITY_VERBOSE    0x4000  ///< 0100 0000 0000 0000 - bit 6:5
#define FIRMWARE_VERBOSITY_BLANK      0x6000  ///< 0110 0000 0000 0000 - bit 6:5
#define CONFIG_DATA_RESET             0x8000  ///< 1000 0000 0000 0000 - bit 7
#define ASF_BOOT_OPTIONS_PRESENT      0x16
#define ASF_BOOT_OPTIONS_NOT_PRESENT  0x17

#define USE_KVM                       0x0020  ///< 0000 0000 0010 0000 - bit 5
///
/// ASF Internet Assigned Numbers Authority Manufacturer ID
/// (The firmware sends 0XBE110000 for decimal value 4542)
///
#define INDUSTRY_IANA_SWAP32(x)       ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | \
                                        (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
#define ASF_INDUSTRY_IANA             0x000011BE
#define ASF_INDUSTRY_CONVERTED_IANA   INDUSTRY_IANA_SWAP32 (ASF_INDUSTRY_IANA)  ///< 0XBE110000, received from ME FW

/**
  Return the SMBus address used by the ASF driver.
  Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED.

  @retval EFI_SUCCESS             Address returned
  @retval EFI_INVALID_PARAMETER   Invalid SMBus address
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_SMBUSADDR) (
  IN  EFI_ALERT_STANDARD_FORMAT_PROTOCOL   *This,
  OUT UINTN                                *SmbusDeviceAddress
  )
;

/**
  Set the SMBus address used by the ASF driver. 0 is an invalid address.
  Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED.

  @param[in] SmbusAddr            SMBus address of the controller

  @retval EFI_SUCCESS             Address set
  @retval EFI_INVALID_PARAMETER   Invalid SMBus address
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SET_SMBUSADDR) (
  IN  EFI_ALERT_STANDARD_FORMAT_PROTOCOL   *This,
  IN  UINTN                                SmbusDeviceAddress
  )
;

/**
  Return the ASF Boot Options obtained from the controller. If the
  Boot Options parameter is NULL and no boot options have been retrieved,
  Query the ASF controller for its boot options.
  Get ASF Boot Options through HECI.

  @param[in] AsfBootOptions       Pointer to ASF boot options to copy current ASF Boot options

  @retval EFI_SUCCESS             Boot options copied
  @retval EFI_NOT_READY           No boot options
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_BOOT_OPTIONS) (
  IN  EFI_ALERT_STANDARD_FORMAT_PROTOCOL   *This,
  IN  OUT EFI_ASF_BOOT_OPTIONS             **AsfBootOptions
  )
;

/**
  Send ASF Message.
  Send ASF Message through HECI.

  @param[in] AsfMessage           Pointer to ASF message

  @retval EFI_SUCCESS             Boot options copied
  @retval EFI_INVALID_PARAMETER   Invalid pointer
  @retval EFI_NOT_READY           No controller
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SEND_ASF_MESSAGE) (
  IN  EFI_ALERT_STANDARD_FORMAT_PROTOCOL   *This,
  IN  EFI_ASF_MESSAGE                      *AsfMessage
  )
;

///
/// Alert Standard Format Protocol
/// This protocol provides interfaces to get ASF Boot Options and send ASF messages
/// HECI protocol is consumed and used to send ASF messages and receive ASF Boot Options
///
struct _EFI_ALERT_STANDARD_FORMAT_PROTOCOL {
  EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_SMBUSADDR    GetSmbusAddr;
  EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SET_SMBUSADDR    SetSmbusAddr;
  EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_BOOT_OPTIONS GetBootOptions;
  EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SEND_ASF_MESSAGE SendAsfMessage;
};

extern EFI_GUID gEfiAlertStandardFormatProtocolGuid;

#endif