2 The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements
3 of the UEFI specification as it is designed to implement an embedded systmes
4 propriatary boot scheme.
6 This template assume a DXE driver produces a SerialIo protocol not using the EFI
7 driver module and it will attempt to connect a console on top of this.
10 Copyright (c) 2009, Apple Inc. All rights reserved.<BR>
12 This program and the accompanying materials
13 are licensed and made available under the terms and conditions of the BSD License
14 which accompanies this distribution. The full text of the license may be found at
15 http://opensource.org/licenses/bsd-license.php
17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
26 FindApplicationMatchingUiSection (
28 OUT EFI_HANDLE
*FvHandle
,
29 OUT EFI_GUID
*NameGuid
33 EFI_STATUS NextStatus
;
37 EFI_FV_FILETYPE FileType
;
38 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
40 EFI_FV_FILE_ATTRIBUTES Attributes
;
44 UINT32 Authentication
;
48 if (UiString
!= NULL
) {
49 DEBUG ((DEBUG_ERROR
, "UiString %s\n", UiString
));
50 UiStringLen
= StrLen (UiString
);
53 Status
= gBS
->LocateHandleBuffer (ByProtocol
, &gEfiFirmwareVolume2ProtocolGuid
, NULL
, &NoHandles
, &Buffer
);
54 if (!EFI_ERROR (Status
)) {
55 for (Index
= 0; Index
< NoHandles
; Index
++) {
56 Status
= gBS
->HandleProtocol (Buffer
[Index
], &gEfiFirmwareVolume2ProtocolGuid
, (VOID
**)&Fv
);
57 if (!EFI_ERROR (Status
)) {
58 Key
= AllocatePool (Fv
->KeySize
);
60 ZeroMem (Key
, Fv
->KeySize
);
62 FileType
= EFI_FV_FILETYPE_APPLICATION
;
65 NextStatus
= Fv
->GetNextFile (Fv
, Key
, &FileType
, NameGuid
, &Attributes
, &Size
);
66 if (!EFI_ERROR (NextStatus
)) {
67 if (UiString
== NULL
) {
69 // If UiString is NULL match first application we find.
71 *FvHandle
= Buffer
[Index
];
77 Status
= Fv
->ReadSection (
80 EFI_SECTION_USER_INTERFACE
,
86 if (!EFI_ERROR (Status
)) {
87 if (StrnCmp (UiString
, UiSection
, UiStringLen
) == 0) {
89 // We found a UiString match.
91 *FvHandle
= Buffer
[Index
];
99 } while (!EFI_ERROR (NextStatus
));
108 return EFI_NOT_FOUND
;
114 IN EFI_HANDLE FvHandle
,
115 IN EFI_GUID
*NameGuid
118 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
119 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH NewNode
;
121 DevicePath
= DevicePathFromHandle (FvHandle
);
123 EfiInitializeFwVolDevicepathNode (&NewNode
, NameGuid
);
125 return AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&NewNode
);
131 LoadPeCoffSectionFromFv (
132 IN EFI_HANDLE FvHandle
,
133 IN EFI_GUID
*NameGuid
137 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
138 EFI_HANDLE ImageHandle
;
140 DevicePath
= FvFileDevicePath (FvHandle
, NameGuid
);
142 Status
= gBS
->LoadImage (TRUE
, gImageHandle
, DevicePath
, NULL
, 0, &ImageHandle
);
143 if (!EFI_ERROR (Status
)) {
144 PERF_END (NULL
, "BDS", NULL
, 0);
145 Status
= gBS
->StartImage (ImageHandle
, NULL
, NULL
);