]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/SetupBrowser.c
Bug fixes for FrameworkHiiToUefiHiiThunk;
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / FrameworkHiiToUefiHiiThunk / SetupBrowser.c
1 /**@file
2 Framework to UEFI 2.1 Setup Browser Thunk. The file consume EFI_FORM_BROWSER2_PROTOCOL
3 to produce a EFI_FORM_BROWSER_PROTOCOL.
4
5 Copyright (c) 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #include "HiiDatabase.h"
17
18 EFI_STATUS
19 EFIAPI
20 ThunkSendForm (
21 IN EFI_FORM_BROWSER_PROTOCOL *This,
22 IN BOOLEAN UseDatabase,
23 IN FRAMEWORK_EFI_HII_HANDLE *Handle,
24 IN UINTN HandleCount,
25 IN FRAMEWORK_EFI_IFR_PACKET *Packet, OPTIONAL
26 IN EFI_HANDLE CallbackHandle, OPTIONAL
27 IN UINT8 *NvMapOverride, OPTIONAL
28 IN FRAMEWORK_EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
29 OUT BOOLEAN *ResetRequired OPTIONAL
30 )
31 {
32 EFI_STATUS Status;
33 EFI_BROWSER_ACTION_REQUEST ActionRequest;
34 HII_THUNK_CONTEXT *ThunkContext;
35 HII_THUNK_PRIVATE_DATA *Private;
36 EFI_FORMBROWSER_THUNK_PRIVATE_DATA *BrowserPrivate;
37
38 if (!UseDatabase) {
39 //
40 // Packet, CallbackHandle.
41 //
42 return EFI_UNSUPPORTED;
43 }
44
45 if (HandleCount != 1 ) {
46 return EFI_UNSUPPORTED;
47 }
48
49 BrowserPrivate = EFI_FORMBROWSER_THUNK_PRIVATE_DATA_FROM_THIS (This);
50 Private = BrowserPrivate->ThunkPrivate;
51
52 ThunkContext = FwHiiHandleToThunkContext (Private, *Handle);
53 if (ThunkContext == NULL) {
54 return EFI_INVALID_PARAMETER;
55 }
56
57 if (NvMapOverride != NULL) {
58 ThunkContext->NvMapOverride = NvMapOverride;
59 }
60
61 Status = mFormBrowser2Protocol->SendForm (
62 mFormBrowser2Protocol,
63 &ThunkContext->UefiHiiHandle,
64 1,
65 NULL,
66 0,
67 (EFI_SCREEN_DESCRIPTOR *) ScreenDimensions,
68 &ActionRequest
69 );
70
71 if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
72 *ResetRequired = TRUE;
73 }
74
75 return Status;
76 }
77
78 EFI_STATUS
79 EFIAPI
80 ThunkCreatePopUp (
81 IN UINTN NumberOfLines,
82 IN BOOLEAN HotKey,
83 IN UINTN MaximumStringSize,
84 OUT CHAR16 *StringBuffer,
85 OUT EFI_INPUT_KEY *KeyValue,
86 IN CHAR16 *String,
87 ...
88 )
89 {
90 EFI_STATUS Status;
91 VA_LIST Marker;
92
93 if (HotKey != TRUE) {
94 return EFI_UNSUPPORTED;
95 }
96
97 VA_START (Marker, KeyValue);
98
99 Status = IfrLibCreatePopUp2 (NumberOfLines, KeyValue, Marker);
100
101 VA_END (Marker);
102
103 return Status;
104 }
105