/* Writes Back the data cache lines specified by ScatterGatherList. */
VOID CapsuleCacheWriteBack(IN EFI_PHYSICAL_ADDRESS ScatterGatherList)
/* Writes Back the data cache lines specified by ScatterGatherList. */
VOID CapsuleCacheWriteBack(IN EFI_PHYSICAL_ADDRESS ScatterGatherList)
{
  EFI_CAPSULE_BLOCK_DESCRIPTOR  *Desc;
  if (!EfiAtRuntime ()) {
    Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)ScatterGatherList;
    do {
      WriteBackDataCacheRange (
        (VOID *)(UINTN)Desc,
        (UINTN)sizeof (*Desc)
        );
      if (Desc->Length > 0) {
        WriteBackDataCacheRange (
          (VOID *)(UINTN)Desc->Union.DataBlock,
          (UINTN)Desc->Length
          );
        Desc++;
      } else if (Desc->Union.ContinuationPointer > 0) {
        Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)Desc->Union.ContinuationPointer;
      }
    } while (Desc->Length > 0 || Desc->Union.ContinuationPointer > 0);
    WriteBackDataCacheRange (
      (VOID *)(UINTN)Desc,
      (UINTN)sizeof (*Desc)
      );
  }
}