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