mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-16 18:24:24 +02:00
OvmfPkg: introduce QemuFwCfgFindFile ()
Tested with the "bootorder" fw_cfg file. Example contents (leading space added and line terminators transcribed for readability): /pci@i0cf8/ide@1,1/drive@0/disk@0<LF> /pci@i0cf8/ide@1,1/drive@1/disk@0<LF> /pci@i0cf8/ethernet@3/ethernet-phy@0<NUL> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13549 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
05916c1532
commit
0ac9bc9be4
@ -41,6 +41,7 @@ typedef enum {
|
|||||||
QemuFwCfgItemKernelSetupAddress = 0x0016,
|
QemuFwCfgItemKernelSetupAddress = 0x0016,
|
||||||
QemuFwCfgItemKernelSetupSize = 0x0017,
|
QemuFwCfgItemKernelSetupSize = 0x0017,
|
||||||
QemuFwCfgItemKernelSetupData = 0x0018,
|
QemuFwCfgItemKernelSetupData = 0x0018,
|
||||||
|
QemuFwCfgItemFileDir = 0x0019,
|
||||||
|
|
||||||
QemuFwCfgItemX86AcpiTables = 0x8000,
|
QemuFwCfgItemX86AcpiTables = 0x8000,
|
||||||
QemuFwCfgItemX86SmbiosTables = 0x8001,
|
QemuFwCfgItemX86SmbiosTables = 0x8001,
|
||||||
@ -153,5 +154,25 @@ QemuFwCfgRead64 (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Find the configuration item corresponding to the firmware configuration file.
|
||||||
|
|
||||||
|
@param[in] Name - Name of file to look up.
|
||||||
|
@param[out] Item - Configuration item corresponding to the file, to be passed
|
||||||
|
to QemuFwCfgSelectItem ().
|
||||||
|
@param[out] Size - Number of bytes in the file.
|
||||||
|
|
||||||
|
@return RETURN_SUCCESS If file is found.
|
||||||
|
RETURN_NOT_FOUND If file is not found.
|
||||||
|
RETURN_UNSUPPORTED If firmware configuration is unavailable.
|
||||||
|
|
||||||
|
**/
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
QemuFwCfgFindFile (
|
||||||
|
IN CONST CHAR8 *Name,
|
||||||
|
OUT FIRMWARE_CONFIG_ITEM *Item,
|
||||||
|
OUT UINTN *Size
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -244,3 +244,56 @@ QemuFwCfgInitialize (
|
|||||||
DEBUG ((EFI_D_INFO, "QemuFwCfg interface is supported.\n"));
|
DEBUG ((EFI_D_INFO, "QemuFwCfg interface is supported.\n"));
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Find the configuration item corresponding to the firmware configuration file.
|
||||||
|
|
||||||
|
@param[in] Name - Name of file to look up.
|
||||||
|
@param[out] Item - Configuration item corresponding to the file, to be passed
|
||||||
|
to QemuFwCfgSelectItem ().
|
||||||
|
@param[out] Size - Number of bytes in the file.
|
||||||
|
|
||||||
|
@return RETURN_SUCCESS If file is found.
|
||||||
|
RETURN_NOT_FOUND If file is not found.
|
||||||
|
RETURN_UNSUPPORTED If firmware configuration is unavailable.
|
||||||
|
|
||||||
|
**/
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
QemuFwCfgFindFile (
|
||||||
|
IN CONST CHAR8 *Name,
|
||||||
|
OUT FIRMWARE_CONFIG_ITEM *Item,
|
||||||
|
OUT UINTN *Size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 Count;
|
||||||
|
UINT32 Idx;
|
||||||
|
|
||||||
|
if (!mQemuFwCfgSupported) {
|
||||||
|
return RETURN_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
QemuFwCfgSelectItem (QemuFwCfgItemFileDir);
|
||||||
|
Count = SwapBytes32 (QemuFwCfgRead32 ());
|
||||||
|
|
||||||
|
for (Idx = 0; Idx < Count; ++Idx) {
|
||||||
|
UINT32 FileSize;
|
||||||
|
UINT16 FileSelect;
|
||||||
|
UINT16 FileReserved;
|
||||||
|
CHAR8 FName[56];
|
||||||
|
|
||||||
|
FileSize = QemuFwCfgRead32 ();
|
||||||
|
FileSelect = QemuFwCfgRead16 ();
|
||||||
|
FileReserved = QemuFwCfgRead16 ();
|
||||||
|
InternalQemuFwCfgReadBytes (sizeof (FName), FName);
|
||||||
|
|
||||||
|
if (AsciiStrCmp (Name, FName) == 0) {
|
||||||
|
*Item = SwapBytes16 (FileSelect);
|
||||||
|
*Size = SwapBytes32 (FileSize);
|
||||||
|
return RETURN_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return RETURN_NOT_FOUND;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user