From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Ming Huang <heyi.guo@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>,
linaro-uefi <linaro-uefi@lists.linaro.org>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
Graeme Gregory <graeme.gregory@linaro.org>,
guoheyi@huawei.com, wanghuiqiang <wanghuiqiang@huawei.com>,
huangming <huangming23@huawei.com>,
Jason Zhang <zhangjinsong2@huawei.com>,
Mengfanrong <mengfanrong@huawei.com>,
waip23@126.com, Yan Zhang <zhangyan81@huawei.com>
Subject: Re: [PATCH edk2-platforms v1 08/14] Hisilicon/PCIe: Disable PCIe ASPM
Date: Sat, 20 Jan 2018 11:04:27 +0000 [thread overview]
Message-ID: <CAKv+Gu-uNuRj453nWB9esbUavHXA73__JSJf45JT2818AR2D2Q@mail.gmail.com> (raw)
In-Reply-To: <1516287703-35516-9-git-send-email-huangming23@huawei.com>
On 18 January 2018 at 15:01, Ming Huang <heyi.guo@linaro.org> wrote:
> From: Yan Zhang <zhangyan81@huawei.com>
>
> In order to replace command line parameter pcie_aspm=off, BIOS needs to
> disable Pcie Aspm support during Pcie initilization.
> D03 and D05 do not support PCIe ASPM, so we disable it in BIOS.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ming Huang <huangming23@huawei.com>
> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
> Signed-off-by: Yan Zhang <zhangyan81@huawei.com>
> ---
> Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.c | 71 ++++++++++++++++++++
> Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.h | 2 +
> Silicon/Hisilicon/Include/Regs/HisiPcieV1RegOffset.h | 2 +
> 3 files changed, 75 insertions(+)
>
> diff --git a/Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.c b/Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.c
> index f420c91..ca3b2f8 100644
> --- a/Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.c
> +++ b/Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.c
> @@ -1033,6 +1033,74 @@ DisableRcOptionRom (
> return;
> }
>
STATIC
> +VOID
> +PcieDbiCs2Enable(
Space before (
> + IN UINT32 HostBridgeNum,
> + IN UINT32 Port,
> + IN BOOLEAN Val
> + )
> +{
> + UINT32 RegVal;
> + RegRead (PCIE_APB_SLAVE_BASE_1610[HostBridgeNum][Port] + PCIE_SUBCTRL_SC_PCIE_SYS_CTRL21, RegVal);
Line length
> + if (Val) {
> + RegVal = RegVal | BIT2;
> + /*BIT2: DBI Chip Select indicator. 0 indicates CS, 1 indicates CS2.*/
Space after /*
> + } else {
> + RegVal = RegVal & (~BIT2);
> + }
> + RegWrite (PCIE_APB_SLAVE_BASE_1610[HostBridgeNum][Port] + PCIE_SUBCTRL_SC_PCIE_SYS_CTRL21, RegVal);
> +}
> +
STATIC
> +BOOLEAN
> +PcieDBIReadOnlyWriteEnable(
Space before (
> + IN UINT32 HostBridgeNum,
> + IN UINT32 Port
> + )
> +{
> + UINT32 Val;
> + RegRead (PCIE_APB_SLAVE_BASE_1610[HostBridgeNum][Port] + PCIE_DBI_READ_ONLY_WRITE_ENABLE, Val);
> + if (Val == 0x1) {
> + return TRUE;
> + } else {
> + RegWrite (PCIE_APB_SLAVE_BASE_1610[HostBridgeNum][Port] + PCIE_DBI_READ_ONLY_WRITE_ENABLE, 0x1);
> + /*Delay 10us to make sure the PCIE device have enouph time to response. */
Space after /*
> + MicroSecondDelay(10);
> + RegRead (PCIE_APB_SLAVE_BASE_1610[HostBridgeNum][Port] + PCIE_DBI_READ_ONLY_WRITE_ENABLE, Val);
Line length
> + if (Val == 0x1) {
> + return TRUE;
> + }
> + }
> + DEBUG ((DEBUG_ERROR,"PcieDBIReadOnlyWriteEnable Fail!!!\n"));
> + return FALSE;
> +}
STATIC
> +VOID
> +SwitchPcieASPMSupport (
> + IN UINT32 HostBridgeNum,
> + IN UINT32 Port,
> + IN UINT8 Val
> + )
> +{
> + PCIE_EP_PCIE_CAP3_U pcie_cap3;
PcieCap3
> +
> + if (Port >= PCIE_MAX_ROOTBRIDGE) {
> + DEBUG ((DEBUG_ERROR, "Port is not valid\n"));
> + return;
> + }
> + if (!PcieDBIReadOnlyWriteEnable (HostBridgeNum, Port)) {
> + DEBUG ((DEBUG_INFO, "PcieDeEmphasisLevelSet ReadOnly Reg do not Enable!!!\n"));
PcieDeEmphasisLevelSet ?
> + return;
> + }
> + PcieDbiCs2Enable (HostBridgeNum, Port, FALSE);
> +
> + RegRead (PCIE_APB_SLAVE_BASE_1610[HostBridgeNum][Port] + PCIE_EP_PCIE_CAP3_REG, pcie_cap3.UInt32);
> + pcie_cap3.Bits.active_state_power_management = Val;
> + RegWrite (PCIE_APB_SLAVE_BASE_1610[HostBridgeNum][Port] + PCIE_EP_PCIE_CAP3_REG, pcie_cap3.UInt32);
> + RegRead (PCIE_APB_SLAVE_BASE_1610[HostBridgeNum][Port] + PCIE_EP_PCIE_CAP3_REG, pcie_cap3.UInt32);
> + DEBUG ((DEBUG_INFO, "ASPI active state power management: %d\n", pcie_cap3.Bits.active_state_power_management));
> +
Line length
> + PcieDbiCs2Enable (HostBridgeNum, Port, TRUE);
> +}
> +
> EFI_STATUS
> EFIAPI
> PciePortInit (
> @@ -1090,6 +1158,9 @@ PciePortInit (
> /* disable link up interrupt */
> (VOID)PcieMaskLinkUpInit(soctype, HostBridgeNum, PortIndex);
>
> + //disable ASPM
Please use comment style consistent with the other code
/* disable ASPM */
> + SwitchPcieASPMSupport (HostBridgeNum, PortIndex, PCIE_ASPM_DISABLE);
> +
> /* Pcie Equalization*/
> (VOID)PcieEqualization(soctype ,HostBridgeNum, PortIndex);
>
> diff --git a/Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.h b/Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.h
> index 9a0f636..e96c53c 100644
> --- a/Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.h
> +++ b/Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.h
> @@ -77,6 +77,8 @@
> #define RegWrite(addr,data) MmioWrite32((addr), (data))
> #define RegRead(addr,data) ((data) = MmioRead32 (addr))
>
> +#define PCIE_ASPM_DISABLE 0x0
> +#define PCIE_ASPM_ENABLE 0x1
>
> typedef struct tagPcieDebugInfo
> {
> diff --git a/Silicon/Hisilicon/Include/Regs/HisiPcieV1RegOffset.h b/Silicon/Hisilicon/Include/Regs/HisiPcieV1RegOffset.h
> index bf57652..c8b9781 100644
> --- a/Silicon/Hisilicon/Include/Regs/HisiPcieV1RegOffset.h
> +++ b/Silicon/Hisilicon/Include/Regs/HisiPcieV1RegOffset.h
> @@ -135,6 +135,7 @@
> #define PCIE_EEP_PORTLOGIC53_REG (0x888)
> #define PCIE_EEP_GEN3_CONTRL_REG (0x890)
> #define PCIE_EEP_PIPE_LOOPBACK_REG (0x8B8)
> +#define PCIE_DBI_READ_ONLY_WRITE_ENABLE (0x8BC)
> #define PCIE_EEP_PORTLOGIC54_REG (0x900)
> #define PCIE_EEP_PORTLOGIC55_REG (0x904)
> #define PCIE_EEP_PORTLOGIC56_REG (0x908)
> @@ -12556,6 +12557,7 @@ typedef union tagPortlogic93
> #define PCIE_SUBCTRL_SC_DISPATCH_DAW_ARRAY5_REG (PCIE_SUBCTRL_BASE + 0x1018)
> #define PCIE_SUBCTRL_SC_DISPATCH_DAW_ARRAY6_REG (PCIE_SUBCTRL_BASE + 0x101C)
> #define PCIE_SUBCTRL_SC_DISPATCH_DAW_ARRAY7_REG (PCIE_SUBCTRL_BASE + 0x1020)
> +#define PCIE_SUBCTRL_SC_PCIE_SYS_CTRL21 (PCIE_SUBCTRL_BASE + 0x1024)
> #define PCIE_SUBCTRL_SC_DISPATCH_RETRY_CONTROL_REG (PCIE_SUBCTRL_BASE + 0x1030)
> #define PCIE_SUBCTRL_SC_DISPATCH_INTMASK_REG (PCIE_SUBCTRL_BASE + 0x1100)
> #define PCIE_SUBCTRL_SC_DISPATCH_RAWINT_REG (PCIE_SUBCTRL_BASE + 0x1104)
> --
> 1.9.1
>
next prev parent reply other threads:[~2018-01-20 10:59 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 15:01 [PATCH edk2-platforms v1 00/14] Improve D0x platforms and bug fix Ming Huang
2018-01-18 15:01 ` [PATCH edk2-platforms v1 01/14] Hisilicon/D05: Add PPTT support Ming Huang
2018-01-20 10:16 ` Ard Biesheuvel
2018-01-22 9:16 ` Huangming (Mark)
2018-01-23 6:00 ` Huangming (Mark)
2018-01-22 13:53 ` Leif Lindholm
2018-01-22 14:15 ` Leif Lindholm
2018-01-24 13:49 ` graeme.gregory
2018-01-23 21:29 ` Jeremy Linton
2018-01-24 7:57 ` Huangming (Mark)
2018-01-25 5:56 ` Huangming (Mark)
2018-01-25 15:27 ` Jeremy Linton
2018-01-18 15:01 ` [PATCH edk2-platforms v1 02/14] Hisilicon D03/D05:Switch to Generic BDS driver Ming Huang
2018-01-20 10:27 ` Ard Biesheuvel
2018-01-22 18:38 ` Leif Lindholm
2018-01-23 6:03 ` Huangming (Mark)
2018-01-18 15:01 ` [PATCH edk2-platforms v1 03/14] Hisilicon D03/D05: Optimize the feature of BMC set boot option Ming Huang
2018-01-20 10:41 ` Ard Biesheuvel
2018-01-23 8:28 ` Huangming (Mark)
2018-01-23 10:28 ` Leif Lindholm
2018-01-23 10:51 ` Huangming (Mark)
2018-01-18 15:01 ` [PATCH edk2-platforms v1 04/14] Hisilicon D03/D05: Add capsule upgrade support Ming Huang
2018-01-20 10:50 ` Ard Biesheuvel
2018-01-23 8:53 ` Huangming (Mark)
2018-01-23 9:33 ` Ard Biesheuvel
2018-01-24 11:10 ` Huangming (Mark)
2018-01-24 11:21 ` Ard Biesheuvel
2018-01-25 0:53 ` Huangming (Mark)
2018-01-23 14:06 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 05/14] Hisilicon D03/D05: Open SasPlatform source code Ming Huang
2018-01-20 10:57 ` Ard Biesheuvel
2018-01-23 11:01 ` Huangming (Mark)
2018-01-23 14:04 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 06/14] Hisilicon D03/D05: Open SnpPlatform " Ming Huang
2018-01-20 11:00 ` Ard Biesheuvel
2018-01-23 11:01 ` Huangming (Mark)
2018-01-23 14:07 ` Leif Lindholm
2018-01-24 12:31 ` Huangming (Mark)
2018-01-24 13:47 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 07/14] Hisilicon/Smbios: modify type 4 Ming Huang
2018-01-20 11:01 ` Ard Biesheuvel
2018-01-23 14:15 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 08/14] Hisilicon/PCIe: Disable PCIe ASPM Ming Huang
2018-01-20 11:04 ` Ard Biesheuvel [this message]
2018-01-18 15:01 ` [PATCH edk2-platforms v1 09/14] Hisilicon/D05: Replace SP805Watchdog by WatchdogTimer driver Ming Huang
2018-01-20 11:05 ` Ard Biesheuvel
2018-01-23 14:21 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 10/14] Hisilicon/D03: " Ming Huang
2018-01-20 11:05 ` Ard Biesheuvel
2018-01-23 14:21 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 11/14] Hisilicon/D05/ACPI: Add ITS PXM Ming Huang
2018-01-20 11:06 ` Ard Biesheuvel
2018-01-18 15:01 ` [PATCH edk2-platforms v1 12/14] Hisilicon/D05/ACPI: Add Pcie, HNS and SAS PXM Ming Huang
2018-01-20 11:08 ` Ard Biesheuvel
2018-01-18 15:01 ` [PATCH edk2-platforms v1 13/14] Hisilicon/Library: Add OsBootLib Ming Huang
2018-01-20 11:11 ` Ard Biesheuvel
2018-01-23 10:23 ` Leif Lindholm
2018-01-27 1:47 ` Huangming (Mark)
2018-01-27 10:37 ` Ard Biesheuvel
2018-01-29 8:55 ` Huangming (Mark)
2018-01-29 10:19 ` Ard Biesheuvel
2018-01-29 11:16 ` Leif Lindholm
2018-02-07 21:16 ` Peter Jones
2018-02-11 6:03 ` Huangming (Mark)
2018-02-26 1:12 ` Guo Heyi
2018-01-18 15:01 ` [PATCH edk2-platforms v1 14/14] Hisilicon D03/D05: Update firmware version to 18.02 Ming Huang
2018-01-20 11:11 ` Ard Biesheuvel
2018-01-23 10:18 ` Leif Lindholm
2018-01-24 1:17 ` Huangming (Mark)
2018-01-24 7:54 ` Leif Lindholm
2018-01-22 13:26 ` [PATCH edk2-platforms v1 00/14] Improve D0x platforms and bug fix Leif Lindholm
2018-01-23 14:24 ` Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKv+Gu-uNuRj453nWB9esbUavHXA73__JSJf45JT2818AR2D2Q@mail.gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox