1 #pragma once 2 /*++ 3 4 Copyright (c) 1998 Intel Corporation 5 6 Module Name: 7 8 Abstract: 9 10 11 12 Revision History 13 14 --*/ 15 16 17 18 // 19 // The variable store protocol interface is specific to the reference 20 // implementation. The initialization code adds variable store devices 21 // to the system, and the FW connects to the devices to provide the 22 // variable store interfaces through these devices. 23 // 24 25 // 26 // Variable Store Device protocol 27 // 28 29 #define VARIABLE_STORE_PROTOCOL \ 30 { 0xf088cd91, 0xa046, 0x11d2, {0x8e, 0x42, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 31 32 INTERFACE_DECL(_EFI_VARIABLE_STORE); 33 34 typedef 35 EFI_STATUS 36 (EFIAPI *EFI_STORE_CLEAR) ( 37 IN struct _EFI_VARIABLE_STORE *This, 38 IN UINTN BankNo, 39 IN OUT VOID *Scratch 40 ); 41 42 43 typedef 44 EFI_STATUS 45 (EFIAPI *EFI_STORE_READ) ( 46 IN struct _EFI_VARIABLE_STORE *This, 47 IN UINTN BankNo, 48 IN UINTN Offset, 49 IN UINTN BufferSize, 50 OUT VOID *Buffer 51 ); 52 53 typedef 54 EFI_STATUS 55 (EFIAPI *EFI_STORE_UPDATE) ( 56 IN struct _EFI_VARIABLE_STORE *This, 57 IN UINTN BankNo, 58 IN UINTN Offset, 59 IN UINTN BufferSize, 60 IN VOID *Buffer 61 ); 62 63 typedef 64 EFI_STATUS 65 (EFIAPI *EFI_STORE_SIZE) ( 66 IN struct _EFI_VARIABLE_STORE *This, 67 IN UINTN NoBanks 68 ); 69 70 typedef 71 EFI_STATUS 72 (EFIAPI *EFI_TRANSACTION_UPDATE) ( 73 IN struct _EFI_VARIABLE_STORE *This, 74 IN UINTN BankNo, 75 IN VOID *NewContents 76 ); 77 78 typedef struct _EFI_VARIABLE_STORE { 79 80 // 81 // Number of banks and bank size 82 // 83 84 UINT32 Attributes; 85 UINT32 BankSize; 86 UINT32 NoBanks; 87 88 // 89 // Functions to access the storage banks 90 // 91 92 EFI_STORE_CLEAR ClearStore; 93 EFI_STORE_READ ReadStore; 94 EFI_STORE_UPDATE UpdateStore; 95 EFI_STORE_SIZE SizeStore OPTIONAL; 96 EFI_TRANSACTION_UPDATE TransactionUpdate OPTIONAL; 97 98 } EFI_VARIABLE_STORE; 99 100 101 // 102 // 103 // ClearStore() - A function to clear the requested storage bank. A cleared 104 // bank contains all "on" bits. 105 // 106 // ReadStore() - Read data from the requested store. 107 // 108 // UpdateStore() - Updates data on the requested store. The FW will only 109 // ever issue updates to clear bits in the store. Updates must be 110 // performed in LSb to MSb order of the update buffer. 111 // 112 // SizeStore() - An optional function for non-runtime stores that can be 113 // dynamically sized. The FW will only ever increase or decrease the store 114 // by 1 banksize at a time, and it is always adding or removing a bank from 115 // the end of the store. 116 // 117 // By default the FW will update variables and storage banks in an 118 // "atomic" manner by keeping 1 old copy of the data during an update, 119 // and recovering appropiately if the power is lost during the middle 120 // of an operation. To do this the FW needs to have multiple banks 121 // of storage dedicated to its use. If that's not possible, the driver 122 // can implement an atomic bank update function and the FW will allow 123 // 1 bank in this case. (It will allow any number of banks, 124 // but it won't require an "extra" bank to provide its bank transaction 125 // function). 126 // 127 // TransactionUpdate() - An optional function that can clear & update an 128 // entire bank in an "atomic" fashion. If the operation fails in the 129 // middle the driver is responsible for having either the previous copy 130 // of the bank's data or the new copy. A copy that's partially written 131 // is not valid as internal data settings may get lost. Supply this 132 // function only when needed. 133 // 134 135