]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Framework/Protocol/FormCallback/FormCallback.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Framework / Protocol / FormCallback / FormCallback.h
1 /*++
2
3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 FormCallback.h
15
16 Abstract:
17
18 The EFI_FORM_CALLBACK_PROTOCOL is the defined interface for access to custom
19 NV storage devices as well as communication of user selections in a more
20 interactive environment. This protocol should be published by hardware
21 specific drivers which want to export access to custom hardware storage or
22 publish IFR which has a requirement to call back the original driver.
23
24 --*/
25
26 #ifndef _FORM_CALLBACK_H_
27 #define _FORM_CALLBACK_H_
28
29 #include EFI_PROTOCOL_DEFINITION (FormBrowser)
30
31 #define EFI_FORM_CALLBACK_PROTOCOL_GUID \
32 { \
33 0xf3e4543d, 0xcf35, 0x6cef, 0x35, 0xc4, 0x4f, 0xe6, 0x34, 0x4d, 0xfc, 0x54 \
34 }
35
36 //
37 // Forward reference for pure ANSI compatability
38 //
39 EFI_FORWARD_DECLARATION (EFI_FORM_CALLBACK_PROTOCOL);
40
41 typedef struct _EFI_FORM_CALLBACK_PROTOCOL EFI_FORM_CALLBACK_PROTOCOL;
42
43 #define RESET_REQUIRED 1 // Flags setting to signify that the callback operation resulted in an eventual
44 // reset to be done upon exit of the browser
45 //
46 #define EXIT_REQUIRED 2 // Flags setting to signify that after the processing of the callback results - exit the browser
47 #define SAVE_REQUIRED 4 // Flags setting to signify that after the processing of the callback results - save the NV data
48 #define NV_CHANGED 8 // Flags setting to signify that after the processing of the callback results - turn the NV flag on
49 #define NV_NOT_CHANGED 16 // Flags setting to signify that after the processing of the callback results - turn the NV flag off
50 #pragma pack(1)
51 typedef struct {
52 UINT8 OpCode; // Likely a string, numeric, or one-of
53 UINT8 Length; // Length of the EFI_IFR_DATA_ENTRY packet
54 UINT16 Flags; // Flags settings to determine what behavior is desired from the browser after the callback
55 VOID *Data; // The data in the form based on the op-code type - this is not a pointer to the data, the data follows immediately
56 // If the OpCode is a OneOf or Numeric type - Data is a UINT16 value
57 // If the OpCode is a String type - Data is a CHAR16[x] type
58 // If the OpCode is a Checkbox type - Data is a UINT8 value
59 // If the OpCode is a NV Access type - Data is a EFI_IFR_NV_DATA structure
60 //
61 } EFI_IFR_DATA_ENTRY;
62
63 typedef struct {
64 VOID *NvRamMap; // If the flag of the op-code specified retrieval of a copy of the NVRAM map,
65 // this is a pointer to a buffer copy
66 //
67 UINT32 EntryCount; // How many EFI_IFR_DATA_ENTRY entries
68 EFI_IFR_DATA_ENTRY Data[1]; // The in-line Data entries.
69 } EFI_IFR_DATA_ARRAY;
70
71 typedef union {
72 EFI_IFR_DATA_ARRAY DataArray; // Primarily used by those who call back to their drivers and use HII as a repository
73 EFI_IFR_PACKET DataPacket; // Primarily used by those which do not use HII as a repository
74 CHAR16 String[1]; // If returning an error - fill the string with null-terminated contents
75 } EFI_HII_CALLBACK_PACKET;
76 #pragma pack()
77 //
78 // The following types are currently defined:
79 //
80 typedef
81 EFI_STATUS
82 (EFIAPI *EFI_NV_READ) (
83 IN EFI_FORM_CALLBACK_PROTOCOL * This,
84 IN CHAR16 *VariableName,
85 IN EFI_GUID * VendorGuid,
86 OUT UINT32 *Attributes OPTIONAL,
87 IN OUT UINTN *DataSize,
88 OUT VOID *Buffer
89 );
90
91 typedef
92 EFI_STATUS
93 (EFIAPI *EFI_NV_WRITE) (
94 IN EFI_FORM_CALLBACK_PROTOCOL * This,
95 IN CHAR16 *VariableName,
96 IN EFI_GUID * VendorGuid,
97 IN UINT32 Attributes,
98 IN UINTN DataSize,
99 IN VOID *Buffer,
100 OUT BOOLEAN *ResetRequired
101 );
102
103 typedef
104 EFI_STATUS
105 (EFIAPI *EFI_FORM_CALLBACK) (
106 IN EFI_FORM_CALLBACK_PROTOCOL * This,
107 IN UINT16 KeyValue,
108 IN EFI_IFR_DATA_ARRAY * Data,
109 OUT EFI_HII_CALLBACK_PACKET **Packet
110 );
111
112 typedef struct _EFI_FORM_CALLBACK_PROTOCOL {
113 EFI_NV_READ NvRead;
114 EFI_NV_WRITE NvWrite;
115 EFI_FORM_CALLBACK Callback;
116 } EFI_FORM_CALLBACK_PROTOCOL;
117
118 extern EFI_GUID gEfiFormCallbackProtocolGuid;
119
120 #endif