summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h
blob: a2756cb0ab1ef1aa919c839483a11a9a398b7d92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/** @file
  Define PPI to shadow Firmware Volume from flash to Permanent Memory.

Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef PEI_FIRMWARE_VOLUME_SHADOW_PPI_H_
#define PEI_FIRMWARE_VOLUME_SHADOW_PPI_H_

//
// Firmware Volume Shadow PPI GUID value
//
#define EDKII_FIRMWARE_VOLUME_SHADOW_PPI_GUID \
  { \
    0x7dfe756c, 0xed8d, 0x4d77, { 0x9e, 0xc4, 0x39, 0x9a, 0x8a, 0x81, 0x51, 0x16 } \
  }

/**
  Copy FV to Destination.  Length of copy is FV length from FV Header.

  @param[in]  FirmwareVolumeBase  Base address of FV to shadow. Length of FV
                                  is in FV Header.
  @param[in]  Destination         Pointer to the Buffer in system memory to
                                  shadow FV.
  @param[in]  DestinationLength   Size of Destination buffer in bytes.

  @retval EFI_SUCCESS            Shadow complete
  @retval EFI_INVALID_PARAMETER  Destination is NULL
  @retval EFI_INVALID_PARAMETER  DestinationLength = 0.
  @retval EFI_INVALID_PARAMETER  FV does not have valid FV Header.
  @retval EFI_INVALID_PARAMETER  FV overlaps Destination.
  @retval EFI_INVALID_PARAMETER  Destination + DestinationLength rolls over 4GB
                                 for 32-bit or 64-bit rollover.
  @retval EFI_BUFFER_TOO_SMALL   DestinationLength less than FV length from FV
                                 Header.
  @retval EFI_UNSUPPORTED        FirmwareVolumeBase to FVBase + FVLength does
                                 not support shadow.  Caller should fallback to
                                 CopyMem().

**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_FIRMWARE_VOLUME_SHADOW)(
  IN EFI_PHYSICAL_ADDRESS  FirmwareVolumeBase,
  IN VOID                  *Destination,
  IN UINTN                 DestinationLength
  );

///
/// This PPI provides a service to shadow a FV from one location to another
///
typedef struct {
  EDKII_PEI_FIRMWARE_VOLUME_SHADOW    FirmwareVolumeShadow;
} EDKII_PEI_FIRMWARE_VOLUME_SHADOW_PPI;

extern EFI_GUID  gEdkiiPeiFirmwareVolumeShadowPpiGuid;

#endif