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