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
|
//**********************************************************************
//**********************************************************************
//** **
//** (C)Copyright 1985-2014, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
//**********************************************************************
// $Header: /Alaska/SOURCE/Modules/NVMe/NvmeSmm/NvmeSmm.h 3 12/10/14 5:15a Lavanyap $
//
// $Revision: 3 $
//
// $Date: 12/10/14 5:15a $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/NVMe/NvmeSmm/NvmeSmm.h $
//
// 3 12/10/14 5:15a Lavanyap
// [TAG] EIP185327
// [Category] Improvement
// [Description] Security Enhancement for SMIHandler in Aptio4.x NVMe
// Driver
// [Files] NvmeSmm.mak, NvmeSmm.c, NvmeSmm.h
//
// 2 9/23/14 2:34a Anandakrishnanl
// [TAG] EIP180861
// [Category] Improvement
// [Description] Add Legacy Boot support in Aptio 4.x Nvme driver - NON
// PI 1.2 Support
// [Files] NvmeBus.c
// NvmeBus.h
// NvmeSmm.c
// NvmeSmm.h
// NvmeSmm.dxs
// NvmeSmm.sdl
//
// 1 9/04/14 7:54a Anandakrishnanl
// [TAG] EIP180861
// [Category] Improvement
// [Description] Legacy Boot support in Aptio 4.x Nvme driver
// [Files] NvmeSmm.cif
// NvmeSmm.mak
// NvmeSmm.dxs
// NvmeSmm.sdl
// NvmeSmm.c
// NvmeSmm.h
// NvmeDef.h
//
//**********************************************************************
//**********************************************************************
//<AMI_FHDR_START>
//
// Name: NvmeSmm.h
//
// Description: Header file for the NvmeSmm
//
//<AMI_FHDR_END>
//**********************************************************************
#ifndef _AMI_NVME_SMM_DRIVER_H_
#define _AMI_NVME_SMM_DRIVER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <EFI.h>
#include <AmiLib.h>
#include <AmiDxeLib.h>
#if defined(PI_SPECIFICATION_VERSION) && (PI_SPECIFICATION_VERSION >= 0x00010014)
#include <Protocol\SmmBase2.h>
#include <Protocol\SmmSwDispatch2.h>
#else
#include <Protocol\SmmBase.h>
#include <Protocol\SmmSwDispatch.h>
#endif
#include "NvmeIncludes.h"
#include "NvmeBus.h"
#include "NvmeDef.h"
#include <AmiBufferValidationLib.h>
typedef VOID (*API_FUNC)(NVME_STRUC*);
//-----------------------------------------------
// ERROR CODE REPORTED TO CALLER
//-----------------------------------------------
#define NVME_WRITE_PROTECT_ERR 0x003 // Write protect error
#define NVME_TIME_OUT_ERR 0x080 // Command timed out error
#define NVME_DRIVE_NOT_READY_ERR 0x0AA // Drive not ready error
#define NVME_DATA_CORRECTED_ERR 0x011 // Data corrected error
#define NVME_PARAMETER_FAILED 0x007 // Bad parameter error
#define NVME_MARK_NOT_FOUND_ERR 0x002 // Address mark not found error
#define NVME_NO_MEDIA_ERR 0x031 // No media in drive
#define NVME_READ_ERR 0x004 // Read error
#define NVME_WRITE_ERR 0x005 // Write error
#define NVME_UNCORRECTABLE_ERR 0x010 // Uncorrectable data error
#define NVME_BAD_SECTOR_ERR 0x00A // Bad sector error
#define NVME_GENERAL_FAILURE 0x020 // Controller general failure
//-----------------------------------------------------------------------;
// NVME_GLOBAL_DATA
//-----------------------------------------------------------------------;
typedef struct{
UINT32 TransferBufferAddress;
UINT8 NvmeMassEmulationOptionTable[MAX_NVME_DEVICES];
ACTIVE_NAMESPACE_DATA NvmeDev[MAX_NVME_DEVICES];
} NVME_GLOBAL_DATA;
//
//NVME Setup fields
//
typedef struct {
UINT8 NvmeMode;
UINT8 NvmeEmu1;
UINT8 NvmeEmu2;
UINT8 NvmeEmu3;
UINT8 NvmeEmu4;
UINT8 NvmeEmu5;
UINT8 NvmeEmu6;
UINT8 NvmeEmu7;
UINT8 NvmeEmu8;
UINT8 NvmeMassDevNum;
} NVME_DEV_CONFIGURATION;
EFI_STATUS
NotInSmmFunction (
EFI_HANDLE ImageHandle,
EFI_SYSTEM_TABLE *SystemTable
);
EFI_STATUS
NvmeInSmmFunction (
EFI_HANDLE ImageHandle,
EFI_SYSTEM_TABLE *SystemTable
);
#if defined(PI_SPECIFICATION_VERSION) && (PI_SPECIFICATION_VERSION >= 0x00010014)
EFI_STATUS
NvmeSWSMIHandler (
IN EFI_HANDLE DispatchHandle,
IN CONST VOID *DispatchContext OPTIONAL,
IN OUT VOID *CommBuffer OPTIONAL,
IN OUT UINTN *CommBufferSize OPTIONAL
);
#else
EFI_STATUS
NvmeSWSMIHandler (
IN EFI_HANDLE DispatchHandle,
IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
);
#endif
VOID
ZeroMemorySmm (
VOID *Buffer,
UINTN Size
);
VOID
NvmeMassAPIGetDeviceInformation (
NVME_STRUC *NvmeURP
);
VOID
NvmeMassAPIGetDeviceGeometry (
NVME_STRUC *NvmeURP
);
VOID
NvmeMassAPIResetDevice (
NVME_STRUC *NvmeURP
);
VOID
NvmeMassAPIReadDevice (
NVME_STRUC *NvmeURP
);
VOID
NvmeMassAPIWriteDevice (
NVME_STRUC *NvmeURP
);
VOID
NvmeMassAPINotSupported (
NVME_STRUC *NvmeURP
);
VOID
NvmeMassAPIPass(
NVME_STRUC *NvmeURP
);
/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif
//**********************************************************************
//**********************************************************************
//** **
//** (C)Copyright 1985-2014, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
|