]>
Commit | Line | Data |
---|---|---|
d0def00d AB |
1 | /** @file\r |
2 | \r | |
3 | Parts of the SMM/MM implementation that are specific to standalone MM\r | |
4 | \r | |
5 | Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
6 | Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #include <Library/SmmMemLib.h>\r | |
18 | #include <Library/UefiBootServicesTableLib.h>\r | |
19 | #include "FaultTolerantWrite.h"\r | |
20 | #include "FaultTolerantWriteSmmCommon.h"\r | |
21 | \r | |
22 | /**\r | |
23 | This function checks if the buffer is valid per processor architecture and\r | |
24 | does not overlap with SMRAM.\r | |
25 | \r | |
26 | @param Buffer The buffer start address to be checked.\r | |
27 | @param Length The buffer length to be checked.\r | |
28 | \r | |
29 | @retval TRUE This buffer is valid per processor architecture and does not\r | |
30 | overlap with SMRAM.\r | |
31 | @retval FALSE This buffer is not valid per processor architecture or overlaps\r | |
32 | with SMRAM.\r | |
33 | **/\r | |
34 | BOOLEAN\r | |
35 | FtwSmmIsBufferOutsideSmmValid (\r | |
36 | IN EFI_PHYSICAL_ADDRESS Buffer,\r | |
37 | IN UINT64 Length\r | |
38 | )\r | |
39 | {\r | |
40 | return TRUE;\r | |
41 | }\r | |
42 | \r | |
43 | /**\r | |
44 | Internal implementation of CRC32. Depending on the execution context\r | |
45 | (standalone SMM or DXE vs standalone MM), this function is implemented\r | |
46 | via a call to the CalculateCrc32 () boot service, or via a library\r | |
47 | call.\r | |
48 | \r | |
49 | If Buffer is NULL, then ASSERT().\r | |
50 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
51 | \r | |
52 | @param[in] Buffer A pointer to the buffer on which the 32-bit CRC is to be computed.\r | |
53 | @param[in] Length The number of bytes in the buffer Data.\r | |
54 | \r | |
55 | @retval Crc32 The 32-bit CRC was computed for the data buffer.\r | |
56 | \r | |
57 | **/\r | |
58 | UINT32\r | |
59 | FtwCalculateCrc32 (\r | |
60 | IN VOID *Buffer,\r | |
61 | IN UINTN Length\r | |
62 | )\r | |
63 | {\r | |
64 | return CalculateCrc32 (Buffer, Length);\r | |
65 | }\r | |
66 | \r | |
67 | /**\r | |
68 | Notify the system that the SMM FTW driver is ready\r | |
69 | **/\r | |
70 | VOID\r | |
71 | FtwNotifySmmReady (\r | |
72 | VOID\r | |
73 | )\r | |
74 | {\r | |
75 | }\r | |
76 | \r | |
77 | /**\r | |
78 | This function is the entry point of the Fault Tolerant Write driver.\r | |
79 | \r | |
80 | @param[in] ImageHandle A handle for the image that is initializing this driver\r | |
81 | @param[in] MmSystemTable A pointer to the MM system table\r | |
82 | \r | |
83 | @retval EFI_SUCCESS The initialization finished successfully.\r | |
84 | @retval EFI_OUT_OF_RESOURCES Allocate memory error\r | |
85 | @retval EFI_INVALID_PARAMETER Workspace or Spare block does not exist\r | |
86 | \r | |
87 | **/\r | |
88 | EFI_STATUS\r | |
89 | EFIAPI\r | |
90 | StandaloneMmFaultTolerantWriteInitialize (\r | |
91 | IN EFI_HANDLE ImageHandle,\r | |
92 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r | |
93 | )\r | |
94 | {\r | |
95 | return MmFaultTolerantWriteInitialize ();\r | |
96 | }\r |