1 /*++ 2 3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR> 4 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 typedef struct _EFI_FORM_CALLBACK_PROTOCOL EFI_FORM_CALLBACK_PROTOCOL; 40 41 #define RESET_REQUIRED 1 // Flags setting to signify that the callback operation resulted in an eventual 42 // reset to be done upon exit of the browser 43 // 44 #define EXIT_REQUIRED 2 // Flags setting to signify that after the processing of the callback results - exit the browser 45 #define SAVE_REQUIRED 4 // Flags setting to signify that after the processing of the callback results - save the NV data 46 #define NV_CHANGED 8 // Flags setting to signify that after the processing of the callback results - turn the NV flag on 47 #define NV_NOT_CHANGED 16 // Flags setting to signify that after the processing of the callback results - turn the NV flag off 48 #pragma pack(1) 49 typedef struct { 50 UINT8 OpCode; // Likely a string, numeric, or one-of 51 UINT8 Length; // Length of the EFI_IFR_DATA_ENTRY packet 52 UINT16 Flags; // Flags settings to determine what behavior is desired from the browser after the callback 53 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 54 // If the OpCode is a OneOf or Numeric type - Data is a UINT16 value 55 // If the OpCode is a String type - Data is a CHAR16[x] type 56 // If the OpCode is a Checkbox type - Data is a UINT8 value 57 // If the OpCode is a NV Access type - Data is a EFI_IFR_NV_DATA structure 58 // 59 } EFI_IFR_DATA_ENTRY; 60 61 typedef struct { 62 VOID *NvRamMap; // If the flag of the op-code specified retrieval of a copy of the NVRAM map, 63 // this is a pointer to a buffer copy 64 // 65 UINT32 EntryCount; // How many EFI_IFR_DATA_ENTRY entries 66 EFI_IFR_DATA_ENTRY Data[1]; // The in-line Data entries. 67 } EFI_IFR_DATA_ARRAY; 68 69 typedef union { 70 EFI_IFR_DATA_ARRAY DataArray; // Primarily used by those who call back to their drivers and use HII as a repository 71 EFI_IFR_PACKET DataPacket; // Primarily used by those which do not use HII as a repository 72 CHAR16 String[1]; // If returning an error - fill the string with null-terminated contents 73 } EFI_HII_CALLBACK_PACKET; 74 #pragma pack() 75 // 76 // The following types are currently defined: 77 // 78 typedef 79 EFI_STATUS 80 (EFIAPI *EFI_NV_READ) ( 81 IN EFI_FORM_CALLBACK_PROTOCOL * This, 82 IN CHAR16 *VariableName, 83 IN EFI_GUID * VendorGuid, 84 OUT UINT32 *Attributes OPTIONAL, 85 IN OUT UINTN *DataSize, 86 OUT VOID *Buffer 87 ); 88 89 typedef 90 EFI_STATUS 91 (EFIAPI *EFI_NV_WRITE) ( 92 IN EFI_FORM_CALLBACK_PROTOCOL * This, 93 IN CHAR16 *VariableName, 94 IN EFI_GUID * VendorGuid, 95 IN UINT32 Attributes, 96 IN UINTN DataSize, 97 IN VOID *Buffer, 98 OUT BOOLEAN *ResetRequired 99 ); 100 101 typedef 102 EFI_STATUS 103 (EFIAPI *EFI_FORM_CALLBACK) ( 104 IN EFI_FORM_CALLBACK_PROTOCOL * This, 105 IN UINT16 KeyValue, 106 IN EFI_IFR_DATA_ARRAY * Data, 107 OUT EFI_HII_CALLBACK_PACKET **Packet 108 ); 109 110 struct _EFI_FORM_CALLBACK_PROTOCOL { 111 EFI_NV_READ NvRead; 112 EFI_NV_WRITE NvWrite; 113 EFI_FORM_CALLBACK Callback; 114 }; 115 116 extern EFI_GUID gEfiFormCallbackProtocolGuid; 117 118 #endif 119