From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.73]) by mx.groups.io with SMTP id smtpd.web11.6368.1587649276955127517 for ; Thu, 23 Apr 2020 06:41:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=jerZUizy; spf=pass (domain: oss.nxp.com, ip: 40.107.3.73, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LCAotuBEtEaFirlHXbMcdb34Y9VV6xk8zStMtZK8iLyeWwXEa5g2q77qZGIsxG8bzKhAYN8p5D9+davPxdbf2b8LJ0R25doascIHBo2yMHH7xPj6oKX8NAFG5zIMKGoolU1jW1jeAoCorOLakWQvOTh/FTc2NRGChiCJmqT419PUQ6jAd9TwBgD6LNJBRmVbJb4x8aORT1VDQ8NqYQYUHzIHcRN8R+Th7A/UEv1w3/jc/ncmjRxhKBzKLeZINPkrwR8pjix74AzROBT9YKe5TzbOpNIOvlf3xWRZQaTATDKbCWrfYF613uxblQK9MxmrOQZnei5x1G98v6CBBiGIrA== 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=FbvkXc2xrAjBLkk44LrIpd8+gPNsyu9Nb+FRPhQ+ynY=; b=eIgA/oEToUK/rRSfLqbw0ldJSPFmwp6fB7JSHiUo58xvQsq+TUgktFz7cl+UAOI0n66kaGMmALjG3ni/osX+Lz9JdI3Ibz36YernIdf0KIUJcwV3zPimFW2ZHKAZzh2Y5ytlWdQWwW/w6snBMLLgDRl43F/n17sFhlaCo/k5p6ok8aAmBv8vip7TEg8MquPC5U1jgTmeL3qkd8LNBYLfsQOPsBu40AVhM+lbDpWAxex3CocNenZ7ETSyi+gIYuDZeUAkFmQDC3RODpU5hqcWpNlqWOV23RoisuiQ4YWkVtnt6MQoIOKdTDbEzN4slcVRIel9IpQHDj22X3ydsMRN0Q== 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=FbvkXc2xrAjBLkk44LrIpd8+gPNsyu9Nb+FRPhQ+ynY=; b=jerZUizytR9ZTP0ND25fOHBTDISeU1sBrMFPNE+jVr+WGrWwx3s7xFMZom7X/z9B7kg4bXpjUn5qGY/xa7WZEcPeHWq2Dv4URlStkszy6Wh6CZFYIIivFH57i3vKT1faGlZNVJNctL0CZl8Ek+OdAjB7op6iqT9fDv3iI/Yhfz8= Received: from VI1PR04MB5135.eurprd04.prod.outlook.com (2603:10a6:803:62::11) by VI1PR04MB5309.eurprd04.prod.outlook.com (2603:10a6:803:59::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Thu, 23 Apr 2020 13:41:14 +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 13:41:14 +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+u4dCBzq4gzKiGjtUAgAAE4nCAABQ7gIAAAEbwgAACGoCAABpAoA== Date: Thu, 23 Apr 2020 13:41:14 +0000 Message-ID: References: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> <20200415121342.9246-17-pankaj.bansal@oss.nxp.com> <20200423102714.GW14075@vanye> <20200423115707.GB14075@vanye> <20200423120537.GC14075@vanye> In-Reply-To: <20200423120537.GC14075@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: 2c04ce75-d51e-4827-44bb-08d7e78bfe0b x-ms-traffictypediagnostic: VI1PR04MB5309:|VI1PR04MB5309: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; 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:(10009020)(4636009)(346002)(376002)(396003)(39860400002)(136003)(366004)(19627235002)(7696005)(33656002)(86362001)(316002)(54906003)(4326008)(8676002)(8936002)(71200400001)(478600001)(76116006)(966005)(26005)(186003)(6916009)(52536014)(55016002)(6506007)(66476007)(66556008)(64756008)(66446008)(53546011)(9686003)(81156014)(66946007)(2906002)(5660300002);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: 1V5zU3XPvQvEZBxPYra612sbrt52Eboc2JftfJZpl2hRVW8jv4qtNSZC4itOJAGNu3FHbGwJZRNkGySv3pAb7sg/A4l1toOM3NyAmWTrQJZf1SYoAPCtb1q49p1zuEri2w6WaGCLfPHxs0T4/sFZzM1juAJ1ejGM/N1xlHitlrEjfkcnULGXTm5bX380u0pebXaAcwj1UDb3+8Fqy6G73kd/HEHx9jJwZUAFg9lgd81jRdUPwHMeK6HNCt1ZkK4RCJ5QXhUlVsF+NxT/uowrdy4zGWJ3e/TX9YrvCM10dd9CeOq9gqYX24p7BtWz4E74aU7T6QaoCSvC3aV2CjHrB0qHJOiCZpUZYFZWa9e8NeS4cI5CuM3fxDpuI1LUEHzFvpZA4mfrNqP3hnRmCs1LhXlB69VkPX7auZKC8XF8iQGuX3Tw02luUZ+ztgLbMotM52/9djdzWEkA56uVd/44k317rQcD4eQanWGU28wOpwH+/nQeANNw0j2E+0FC2aqaRlrWb0WgHX52mLWxinv2kw== x-ms-exchange-antispam-messagedata: Y4nhdlq9zEhvqmnrF+3r5q/q9g54enWnX4p4lLgBoaywMzGw6WigiYE3Ktb0Irh6QzeYhw61QwB8XclFl7QOlXfXR3KRCc9HjWsFrFP4NSfYh6KvRgqvx/unuMzo3Z6qq3bFAZxkgwiKF1mChJDUiw== MIME-Version: 1.0 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c04ce75-d51e-4827-44bb-08d7e78bfe0b X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2020 13:41:14.3457 (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: 1/bwLBoHhU3a/+Ch8h7wo6ItU+WPBKRlTHQk9Vd1AG7TaDXPO6dLxPhASnlfgJQ5bdeVfilKvYxWWPmyaX5trT+LPlfQbjMbg+CuegsHTsW6pF6NTF+KxuAxAK66c/qc X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5309 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm > Sent: Thursday, April 23, 2020 5:36 PM > To: Pankaj Bansal (OSS) > Cc: Meenakshi Aggarwal ; Michael D Kinney > ; devel@edk2.groups.io; Varun Sethi > ; Samer El-Haj-Mahmoud Mahmoud@arm.com>; Jon Nettleton ; Ard Biesheuvel > > Subject: Re: [PATCH edk2-platforms v3 16/24] Silicon/NXP: Add Chassis2 > Package >=20 > On Thu, Apr 23, 2020 at 12:02:16 +0000, Pankaj Bansal (OSS) wrote: > > > > > > > -----Original Message----- > > > From: Leif Lindholm > > > Sent: Thursday, April 23, 2020 5:27 PM > > > To: Pankaj Bansal (OSS) > > > Cc: Meenakshi Aggarwal ; Michael D > Kinney > > > ; devel@edk2.groups.io; Varun Sethi > > > ; Samer El-Haj-Mahmoud > > Mahmoud@arm.com>; Jon Nettleton ; Ard Biesheuvel > > > > > > Subject: Re: [PATCH edk2-platforms v3 16/24] Silicon/NXP: Add Chassis= 2 > > > Package > > > > > > On Thu, Apr 23, 2020 at 11:38:12 +0000, Pankaj Bansal (OSS) wrote: > > > > > > + > > > > > > + @return The value read. > > > > > > +**/ > > > > > > +UINT32 > > > > > > +EFIAPI > > > > > > +DcfgRead32 ( > > > > > > + IN UINTN Address > > > > > > + ) > > > > > > +{ > > > > > > + MMIO_OPERATIONS_32 *DcfgOps; > > > > > > + > > > > > > + DcfgOps =3D GetMmioOperations32 (FeaturePcdGet > (PcdDcfgBigEndian)); > > > > > > + > > > > > > + return DcfgOps->Read32 (Address); > > > > > > +} > > > > > > > > > > The intended usage model for IoAccessLib is to retrieve the funct= ion > > > > > 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 reaso= n: > > > > The order of Library constructor call for a module cannot be gu= aranteed. > > > > https://edk2.groups.io/g/devel/message/57254 is an good exampl= e of > this. > > > > BaseDebugLibSerialPortConstructor would need to depend on > > > ChassisLibConstructor, > > > > 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) > > > > > > If this is a problem (and I recall Ard pointing out some shortcomings > > > in the dependency handling in the past), we can solve this with an > > > explicit initialisation call in the SoC or platform init code. > > > > You mean put ChassisLibConstructor() call in SerialPortInitialize () ? >=20 > Or before the call to SerialPortInitialize in ChassisInit. But SerialPortInitialize would be called from each module. Each module that has SerialPort and ChassiLib linked to it would have a local copy of mDcfgOps, which needs to be initialized. >=20 > / > Leif >=20 > > > > > > > > / > > > Leif > > > > > > > > > > > > and do something like: > > > > > > > > > > STATIC MMIO_OPERATIONS mDcfgOps; > > > > > > > > > > /** > > > > > Read Dcfg register > > > > > > > > > > @param Address The MMIO register to read. > > > > > > > > > > @return The value read. > > > > > **/ > > > > > UINT32 > > > > > EFIAPI > > > > > DcfgRead32 ( > > > > > IN UINTN Address > > > > > ) > > > > > { > > > > > return mDcfgOps->Read32 (Address); > > > > > } > > > > > > > > > > /** > > > > > Write Dcfg register > > > > > > > > > > @param Address The MMIO register to write. > > > > > @param Value The value to write to the MMIO register. > > > > > > > > > > @return Value. > > > > > > > > > > **/ > > > > > UINT32 > > > > > EFIAPI > > > > > DcfgWrite32 ( > > > > > IN UINTN Address, > > > > > IN UINT32 Value > > > > > ) > > > > > { > > > > > return mDcfgOps->Write32 (Address, Value); > > > > > } > > > > > > > > > > ... > > > > > > > > > > /** > > > > > The constructor function initializes the IoAccessLib > > > > > function pointer structure. > > > > > > > > > > @retval RETURN_SUCCESS The constructor always returns > EFI_SUCCESS. > > > > > > > > > > **/ > > > > > EFI_STATUS > > > > > EFIAPI > > > > > ChassisLibConstructor ( > > > > > VOID > > > > > ) > > > > > { > > > > > mDcfgOps =3D GetMmioOperations (FeaturePcdGet (PcdDcfgBigEndian= )); > > > > > > > > > > return EFI_SUCCESS; > > > > > } > > > > > > > > > > / > > > > > Leif > > > > > > > > >