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