]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / PciSegmentLibSegmentInfo / BasePciSegmentLib.c
1 /** @file
2 Instance of Base PCI Segment Library that support multi-segment PCI configuration access.
3
4 PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to
5 support multi-segment PCI configuration access through enhanced configuration access mechanism.
6
7 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #include "PciSegmentLibCommon.h"
13
14 /**
15 Return the virtual address for the physical address.
16
17 @param Address The physical address.
18
19 @retval The virtual address.
20 **/
21 UINTN
22 PciSegmentLibVirtualAddress (
23 IN UINTN Address
24 )
25 {
26 return Address;
27 }
28
29 /**
30 Register a PCI device so PCI configuration registers may be accessed after
31 SetVirtualAddressMap().
32
33 If any reserved bits in Address are set, then ASSERT().
34
35 @param Address The address that encodes the PCI Bus, Device, Function and
36 Register.
37
38 @retval RETURN_SUCCESS The PCI device was registered for runtime access.
39 @retval RETURN_UNSUPPORTED An attempt was made to call this function
40 after ExitBootServices().
41 @retval RETURN_UNSUPPORTED The resources required to access the PCI device
42 at runtime could not be mapped.
43 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to
44 complete the registration.
45
46 **/
47 RETURN_STATUS
48 EFIAPI
49 PciSegmentRegisterForRuntimeAccess (
50 IN UINTN Address
51 )
52 {
53 //
54 // Use PciSegmentLibGetEcamAddress() to validate the Address.
55 //
56 DEBUG_CODE (
57 UINTN Count;
58 PCI_SEGMENT_INFO *SegmentInfo;
59
60 SegmentInfo = GetPciSegmentInfo (&Count);
61 PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count);
62 );
63 return RETURN_SUCCESS;
64 }