]>
Commit | Line | Data |
---|---|---|
4e8ee0a0 | 1 | /** @file\r |
e077a93d AB |
2 | ARM implementation of architecture specific routines related to\r |
3 | PersistAcrossReset capsules\r | |
4 | \r | |
5 | Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r | |
6 | \r | |
7 | This program and the accompanying materials are licensed and made available\r | |
8 | under the terms and conditions of the BSD License which accompanies this\r | |
9 | 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 "CapsuleService.h"\r | |
18 | \r | |
19 | #include <Library/CacheMaintenanceLib.h>\r | |
20 | \r | |
21 | /**\r | |
22 | Whether the platform supports capsules that persist across reset. Note that\r | |
23 | some platforms only support such capsules at boot time.\r | |
24 | \r | |
25 | @return TRUE if a PersistAcrossReset capsule may be passed to UpdateCapsule()\r | |
26 | at this time\r | |
27 | FALSE otherwise\r | |
28 | **/\r | |
29 | BOOLEAN\r | |
30 | IsPersistAcrossResetCapsuleSupported (\r | |
31 | VOID\r | |
32 | )\r | |
33 | {\r | |
34 | //\r | |
35 | // ARM requires the capsule payload to be cleaned to the point of coherency\r | |
36 | // (PoC), but only permits doing so using cache maintenance instructions that\r | |
37 | // operate on virtual addresses. Since at runtime, we don't know the virtual\r | |
38 | // addresses of the data structures that make up the scatter/gather list, we\r | |
39 | // cannot perform the maintenance, and all we can do is give up.\r | |
40 | //\r | |
41 | return FeaturePcdGet (PcdSupportUpdateCapsuleReset) && !EfiAtRuntime ();\r | |
42 | }\r | |
43 | \r | |
44 | /**\r | |
45 | Writes Back a range of data cache lines covering a set of capsules in memory.\r | |
46 | \r | |
47 | Writes Back the data cache lines specified by ScatterGatherList.\r | |
48 | \r | |
49 | @param ScatterGatherList Physical address of the data structure that\r | |
50 | describes a set of capsules in memory\r | |
51 | \r | |
52 | **/\r | |
53 | VOID\r | |
54 | CapsuleCacheWriteBack (\r | |
55 | IN EFI_PHYSICAL_ADDRESS ScatterGatherList\r | |
56 | )\r | |
57 | {\r | |
58 | EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc;\r | |
59 | \r | |
60 | Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)ScatterGatherList;\r | |
61 | do {\r | |
62 | WriteBackDataCacheRange (Desc, sizeof *Desc);\r | |
63 | \r | |
64 | if (Desc->Length > 0) {\r | |
65 | WriteBackDataCacheRange ((VOID *)(UINTN)Desc->Union.DataBlock,\r | |
66 | Desc->Length\r | |
67 | );\r | |
68 | Desc++;\r | |
69 | } else if (Desc->Union.ContinuationPointer > 0) {\r | |
70 | Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)Desc->Union.ContinuationPointer;\r | |
71 | }\r | |
72 | } while (Desc->Length > 0 || Desc->Union.ContinuationPointer > 0);\r | |
73 | \r | |
74 | WriteBackDataCacheRange (Desc, sizeof *Desc);\r | |
75 | }\r |