TianoCore EDK2 master
Loading...
Searching...
No Matches
Fvb.h
1/*++
2
3Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4SPDX-License-Identifier: BSD-2-Clause-Patent
5
6Module Name:
7
8 FwBlockService.h
9
10Abstract:
11
12 Firmware volume block driver for Intel Firmware Hub (FWH) device
13
14--*/
15
16#ifndef _FW_BLOCK_SERVICE_H
17#define _FW_BLOCK_SERVICE_H
18
19//
20// Fvb Protocol instance data
21//
22#define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
23#define FVB_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'V', 'B', 'N')
24
25#pragma pack (1)
26
27typedef struct {
29 EFI_FV_BLOCK_MAP_ENTRY EndBlockMap;
32
33typedef struct {
34 MEMMAP_DEVICE_PATH MemMapDevPath;
35 EFI_DEVICE_PATH_PROTOCOL EndDevPath;
37
38#pragma pack ()
39
40typedef struct {
41 UINTN Signature;
42 FV_DEVICE_PATH DevicePath;
43 VOID *BufferPtr;
44 UINTN BlockSize;
45 UINTN Size;
46 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
48
49//
50// Constants
51//
52#define EMU_FVB_BLOCK_SIZE \
53 EFI_PAGE_SIZE
54#define EMU_FVB_NUM_SPARE_BLOCKS \
55 EFI_SIZE_TO_PAGES ((UINTN)FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
56#define EMU_FVB_NUM_TOTAL_BLOCKS \
57 (2 * EMU_FVB_NUM_SPARE_BLOCKS)
58#define EMU_FVB_SIZE \
59 (EMU_FVB_NUM_TOTAL_BLOCKS * EMU_FVB_BLOCK_SIZE)
60#define FTW_WRITE_QUEUE_SIZE \
61 (FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) - \
62 sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER))
63#define EMU_FV_HEADER_LENGTH OFFSET_OF (FVB_FV_HDR_AND_VARS_TEMPLATE, VarHdr)
64
65#define NOT_ERASED_BIT 0
66#define ERASED_BIT 1
67#define ERASED_UINT8 0xff
68#define ERASED_UINT32 0xffffffff
69
70//
71// Protocol APIs
72//
74EFIAPI
75FvbProtocolGetAttributes (
77 OUT EFI_FVB_ATTRIBUTES_2 *Attributes
78 )
79;
80
82EFIAPI
83FvbProtocolSetAttributes (
85 IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
86 )
87;
88
90EFIAPI
91FvbProtocolGetPhysicalAddress (
94 )
95;
96
98EFIAPI
99FvbProtocolGetBlockSize (
101 IN EFI_LBA Lba,
102 OUT UINTN *BlockSize,
103 OUT UINTN *NumberOfBlocks
104 )
105;
106
108EFIAPI
109FvbProtocolRead (
111 IN EFI_LBA Lba,
112 IN UINTN Offset,
113 IN OUT UINTN *NumBytes,
114 IN OUT UINT8 *Buffer
115 )
116;
117
119EFIAPI
120FvbProtocolWrite (
122 IN EFI_LBA Lba,
123 IN UINTN Offset,
124 IN OUT UINTN *NumBytes,
125 IN UINT8 *Buffer
126 )
127;
128
130EFIAPI
131FvbProtocolEraseBlocks (
133 ...
134 )
135;
136
137#endif
UINT64 UINTN
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT32 EFI_FVB_ATTRIBUTES_2
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
UINT64 EFI_LBA
Definition: UefiBaseType.h:45
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29