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.
11 Portions copyright (c) 2008-2009, Apple Inc. All rights reserved.
14 This document is the property of Apple, Inc.
15 It is considered confidential and proprietary.
17 This document may not be reproduced or transmitted in any form,
18 in whole or in part, without the express written permission of
27 FindApplicationMatchingUiSection (
29 OUT EFI_HANDLE
*FvHandle
,
30 OUT EFI_GUID
*NameGuid
34 EFI_STATUS NextStatus
;
38 EFI_FV_FILETYPE FileType
;
39 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
41 EFI_FV_FILE_ATTRIBUTES Attributes
;
45 UINT32 Authentication
;
49 if (UiString
!= NULL
) {
50 DEBUG ((DEBUG_ERROR
, "UiString %s\n", UiString
));
51 UiStringLen
= StrLen (UiString
);
54 Status
= gBS
->LocateHandleBuffer (ByProtocol
, &gEfiFirmwareVolume2ProtocolGuid
, NULL
, &NoHandles
, &Buffer
);
55 if (!EFI_ERROR (Status
)) {
56 for (Index
= 0; Index
< NoHandles
; Index
++) {
57 Status
= gBS
->HandleProtocol (Buffer
[Index
], &gEfiFirmwareVolume2ProtocolGuid
, (VOID
**)&Fv
);
58 if (!EFI_ERROR (Status
)) {
59 Key
= AllocatePool (Fv
->KeySize
);
61 ZeroMem (Key
, Fv
->KeySize
);
63 FileType
= EFI_FV_FILETYPE_APPLICATION
;
66 NextStatus
= Fv
->GetNextFile (Fv
, Key
, &FileType
, NameGuid
, &Attributes
, &Size
);
67 if (!EFI_ERROR (NextStatus
)) {
68 if (UiString
== NULL
) {
70 // If UiString is NULL match first application we find.
72 *FvHandle
= Buffer
[Index
];
78 Status
= Fv
->ReadSection (
81 EFI_SECTION_USER_INTERFACE
,
87 if (!EFI_ERROR (Status
)) {
88 if (StrnCmp (UiString
, UiSection
, UiStringLen
) == 0) {
90 // We found a UiString match.
92 *FvHandle
= Buffer
[Index
];
100 } while (!EFI_ERROR (NextStatus
));
109 return EFI_NOT_FOUND
;
115 IN EFI_HANDLE FvHandle
,
116 IN EFI_GUID
*NameGuid
119 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
120 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH NewNode
;
122 DevicePath
= DevicePathFromHandle (FvHandle
);
124 EfiInitializeFwVolDevicepathNode (&NewNode
, NameGuid
);
126 return AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&NewNode
);
132 LoadPeCoffSectionFromFv (
133 IN EFI_HANDLE FvHandle
,
134 IN EFI_GUID
*NameGuid
138 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
139 EFI_HANDLE ImageHandle
;
141 DevicePath
= FvFileDevicePath (FvHandle
, NameGuid
);
143 Status
= gBS
->LoadImage (TRUE
, gImageHandle
, DevicePath
, NULL
, 0, &ImageHandle
);
144 if (!EFI_ERROR (Status
)) {
145 Status
= gBS
->StartImage (ImageHandle
, NULL
, NULL
);