2 ARM implementation of architecture specific routines related to
3 PersistAcrossReset capsules
5 Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available
8 under the terms and conditions of the BSD License which accompanies this
9 distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "CapsuleService.h"
19 #include <Library/CacheMaintenanceLib.h>
22 Whether the platform supports capsules that persist across reset. Note that
23 some platforms only support such capsules at boot time.
25 @return TRUE if a PersistAcrossReset capsule may be passed to UpdateCapsule()
30 IsPersistAcrossResetCapsuleSupported (
35 // ARM requires the capsule payload to be cleaned to the point of coherency
36 // (PoC), but only permits doing so using cache maintenance instructions that
37 // operate on virtual addresses. Since at runtime, we don't know the virtual
38 // addresses of the data structures that make up the scatter/gather list, we
39 // cannot perform the maintenance, and all we can do is give up.
41 return FeaturePcdGet (PcdSupportUpdateCapsuleReset
) && !EfiAtRuntime ();
45 Writes Back a range of data cache lines covering a set of capsules in memory.
47 Writes Back the data cache lines specified by ScatterGatherList.
49 @param ScatterGatherList Physical address of the data structure that
50 describes a set of capsules in memory
54 CapsuleCacheWriteBack (
55 IN EFI_PHYSICAL_ADDRESS ScatterGatherList
58 EFI_CAPSULE_BLOCK_DESCRIPTOR
*Desc
;
60 Desc
= (EFI_CAPSULE_BLOCK_DESCRIPTOR
*)(UINTN
)ScatterGatherList
;
62 WriteBackDataCacheRange (Desc
, sizeof *Desc
);
64 if (Desc
->Length
> 0) {
65 WriteBackDataCacheRange ((VOID
*)(UINTN
)Desc
->Union
.DataBlock
,
69 } else if (Desc
->Union
.ContinuationPointer
> 0) {
70 Desc
= (EFI_CAPSULE_BLOCK_DESCRIPTOR
*)(UINTN
)Desc
->Union
.ContinuationPointer
;
72 } while (Desc
->Length
> 0 || Desc
->Union
.ContinuationPointer
> 0);
74 WriteBackDataCacheRange (Desc
, sizeof *Desc
);