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