]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c
MdePkg/BaseSafeIntLib: fix undefined behavior in SafeInt64Add()
[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
8 This program and the accompanying materials are\r
9 licensed and made available under the terms and conditions of\r
10 the BSD License which accompanies this distribution. The full\r
11 text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php.\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17**/\r
18\r
19#include "PciSegmentLibCommon.h"\r
20\r
21/**\r
22 Return the virtual address for the physical address.\r
23\r
24 @param Address The physical address.\r
25\r
26 @retval The virtual address.\r
27**/\r
28UINTN\r
29PciSegmentLibVirtualAddress (\r
30 IN UINTN Address\r
31 )\r
32{\r
33 return Address;\r
34}\r
35\r
36/**\r
37 Register a PCI device so PCI configuration registers may be accessed after\r
38 SetVirtualAddressMap().\r
39\r
40 If any reserved bits in Address are set, then ASSERT().\r
41\r
42 @param Address The address that encodes the PCI Bus, Device, Function and\r
43 Register.\r
44\r
45 @retval RETURN_SUCCESS The PCI device was registered for runtime access.\r
46 @retval RETURN_UNSUPPORTED An attempt was made to call this function\r
47 after ExitBootServices().\r
48 @retval RETURN_UNSUPPORTED The resources required to access the PCI device\r
49 at runtime could not be mapped.\r
50 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to\r
51 complete the registration.\r
52\r
53**/\r
54RETURN_STATUS\r
55EFIAPI\r
56PciSegmentRegisterForRuntimeAccess (\r
57 IN UINTN Address\r
58 )\r
59{\r
60 //\r
61 // Use PciSegmentLibGetEcamAddress() to validate the Address.\r
62 //\r
63 DEBUG_CODE (\r
64 UINTN Count;\r
65 PCI_SEGMENT_INFO *SegmentInfo;\r
66\r
67 SegmentInfo = GetPciSegmentInfo (&Count);\r
68 PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count);\r
69 );\r
70 return RETURN_SUCCESS;\r
71}\r