2 Platform Pcie Helper Lib.
4 Copyright (c) 2013 Intel Corporation.
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "CommonHeader.h"
19 // Routines local to this source module.
23 IN CONST UINT32 LevelRegOffset
,
24 IN CONST UINT32 GpioNum
,
25 IN CONST BOOLEAN HighLevel
29 UINT32 GpioBaseAddress
;
32 GpioBaseAddress
= LpcPciCfg32 (R_QNC_LPC_GBA_BASE
) & B_QNC_LPC_GPA_BASE_MASK
;
33 ASSERT (GpioBaseAddress
> 0);
35 RegValue
= IoRead32 (GpioBaseAddress
+ LevelRegOffset
);
36 GpioNumMask
= (1 << GpioNum
);
38 RegValue
|= (GpioNumMask
);
40 RegValue
&= ~(GpioNumMask
);
42 IoWrite32 (GpioBaseAddress
+ R_QNC_GPIO_RGLVL_RESUME_WELL
, RegValue
);
46 // Routines exported by this component.
50 Platform assert PCI express PERST# signal.
52 @param PlatformType See EFI_PLATFORM_TYPE enum definitions.
58 IN CONST EFI_PLATFORM_TYPE PlatformType
61 if (PlatformType
== GalileoGen2
) {
62 LegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL
, GALILEO_GEN2_PCIEXP_PERST_RESUMEWELL_GPIO
, FALSE
);
64 LegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL
, PCIEXP_PERST_RESUMEWELL_GPIO
, FALSE
);
69 Platform de assert PCI express PERST# signal.
71 @param PlatformType See EFI_PLATFORM_TYPE enum definitions.
76 PlatformPERSTDeAssert (
77 IN CONST EFI_PLATFORM_TYPE PlatformType
80 if (PlatformType
== GalileoGen2
) {
81 LegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL
, GALILEO_GEN2_PCIEXP_PERST_RESUMEWELL_GPIO
, TRUE
);
83 LegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL
, PCIEXP_PERST_RESUMEWELL_GPIO
, TRUE
);
87 /** Early initialisation of the PCIe controller.
89 @param PlatformType See EFI_PLATFORM_TYPE enum definitions.
91 @retval EFI_SUCCESS Operation success.
96 PlatformPciExpressEarlyInit (
97 IN CONST EFI_PLATFORM_TYPE PlatformType
102 // Release and wait for PCI controller to come out of reset.
104 SocUnitReleasePcieControllerPreWaitPllLock (PlatformType
);
105 MicroSecondDelay (PCIEXP_DELAY_US_WAIT_PLL_LOCK
);
106 SocUnitReleasePcieControllerPostPllLock (PlatformType
);
109 // Early PCIe initialisation
111 SocUnitEarlyInitialisation ();
114 // Do North cluster early PCIe init.
116 PciExpressEarlyInit ();