]>
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 | |
9d510e61 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d0def00d AB |
8 | \r |
9 | **/\r | |
10 | \r | |
11 | #include <Library/SmmMemLib.h>\r | |
12 | #include <Library/UefiBootServicesTableLib.h>\r | |
13 | #include "FaultTolerantWrite.h"\r | |
14 | #include "FaultTolerantWriteSmmCommon.h"\r | |
15 | \r | |
16 | /**\r | |
17 | This function checks if the buffer is valid per processor architecture and\r | |
18 | does not overlap with SMRAM.\r | |
19 | \r | |
20 | @param Buffer The buffer start address to be checked.\r | |
21 | @param Length The buffer length to be checked.\r | |
22 | \r | |
23 | @retval TRUE This buffer is valid per processor architecture and does not\r | |
24 | overlap with SMRAM.\r | |
25 | @retval FALSE This buffer is not valid per processor architecture or overlaps\r | |
26 | with SMRAM.\r | |
27 | **/\r | |
28 | BOOLEAN\r | |
29 | FtwSmmIsBufferOutsideSmmValid (\r | |
30 | IN EFI_PHYSICAL_ADDRESS Buffer,\r | |
31 | IN UINT64 Length\r | |
32 | )\r | |
33 | {\r | |
34 | return TRUE;\r | |
35 | }\r | |
36 | \r | |
37 | /**\r | |
38 | Internal implementation of CRC32. Depending on the execution context\r | |
39 | (standalone SMM or DXE vs standalone MM), this function is implemented\r | |
40 | via a call to the CalculateCrc32 () boot service, or via a library\r | |
41 | call.\r | |
42 | \r | |
43 | If Buffer is NULL, then ASSERT().\r | |
44 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
45 | \r | |
46 | @param[in] Buffer A pointer to the buffer on which the 32-bit CRC is to be computed.\r | |
47 | @param[in] Length The number of bytes in the buffer Data.\r | |
48 | \r | |
49 | @retval Crc32 The 32-bit CRC was computed for the data buffer.\r | |
50 | \r | |
51 | **/\r | |
52 | UINT32\r | |
53 | FtwCalculateCrc32 (\r | |
54 | IN VOID *Buffer,\r | |
55 | IN UINTN Length\r | |
56 | )\r | |
57 | {\r | |
58 | return CalculateCrc32 (Buffer, Length);\r | |
59 | }\r | |
60 | \r | |
61 | /**\r | |
44289eea | 62 | Notify the system that the SMM FTW driver is ready.\r |
d0def00d AB |
63 | **/\r |
64 | VOID\r | |
65 | FtwNotifySmmReady (\r | |
66 | VOID\r | |
67 | )\r | |
68 | {\r | |
69 | }\r | |
70 | \r | |
71 | /**\r | |
72 | This function is the entry point of the Fault Tolerant Write driver.\r | |
73 | \r | |
74 | @param[in] ImageHandle A handle for the image that is initializing this driver\r | |
75 | @param[in] MmSystemTable A pointer to the MM system table\r | |
76 | \r | |
77 | @retval EFI_SUCCESS The initialization finished successfully.\r | |
78 | @retval EFI_OUT_OF_RESOURCES Allocate memory error\r | |
79 | @retval EFI_INVALID_PARAMETER Workspace or Spare block does not exist\r | |
80 | \r | |
81 | **/\r | |
82 | EFI_STATUS\r | |
83 | EFIAPI\r | |
84 | StandaloneMmFaultTolerantWriteInitialize (\r | |
85 | IN EFI_HANDLE ImageHandle,\r | |
86 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r | |
87 | )\r | |
88 | {\r | |
89 | return MmFaultTolerantWriteInitialize ();\r | |
90 | }\r |