summaryrefslogtreecommitdiff
path: root/EmbeddedPkg/Include/Protocol/GblEfiBootMemory.h
blob: 5c34230c7726cafe575bd1ff474afafb965d63e5 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
/** @file
  GBL EFI Boot Memory Protocol.

  Provides APIs for retrieving and synchronizing boot and partition buffers.

  Related docs:
  https://android.googlesource.com/platform/bootable/libbootloader/+/refs/heads/gbl-mainline/gbl/docs/gbl_efi_boot_memory_protocol.md

  Copyright (c) 2025, The Android Open Source Project.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#pragma once

#include <Uefi/UefiBaseType.h>

//
// {309f2874-ad59-4fd2-af5e-ce0f4ab401a6}
//
#define GBL_EFI_BOOT_MEMORY_PROTOCOL_GUID \
  { 0x309f2874, 0xad59, 0x4fd2, { 0xaf, 0x5e, 0xce, 0x0f, 0x4a, 0xb4, 0x01, 0xa6 } }

#define GBL_EFI_BOOT_MEMORY_PROTOCOL_REVISION  0x00010000

typedef struct _GBL_EFI_BOOT_MEMORY_PROTOCOL GBL_EFI_BOOT_MEMORY_PROTOCOL;

typedef enum {
  GblEfiBootBufferTypeGeneralLoad = 0,
  GblEfiBootBufferTypeKernel,
  GblEfiBootBufferTypeRamdisk,
  GblEfiBootBufferTypeFdt,
  GblEfiBootBufferTypePvmfwData,
  GblEfiBootBufferTypeFastbootDownload
} GBL_EFI_BOOT_BUFFER_TYPE;

typedef enum {
  GblEfiPartitionBufferFlagPreloaded = BIT0
} GBL_EFI_PARTITION_BUFFER_FLAG;

typedef
EFI_STATUS
(EFIAPI *GBL_EFI_BOOT_MEMORY_GET_PARTITION_BUFFER)(
  IN GBL_EFI_BOOT_MEMORY_PROTOCOL   *This,
  IN CONST CHAR8                    *BaseName,
  OUT UINTN                         *Size,
  OUT VOID                          **Addr,
  OUT UINT32                        *Flag // GBL_EFI_PARTITION_BUFFER_FLAG
  );

typedef
EFI_STATUS
(EFIAPI *GBL_EFI_BOOT_MEMORY_SYNC_PARTITION_BUFFER)(
  IN GBL_EFI_BOOT_MEMORY_PROTOCOL *This,
  IN BOOLEAN                      SyncPreloaded
  );

typedef
EFI_STATUS
(EFIAPI *GBL_EFI_BOOT_MEMORY_GET_BOOT_BUFFER)(
  IN GBL_EFI_BOOT_MEMORY_PROTOCOL *This,
  IN UINT32                       BufType, // GBL_EFI_BOOT_BUFFER_TYPE
  OUT UINTN                       *Size,
  OUT VOID                        **Addr
  );

struct _GBL_EFI_BOOT_MEMORY_PROTOCOL {
  UINT64                                       Revision;
  GBL_EFI_BOOT_MEMORY_GET_PARTITION_BUFFER     GetPartitionBuffer;
  GBL_EFI_BOOT_MEMORY_SYNC_PARTITION_BUFFER    SyncPartitionBuffer;
  GBL_EFI_BOOT_MEMORY_GET_BOOT_BUFFER          GetBootBuffer;
};

extern EFI_GUID  gGblEfiBootMemoryProtocolGuid;