]>
Commit | Line | Data |
---|---|---|
a89fd3a3 ZG |
1 | /** @file\r |
2 | Flush the cache is required for most architectures while do capsule\r | |
3 | update. It is not support at Runtime.\r | |
4 | \r | |
5 | Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r | |
6 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r | |
7 | \r | |
8 | This program and the accompanying materials are licensed and made available\r | |
9 | under the terms and conditions of the BSD License which accompanies this\r | |
10 | distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #include "CapsuleService.h"\r | |
19 | \r | |
20 | #include <Library/CacheMaintenanceLib.h>\r | |
21 | \r | |
22 | /**\r | |
23 | Writes Back a range of data cache lines covering a set of capsules in memory.\r | |
24 | \r | |
25 | Writes Back the data cache lines specified by ScatterGatherList.\r | |
26 | \r | |
27 | @param ScatterGatherList Physical address of the data structure that\r | |
28 | describes a set of capsules in memory\r | |
29 | \r | |
30 | **/\r | |
31 | VOID\r | |
32 | CapsuleCacheWriteBack (\r | |
33 | IN EFI_PHYSICAL_ADDRESS ScatterGatherList\r | |
34 | )\r | |
35 | {\r | |
36 | EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc;\r | |
37 | \r | |
38 | if (!EfiAtRuntime ()) {\r | |
39 | Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)ScatterGatherList;\r | |
40 | do {\r | |
41 | WriteBackDataCacheRange (\r | |
42 | (VOID *)(UINTN)Desc,\r | |
43 | (UINTN)sizeof (*Desc)\r | |
44 | );\r | |
45 | \r | |
46 | if (Desc->Length > 0) {\r | |
47 | WriteBackDataCacheRange (\r | |
48 | (VOID *)(UINTN)Desc->Union.DataBlock,\r | |
49 | (UINTN)Desc->Length\r | |
50 | );\r | |
51 | Desc++;\r | |
52 | } else if (Desc->Union.ContinuationPointer > 0) {\r | |
53 | Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)Desc->Union.ContinuationPointer;\r | |
54 | }\r | |
55 | } while (Desc->Length > 0 || Desc->Union.ContinuationPointer > 0);\r | |
56 | \r | |
57 | WriteBackDataCacheRange (\r | |
58 | (VOID *)(UINTN)Desc,\r | |
59 | (UINTN)sizeof (*Desc)\r | |
60 | );\r | |
61 | }\r | |
62 | }\r | |
63 | \r |