8ad0015f3c9e5d6f26c0d81ead9e770b1c901efe
[mirror_edk2.git] / MdeModulePkg / Universal / FaultTolerantWriteDxe / FaultTolerantWriteSmmCommon.h
1 /** @file\r
2 \r
3   The common header file for SMM FTW module and SMM FTW DXE Module.\r
4 \r
5 Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution.  The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13 \r
14 **/\r
15 \r
16 #ifndef __SMM_FTW_COMMON_H__\r
17 #define __SMM_FTW_COMMON_H__\r
18 \r
19 #include <Protocol/SmmFirmwareVolumeBlock.h>\r
20 #include <Protocol/SmmFaultTolerantWrite.h>\r
21 \r
22 #define FTW_FUNCTION_GET_MAX_BLOCK_SIZE       1\r
23 #define FTW_FUNCTION_ALLOCATE                 2\r
24 #define FTW_FUNCTION_WRITE                    3\r
25 #define FTW_FUNCTION_RESTART                  4\r
26 #define FTW_FUNCTION_ABORT                    5\r
27 #define FTW_FUNCTION_GET_LAST_WRITE           6\r
28 \r
29 typedef struct {\r
30   UINTN       Function;\r
31   EFI_STATUS  ReturnStatus;\r
32   UINT8       Data[1];\r
33 } SMM_FTW_COMMUNICATE_FUNCTION_HEADER;\r
34 \r
35 ///\r
36 /// Size of SMM communicate header, without including the payload.\r
37 ///\r
38 #define SMM_COMMUNICATE_HEADER_SIZE  (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data))\r
39 \r
40 ///\r
41 /// Size of SMM FTW communicate function header, without including the payload.\r
42 ///\r
43 #define SMM_FTW_COMMUNICATE_HEADER_SIZE  (OFFSET_OF (SMM_FTW_COMMUNICATE_FUNCTION_HEADER, Data))\r
44 \r
45 typedef struct {\r
46   UINTN                                 BlockSize;\r
47 } SMM_FTW_GET_MAX_BLOCK_SIZE_HEADER;\r
48 \r
49 typedef struct {\r
50   EFI_GUID                              CallerId;\r
51   UINTN                                 PrivateDataSize;\r
52   UINTN                                 NumberOfWrites;\r
53 } SMM_FTW_ALLOCATE_HEADER;\r
54 \r
55 typedef struct {\r
56   EFI_LBA                               Lba;\r
57   UINTN                                 Offset;\r
58   UINTN                                 PrivateDataSize;\r
59   EFI_PHYSICAL_ADDRESS                  FvbBaseAddress;\r
60   EFI_FVB_ATTRIBUTES_2                  FvbAttributes;\r
61   UINTN                                 Length;\r
62   UINT8                                 Data[1];\r
63 } SMM_FTW_WRITE_HEADER;\r
64 \r
65 typedef struct {\r
66   EFI_PHYSICAL_ADDRESS                  FvbBaseAddress;\r
67   EFI_FVB_ATTRIBUTES_2                  FvbAttributes;\r
68 } SMM_FTW_RESTART_HEADER;\r
69 \r
70 typedef struct {\r
71   EFI_GUID                              CallerId;\r
72   EFI_LBA                               Lba;\r
73   UINTN                                 Offset;\r
74   UINTN                                 Length;\r
75   UINTN                                 PrivateDataSize;\r
76   BOOLEAN                               Complete;\r
77   UINT8                                 Data[1];\r
78 } SMM_FTW_GET_LAST_WRITE_HEADER;\r
79 \r
80 #endif\r