From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.48]) by mx.groups.io with SMTP id smtpd.web10.1106.1589216557472388834 for ; Mon, 11 May 2020 10:02:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=ffgOAcXr; spf=pass (domain: vmware.com, ip: 40.107.92.48, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HH1RTdwdsf8q4+5B9kBWekpgdqbfACWlloMFyUjIc1lGQROdS8tV4QFlrNbbE21NEJsTziewch+nZSqHrbgAV01aozy+04ndwHa8Bd7y5Zuf85Zldd68Ejn8HlkMjZUEeVOE/QoJNimTlIiJlRp+hQlJjHmQ0gj1IYmLWiSRQCpRSvGcZjIGFZWaix+a5SeqfJ628YVWzVY+/Nf2LQd1obIcX/Xi608mi6izh6CFbT3WrsPDws9uoT6pNw8Ti48IzyyzjK92F3TX1/0ElPMX7tNLKPriZ0w/WaZTMyqqpqL8oPnsKWz0SCExFZ/3xIKVwRRVK9qrxhwrl5NfwR+adw== 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=m/SQMMWQoA4u6SWpVuAw4YSOsaHE4gfIrueZHR3s08o=; b=d/2fCsArzo3PF0ik1FG4Ix27Fvi3iHwb7aqo45ANZU32UmujeasSgJt9bmPok5WaYOBZV46B2EMensc9PP38jOLW3aG0K2OhZrwdkRFB7RKG40p5LWs3WhZjURVTNmHaZh22xBgbDWzCC2xWFX1mLLepop0Nzo53FaE/XLvhsEwqG+Jzu56mMKuBb+fm5fESS0eEgp7fl73eKLrqG56A04v+/S4FP3I5x6hzWDfgn/g+9bLJJ+EssMA10nJ2/OYgr9RH+OOhDW7V7Ocp1uQJB4a2qSs95XYPkcyxzw09M5b18EfUiV0Qv/syLX5WjksFZFImVxmmiZgBaHeDcu5vdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m/SQMMWQoA4u6SWpVuAw4YSOsaHE4gfIrueZHR3s08o=; b=ffgOAcXrQHXMPPrs4uF2YfiVfIpzngvEpaq7emjUdeUU64BcF1FKUzIy2sPZ6845fg9oF69EZ1YetkmpULwoyDYT34FsrpGa1T2+2XbuZbCnVtjz+a+XGamZ+sq0hNFiKMr09hsY1ukfA+KSTUF2fDjl2zrjp7X2+Yp4K//3wH4= Received: from BN6PR05MB3411.namprd05.prod.outlook.com (2603:10b6:405:43::23) by BN6PR05MB2820.namprd05.prod.outlook.com (2603:10b6:404:29::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.11; Mon, 11 May 2020 17:02:35 +0000 Received: from BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::f463:db64:43d8:5a0f]) by BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::f463:db64:43d8:5a0f%3]) with mapi id 15.20.3000.016; Mon, 11 May 2020 17:02:35 +0000 From: "Andrei Warkentin" To: Andrei Warkentin , "devel@edk2.groups.io" , "ard.biesheuvel@arm.com" CC: "leif@nuviainc.com" , "pete@akeo.ie" , "philmd@redhat.com" Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: add Gpio output set/clear functions to GpioLib Thread-Topic: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: add Gpio output set/clear functions to GpioLib Thread-Index: AQHWJxM1Qv4mepFABU6Lj0IbnAFcuqih2KIAgAFDv6w= Date: Mon, 11 May 2020 17:02:35 +0000 Message-ID: References: <20200510213650.12829-1-andrey.warkentin@gmail.com>,<720059bd-3069-f39b-070a-0c4e0a4e0c8c@arm.com> In-Reply-To: <720059bd-3069-f39b-070a-0c4e0a4e0c8c@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=vmware.com; x-originating-ip: [98.214.99.181] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f70c2a23-6361-4176-15ce-08d7f5cd1a86 x-ms-traffictypediagnostic: BN6PR05MB2820: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 04004D94E2 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CdZdNraxy27SeH6rz1QmGZLZnMI5BqKCj5mcaDvvIa+FJtVqkmrS3ZpuAlaBurBHmI1fFxJEBvVH+LSIkIZqgQfQpC+BeySj8ikHFypp3Fazq3tY8xOWsISQ3cqeIBIJCAuh1h/DNFtC7RrUHF7jTc63OcqU/74Dn/b74pfbaZRUX/yrIGeUg2NncTGiUMexpoN5BTCVhVR5mQ5+mkrtuDrtxKuOCv0ftQC8F2oHPrGxjl9R3/jFU8VActCurvy6TO3AbjmyU194UIt6GrDQVCzMFgv4+bfb6Hg3C4vGwxlXBmfAulM7rF953tKoZdla27IUizxGK57RMyQtUq3oqtDQEd5E6Z8veuACgQgjVP1TZm5KyIYeQcImvY52RBXalBLMb6E9ejHXXHbJ9yFzLQkKKncdawxPgmCofMoHfW5Vpu9zHc6Wjq1VhV0MY75L7W87JsGdvS5DvtWSgJW0sAsIbWAd5yxBS50nVa/x/lbQ54dcA5aFryB9UgnSbtfzE9OjUBXQBNCCTQ6Jv4KqudltNI6X0Y3VIwfDLbe1MwAGgPnWDqKWkVJo84l6fcltXJkkkGerB08lxE2NpX9av4xAnVfdOaT7PvSDJskyppc= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR05MB3411.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(396003)(366004)(346002)(376002)(136003)(33430700001)(16799955002)(66946007)(76116006)(478600001)(19627235002)(5660300002)(54906003)(966005)(45080400002)(110136005)(4326008)(19627405001)(86362001)(2906002)(186003)(52536014)(53546011)(64756008)(33656002)(66446008)(6506007)(26005)(8676002)(9686003)(55016002)(166002)(7696005)(66476007)(33440700001)(66556008)(71200400001)(316002)(8936002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: T9BEWV8R67HlSJIp+QNwJ2nZQsF3KqbtUkO60/fETMA+i16uWvYhOUti9U7B+pzwMmUbJhb1PPaswFl5LfrcABtL2wZ0we7Y/s+DHuCI9Oy938Gt9fjz1mWtYhpdlz+CwALafxunEj6URe15S8NxrEtYlkRxquQ9X1yHkjuuOzX4UHJn/Mtmw84TgSiOYsSmTtMACELj+f/fy+6g9znpwNOWW3jsxdo8lsm+jz4YUD3IFSb2YbcNTSiB9YiKggw8WdOK70LGM+x5w9BC7K4HPFAEZgNrbu9CxYlybzvjpUIb6rwyjUpwbTC6+Jhana5npW/007MjsGutXTTBCAVT675BeH4QahR8fwmAKl41/x7J2MKTTanj8ShKj34W8KYadavAJv3yZlsl5ExLLPxlhwCpipkEesf8Ed9sLu0Wd3JqTdsv42AyOTdGjSDfoKv8/K13r6gvp2rZf8LIPzGVQXT1L3RcCscGsnsXPZmuFMA= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: f70c2a23-6361-4176-15ce-08d7f5cd1a86 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2020 17:02:35.6811 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WMPIeRw3kskpGvaA+XRHAe7BRs2MgwxzonNeTF2N+Cfc7mFpgaqzaMG2gPMBZ/5Nq6xP5Qcs8xgN5dlN+95bCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR05MB2820 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR05MB341142B01AF10A9C78B99D0DB9A10BN6PR05MB3411namp_" --_000_BN6PR05MB341142B01AF10A9C78B99D0DB9A10BN6PR05MB3411namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I was going to have a patch to support power-off using an alternate mechani= sm (not PSCI, but via GPIO for the https://raspberrypiwiki.com/index.php/X7= 35 hat. Ultimately, I decided against complicating UEFI - an OS isn't required to = use UEFI RT today over PSCI (OpenBSD didn't), the memory map becomes more c= omplicated (to cover the RT MMIO for GPIO block). The right place for this = functionality appears to be TF-A, so that's why I just have the GpioLib cha= nge. So in the near future I don't anticipate any changes from me that would us= e this GpioLib functionality, yet it is tested (at the least GpioSet) and w= ould be useful to others to have it. Shall I bail on it entirely? A ________________________________ From: devel@edk2.groups.io on behalf of Ard Biesheu= vel via groups.io Sent: Sunday, May 10, 2020 4:38 PM To: Andrei Warkentin ; devel@edk2.groups.io Cc: leif@nuviainc.com ; pete@akeo.ie ; ph= ilmd@redhat.com Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: add Gpio output= set/clear functions to GpioLib On 5/10/20 11:36 PM, Andrei Warkentin wrote: > GpioSet and GpioClear. Using hw of course (not mailbox). > > Signed-off-by: Andrei Warkentin Can you add this patch to the series that actually introduces a user for this new functionality? Also, please don't hide unrelated changes in your patches like this. > --- > Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h | 10 +++++ > Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c | 42 ++++++++++++++= +++++- > 2 files changed, 50 insertions(+), 2 deletions(-) > > diff --git a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h b/Silico= n/Broadcom/Bcm283x/Include/Library/GpioLib.h > index 014c6b07..10c9cdfb 100644 > --- a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h > +++ b/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h > @@ -24,4 +24,14 @@ GpioPinFuncGet ( > IN UINTN Pin > ); > > +VOID > +GpioSet ( > + IN UINTN Pin > + ); > + > +VOID > +GpioClear ( > + IN UINTN Pin > + ); > + > #endif /* __GPIO_LIB__ */ > diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c b/Silico= n/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c > index 542b6e8f..716b05be 100644 > --- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c > +++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c > @@ -18,7 +18,7 @@ > > STATIC > VOID > -GpioFSELModify ( > +GpioFSelModify ( > IN UINTN RegIndex, > IN UINT32 ModifyMask, > IN UINT32 FunctionMask > @@ -38,6 +38,44 @@ GpioFSELModify ( > MmioWrite32 (Reg, Val); > } > > +VOID > +GpioSet ( > + IN UINTN Pin > + ) > +{ > + UINT32 Val; > + EFI_PHYSICAL_ADDRESS Reg; > + UINT8 RegIndex =3D Pin / 32; > + UINT8 SelIndex =3D Pin % 32; > + > + Reg =3D RegIndex * sizeof (UINT32) + GPIO_GPSET0; > + > + ASSERT (Reg <=3D GPIO_GPSET1); > + > + Val =3D MmioRead32 (Reg); > + Val |=3D 1 << SelIndex; > + MmioWrite32 (Reg, Val); > +} > + > +VOID > +GpioClear ( > + IN UINTN Pin > + ) > +{ > + UINT32 Val; > + EFI_PHYSICAL_ADDRESS Reg; > + UINT8 RegIndex =3D Pin / 32; > + UINT8 SelIndex =3D Pin % 32; > + > + Reg =3D RegIndex * sizeof (UINT32) + GPIO_GPCLR0; > + > + ASSERT (Reg <=3D GPIO_GPCLR1); > + > + Val =3D MmioRead32 (Reg); > + Val |=3D 1 << SelIndex; > + MmioWrite32 (Reg, Val); > +} > + > VOID > GpioPinFuncSet ( > IN UINTN Pin, > @@ -57,7 +95,7 @@ GpioPinFuncSet ( > > ModifyMask =3D GPIO_FSEL_MASK << (SelIndex * GPIO_FSEL_BITS_PER_PIN)= ; > FunctionMask =3D Function << (SelIndex * GPIO_FSEL_BITS_PER_PIN); > - GpioFSELModify (RegIndex, ModifyMask, FunctionMask); > + GpioFSelModify (RegIndex, ModifyMask, FunctionMask); > } > > UINTN > --_000_BN6PR05MB341142B01AF10A9C78B99D0DB9A10BN6PR05MB3411namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
I was going to have a patch to support power-off using an alternate mechan= ism (not PSCI, but via GPIO for the https://raspberrypiwiki.com/index.php/X735 ha= t.

Ultimately, I decided against complicating UEFI - an OS isn't required to = use UEFI RT today over PSCI (OpenBSD didn't), the memory map becomes more c= omplicated (to cover the RT MMIO for GPIO block). The right place for this = functionality appears to be TF-A, so that's why I just have the GpioLib change.

So in the near future I don't anticipate any changes from me that would us= e this GpioLib functionality, yet it is tested (at the least GpioSet) and w= ould be useful to others to have it. Shall I bail on it entirely?

A

From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of Ard Biesheuvel via groups.io <= ;ard.biesheuvel=3Darm.com@groups.io>
Sent: Sunday, May 10, 2020 4:38 PM
To: Andrei Warkentin <andrey.warkentin@gmail.com>; devel@edk2= .groups.io <devel@edk2.groups.io>
Cc: leif@nuviainc.com <leif@nuviainc.com>; pete@akeo.ie <p= ete@akeo.ie>; philmd@redhat.com <philmd@redhat.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: add Gpio= output set/clear functions to GpioLib
 
On 5/10/20 11:36 PM, Andrei Warkentin wrote:
> GpioSet and GpioClear. Using hw of course (not mailbox).
>
> Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Can you add this patch to the series that actually introduces a user for <= br> this new functionality?

Also, please don't hide unrelated changes in your patches like this.

> ---
>   Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h | 10 &= #43;++++
>   Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c | 42 &= #43;++++++++++++++&= #43;+++-
>   2 files changed, 50 insertions(+), 2 deletions(-)
>
> diff --git a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h b/Sil= icon/Broadcom/Bcm283x/Include/Library/GpioLib.h
> index 014c6b07..10c9cdfb 100644
> --- a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
> +++ b/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h<= br> > @@ -24,4 +24,14 @@ GpioPinFuncGet (
>     IN  UINTN Pin
>     );
>  
> +VOID
> +GpioSet (
> +  IN  UINTN Pin
> +  );
> +
> +VOID
> +GpioClear (
> +  IN  UINTN Pin
> +  );
> +
>   #endif /* __GPIO_LIB__ */
> diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c b/Sil= icon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
> index 542b6e8f..716b05be 100644
> --- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
> +++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c<= br> > @@ -18,7 +18,7 @@
>  
>   STATIC
>   VOID
> -GpioFSELModify (
> +GpioFSelModify (
>     IN  UINTN RegIndex,
>     IN  UINT32 ModifyMask,
>     IN  UINT32 FunctionMask
> @@ -38,6 +38,44 @@ GpioFSELModify (
>     MmioWrite32 (Reg, Val);
>   }
>  
> +VOID
> +GpioSet (
> +  IN  UINTN Pin
> +  )
> +{
> +  UINT32 Val;
> +  EFI_PHYSICAL_ADDRESS Reg;
> +  UINT8 RegIndex =3D Pin / 32;
> +  UINT8 SelIndex =3D Pin % 32;
> +
> +  Reg =3D RegIndex * sizeof (UINT32) + GPIO_GPSET0;
> +
> +  ASSERT (Reg <=3D GPIO_GPSET1);
> +
> +  Val =3D MmioRead32 (Reg);
> +  Val |=3D 1 << SelIndex;
> +  MmioWrite32 (Reg, Val);
> +}
> +
> +VOID
> +GpioClear (
> +  IN  UINTN Pin
> +  )
> +{
> +  UINT32 Val;
> +  EFI_PHYSICAL_ADDRESS Reg;
> +  UINT8 RegIndex =3D Pin / 32;
> +  UINT8 SelIndex =3D Pin % 32;
> +
> +  Reg =3D RegIndex * sizeof (UINT32) + GPIO_GPCLR0;
> +
> +  ASSERT (Reg <=3D GPIO_GPCLR1);
> +
> +  Val =3D MmioRead32 (Reg);
> +  Val |=3D 1 << SelIndex;
> +  MmioWrite32 (Reg, Val);
> +}
> +
>   VOID
>   GpioPinFuncSet (
>     IN  UINTN Pin,
> @@ -57,7 +95,7 @@ GpioPinFuncSet (
>  
>     ModifyMask =3D GPIO_FSEL_MASK << (SelIn= dex * GPIO_FSEL_BITS_PER_PIN);
>     FunctionMask =3D Function << (SelIndex = * GPIO_FSEL_BITS_PER_PIN);
> -  GpioFSELModify (RegIndex, ModifyMask, FunctionMask);
> +  GpioFSelModify (RegIndex, ModifyMask, FunctionMask);
>   }
>  
>   UINTN
>




--_000_BN6PR05MB341142B01AF10A9C78B99D0DB9A10BN6PR05MB3411namp_--