From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.90]) by mx.groups.io with SMTP id smtpd.web10.11471.1633524969747043563 for ; Wed, 06 Oct 2021 05:56:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=OIFuBMvk; spf=pass (domain: os.amperecomputing.com, ip: 40.107.244.90, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tt/zVZPTtyl94DMVi1OqO+frKlkVsHZxWO05xzCLFTBvwJ2qwO8KswG5qa2D5Pr+NFSiscvQgPJEZUJQrTYVDFAfSk6j2GOtBa/wWd58flqCI7RxNf86eo4Q+fnPXLi2rOjN+YtLenJCN4QdmWeU0nOztbaIXWYXtKNTyN4y5ihKjNaKVAy8jBcwpYUT8gmdHGm5BWmQEpLcVD0POYPXebkRM1o6klL2Y5LiwyaqZLRQR7gzm51syqDTx3bYLzH3mA74bFZNU2+aPgPVnJQMo5WsQlJcU5cxGc2+oS58JaRVzVZ4/mP7Xa9Njd1iKtIN3zpCfp70xFJfLdZeO9pfLw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4t9yi6WgD1ogrIIf9Ms6vHeyku9/bj+zgSD/YQ/86lc=; b=IP2K7EocZmy77eAO8MjqKS+zMR6hRyKBXfWHx4HNBKPnk4JEA/NHxW+flvH35KhjdSXpjCMcnO+s9aZPzsOqI0Z7Jeux2uAQU5TM/8YNxoMiQv14pmV8x0FRy++Insv+pJcBJNVpRqLnvxlbFw2fWgI9G4ZUosrB7ukkVL55UkdHXAMS1CyX2y/FItscj4CxfEoGLFjp+1XfJTEypW+4SYt/dmapUBioFy78rO6Pl4Ig6Ey+nRU+9Xn3oZOMWReV7XyGpMKmaLJN2YY8WJCMcNe9vHJ4BWmc180aNtmbM3DZKnLXOpge9bR2qyyVVppROifHUIunsMr5HtbAR3ZkVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4t9yi6WgD1ogrIIf9Ms6vHeyku9/bj+zgSD/YQ/86lc=; b=OIFuBMvkxetXlE2fDTReY4Su9ZxuetbJJ+nYdmWsL0/SKJmzOANkF+9sKet7HYPCv4VUNGQGZ7UYfIOvXmcI6+h9q2rvkyC/ynlBT+CEQ2yDWKGHLGLK8nvnTEI2mlB7Xy7CGLSLwJQPDoS8FfV3JJfiBuP7dBD6b/v2RITGIdk= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6293.prod.exchangelabs.com (2603:10b6:510:13::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Wed, 6 Oct 2021 12:56:06 +0000 Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4587.019; Wed, 6 Oct 2021 12:56:05 +0000 Subject: Re: [edk2-devel] [PATCH v3 12/28] AmpereAltraPkg: Add Ac01PcieLib library instance To: leif@nuviainc.com Cc: devel@edk2.groups.io, patches@amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Michael D Kinney , Ard Biesheuvel , Nate DeSimone References: <20210915155527.8176-1-nhi@os.amperecomputing.com> <20210915155527.8176-13-nhi@os.amperecomputing.com> <20210923134931.gzxueebb4axflhdi@leviathan> <20211005195953.eqmym4dkkkpqatik@leviathan> From: "Nhi Pham" Message-ID: Date: Wed, 6 Oct 2021 19:55:53 +0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <20211005195953.eqmym4dkkkpqatik@leviathan> X-ClientProxiedBy: HK2PR02CA0194.apcprd02.prod.outlook.com (2603:1096:201:21::30) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from [IPv6:2405:4802:91b7:33b0:442c:647c:8de4:5a2b] (2405:4802:91b7:33b0:442c:647c:8de4:5a2b) by HK2PR02CA0194.apcprd02.prod.outlook.com (2603:1096:201:21::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Wed, 6 Oct 2021 12:56:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58fe7e01-edc9-42e3-8e73-08d988c8a876 X-MS-TrafficTypeDiagnostic: PH0PR01MB6293: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iBYunYMTOG7bpyYVfKTAdf+VMkBMz7ndAHf1uSoQcuekmcwZXqZNaWrwpeoD8ShSNdYK02som02FwrvIa53zvLficJAc1suosoVXANPyn25ZaOXvgd3ykQnou75kBT1t/yftGzQElGSPGvJKj2vNM132yZg2xnorcbZBZPMByyd2vppfYadkthrscZuvkOqUgR5IRVDx9D6bOL/3hL/6kVcYtl6x7uLj9k11fWcQu4NIBwk1U7dD8VO4NegBGp2URVazsvYBwqFvAjCD4da7iN5nQitwVBLfTMbDpX2lkHP/DioTNxj896uvJLnqWdGk7MhE2ZIJqV5zHNE7u+TtozqZJ46U2eh58zmYMov6+LW+sRDcroBUwjiYjavJYjRXiM/oQzfIHC5FPSU+kSfA8uswq7ty8uksLORT6EUOeBcYrKW5ResdbCYkP2z1azQc8rdPEP3wNR7CyC98JMcklGUWevxnds92AIv+3NHqzwuKWgOCY4jLMyeE+EkKbS8TJTOSUmjQYzvjekWsYB2dmOmiBnR8BSIIummw4UPFq/yZPIOB+ssmFicZrKh5jUlNN/qoJQvAdrvwEQ58y3xUSwPLhIVhluv1Asl6fR+bcJYQRv3YIzgOGQw6q5BsjoOSCwAa3r7G3QE9KWDiXmwhjd9zyw1q5ZHTrXG++oxQwF2EMuurSs4+mb0n0RZnAWMP4tXN/Amz2HW2Du4+ZLasizplJLhmFPuGPxyxdZbytv+LjciWi6p5erS7Rf82kkurUV9XIEtN5F2pXVqWykR6vUftYBO+arZfLjQU5zPLT1cKyyVXZLTX1AVrh9WzVjBe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7287.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(83380400001)(6916009)(5660300002)(6666004)(508600001)(2616005)(186003)(8676002)(4326008)(966005)(316002)(19627235002)(31696002)(54906003)(52116002)(53546011)(8936002)(6486002)(31686004)(66476007)(66556008)(2906002)(38100700002)(86362001)(66946007)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MFdsTnovSlpjeGlyUi9oSWZQakFXMjV6cksxY3J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ZqbUxFd0ZnTEZNQ0pIdHAxREFqczVoUWhWWGJpd09tZ2lZS25ocnU4?= =?utf-8?Q?yF2znp/ZasJGj?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58fe7e01-edc9-42e3-8e73-08d988c8a876 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2021 12:56:05.4050 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4mzlGFaiETkU3Rr4+Nts4HIjn+SwwzaAueU+cuZLSu9um6ucgPjKJx3B1RfqGGxY044p3Ig6RBIJ+bNVUBWGU463SnjYq2lIUp2QyEgNYA8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6293 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Hi Leif, On 06/10/2021 02:59, Leif Lindholm via groups.io wrote: > On Mon, Oct 04, 2021 at 19:03:40 +0700, Nhi Pham wrote: >> Hi Leif, >> >> There are two comments that I would like to clarify with you. >> >> On 23/09/2021 20:49, Leif Lindholm wrote: >>>> +VOID >>>> +Ac01PcieMmioWr ( >>>> + UINT64 Addr, >>>> + UINT32 Val >>>> + ) >>>> +{ >>>> + Ac01PcieCsrOut32Serdes ((VOID *)Addr, (UINT32)Val); >>>> +} >>>> + >>>> +VOID >>>> +Ac01PciePuts ( >>> Wait, what. We have *two* sets of output overlays in this patch? >> This function is consumed by PCIe PHY library (PHYLib). We are making this >> wrapper function to conform with the function prototype defined by PHYLib. >> >> We will reduce DEBUG_PCIE_PHY by using directly the DEBUG (). Does it look >> good to you? > It's still a little bit awkward, but if that's the only way to get > debug out of PCYLib... > >>>> +VOID >>>> +Ac01PcieDelay ( >>>> + UINT32 Val >>>> + ) >>>> +{ >>>> + MicroSecondDelay (Val); >>> No, use MicroSecondDelay directly. >> Seems above. This wrapper function is to conform with the function prototype >> consumed by PHYLib. It's hard to change it. > So, I'm assuming this PHYLib is a library shared across multiple > codebases? Yes, it's a real pain in the neck so it's hard to change the PHYLib framework to satisfy the EDK2 coding style. > > Would it be possible for PHYLib to link in ArmArchTimerLib directly > and wrap this there instead? Something about this integration just > feels kind of backwards to me. Thanks Leif. That's great idea. I will wrap it and re-send the patchset for PHYLib in the edk2-non-osi repository as well. Best regards, Nhi > > Because we now have (sort of) an undocumented dircular dependency: > this driver declares a dependency of PciePhyLib, but that library > needs to be manually initialized by this driver. > > / > Leif > > > > >