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

Go to the source code of this file.

Data Structures

struct  EXTRA_ROOT_BUS_MAP_STRUCT
 

Functions

STATIC INTN EFIAPI RootBridgePathCompare (IN CONST VOID *UserStruct1, IN CONST VOID *UserStruct2)
 
STATIC INTN EFIAPI RootBridgePathKeyCompare (IN CONST VOID *StandaloneKey, IN CONST VOID *UserStruct)
 
EFI_STATUS CreateExtraRootBusMap (OUT EXTRA_ROOT_BUS_MAP **ExtraRootBusMap)
 
VOID DestroyExtraRootBusMap (IN EXTRA_ROOT_BUS_MAP *ExtraRootBusMap)
 
EFI_STATUS MapRootBusPosToBusNr (IN CONST EXTRA_ROOT_BUS_MAP *ExtraRootBusMap, IN UINT64 RootBusPos, OUT UINT32 *RootBusNr)
 

Detailed Description

Map positions of extra PCI root buses to bus numbers.

Copyright (C) 2015, Red Hat, Inc.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ExtraRootBusMap.c.

Function Documentation

◆ CreateExtraRootBusMap()

EFI_STATUS CreateExtraRootBusMap ( OUT EXTRA_ROOT_BUS_MAP **  ExtraRootBusMap)

Create a structure that maps the relative positions of PCI root buses to bus numbers.

In the "bootorder" fw_cfg file, QEMU refers to extra PCI root buses by their positions, in relative root bus number order, not by their actual PCI bus numbers. The ACPI HID device path nodes however that are associated with PciRootBridgeIo protocol instances in the system have their UID fields set to the bus numbers. Create a map that gives, for each extra PCI root bus's position (ie. "serial number") its actual PCI bus number.

Parameters
[out]ExtraRootBusMapThe data structure implementing the map.
Return values
EFI_SUCCESSExtraRootBusMap has been populated.
EFI_OUT_OF_RESOURCESMemory allocation failed.
EFI_ALREADY_STARTEDA duplicate root bus number has been found in the system. (This should never happen.)
Returns
Error codes returned by gBS->LocateHandleBuffer() and gBS->HandleProtocol().

Definition at line 128 of file ExtraRootBusMap.c.

◆ DestroyExtraRootBusMap()

VOID DestroyExtraRootBusMap ( IN EXTRA_ROOT_BUS_MAP ExtraRootBusMap)

Release a map created with CreateExtraRootBusMap().

Parameters
[in]ExtraRootBusMapThe map to release.

Definition at line 278 of file ExtraRootBusMap.c.

◆ MapRootBusPosToBusNr()

EFI_STATUS MapRootBusPosToBusNr ( IN CONST EXTRA_ROOT_BUS_MAP ExtraRootBusMap,
IN UINT64  RootBusPos,
OUT UINT32 *  RootBusNr 
)

Map the position (serial number) of an extra PCI root bus to its bus number.

Parameters
[in]ExtraRootBusMapThe map created with CreateExtraRootBusMap();
[in]RootBusPosThe extra PCI root bus position to map.
[out]RootBusNrThe bus number belonging to the extra PCI root bus identified by RootBusPos.
Return values
EFI_INVALID_PARAMETERRootBusPos is zero. The zero position identifies the main root bus, whose bus number is always zero, and is therefore never maintained in ExtraRootBusMap.
EFI_NOT_FOUNDRootBusPos is not found in ExtraRootBusMap.
EFI_SUCCESSMapping successful.

Definition at line 309 of file ExtraRootBusMap.c.

◆ RootBridgePathCompare()

STATIC INTN EFIAPI RootBridgePathCompare ( IN CONST VOID *  UserStruct1,
IN CONST VOID *  UserStruct2 
)

An ORDERED_COLLECTION_USER_COMPARE function that compares root bridge protocol device paths based on UID.

Parameters
[in]UserStruct1Pointer to the first ACPI_HID_DEVICE_PATH.
[in]UserStruct2Pointer to the second ACPI_HID_DEVICE_PATH.
Return values
<0If UserStruct1 compares less than UserStruct2.
0If UserStruct1 compares equal to UserStruct2.
>0If UserStruct1 compares greater than UserStruct2.

Definition at line 52 of file ExtraRootBusMap.c.

◆ RootBridgePathKeyCompare()

STATIC INTN EFIAPI RootBridgePathKeyCompare ( IN CONST VOID *  StandaloneKey,
IN CONST VOID *  UserStruct 
)

An ORDERED_COLLECTION_KEY_COMPARE function that compares a root bridge protocol device path against a UID.

Parameters
[in]StandaloneKeyPointer to the bare UINT32 UID.
[in]UserStructPointer to the ACPI_HID_DEVICE_PATH with the embedded UINT32 UID.
Return values
<0If StandaloneKey compares less than UserStruct's key.
0If StandaloneKey compares equal to UserStruct's key.
>0If StandaloneKey compares greater than UserStruct's key.

Definition at line 86 of file ExtraRootBusMap.c.