TianoCore EDK2 master
Loading...
Searching...
No Matches
BdsPlatform.c File Reference

Go to the source code of this file.

Data Structures

struct  SERIAL_DEVICE_PATH
 

Typedefs

typedef EFI_STATUS(EFIAPI * PROTOCOL_INSTANCE_CALLBACK) (IN EFI_HANDLE Handle, IN VOID *Instance, IN VOID *Context)
 
typedef EFI_STATUS(EFIAPI * VISIT_PCI_INSTANCE_CALLBACK) (IN EFI_HANDLE Handle, IN EFI_PCI_IO_PROTOCOL *PciIo, IN PCI_TYPE00 *Pci)
 

Functions

EFI_STATUS VisitAllInstancesOfProtocol (IN EFI_GUID *Id, IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction, IN VOID *Context)
 
EFI_STATUS VisitAllPciInstancesOfProtocol (IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction)
 
VOID InstallDevicePathCallback (VOID)
 
VOID PlatformRegisterFvBootOption (EFI_GUID *FileGuid, CHAR16 *Description, UINT32 Attributes)
 
VOID RemoveStaleFvFileOptions (VOID)
 
VOID RestrictBootOptionsToFirmware (VOID)
 
VOID PlatformRegisterOptionsAndKeys (VOID)
 
EFI_STATUS EFIAPI ConnectRootBridge (IN EFI_HANDLE RootBridgeHandle, IN VOID *Instance, IN VOID *Context)
 
STATIC EFI_STATUS EFIAPI ConnectVirtioPciRng (IN EFI_HANDLE Handle, IN VOID *Instance, IN VOID *Context)
 
STATIC VOID SaveS3BootScript (VOID)
 
VOID EFIAPI PlatformBootManagerBeforeConsole (VOID)
 
EFI_STATUS PrepareLpcBridgeDevicePath (IN EFI_HANDLE DeviceHandle)
 
VOID PrepareMicrovmDevicePath (VOID)
 
EFI_STATUS GetGopDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *PciDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL **GopDevicePath)
 
EFI_STATUS PreparePciDisplayDevicePath (IN EFI_HANDLE DeviceHandle)
 
EFI_STATUS PreparePciSerialDevicePath (IN EFI_HANDLE DeviceHandle)
 
EFI_STATUS PrepareVirtioSerialDevicePath (IN EFI_HANDLE DeviceHandle)
 
EFI_STATUS EFIAPI VisitingAPciInstance (IN EFI_HANDLE Handle, IN VOID *Instance, IN VOID *Context)
 
EFI_STATUS VisitAllPciInstances (IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction)
 
EFI_STATUS EFIAPI DetectAndPreparePlatformPciDevicePath (IN EFI_HANDLE Handle, IN EFI_PCI_IO_PROTOCOL *PciIo, IN PCI_TYPE00 *Pci)
 
EFI_STATUS EFIAPI DetectAndPreparePlatformVirtioDevicePath (IN EFI_HANDLE Handle, IN VOID *Instance, IN VOID *Context)
 
VOID PlatformInitializeConsole (IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole)
 
EFI_STATUS EFIAPI SetPciIntLine (IN EFI_HANDLE Handle, IN EFI_PCI_IO_PROTOCOL *PciIo, IN PCI_TYPE00 *PciHdr)
 
VOID PciAcpiInitialization ()
 
EFI_STATUS EFIAPI ConnectRecursivelyIfPciMassStorage (IN EFI_HANDLE Handle, IN EFI_PCI_IO_PROTOCOL *Instance, IN PCI_TYPE00 *PciHeader)
 
VOID EFIAPI EmuVariablesUpdatedCallback (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI VisitingFileSystemInstance (IN EFI_HANDLE Handle, IN VOID *Instance, IN VOID *Context)
 
VOID PlatformBdsRestoreNvVarsFromHardDisk ()
 
VOID PlatformBdsConnectSequence (VOID)
 
VOID EFIAPI PlatformBootManagerAfterConsole (VOID)
 
VOID EFIAPI NotifyDevPath (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI PlatformBootManagerWaitCallback (UINT16 TimeoutRemain)
 
VOID EFIAPI PlatformBootManagerUnableToBoot (VOID)
 

Variables

VOID * mEfiDevPathNotifyReg
 
EFI_EVENT mEfiDevPathEvent
 
VOID * mEmuVariableEventReg
 
EFI_EVENT mEmuVariableEvent
 
UINT16 mHostBridgeDevId
 
CONST UINT8 PciHostIrqs []
 
SERIAL_DEVICE_PATH serialDevicePath
 

Detailed Description

Platform BDS customizations.

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

Definition in file BdsPlatform.c.

Typedef Documentation

◆ PROTOCOL_INSTANCE_CALLBACK

typedef EFI_STATUS(EFIAPI * PROTOCOL_INSTANCE_CALLBACK) (IN EFI_HANDLE Handle, IN VOID *Instance, IN VOID *Context)

Definition at line 44 of file BdsPlatform.c.

◆ VISIT_PCI_INSTANCE_CALLBACK

typedef EFI_STATUS(EFIAPI * VISIT_PCI_INSTANCE_CALLBACK) (IN EFI_HANDLE Handle, IN EFI_PCI_IO_PROTOCOL *PciIo, IN PCI_TYPE00 *Pci)
Parameters
[in]Handle- Handle of PCI device instance
[in]PciIo- PCI IO protocol instance
[in]Pci- PCI Header register block

Definition at line 57 of file BdsPlatform.c.

Function Documentation

◆ ConnectRecursivelyIfPciMassStorage()

EFI_STATUS EFIAPI ConnectRecursivelyIfPciMassStorage ( IN EFI_HANDLE  Handle,
IN EFI_PCI_IO_PROTOCOL Instance,
IN PCI_TYPE00 PciHeader 
)

Definition at line 1559 of file BdsPlatform.c.

◆ ConnectRootBridge()

EFI_STATUS EFIAPI ConnectRootBridge ( IN EFI_HANDLE  RootBridgeHandle,
IN VOID *  Instance,
IN VOID *  Context 
)

Definition at line 546 of file BdsPlatform.c.

◆ ConnectVirtioPciRng()

STATIC EFI_STATUS EFIAPI ConnectVirtioPciRng ( IN EFI_HANDLE  Handle,
IN VOID *  Instance,
IN VOID *  Context 
)

Definition at line 571 of file BdsPlatform.c.

◆ DetectAndPreparePlatformPciDevicePath()

EFI_STATUS EFIAPI DetectAndPreparePlatformPciDevicePath ( IN EFI_HANDLE  Handle,
IN EFI_PCI_IO_PROTOCOL PciIo,
IN PCI_TYPE00 Pci 
)

Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut.

Parameters
[in]Handle- Handle of PCI device instance
[in]PciIo- PCI IO protocol instance
[in]Pci- PCI Header register block
Return values
EFI_SUCCESS- PCI Device check and Console variable update successfully.
EFI_STATUS- PCI Device check or Console variable update fail.

Definition at line 1170 of file BdsPlatform.c.

◆ DetectAndPreparePlatformVirtioDevicePath()

EFI_STATUS EFIAPI DetectAndPreparePlatformVirtioDevicePath ( IN EFI_HANDLE  Handle,
IN VOID *  Instance,
IN VOID *  Context 
)

Definition at line 1242 of file BdsPlatform.c.

◆ EmuVariablesUpdatedCallback()

VOID EFIAPI EmuVariablesUpdatedCallback ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

This notification function is invoked when the EMU Variable FVB has been changed.

Parameters
EventThe event that occurred
ContextFor EFI compatibility. Not used.

Definition at line 1621 of file BdsPlatform.c.

◆ GetGopDevicePath()

EFI_STATUS GetGopDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL PciDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL **  GopDevicePath 
)

Definition at line 848 of file BdsPlatform.c.

◆ InstallDevicePathCallback()

VOID InstallDevicePathCallback ( VOID  )

Definition at line 1951 of file BdsPlatform.c.

◆ NotifyDevPath()

VOID EFIAPI NotifyDevPath ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

This notification function is invoked when an instance of the EFI_DEVICE_PATH_PROTOCOL is produced.

Parameters
EventThe event that occurred
ContextFor EFI compatibility. Not used.

Definition at line 1871 of file BdsPlatform.c.

◆ PciAcpiInitialization()

VOID PciAcpiInitialization ( )

Definition at line 1491 of file BdsPlatform.c.

◆ PlatformBdsConnectSequence()

VOID PlatformBdsConnectSequence ( VOID  )

Connect with predefined platform connect sequence.

The OEM/IBV can customize with their own connect sequence.

Definition at line 1687 of file BdsPlatform.c.

◆ PlatformBdsRestoreNvVarsFromHardDisk()

VOID PlatformBdsRestoreNvVarsFromHardDisk ( )

Definition at line 1670 of file BdsPlatform.c.

◆ PlatformBootManagerAfterConsole()

VOID EFIAPI PlatformBootManagerAfterConsole ( VOID  )

Do the platform specific action after the console is ready

Possible things that can be done in PlatformBootManagerAfterConsole:

‍Console post action: Dynamically switch output mode from 100x31 to 80x25 for certain senarino Signal console ready platform customized event Run diagnostics like memory testing Connect certain devices Dispatch aditional option roms Special boot: e.g.: USB boot, enter UI

Definition at line 1773 of file BdsPlatform.c.

◆ PlatformBootManagerBeforeConsole()

VOID EFIAPI PlatformBootManagerBeforeConsole ( VOID  )

Do the platform init, can be customized by OEM/IBV

Possible things that can be done in PlatformBootManagerBeforeConsole:

‍Update console variable: 1. include hot-plug devices;

  1. Clear ConIn and add SOL for AMT Register new Driver#### or Boot#### Register new Key####: e.g.: F12 Signal ReadyToLock event Authentication action: 1. connect Auth devices;

Identify auto logon user.

Definition at line 422 of file BdsPlatform.c.

◆ PlatformBootManagerUnableToBoot()

VOID EFIAPI PlatformBootManagerUnableToBoot ( VOID  )

The function is called when no boot option could be launched, including platform recovery options and options pointing to applications built into firmware volumes.

If this function returns, BDS attempts to enter an infinite loop.

Definition at line 2014 of file BdsPlatform.c.

◆ PlatformBootManagerWaitCallback()

VOID EFIAPI PlatformBootManagerWaitCallback ( UINT16  TimeoutRemain)

This function is called each second during the boot manager waits the timeout.

Parameters
TimeoutRemainThe remaining timeout.

Definition at line 1973 of file BdsPlatform.c.

◆ PlatformInitializeConsole()

VOID PlatformInitializeConsole ( IN PLATFORM_CONSOLE_CONNECT_ENTRY PlatformConsole)

Connect the predefined platform default console device.

Always try to find and enable PCI display devices.

Parameters
[in]PlatformConsolePredefined platform default console device array.

Definition at line 1272 of file BdsPlatform.c.

◆ PlatformRegisterFvBootOption()

VOID PlatformRegisterFvBootOption ( EFI_GUID FileGuid,
CHAR16 *  Description,
UINT32  Attributes 
)

Definition at line 86 of file BdsPlatform.c.

◆ PlatformRegisterOptionsAndKeys()

VOID PlatformRegisterOptionsAndKeys ( VOID  )

Definition at line 335 of file BdsPlatform.c.

◆ PrepareLpcBridgeDevicePath()

EFI_STATUS PrepareLpcBridgeDevicePath ( IN EFI_HANDLE  DeviceHandle)

Add IsaKeyboard to ConIn; add IsaSerial to ConOut, ConIn, ErrOut.

Parameters
[in]DeviceHandleHandle of the LPC Bridge device.
Return values
EFI_SUCCESSConsole devices on the LPC bridge have been added to ConOut, ConIn, and ErrOut.
Returns
Error codes, due to EFI_DEVICE_PATH_PROTOCOL missing from DeviceHandle.

Definition at line 694 of file BdsPlatform.c.

◆ PrepareMicrovmDevicePath()

VOID PrepareMicrovmDevicePath ( VOID  )

Definition at line 820 of file BdsPlatform.c.

◆ PreparePciDisplayDevicePath()

EFI_STATUS PreparePciDisplayDevicePath ( IN EFI_HANDLE  DeviceHandle)

Add PCI display to ConOut.

Parameters
[in]DeviceHandleHandle of the PCI display device.
Return values
EFI_SUCCESSThe PCI display device has been added to ConOut.
Returns
Error codes, due to EFI_DEVICE_PATH_PROTOCOL missing from DeviceHandle.

Definition at line 950 of file BdsPlatform.c.

◆ PreparePciSerialDevicePath()

EFI_STATUS PreparePciSerialDevicePath ( IN EFI_HANDLE  DeviceHandle)

Add PCI Serial to ConOut, ConIn, ErrOut.

Parameters
[in]DeviceHandleHandle of the PCI serial device.
Return values
EFI_SUCCESSThe PCI serial device has been added to ConOut, ConIn, ErrOut.
Returns
Error codes, due to EFI_DEVICE_PATH_PROTOCOL missing from DeviceHandle.

Definition at line 989 of file BdsPlatform.c.

◆ PrepareVirtioSerialDevicePath()

EFI_STATUS PrepareVirtioSerialDevicePath ( IN EFI_HANDLE  DeviceHandle)

Definition at line 1023 of file BdsPlatform.c.

◆ RemoveStaleFvFileOptions()

VOID RemoveStaleFvFileOptions ( VOID  )

Remove all MemoryMapped(...)/FvFile(...) and Fv(...)/FvFile(...) boot options whose device paths do not resolve exactly to an FvFile in the system.

This removes any boot options that point to binaries built into the firmware and have become stale due to any of the following:

  • DXEFV's base address or size changed (historical),
  • DXEFV's FvNameGuid changed,
  • the FILE_GUID of the pointed-to binary changed,
  • the referenced binary is no longer built into the firmware.

EfiBootManagerFindLoadOption() used in PlatformRegisterFvBootOption() only avoids exact duplicates.

Definition at line 165 of file BdsPlatform.c.

◆ RestrictBootOptionsToFirmware()

VOID RestrictBootOptionsToFirmware ( VOID  )

Definition at line 295 of file BdsPlatform.c.

◆ SaveS3BootScript()

STATIC VOID SaveS3BootScript ( VOID  )

Save the S3 boot script.

Note that DxeSmmReadyToLock must be signaled after this function returns; otherwise the script wouldn't be saved actually.

Definition at line 1729 of file BdsPlatform.c.

◆ SetPciIntLine()

EFI_STATUS EFIAPI SetPciIntLine ( IN EFI_HANDLE  Handle,
IN EFI_PCI_IO_PROTOCOL PciIo,
IN PCI_TYPE00 PciHdr 
)

Configure PCI Interrupt Line register for applicable devices Ported from SeaBIOS, src/fw/pciinit.c, *_pci_slot_get_irq()

Parameters
[in]Handle- Handle of PCI device instance
[in]PciIo- PCI IO protocol instance
[in]PciHdr- PCI Header register block
Return values
EFI_SUCCESS- PCI Interrupt Line register configured successfully.

Definition at line 1340 of file BdsPlatform.c.

◆ VisitAllInstancesOfProtocol()

EFI_STATUS VisitAllInstancesOfProtocol ( IN EFI_GUID Id,
IN PROTOCOL_INSTANCE_CALLBACK  CallBackFunction,
IN VOID *  Context 
)

Definition at line 1062 of file BdsPlatform.c.

◆ VisitAllPciInstances()

EFI_STATUS VisitAllPciInstances ( IN VISIT_PCI_INSTANCE_CALLBACK  CallBackFunction)

Definition at line 1144 of file BdsPlatform.c.

◆ VisitingAPciInstance()

EFI_STATUS EFIAPI VisitingAPciInstance ( IN EFI_HANDLE  Handle,
IN VOID *  Instance,
IN VOID *  Context 
)

Definition at line 1110 of file BdsPlatform.c.

◆ VisitingFileSystemInstance()

EFI_STATUS EFIAPI VisitingFileSystemInstance ( IN EFI_HANDLE  Handle,
IN VOID *  Instance,
IN VOID *  Context 
)

Definition at line 1632 of file BdsPlatform.c.

Variable Documentation

◆ mEfiDevPathEvent

EFI_EVENT mEfiDevPathEvent

Definition at line 23 of file BdsPlatform.c.

◆ mEfiDevPathNotifyReg

VOID* mEfiDevPathNotifyReg

Definition at line 22 of file BdsPlatform.c.

◆ mEmuVariableEvent

EFI_EVENT mEmuVariableEvent

Definition at line 25 of file BdsPlatform.c.

◆ mEmuVariableEventReg

VOID* mEmuVariableEventReg

Definition at line 24 of file BdsPlatform.c.

◆ mHostBridgeDevId

UINT16 mHostBridgeDevId

Definition at line 26 of file BdsPlatform.c.

◆ PciHostIrqs

CONST UINT8 PciHostIrqs[]
Initial value:
= {
0x0a,
0x0a,
0x0b,
0x0b
}

Definition at line 32 of file BdsPlatform.c.

◆ serialDevicePath

SERIAL_DEVICE_PATH serialDevicePath
Initial value:
= {
{
},
EDKII_SERIAL_PORT_LIB_VENDOR_GUID
},
{ END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 }
}
}
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133

Definition at line 809 of file BdsPlatform.c.