From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.84]) by mx.groups.io with SMTP id smtpd.web12.13247.1593413138675846072 for ; Sun, 28 Jun 2020 23:45:39 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=KswlnnXS; spf=pass (domain: oss.nxp.com, ip: 40.107.22.84, mailfrom: wasim.khan@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EWxL6vE/jALLD0g55lVIy10sj30Y45olrGxEP5a3kSkv1T0aWY1QNiiYSxvnhMg4kh6vrgZRCf8GB4h3evflVUQIpAcqiAuIbXxlkx4b8d4z84egHVk32P00/iLcHDouMmQNo0ewmnUPpzNX2Llwqqz4p1swJFgZAa/419ERKMvCwzqFLSwKJdR45v1ANudZltZj3fpMhk3545KkQdZGDjSm6wvZUAzf/eXZxpiMK6z9aRHNGte2PEWzegWLQ4pMHFNhGExw35SAJ047SQWMHA+6MkRepPYANnLTPEdJFkIJG+AoanQ4aQnzR7jjgKIu4QRT2GCBOXW2g0A68bwvXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hN9daprzU+R6OhgV0/9bS6h/8ldKLh4Lc7bZu/CHK1M=; b=hrMlX0T1fUffOqk4GAQjEbx0rVg4FUT3cFTLVnlq4WGqIwZCu0CJN4BrNgcDG1A/ieK3i0eUrpDsz8SvtetCbBSf3y5ehLg8c5Ne6SRKLsiZU3ldfDSsdQRCky/WviMZDq2S9JZfrjYNMzLZufFbnBDJtKUpGZMQWHWNWRQ88YSEWaXlfx9268CzVwlDCYY7SEcoC9uhMAnpAxgMR6i1z5zYa6T+LGDio5iIudbz0DJqffruE8P9z1GZaLBQq7KrKEoKbb98jvkdckGx6KNUzaF4GHL9s3VZxHLzD7QFqwyApz/LkPV7v4TsvMcDOBsUHt7m79N2oa37YBhMKDTZVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hN9daprzU+R6OhgV0/9bS6h/8ldKLh4Lc7bZu/CHK1M=; b=KswlnnXSXImtxtzLa/ahyTzqCiW08kamUr7sSo7v4KoEwekaXA6nFgc4rp3LWtt1wMrcdfWxFv9qhQpC4crYoTTzSIfZnV/gGljmX7GHjaa5146DofUuI/hH3ca2VN+fjC3w8APPuSOqgjK+c4W6mXekqNIQ5togwpf8eI2yAZY= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) by VI1PR04MB4816.eurprd04.prod.outlook.com (2603:10a6:803:5b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20; Mon, 29 Jun 2020 06:45:36 +0000 Received: from VE1PR04MB6702.eurprd04.prod.outlook.com ([fe80::81c4:97a6:7592:f225]) by VE1PR04MB6702.eurprd04.prod.outlook.com ([fe80::81c4:97a6:7592:f225%7]) with mapi id 15.20.3131.026; Mon, 29 Jun 2020 06:45:36 +0000 From: Wasim Khan To: devel@edk2.groups.io, meenakshi.aggarwal@nxp.com, V.Sethi@nxp.com, ard.biesheuvel@arm.com, leif@nuviainc.com CC: Wasim Khan Subject: [PATCH edk2-platforms v2 3/7] Platform/NXP: LX2160aRdbPkg: Add PlatformDxe driver Date: Mon, 29 Jun 2020 12:15:02 +0530 Message-ID: <1593413106-1672-4-git-send-email-wasim.khan@oss.nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593413106-1672-1-git-send-email-wasim.khan@oss.nxp.com> References: <1593413106-1672-1-git-send-email-wasim.khan@oss.nxp.com> X-ClientProxiedBy: BMXPR01CA0083.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::23) To VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) Return-Path: wasim.khan@oss.nxp.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wasimk-VirtualBox.nxp.com (157.37.149.241) by BMXPR01CA0083.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3131.20 via Frontend Transport; Mon, 29 Jun 2020 06:45:33 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [157.37.149.241] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ff223700-7452-441a-eaa3-08d81bf8072c X-MS-TrafficTypeDiagnostic: VI1PR04MB4816: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 044968D9E1 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OjXMpJq99Aplok/5vovHy3VtGhXxX5JF81ZlCAStYNvNwzTN1wt5AuPJIEOyU0F/uH7ugkOUz79jbDUBuWCKQ0zp7LV2EY17xNWh4Z03hqDFGdJGZ8+jbVN31bfJcz6M77DylqInzGJjKp2v9RuMmJhVgjSSEC8ttaS1FAkT32iHEkaSJ7IAFgVQcDMQxj3iyQtPe4RWE+OCDYWQ3CrIipnDirgBRXC0+BmkoKx7CFY5PPteJ3lT7Veu//0msu3kj5Lw/rLYnEc/vIudHcdiHNzkmyBTSMdfZnlkhoAZjesnfxOLOKZsnzHZotki4zdnwk/s7axQBL8/pAweaC5ffw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6702.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(39860400002)(376002)(396003)(346002)(366004)(4326008)(52116002)(86362001)(66946007)(26005)(2906002)(6506007)(44832011)(66556008)(66476007)(2616005)(956004)(186003)(16526019)(6512007)(6486002)(8676002)(6666004)(8936002)(478600001)(19627235002)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: jw/VRwQN3EKB3rkyv9dDA7AcZGffgFx/c75uQ1O/kdpzJFcG7/1CNYaW28nCvpG9iCGVi+hwLUz/Wav6aJSByO1Jw8SaqFvCSbPzTxsnBdZB3P4gpV40rcecRuLpwlZj7yQsvY62CyjOYmHUr49MiY9vX58q5gA0NN1JCupl3GFyHEXGjC16U6zrh7hrwXFto21xAqsqssSQvI7cBh9kEsj7Nu1KgMpHc2J7QC80buw8sVM9j1fSc8HIF11N8yBCVdXe1vyPmrBMueE6WSnTCxWTHAjT73SSpbb0GpDwi/qjmZu2wbxoSEic7dFky+S2UrH5katwBJqJuWEbrAnSOmPhVTy3yjP4CXg/5EiZ1hL6jXH6Xh/fg4B4gDlWlyX/w3IxVeW8c9oPN4Zy0yu/NM1EFGRcHMC3ObC0smbhaEQFt36a3R1/56bQhS7MehRGsQwPU/YKwpCwnsR0QSsoo8OtpiuCAmxyP93TtnDecCGR/m6VpqF/GHDV/OU2Gz8X X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff223700-7452-441a-eaa3-08d81bf8072c X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6702.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2020 06:45:36.2116 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +MlhQJP6Tdda5q6yf8YtepcnZMB4cVqcUaP1/5JItqma0L/Tq1Y8IeBJdJHSNy3kQ4y3ii/6d/M984z8WHMtlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4816 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Wasim Khan Add PlatformDxe to do platform specific work. At present it sets PCDs for PCIe controller based on SoC version, which are used later during initialization of PCIe controller. Signed-off-by: Wasim Khan --- Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf | 35 ++++++= ++ Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c | 90 ++++++= ++++++++++++++ 2 files changed, 125 insertions(+) diff --git a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf= b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf new file mode 100644 index 000000000000..2514adf1d69d --- /dev/null +++ b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf @@ -0,0 +1,35 @@ +## @file +# +# Copyright 2020 NXP +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010019 + BASE_NAME =3D PlatformDxe + FILE_GUID =3D C4063EBA-7729-11EA-BC55-0232AC130003 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PlatformDxeEntryPoint + +[Sources] + PlatformDxe.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/NXP/Chassis3V2/Chassis3V2.dec + Silicon/NXP/LX2160A/LX2160A.dec + Silicon/NXP/NxpQoriqLs.dec + +[LibraryClasses] + PcdLib + UefiDriverEntryPoint + +[Pcd] + gNxpQoriqLsTokenSpaceGuid.PcdPciCfgShiftEnable + gNxpQoriqLsTokenSpaceGuid.PcdPciLsGen4Ctrl + +[Depex] + TRUE diff --git a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c b= /Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c new file mode 100644 index 000000000000..0caabb448ec0 --- /dev/null +++ b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c @@ -0,0 +1,90 @@ +/** @file +* +* Copyright 2020 NXP +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +**/ +#include +#include +#include +#include + +/** + Set PCDs for PCIe controller based on SoC version. + LX2160-Rev1 and LX2160-Rev2 has different PCIe controller. This function + check the SoC version and set PCDs for PCIe controller which will be + used by PciHostBridgeLib and PciSegmentLib for controller initialization= . + + @return EFI_SUCCESS PCDs were set successfully + @return EFI_INVALID_PARAMETER Invalid major version number +**/ +EFI_STATUS +SetPciControllerPcdOptions ( + VOID + ) +{ + UINT32 Svr; + + Svr =3D SocGetSvr (); + if (SVR_SOC_VER(Svr) =3D=3D SVR_LX2160A) { + switch (SVR_MAJOR(Svr)) { + case 0x1: + // + // LX2160-Rev1 and LX2160-Rev2 has different PCIe controllers. + // Set PcdPciLsGen4Ctrl to TRUE for LX2160-Rev1, which will be used + // by PciHostBridgeLib and PciSegmentLib to differentiate both contr= ollers + // and perform controller specific initialization. + // + PcdSetBoolS (PcdPciLsGen4Ctrl, TRUE); + break; + case 0x2: + // + // PCIe controller in LX2160-Rev2 supports two methods for config + // transactions. + // 1 - Default (Non ECAM compliant): PCIe controller + // requires target BDF to be written to bit[31:16] of type0/type1 + // outbound window. + // 2 - CFG SHIFT: PCIe controller shifts BDF from bits[27:12] to + // bits[31:16] and supports Enhanced Configuration Address Mapping (= ECAM) + // mechanism. + // + // Set PcdPciCfgShiftEnable to TRUE for LX2160-Rev2, which will be u= sed by + // PciHostBridgeLib and PciSegmentLib to enable CFG SHIFT feature on + // PCIe controller and program the iATU windows accordingly. + // + PcdSetBoolS (PcdPciCfgShiftEnable, TRUE); + break; + default: + DEBUG ((DEBUG_ERROR, "%a: Invalid SoC Version 0x%x \n", __FUNCTION__= , + SVR_MAJOR(Svr))); + return EFI_INVALID_PARAMETER; + } + } + + return EFI_SUCCESS; +} + +/** + The entry point for PlatformDxe driver. This driver + intends to perform platform specific initialization. + + @param[in] ImageHandle The image handle of the driver. + @param[in] SystemTable The system table. + + @retval EFI_SUCCESS Driver initialization success. + +**/ +EFI_STATUS +EFIAPI +PlatformDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // Set PCDs for PCIe controller + Status =3D SetPciControllerPcdOptions (); + + return Status; +} --=20 2.7.4