Home | History | Annotate | Download | only in FvbServicesRuntimeDxe
      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 FvbReadBlock (
     76   IN UINTN                                Instance,
     77   IN EFI_LBA                              Lba,
     78   IN UINTN                                BlockOffset,
     79   IN OUT UINTN                            *NumBytes,
     80   IN UINT8                                *Buffer,
     81   IN ESAL_FWB_GLOBAL                      *Global,
     82   IN BOOLEAN                              Virtual
     83   );
     84 
     85 EFI_STATUS
     86 FvbWriteBlock (
     87   IN UINTN                                Instance,
     88   IN CONST EFI_LBA                              Lba,
     89   IN CONST UINTN                                BlockOffset,
     90   IN OUT UINTN                            *NumBytes,
     91   IN CONST UINT8                                *Buffer,
     92   IN ESAL_FWB_GLOBAL                      *Global,
     93   IN BOOLEAN                              Virtual
     94   );
     95 
     96 EFI_STATUS
     97 FvbEraseBlock (
     98   IN UINTN                                Instance,
     99   IN EFI_LBA                              Lba,
    100   IN ESAL_FWB_GLOBAL                      *Global,
    101   IN BOOLEAN                              Virtual
    102   );
    103 
    104 EFI_STATUS
    105 FvbSetVolumeAttributes (
    106   IN UINTN                                Instance,
    107   IN OUT EFI_FVB_ATTRIBUTES_2             *Attributes,
    108   IN ESAL_FWB_GLOBAL                      *Global,
    109   IN BOOLEAN                              Virtual
    110   );
    111 
    112 EFI_STATUS
    113 FvbGetVolumeAttributes (
    114   IN UINTN                                Instance,
    115   OUT EFI_FVB_ATTRIBUTES_2                *Attributes,
    116   IN ESAL_FWB_GLOBAL                      *Global,
    117   IN BOOLEAN                              Virtual
    118   );
    119 
    120 EFI_STATUS
    121 FvbGetPhysicalAddress (
    122   IN UINTN                                Instance,
    123   OUT EFI_PHYSICAL_ADDRESS                *Address,
    124   IN ESAL_FWB_GLOBAL                      *Global,
    125   IN BOOLEAN                              Virtual
    126   );
    127 
    128 EFI_STATUS
    129 EFIAPI
    130 FvbInitialize (
    131   IN EFI_HANDLE         ImageHandle,
    132   IN EFI_SYSTEM_TABLE   *SystemTable
    133   );
    134 
    135 
    136 VOID
    137 EFIAPI
    138 FvbClassAddressChangeEvent (
    139   IN EFI_EVENT        Event,
    140   IN VOID             *Context
    141   );
    142 
    143 EFI_STATUS
    144 FvbGetLbaAddress (
    145   IN  UINTN                               Instance,
    146   IN  EFI_LBA                             Lba,
    147   OUT UINTN                               *LbaAddress,
    148   OUT UINTN                               *LbaLength,
    149   OUT UINTN                               *NumOfBlocks,
    150   IN  ESAL_FWB_GLOBAL                     *Global,
    151   IN  BOOLEAN                             Virtual
    152   );
    153 
    154 //
    155 // Protocol APIs
    156 //
    157 EFI_STATUS
    158 EFIAPI
    159 FvbProtocolGetAttributes (
    160   IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,
    161   OUT EFI_FVB_ATTRIBUTES_2                              *Attributes
    162   );
    163 
    164 EFI_STATUS
    165 EFIAPI
    166 FvbProtocolSetAttributes (
    167   IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,
    168   IN OUT EFI_FVB_ATTRIBUTES_2                           *Attributes
    169   );
    170 
    171 EFI_STATUS
    172 EFIAPI
    173 FvbProtocolGetPhysicalAddress (
    174   IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,
    175   OUT EFI_PHYSICAL_ADDRESS                        *Address
    176   );
    177 
    178 EFI_STATUS
    179 EFIAPI
    180 FvbProtocolGetBlockSize (
    181   IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,
    182   IN CONST EFI_LBA                                     Lba,
    183   OUT UINTN                                       *BlockSize,
    184   OUT UINTN                                       *NumOfBlocks
    185   );
    186 
    187 EFI_STATUS
    188 EFIAPI
    189 FvbProtocolRead (
    190   IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,
    191   IN CONST EFI_LBA                                      Lba,
    192   IN CONST UINTN                                        Offset,
    193   IN OUT UINTN                                    *NumBytes,
    194   IN UINT8                                        *Buffer
    195   );
    196 
    197 EFI_STATUS
    198 EFIAPI
    199 FvbProtocolWrite (
    200   IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,
    201   IN       EFI_LBA                                      Lba,
    202   IN       UINTN                                        Offset,
    203   IN OUT   UINTN                                        *NumBytes,
    204   IN       UINT8                                        *Buffer
    205   );
    206 
    207 EFI_STATUS
    208 EFIAPI
    209 FvbProtocolEraseBlocks (
    210   IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    *This,
    211   ...
    212   );
    213 
    214 #endif
    215