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