TianoCore EDK2 master
Loading...
Searching...
No Matches
PciOptionRomSupport.c File Reference
#include "PciBus.h"

Go to the source code of this file.

Functions

EFI_STATUS LocalLoadFile2 (IN PCI_IO_DEVICE *PciIoDevice, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL)
 
VOID InitializePciLoadFile2 (IN PCI_IO_DEVICE *PciIoDevice)
 
EFI_STATUS EFIAPI LoadFile2 (IN EFI_LOAD_FILE2_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL)
 
EFI_STATUS GetOpRomInfo (IN OUT PCI_IO_DEVICE *PciIoDevice)
 
BOOLEAN ContainEfiImage (IN VOID *RomImage, IN UINT64 RomSize)
 
EFI_STATUS LoadOpRomImage (IN PCI_IO_DEVICE *PciDevice, IN UINT64 RomBase)
 
VOID RomDecode (IN PCI_IO_DEVICE *PciDevice, IN UINT8 RomBarIndex, IN UINT32 RomBar, IN BOOLEAN Enable)
 
EFI_STATUS ProcessOpRomImage (IN PCI_IO_DEVICE *PciDevice)
 

Detailed Description

PCI Rom supporting funtions implementation for PCI Bus module.

Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PciOptionRomSupport.c.

Function Documentation

◆ ContainEfiImage()

BOOLEAN ContainEfiImage ( IN VOID *  RomImage,
IN UINT64  RomSize 
)

Check if the RomImage contains EFI Images.

Parameters
RomImageThe ROM address of Image for check.
RomSizeSize of ROM for check.
Return values
TRUEROM contain EFI Image.
FALSEROM not contain EFI Image.

Definition at line 320 of file PciOptionRomSupport.c.

◆ GetOpRomInfo()

EFI_STATUS GetOpRomInfo ( IN OUT PCI_IO_DEVICE PciIoDevice)

Get Pci device's oprom information.

Parameters
PciIoDeviceInput Pci device instance. Output Pci device instance with updated OptionRom size.
Return values
EFI_NOT_FOUNDPci device has not Option Rom.
EFI_SUCCESSPci device has Option Rom.

Definition at line 231 of file PciOptionRomSupport.c.

◆ InitializePciLoadFile2()

VOID InitializePciLoadFile2 ( IN PCI_IO_DEVICE PciIoDevice)

Initialize a PCI LoadFile2 instance.

Parameters
PciIoDevicePCI IO Device.

Definition at line 164 of file PciOptionRomSupport.c.

◆ LoadFile2()

EFI_STATUS EFIAPI LoadFile2 ( IN EFI_LOAD_FILE2_PROTOCOL This,
IN EFI_DEVICE_PATH_PROTOCOL FilePath,
IN BOOLEAN  BootPolicy,
IN OUT UINTN BufferSize,
IN VOID *Buffer  OPTIONAL 
)

Causes the driver to load a specified file.

Parameters
ThisIndicates a pointer to the calling context.
FilePathThe device specific path of the file to load.
BootPolicyShould always be FALSE.
BufferSizeOn input the size of Buffer in bytes. On output with a return code of EFI_SUCCESS, the amount of data transferred to Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer required to retrieve the requested file.
BufferThe memory buffer to transfer the file to. If Buffer is NULL, then no the size of the requested file is returned in BufferSize.
Return values
EFI_SUCCESSThe file was loaded.
EFI_UNSUPPORTEDBootPolicy is TRUE.
EFI_INVALID_PARAMETERFilePath is not a valid device path, or BufferSize is NULL.
EFI_NOT_FOUNDNot found PCI Option Rom on PCI device.
EFI_DEVICE_ERRORFailed to decompress PCI Option Rom image.
EFI_BUFFER_TOO_SMALLThe BufferSize is too small to read the current directory entry. BufferSize has been updated with the size needed to complete the request.

Definition at line 196 of file PciOptionRomSupport.c.

◆ LoadOpRomImage()

EFI_STATUS LoadOpRomImage ( IN PCI_IO_DEVICE PciDevice,
IN UINT64  RomBase 
)

Load Option Rom image for specified PCI device.

Parameters
PciDevicePci device instance.
RomBaseBase address of Option Rom.
Return values
EFI_OUT_OF_RESOURCESNo enough memory to hold image.
EFI_SUCESSSuccessfully loaded Option Rom.

Definition at line 378 of file PciOptionRomSupport.c.

◆ LocalLoadFile2()

EFI_STATUS LocalLoadFile2 ( IN PCI_IO_DEVICE PciIoDevice,
IN EFI_DEVICE_PATH_PROTOCOL FilePath,
IN OUT UINTN BufferSize,
IN VOID *Buffer  OPTIONAL 
)

Load the EFI Image from Option ROM

Parameters
PciIoDevicePCI IO device instance.
FilePathThe file path of the EFI Image
BufferSizeOn input the size of Buffer in bytes. On output with a return code of EFI_SUCCESS, the amount of data transferred to Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer required to retrieve the requested file.
BufferThe memory buffer to transfer the file to. If Buffer is NULL, then no the size of the requested file is returned in BufferSize.
Return values
EFI_SUCCESSThe file was loaded.
EFI_INVALID_PARAMETERFilePath is not a valid device path, or BufferSize is NULL.
EFI_NOT_FOUNDNot found PCI Option Rom on PCI device.
EFI_DEVICE_ERRORFailed to decompress PCI Option Rom image.
EFI_BUFFER_TOO_SMALLThe BufferSize is too small to read the current directory entry. BufferSize has been updated with the size needed to complete the request.

Definition at line 32 of file PciOptionRomSupport.c.

◆ ProcessOpRomImage()

EFI_STATUS ProcessOpRomImage ( IN PCI_IO_DEVICE PciDevice)

Load and start the Option Rom image.

Parameters
PciDevicePci device instance.
Return values
EFI_SUCCESSSuccessfully loaded and started PCI Option Rom image.
EFI_NOT_FOUNDFailed to process PCI Option Rom image.

Definition at line 651 of file PciOptionRomSupport.c.

◆ RomDecode()

VOID RomDecode ( IN PCI_IO_DEVICE PciDevice,
IN UINT8  RomBarIndex,
IN UINT32  RomBar,
IN BOOLEAN  Enable 
)

Enable/Disable Option Rom decode.

Parameters
PciDevicePci device instance.
RomBarIndexThe BAR index of the standard PCI Configuration header to use as the base address for resource range. The legal range for this field is 0..5.
RomBarBase address of Option Rom.
EnableFlag for enable/disable decode.

Definition at line 582 of file PciOptionRomSupport.c.