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