]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h
ArmPlatformPkg: ASSERT that PcdSystemMemoryBase does not exceed MAX_ADDRESS
[mirror_edk2.git] / OvmfPkg / QemuFlashFvbServicesRuntimeDxe / FwBlockService.h
1 /**@file
2
3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 FwBlockService.h
15
16 Abstract:
17
18 Firmware volume block driver for Intel Firmware Hub (FWH) device
19
20 **/
21
22 #ifndef _FW_BLOCK_SERVICE_H
23 #define _FW_BLOCK_SERVICE_H
24
25 //
26 // BugBug: Add documentation here for data structure!!!!
27 //
28 #define FVB_PHYSICAL 0
29 #define FVB_VIRTUAL 1
30
31 typedef struct {
32 EFI_LOCK FvbDevLock;
33 UINTN FvBase[2];
34 UINTN NumOfBlocks;
35 EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
36 } EFI_FW_VOL_INSTANCE;
37
38 typedef struct {
39 UINT32 NumFv;
40 EFI_FW_VOL_INSTANCE *FvInstance[2];
41 UINT8 *FvbScratchSpace[2];
42 } ESAL_FWB_GLOBAL;
43
44 //
45 // Fvb Protocol instance data
46 //
47 #define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
48 #define FVB_EXTEND_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FvbExtension, FVB_DEVICE_SIGNATURE)
49 #define FVB_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'V', 'B', 'N')
50
51 typedef struct {
52 MEDIA_FW_VOL_DEVICE_PATH FvDevPath;
53 EFI_DEVICE_PATH_PROTOCOL EndDevPath;
54 } FV_PIWG_DEVICE_PATH;
55
56 typedef struct {
57 MEMMAP_DEVICE_PATH MemMapDevPath;
58 EFI_DEVICE_PATH_PROTOCOL EndDevPath;
59 } FV_MEMMAP_DEVICE_PATH;
60
61 typedef struct {
62 UINTN Signature;
63 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
64 UINTN Instance;
65 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
66 } EFI_FW_VOL_BLOCK_DEVICE;
67
68 EFI_STATUS
69 GetFvbInfo (
70 IN UINT64 FvLength,
71 OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
72 );
73
74 EFI_STATUS
75 FvbSetVolumeAttributes (
76 IN UINTN Instance,
77 IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
78 IN ESAL_FWB_GLOBAL *Global,
79 IN BOOLEAN Virtual
80 );
81
82 EFI_STATUS
83 FvbGetVolumeAttributes (
84 IN UINTN Instance,
85 OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
86 IN ESAL_FWB_GLOBAL *Global,
87 IN BOOLEAN Virtual
88 );
89
90 EFI_STATUS
91 FvbGetPhysicalAddress (
92 IN UINTN Instance,
93 OUT EFI_PHYSICAL_ADDRESS *Address,
94 IN ESAL_FWB_GLOBAL *Global,
95 IN BOOLEAN Virtual
96 );
97
98 EFI_STATUS
99 EFIAPI
100 FvbInitialize (
101 IN EFI_HANDLE ImageHandle,
102 IN EFI_SYSTEM_TABLE *SystemTable
103 );
104
105
106 VOID
107 EFIAPI
108 FvbClassAddressChangeEvent (
109 IN EFI_EVENT Event,
110 IN VOID *Context
111 );
112
113 EFI_STATUS
114 FvbGetLbaAddress (
115 IN UINTN Instance,
116 IN EFI_LBA Lba,
117 OUT UINTN *LbaAddress,
118 OUT UINTN *LbaLength,
119 OUT UINTN *NumOfBlocks,
120 IN ESAL_FWB_GLOBAL *Global,
121 IN BOOLEAN Virtual
122 );
123
124 //
125 // Protocol APIs
126 //
127 EFI_STATUS
128 EFIAPI
129 FvbProtocolGetAttributes (
130 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
131 OUT EFI_FVB_ATTRIBUTES_2 *Attributes
132 );
133
134 EFI_STATUS
135 EFIAPI
136 FvbProtocolSetAttributes (
137 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
138 IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
139 );
140
141 EFI_STATUS
142 EFIAPI
143 FvbProtocolGetPhysicalAddress (
144 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
145 OUT EFI_PHYSICAL_ADDRESS *Address
146 );
147
148 EFI_STATUS
149 EFIAPI
150 FvbProtocolGetBlockSize (
151 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
152 IN CONST EFI_LBA Lba,
153 OUT UINTN *BlockSize,
154 OUT UINTN *NumOfBlocks
155 );
156
157 EFI_STATUS
158 EFIAPI
159 FvbProtocolRead (
160 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
161 IN CONST EFI_LBA Lba,
162 IN CONST UINTN Offset,
163 IN OUT UINTN *NumBytes,
164 IN UINT8 *Buffer
165 );
166
167 EFI_STATUS
168 EFIAPI
169 FvbProtocolWrite (
170 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
171 IN EFI_LBA Lba,
172 IN UINTN Offset,
173 IN OUT UINTN *NumBytes,
174 IN UINT8 *Buffer
175 );
176
177 EFI_STATUS
178 EFIAPI
179 FvbProtocolEraseBlocks (
180 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
181 ...
182 );
183
184 #endif