1 | /**@file
|
---|
2 |
|
---|
3 | Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
---|
4 |
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | Module Name:
|
---|
8 |
|
---|
9 | FwBlockService.h
|
---|
10 |
|
---|
11 | Abstract:
|
---|
12 |
|
---|
13 | Firmware volume block driver for Intel Firmware Hub (FWH) device
|
---|
14 |
|
---|
15 | **/
|
---|
16 |
|
---|
17 | #ifndef _FW_BLOCK_SERVICE_H
|
---|
18 | #define _FW_BLOCK_SERVICE_H
|
---|
19 |
|
---|
20 | typedef struct {
|
---|
21 | UINTN FvBase;
|
---|
22 | UINTN NumOfBlocks;
|
---|
23 | EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
|
---|
24 | } EFI_FW_VOL_INSTANCE;
|
---|
25 |
|
---|
26 | typedef struct {
|
---|
27 | UINT32 NumFv;
|
---|
28 | EFI_FW_VOL_INSTANCE *FvInstance;
|
---|
29 | } ESAL_FWB_GLOBAL;
|
---|
30 |
|
---|
31 | extern ESAL_FWB_GLOBAL *mFvbModuleGlobal;
|
---|
32 |
|
---|
33 | //
|
---|
34 | // Fvb Protocol instance data
|
---|
35 | //
|
---|
36 | #define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE,\
|
---|
37 | FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
|
---|
38 |
|
---|
39 | #define FVB_EXTEND_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE,\
|
---|
40 | FvbExtension, FVB_DEVICE_SIGNATURE)
|
---|
41 |
|
---|
42 | #define FVB_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'V', 'B', 'N')
|
---|
43 |
|
---|
44 | typedef struct {
|
---|
45 | MEDIA_FW_VOL_DEVICE_PATH FvDevPath;
|
---|
46 | EFI_DEVICE_PATH_PROTOCOL EndDevPath;
|
---|
47 | } FV_PIWG_DEVICE_PATH;
|
---|
48 |
|
---|
49 | typedef struct {
|
---|
50 | MEMMAP_DEVICE_PATH MemMapDevPath;
|
---|
51 | EFI_DEVICE_PATH_PROTOCOL EndDevPath;
|
---|
52 | } FV_MEMMAP_DEVICE_PATH;
|
---|
53 |
|
---|
54 | typedef struct {
|
---|
55 | UINTN Signature;
|
---|
56 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
57 | UINTN Instance;
|
---|
58 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
|
---|
59 | } EFI_FW_VOL_BLOCK_DEVICE;
|
---|
60 |
|
---|
61 | EFI_STATUS
|
---|
62 | GetFvbInfo (
|
---|
63 | IN UINT64 FvLength,
|
---|
64 | OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
|
---|
65 | );
|
---|
66 |
|
---|
67 | EFI_STATUS
|
---|
68 | FvbSetVolumeAttributes (
|
---|
69 | IN UINTN Instance,
|
---|
70 | IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
|
---|
71 | IN ESAL_FWB_GLOBAL *Global
|
---|
72 | );
|
---|
73 |
|
---|
74 | EFI_STATUS
|
---|
75 | FvbGetVolumeAttributes (
|
---|
76 | IN UINTN Instance,
|
---|
77 | OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
|
---|
78 | IN ESAL_FWB_GLOBAL *Global
|
---|
79 | );
|
---|
80 |
|
---|
81 | EFI_STATUS
|
---|
82 | FvbGetPhysicalAddress (
|
---|
83 | IN UINTN Instance,
|
---|
84 | OUT EFI_PHYSICAL_ADDRESS *Address,
|
---|
85 | IN ESAL_FWB_GLOBAL *Global
|
---|
86 | );
|
---|
87 |
|
---|
88 | EFI_STATUS
|
---|
89 | EFIAPI
|
---|
90 | FvbInitialize (
|
---|
91 | IN EFI_HANDLE ImageHandle,
|
---|
92 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
93 | );
|
---|
94 |
|
---|
95 | VOID
|
---|
96 | EFIAPI
|
---|
97 | FvbClassAddressChangeEvent (
|
---|
98 | IN EFI_EVENT Event,
|
---|
99 | IN VOID *Context
|
---|
100 | );
|
---|
101 |
|
---|
102 | EFI_STATUS
|
---|
103 | FvbGetLbaAddress (
|
---|
104 | IN UINTN Instance,
|
---|
105 | IN EFI_LBA Lba,
|
---|
106 | OUT UINTN *LbaAddress,
|
---|
107 | OUT UINTN *LbaLength,
|
---|
108 | OUT UINTN *NumOfBlocks,
|
---|
109 | IN ESAL_FWB_GLOBAL *Global
|
---|
110 | );
|
---|
111 |
|
---|
112 | //
|
---|
113 | // Protocol APIs
|
---|
114 | //
|
---|
115 | EFI_STATUS
|
---|
116 | EFIAPI
|
---|
117 | FvbProtocolGetAttributes (
|
---|
118 | IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
---|
119 | OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
---|
120 | );
|
---|
121 |
|
---|
122 | EFI_STATUS
|
---|
123 | EFIAPI
|
---|
124 | FvbProtocolSetAttributes (
|
---|
125 | IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
---|
126 | IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
---|
127 | );
|
---|
128 |
|
---|
129 | EFI_STATUS
|
---|
130 | EFIAPI
|
---|
131 | FvbProtocolGetPhysicalAddress (
|
---|
132 | IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
---|
133 | OUT EFI_PHYSICAL_ADDRESS *Address
|
---|
134 | );
|
---|
135 |
|
---|
136 | EFI_STATUS
|
---|
137 | EFIAPI
|
---|
138 | FvbProtocolGetBlockSize (
|
---|
139 | IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
---|
140 | IN CONST EFI_LBA Lba,
|
---|
141 | OUT UINTN *BlockSize,
|
---|
142 | OUT UINTN *NumOfBlocks
|
---|
143 | );
|
---|
144 |
|
---|
145 | EFI_STATUS
|
---|
146 | EFIAPI
|
---|
147 | FvbProtocolRead (
|
---|
148 | IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
---|
149 | IN CONST EFI_LBA Lba,
|
---|
150 | IN CONST UINTN Offset,
|
---|
151 | IN OUT UINTN *NumBytes,
|
---|
152 | IN UINT8 *Buffer
|
---|
153 | );
|
---|
154 |
|
---|
155 | EFI_STATUS
|
---|
156 | EFIAPI
|
---|
157 | FvbProtocolWrite (
|
---|
158 | IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
---|
159 | IN EFI_LBA Lba,
|
---|
160 | IN UINTN Offset,
|
---|
161 | IN OUT UINTN *NumBytes,
|
---|
162 | IN UINT8 *Buffer
|
---|
163 | );
|
---|
164 |
|
---|
165 | EFI_STATUS
|
---|
166 | EFIAPI
|
---|
167 | FvbProtocolEraseBlocks (
|
---|
168 | IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
---|
169 | ...
|
---|
170 | );
|
---|
171 |
|
---|
172 | //
|
---|
173 | // The following functions have different implementations dependent on the
|
---|
174 | // module type chosen for building this driver.
|
---|
175 | //
|
---|
176 | VOID
|
---|
177 | InstallProtocolInterfaces (
|
---|
178 | IN EFI_FW_VOL_BLOCK_DEVICE *FvbDevice
|
---|
179 | );
|
---|
180 |
|
---|
181 | VOID
|
---|
182 | InstallVirtualAddressChangeHandler (
|
---|
183 | VOID
|
---|
184 | );
|
---|
185 |
|
---|
186 | EFI_STATUS
|
---|
187 | MarkIoMemoryRangeForRuntimeAccess (
|
---|
188 | IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
---|
189 | IN UINTN Length
|
---|
190 | );
|
---|
191 |
|
---|
192 | VOID
|
---|
193 | SetPcdFlashNvStorageBaseAddresses (
|
---|
194 | VOID
|
---|
195 | );
|
---|
196 |
|
---|
197 | #endif
|
---|