44 CONST CHAR16 *FileName
88 if (EFI_ERROR (Status)) {
89 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
116 Status =
ShellOpenFileMetaArg ((CHAR16 *)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
117 if (EFI_ERROR (Status)) {
133 if (EFI_ERROR (Node->
Status)) {
147 if (File1Buffer ==
NULL) {
153 Status = gEfiShellProtocol->ReadFile (Node->
Handle, &SourceSize, File1Buffer);
154 if (EFI_ERROR (Status)) {
186 return (ShellStatus);
206 CONST CHAR16 *FileName
219 CHAR16 RomFileName[280];
222 UINT32 DestinationSize;
226 VOID *DecompressedImageBuffer;
229 UINT32 InitializationSize;
232 ReturnStatus = EFI_NOT_FOUND;
233 RomBarOffset = (
UINTN)RomBar;
238 if (EfiRomHeader->
Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
248 if ((EfiRomHeader->PcirOffset == 0) ||
249 ((EfiRomHeader->PcirOffset & 3) != 0) ||
259 if (Pcir->
Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
263 ImageSize = Pcir->ImageLength * 512;
264 if (RomBarOffset - (
UINTN)RomBar + ImageSize > RomSize) {
268 if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
270 ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
271 (EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)))
273 ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
274 InitializationSize = EfiRomHeader->InitializationSize * 512;
276 if ((InitializationSize <= ImageSize) && (ImageOffset < InitializationSize)) {
277 ImageBuffer = (VOID *)(
UINTN)(RomBarOffset + ImageOffset);
278 ImageLength = InitializationSize - ImageOffset;
279 DecompressedImageBuffer =
NULL;
290 Status =
gBS->LocateProtocol (&gEfiDecompressProtocolGuid,
NULL, (VOID **)&
Decompress);
292 if (EFI_ERROR (Status)) {
303 if (!EFI_ERROR (Status)) {
305 if (DecompressedImageBuffer ==
NULL) {
307 return EFI_OUT_OF_RESOURCES;
310 if (ImageBuffer !=
NULL) {
312 if (Scratch !=
NULL) {
317 DecompressedImageBuffer,
322 if (!EFI_ERROR (Status)) {
323 ImageBuffer = DecompressedImageBuffer;
324 ImageLength = DestinationSize;
339 UnicodeSPrint (RomFileName,
sizeof (RomFileName), L
"%s[%d]", FileName, ImageIndex);
341 if (FilePath ==
NULL) {
343 SHELL_FREE_NON_NULL (DecompressedImageBuffer);
344 return EFI_OUT_OF_RESOURCES;
347 Status =
gBS->LoadImage (
355 if (EFI_ERROR (Status)) {
362 if (Status == EFI_SECURITY_VIOLATION) {
363 gBS->UnloadImage (ImageHandle);
369 Status =
gBS->StartImage (ImageHandle,
NULL,
NULL);
370 if (EFI_ERROR (Status)) {
374 ReturnStatus = Status;
379 if (DecompressedImageBuffer !=
NULL) {
385 RomBarOffset = RomBarOffset + ImageSize;
387 }
while (((Pcir->Indicator & 0x80) == 0x00) && ((RomBarOffset - (
UINTN)RomBar) < RomSize));
408 Status =
gBS->LocateHandleBuffer (
415 if (EFI_ERROR (Status)) {
419 for (Index = 0; Index < HandleCount; Index++) {
421 Status = EFI_ABORTED;
428 if (HandleBuffer !=
NULL) {
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI FileDevicePath(IN EFI_HANDLE Device OPTIONAL, IN CONST CHAR16 *FileName)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI FileHandleIsDirectory(IN EFI_FILE_HANDLE DirHandle)
EFI_STATUS LoadEfiDriversFromRomImage(VOID *RomBar, UINTN RomSize, CONST CHAR16 *FileName)
SHELL_STATUS EFIAPI ShellCommandRunLoadPciRom(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS LoadPciRomConnectAllDriversToAllControllers(VOID)
EFI_STATUS EFIAPI Decompress(IN CONST EFI_PEI_DECOMPRESS_PPI *This, IN CONST EFI_COMPRESSION_SECTION *CompressionSection, OUT VOID **OutputBuffer, OUT UINTN *OutputSize)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
#define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE
defined in UEFI Spec.
#define EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED
defined in UEFI spec.
BOOLEAN EFIAPI ShellGetExecutionBreakFlag(VOID)
EFI_STATUS EFIAPI ShellCloseFileMetaArg(IN OUT EFI_SHELL_FILE_INFO **ListHead)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeFlag
A flag that is present or not present only (IE "-a").
EFI_STATUS EFIAPI ShellOpenFileMetaArg(IN CHAR16 *Arg, IN UINT64 OpenMode, IN OUT EFI_SHELL_FILE_INFO **ListHead)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
UINT32 EfiSignature
0x0EF1
LIST_ENTRY Link
Linked list members.
SHELL_FILE_HANDLE Handle
Handle for interacting with the opened file or NULL if closed.
EFI_FILE_INFO * Info
Pointer to the FileInfo struct for this file or NULL.
EFI_STATUS Status
Status of opening the file. Valid only if Handle != NULL.
CONST CHAR16 * FullName
Fully qualified filename.