TianoCore EDK2 master
|
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OrderedCollectionLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/DevicePath.h>
#include <Protocol/PciRootBridgeIo.h>
#include "ExtraRootBusMap.h"
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) |
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.
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.
[out] | ExtraRootBusMap | The data structure implementing the map. |
EFI_SUCCESS | ExtraRootBusMap has been populated. |
EFI_OUT_OF_RESOURCES | Memory allocation failed. |
EFI_ALREADY_STARTED | A duplicate root bus number has been found in the system. (This should never happen.) |
Definition at line 128 of file ExtraRootBusMap.c.
VOID DestroyExtraRootBusMap | ( | IN EXTRA_ROOT_BUS_MAP * | ExtraRootBusMap | ) |
Release a map created with CreateExtraRootBusMap().
[in] | ExtraRootBusMap | The map to release. |
Definition at line 278 of file ExtraRootBusMap.c.
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.
[in] | ExtraRootBusMap | The map created with CreateExtraRootBusMap(); |
[in] | RootBusPos | The extra PCI root bus position to map. |
[out] | RootBusNr | The bus number belonging to the extra PCI root bus identified by RootBusPos. |
EFI_INVALID_PARAMETER | RootBusPos 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_FOUND | RootBusPos is not found in ExtraRootBusMap. |
EFI_SUCCESS | Mapping successful. |
Definition at line 309 of file ExtraRootBusMap.c.
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.
[in] | UserStruct1 | Pointer to the first ACPI_HID_DEVICE_PATH. |
[in] | UserStruct2 | Pointer to the second ACPI_HID_DEVICE_PATH. |
<0 | If UserStruct1 compares less than UserStruct2. |
0 | If UserStruct1 compares equal to UserStruct2. |
>0 | If UserStruct1 compares greater than UserStruct2. |
Definition at line 52 of file ExtraRootBusMap.c.
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.
[in] | StandaloneKey | Pointer to the bare UINT32 UID. |
[in] | UserStruct | Pointer to the ACPI_HID_DEVICE_PATH with the embedded UINT32 UID. |
<0 | If StandaloneKey compares less than UserStruct's key. |
0 | If StandaloneKey compares equal to UserStruct's key. |
>0 | If StandaloneKey compares greater than UserStruct's key. |
Definition at line 86 of file ExtraRootBusMap.c.