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