From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.60]) by mx.groups.io with SMTP id smtpd.web10.4486.1587641895044068226 for ; Thu, 23 Apr 2020 04:38:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=DyWnP3Kg; spf=pass (domain: oss.nxp.com, ip: 40.107.0.60, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X/7yVt18UCe+kPpevKRnpQ0rTbke6YA55NA4JlZ4uArJLGNB5dhjr2fgZkTyX5t9m8Yc2kaOJPOypW55h5kLVlDxYJpgJ5Iqod5aS0BY5oS/kxBJIQrlYPiSb19EBMV1CTh5VftMnWya2Ohl7UOtfs6MtGjcsx95jLZPAxNcVfBwrvI4AfFriVFIhnL64cCISBk2b9C+HWlNbcLXRfyBbWtgSNnQNoTQdoQIlBt+fKaBrApFAT3kqXNf10OngBGHLHvmZz89v9NCUhUJOSjaXRz3zNp7HuE2WruwUTib8WE/fT7l7JTBMfQREqaHKNLAllEYPgesdJz0HBoOlysXvg== 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=K2cEimDsCHP0uZWh1HUkQImTm0sV00oKrWrxyFVrG6A=; b=TMY59/rzc7DChkYNuS2UMahq2GFtcUXc0V06E3koDVaDA60ZgkXRap2RSj9gTNOka0bI43vZD66nyUHwu3Xl0mxviU3FR3L7sNk1E/sWtF11YNPcgA/hhgB5iffD+fF6O5L4mev7HyL4Kz6a0miGCt2n2qymX8p7d0zWKpyrzMUGFf44auVcJCEGnjgVQfVYfuUKma0G5S/vp3CfdPVuMAXBaxo0s5l6cSzYS24/NG2jppA5Wat7t3wpIC3Vum42f2E4adyyhLD8y6wPBniaYPMjQsWP4xnPvxPbfvX4J/PI8OQc+6thRLKydgtBnossrOj3mspAKzhnStmQDC57iA== 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=K2cEimDsCHP0uZWh1HUkQImTm0sV00oKrWrxyFVrG6A=; b=DyWnP3Kgk5roUDit5BJ56PFqWvbkBFwtzm0tG2j4I1pI80yW538XbP8e1v3SrPFpeWG4kD/wkjPTP3IbinFnR+P9ClRguSI85RNm6gQ5D8GtiUAY209+3JZkKovwk69AFX0BRc5YQ13CiE0PldaMMEGrOKuc08ro7qsUl3EsxaM= Received: from VI1PR04MB5135.eurprd04.prod.outlook.com (2603:10a6:803:62::11) by VI1PR04MB5184.eurprd04.prod.outlook.com (2603:10a6:803:5d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 23 Apr 2020 11:38:13 +0000 Received: from VI1PR04MB5135.eurprd04.prod.outlook.com ([fe80::e51b:b40c:9a6d:fbf]) by VI1PR04MB5135.eurprd04.prod.outlook.com ([fe80::e51b:b40c:9a6d:fbf%5]) with mapi id 15.20.2921.030; Thu, 23 Apr 2020 11:38:13 +0000 From: "Pankaj Bansal" To: Leif Lindholm CC: Meenakshi Aggarwal , Michael D Kinney , "devel@edk2.groups.io" , Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton , Ard Biesheuvel Subject: Re: [PATCH edk2-platforms v3 16/24] Silicon/NXP: Add Chassis2 Package Thread-Topic: [PATCH edk2-platforms v3 16/24] Silicon/NXP: Add Chassis2 Package Thread-Index: AQHWElZluN07dp8m8E+u4dCBzq4gzKiGjtUAgAAE4nA= Date: Thu, 23 Apr 2020 11:38:12 +0000 Message-ID: References: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> <20200415121342.9246-17-pankaj.bansal@oss.nxp.com> <20200423102714.GW14075@vanye> In-Reply-To: <20200423102714.GW14075@vanye> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@oss.nxp.com; x-originating-ip: [49.36.135.81] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f8bd7578-c2e3-4346-c760-08d7e77ace57 x-ms-traffictypediagnostic: VI1PR04MB5184:|VI1PR04MB5184: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 03827AF76E x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5135.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(136003)(366004)(39860400002)(376002)(346002)(54906003)(966005)(478600001)(316002)(33656002)(6916009)(9686003)(19627235002)(55016002)(186003)(4326008)(8936002)(81156014)(52536014)(71200400001)(66446008)(76116006)(66476007)(66946007)(66556008)(64756008)(7696005)(8676002)(26005)(86362001)(6506007)(5660300002)(2906002);DIR:OUT;SFP:1101; received-spf: None (protection.outlook.com: oss.nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XSLpJ6PMtET+LOEth9ICpHhI9WzgqLP/zpm8JwLkKbk8hVWg2KPZaCLhA2i25N/Gj8Nj0wNefQ7mbgwFyDtiTTCIe2cGe/uDDRrcAIHCSjnrDm9kh7a36IL56+GEAdNrch+poa8v9ibEMRCAZLikOQLu9ApZN2D3aH6rz8A2gN9gYbbErUWXH9p5v3xqPYyrg1Xa8FjdCNSWYG27j8zh1mQVbbwKpgPBUqbGYtow7uHaRy4fXjmpXmAlvSMHaZkM4yKILJuh+WYOxwAzPkzjMdIz57SyLlFKvnrLslVYxYllzvY8o21L6hS3AaeHOiomS+8JcfdeprGoyaUuprZGSDaeT/8K2GCEI4pfTs+V0apW7In64m0L1KGz4Z2J5hG4/B6yFXym2E2o5GsOWU3Y5iobH0QBEygx8/3F2kNFkiQ/IdRPgDx5Q7R5W37tbSDmbXl/nSW7LuJFvMbmusBKI5e6zgrrYSHrTFYPu9sycctkk1PZTNV3kNyxXajpAEw0PD3HAqcuG29Jvj/7NXL3IQ== x-ms-exchange-antispam-messagedata: S6VF/XEmQJ3GL7fZyf9MVu1D5EQrkLDG5/wLHEias7H769ssgsOLP63MkPS2KoJUoLYVQ6akQUKHFEo8zPoIwRuYOP3/EuTr4DzzHhT6oSg78GGlcQZ8CCrrvBiqzjyaRHuHmnZz4h5hPrFdNnjoJg== MIME-Version: 1.0 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8bd7578-c2e3-4346-c760-08d7e77ace57 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2020 11:38:12.9220 (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: h/vdLO4EAWSXH8EzzQ4i9kJzTGMvO/tuzPjmrSFFGTxpI5ZbGzAB880zAzF65NtA5B2GLZVdYaIa2jyeNPhMlpHDG7XEqGwpVi5fLt/m3rmMyZwnUCbrPycAlSd1+VJj X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5184 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > > + > > + @return The value read. > > +**/ > > +UINT32 > > +EFIAPI > > +DcfgRead32 ( > > + IN UINTN Address > > + ) > > +{ > > + MMIO_OPERATIONS_32 *DcfgOps; > > + > > + DcfgOps =3D GetMmioOperations32 (FeaturePcdGet (PcdDcfgBigEndian)); > > + > > + return DcfgOps->Read32 (Address); > > +} >=20 > The intended usage model for IoAccessLib is to retrieve the function > pointer struct once and then always refer to it. Since this is a > library, we could have a CONSTRUCTOR function (specified in the .inf) I had thought of this, but decided against it because of this reason: The order of Library constructor call for a module cannot be guaranteed= . https://edk2.groups.io/g/devel/message/57254 is an good example of thi= s. BaseDebugLibSerialPortConstructor would need to depend on ChassisLibCon= structor, to retrieve the UART clock frequency. If the constructor calls are not = guaranteed, BaseDebugLibSerialPortConstructor would fail and it would cause ASSERT due to ASSERT_RETURN_ERROR (Status= ) > and do something like: >=20 > STATIC MMIO_OPERATIONS mDcfgOps; >=20 > /** > Read Dcfg register >=20 > @param Address The MMIO register to read. >=20 > @return The value read. > **/ > UINT32 > EFIAPI > DcfgRead32 ( > IN UINTN Address > ) > { > return mDcfgOps->Read32 (Address); > } >=20 > /** > Write Dcfg register >=20 > @param Address The MMIO register to write. > @param Value The value to write to the MMIO register. >=20 > @return Value. >=20 > **/ > UINT32 > EFIAPI > DcfgWrite32 ( > IN UINTN Address, > IN UINT32 Value > ) > { > return mDcfgOps->Write32 (Address, Value); > } >=20 > ... >=20 > /** > The constructor function initializes the IoAccessLib > function pointer structure. >=20 > @retval RETURN_SUCCESS The constructor always returns EFI_SUCCESS. >=20 > **/ > EFI_STATUS > EFIAPI > ChassisLibConstructor ( > VOID > ) > { > mDcfgOps =3D GetMmioOperations (FeaturePcdGet (PcdDcfgBigEndian)); >=20 > return EFI_SUCCESS; > } >=20 > / > Leif >=20