From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.81.98; helo=nam01-by2-obe.outbound.protection.outlook.com; envelope-from=christopher.co@microsoft.com; receiver=edk2-devel@lists.01.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-eopbgr810098.outbound.protection.outlook.com [40.107.81.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BFC7C21194D45 for ; Fri, 30 Nov 2018 16:22:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zH75EqZEtWOZ9A60aoNay8drWaU9/vfE92/lj3+6rIA=; b=m+gvOucbOcog4uiLOdu3z7wTSMqktEUnmzxOs4zOGIVxA2HUO4O6zXeeCQ5RA71m+xZ8PyHLJaAoi2SNYVf4A9RIjinmD8YpMmNR6wpMr6DzVDuGFds/88IYXj0x9VP4FuQNzUQx7FZ/LC0vyFjykE6YaBVcc4V18AEEqVUgd3U= Received: from DM5PR21MB0186.namprd21.prod.outlook.com (10.173.173.137) by DM5PR21MB0140.namprd21.prod.outlook.com (10.173.173.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.9; Sat, 1 Dec 2018 00:22:17 +0000 Received: from DM5PR21MB0186.namprd21.prod.outlook.com ([fe80::9115:7193:d145:d0f5]) by DM5PR21MB0186.namprd21.prod.outlook.com ([fe80::9115:7193:d145:d0f5%6]) with mapi id 15.20.1404.011; Sat, 1 Dec 2018 00:22:17 +0000 From: Chris Co To: Leif Lindholm CC: "edk2-devel@lists.01.org" , Ard Biesheuvel , Michael D Kinney Thread-Topic: [PATCH edk2-platforms 09/27] Silicon/NXP: Add headers for SoC-specific i.MX packages to use Thread-Index: AQHUUYS6Td0Qdv51FkilLzYFFMJClqU7fA4AgC32pnA= Date: Sat, 1 Dec 2018 00:22:17 +0000 Message-ID: References: <20180921082542.35768-1-christopher.co@microsoft.com> <20180921082542.35768-10-christopher.co@microsoft.com> <20181101182020.w5qvmjbi3ukhxf2t@bivouac.eciton.net> In-Reply-To: <20181101182020.w5qvmjbi3ukhxf2t@bivouac.eciton.net> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=chrco@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2018-12-01T00:22:15.7354265Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [2001:4898:80e8:3:3c65:e765:8908:c2de] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR21MB0140; 6:nAYjyXxirjDTupofLGy/xwPUu0yYnqcueC9YQ9CJPnfybeT0EhS+NATU+yawqdu7r3z8yMadTqaUsxLCDMbK/v58AybQ3TeUiTGMoYbNVLaQ7MPNv+hDHJbgBoRUx2F06+ygv5Fljtzuvx5Pl67aYtZeb8qWJQgp8vWXwsJxQVPifqp4RsdB/aPKd2YXrDFPx5gZrs4v6znQFm0C6UsISEKYNk6t1dS06rBjUWdzkWBgWXo0o1lfGQyTjaaDV9NbVbDAZk6ImDH1rhQm4ekBxnx+8+Z92uAmZJvHFT1v0vphHCS5L/rMzA2eT3/3xr5wke2MbiKY1FG499u1VV/bt3PG2WssyuBR13BHKZ/i0EUbkct7Z2OnZoNVwIqbnK7G9bNheFjq7fttO4pIGoQu2SortIekUCd+luLb/AlYW7pEsAA983vxEdf5RyU/gx3XPHDoYWZr3KQbeoFwLVTvMA==; 5:/+ChaC72GrSCCD4JB0mD3QZ+7EPSXZ/xPl2uEz/+0ZZxdoWbUEhfksKYhZSApDU9zpIVSbSCEGczmEPS5i3dPUKEyyaTgJ0jB98aVD7n56M9yrMW0JmtCrJk+UWAR0W5kNazKZJ8Ym6eHnkhMqP6G7yZKJRZ4Js/YkwymM1lqRA=; 7:shbBgFCYPMoZtIGaotoEQovoxAJamF8Zsc32Z+IYcTeth+A6Fn8NOmVcpbKyyOmTiyDpeU/7uhi+LoiB48fB49xsCBxx/5HwGwnS+dsrcrLJmdaYyBobX3ksi3ZzrgA27vddGQu8IDBX0pCbRw82Dg== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: fdd67140-f3b3-4268-0b86-08d657230d5a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:DM5PR21MB0140; x-ms-traffictypediagnostic: DM5PR21MB0140: x-ms-exchange-purlcount: 3 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Christopher.Co@microsoft.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(8220035)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231453)(999002)(944501470)(4982022)(2018427008)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:DM5PR21MB0140; BCL:0; PCL:0; RULEID:; SRVR:DM5PR21MB0140; x-forefront-prvs: 087396016C x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(376002)(39860400002)(136003)(396003)(366004)(189003)(199004)(13464003)(229853002)(14454004)(7696005)(6246003)(46003)(316002)(76176011)(22452003)(53936002)(55016002)(486006)(33656002)(6436002)(2906002)(8936002)(186003)(446003)(6306002)(11346002)(476003)(53546011)(6506007)(72206003)(478600001)(7736002)(305945005)(74316002)(25786009)(10290500003)(102836004)(81166006)(81156014)(9686003)(4326008)(105586002)(99286004)(86612001)(71190400001)(71200400001)(68736007)(6916009)(10090500001)(256004)(8676002)(6116002)(575784001)(86362001)(16799955002)(8990500004)(97736004)(54906003)(106356001)(5660300001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR21MB0140; H:DM5PR21MB0186.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 4Y3lDXJ6X5ckl4u4YcCGVkxDyls9mutFTeArjt34QF2jexD48RGTDjE9eXF0XEPHkQBS3I7qHNZR31wqIfWztaGcsp6eQ9RmCJFk8dJdj+rve3Gftv57+lxzx1jeeX8RyjgRGnDzKN0eexxV03vrNxriCszlDdWZXnGrQphEzCaO7eyP2qN51Bfju/LZ4v3tbTWJCnVjWpQtdkKE5cQRT8Uu44VszGGNWWKLWYiEj1cy3L4OsmodVMeKgIH5MLh4fyy0hvxok8tQ+df6mio9SGOVLLIuUa8B5K8we/r9uND68PErJWUk8APOolLhjF5ANFHt1sYJFFId7YdbaXX4RVwZ+1w/rKFTkS6G+lqqjK4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdd67140-f3b3-4268-0b86-08d657230d5a X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2018 00:22:17.7719 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0140 Subject: Re: [PATCH edk2-platforms 09/27] Silicon/NXP: Add headers for SoC-specific i.MX packages to use X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2018 00:22:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Leif, > -----Original Message----- > From: Leif Lindholm > Sent: Thursday, November 1, 2018 11:20 AM > To: Chris Co > Cc: edk2-devel@lists.01.org; Ard Biesheuvel ; > Michael D Kinney > Subject: Re: [PATCH edk2-platforms 09/27] Silicon/NXP: Add headers for So= C- > specific i.MX packages to use >=20 > On Fri, Sep 21, 2018 at 08:26:00AM +0000, Chris Co wrote: > > This adds common headers for other NXP i.MX SoC packages. > > More specifically, this adds i.MX-generic GPIO, IoMux, and Platform > > definitions. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Christopher Co > > Cc: Ard Biesheuvel > > Cc: Leif Lindholm > > Cc: Michael D Kinney > > --- > > Silicon/NXP/iMXPlatformPkg/Include/Platform.h | 67 ++++++++++++++ > > Silicon/NXP/iMXPlatformPkg/Include/iMXGpio.h | 92 > > ++++++++++++++++++++ Silicon/NXP/iMXPlatformPkg/Include/iMXIoMux.h | > > 24 +++++ > > 3 files changed, 183 insertions(+) > > > > diff --git a/Silicon/NXP/iMXPlatformPkg/Include/Platform.h > > b/Silicon/NXP/iMXPlatformPkg/Include/Platform.h > > new file mode 100644 > > index 000000000000..8a1e828f68ea > > --- /dev/null > > +++ b/Silicon/NXP/iMXPlatformPkg/Include/Platform.h > > @@ -0,0 +1,67 @@ > > +/** @file > > +* > > +* i.MX Platform specific defines for constructing ACPI tables > > +* > > +* Copyright (c) 2018 Microsoft Corporation. All rights reserved. > > +* > > +* This program and the accompanying materials > > +* are licensed and made available under the terms and conditions of > > +the BSD License > > +* which accompanies this distribution. The full text of the license > > +may be found at > > +* > > +https://na01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fopen= s > > +ource.org%2Flicenses%2Fbsd- > license.php&data=3D02%7C01%7CChristopher > > > +.Co%40microsoft.com%7C53adf4afe364416fab0c08d64026b170%7C72f988bf8 > 6f1 > > > +41af91ab2d7cd011db47%7C1%7C0%7C636766932265064004&sdata=3DlEf > %2Bq2l > > +nuxJ3cw%2BL91rhCTJ2e3jzWZfvgZZY8cyHswY%3D&reserved=3D0 > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > > +BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > > +* > > +**/ > > + > > +#ifndef _PLATFORM_IMX_H_ > > +#define _PLATFORM_IMX_H_ > > + > > +#include > > + > > +#define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'} // OEM= ID 6 bytes > > +#define EFI_ACPI_VENDOR_ID SIGNATURE_32('N','X','P','I') > > +#define EFI_ACPI_CSRT_REVISION 0x00000005 > > +#define EFI_ACPI_5_0_CSRT_REVISION 0x00000000 > > + > > +// Resource Descriptor Types > > +#define EFI_ACPI_CSRT_RD_TYPE_INTERRUPT 1 #define > > +EFI_ACPI_CSRT_RD_TYPE_TIMER 2 #define EFI_ACPI_CSRT_RD_TYPE_DMA 3 > > +#define EFI_ACPI_CSRT_RD_TYPE_CACHE 4 > > + > > +// Resource Descriptor Subtypes > > +#define EFI_ACPI_CSRT_RD_SUBTYPE_INTERRUPT_LINES 0 #define > > +EFI_ACPI_CSRT_RD_SUBTYPE_INTERRUPT_CONTROLLER 1 #define > > +EFI_ACPI_CSRT_RD_SUBTYPE_TIMER 0 #define > > +EFI_ACPI_CSRT_RD_SUBTYPE_DMA_CHANNEL 0 #define > > +EFI_ACPI_CSRT_RD_SUBTYPE_DMA_CONTROLLER 1 #define > > +EFI_ACPI_CSRT_RD_SUBTYPE_CACHE 0 >=20 > If using EFI_ACPI prefix, these #defines really should be in edk2 MdePkg.= And > CSRT itself is, so that might not be a bad idea. >=20 > > + > > +#pragma pack(push, 1) >=20 > I don't see this #pragma making any difference to the structs below, can = it be > dropped? >=20 The pragma pack is defensive. Without it, we rely on the compiler packing s= tructures by default and this may not happen on 64 bit compiles. I have addressed the remaining feedback and will resubmit with v2. Thanks, Chris > > +//------------------------------------------------------------------- > > +----- // CSRT Resource Group header 24 bytes long > > +//------------------------------------------------------------------- > > +----- > > +typedef struct { > > + UINT32 Length; > > + UINT32 VendorID; > > + UINT32 SubVendorId; > > + UINT16 DeviceId; > > + UINT16 SubdeviceId; > > + UINT16 Revision; > > + UINT16 Reserved; > > + UINT32 SharedInfoLength; > > +} EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER; > > + > > +//------------------------------------------------------------------- > > +----- // CSRT Resource Descriptor 12 bytes total > > +//------------------------------------------------------------------- > > +----- > > +typedef struct { > > + UINT32 Length; > > + UINT16 ResourceType; > > + UINT16 ResourceSubType; > > + UINT32 UID; > > +} EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER; > > +#pragma pack (pop) > > + > > +#endif // !_PLATFORM_IMX_H_ > > diff --git a/Silicon/NXP/iMXPlatformPkg/Include/iMXGpio.h > > b/Silicon/NXP/iMXPlatformPkg/Include/iMXGpio.h > > new file mode 100644 > > index 000000000000..dce01f789058 > > --- /dev/null > > +++ b/Silicon/NXP/iMXPlatformPkg/Include/iMXGpio.h > > @@ -0,0 +1,92 @@ > > +/** @file > > +* > > +* Copyright (c) 2018 Microsoft Corporation. All rights reserved. > > +* > > +* This program and the accompanying materials > > +* are licensed and made available under the terms and conditions of > > +the BSD License > > +* which accompanies this distribution. The full text of the license > > +may be found at > > +* > > +https://na01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fopen= s > > +ource.org%2Flicenses%2Fbsd- > license.php&data=3D02%7C01%7CChristopher > > > +.Co%40microsoft.com%7C53adf4afe364416fab0c08d64026b170%7C72f988bf8 > 6f1 > > > +41af91ab2d7cd011db47%7C1%7C0%7C636766932265064004&sdata=3DlEf > %2Bq2l > > +nuxJ3cw%2BL91rhCTJ2e3jzWZfvgZZY8cyHswY%3D&reserved=3D0 > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > > +BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > > +* > > +**/ > > + > > +#ifndef _IMX_GPIO_H_ > > +#define _IMX_GPIO_H_ > > + > > +#include > > + > > +typedef enum { > > + IMX_GPIO_LOW =3D 0, > > + IMX_GPIO_HIGH =3D 1 > > +} IMX_GPIO_VALUE; > > + > > +typedef enum { > > + IMX_GPIO_DIR_INPUT, > > + IMX_GPIO_DIR_OUTPUT > > +} IMX_GPIO_DIR; > > + > > +typedef enum { > > + IMX_GPIO_BANK1 =3D 1, > > + IMX_GPIO_BANK2, > > + IMX_GPIO_BANK3, > > + IMX_GPIO_BANK4, > > + IMX_GPIO_BANK5, > > + IMX_GPIO_BANK6, > > + IMX_GPIO_BANK7, > > +} IMX_GPIO_BANK; > > + > > +#pragma pack(push, 1) >=20 > I don't see what effect this is supposed to have, can it be dropped? >=20 > > + > > +#define GPIO_RESERVED_SIZE \ > > + ((FixedPcdGet32(PcdGpioBankMemoryRange) / 4) - 8) > > + > > +typedef struct { > > + UINT32 DR; // 0x00 GPIO data register (GP= IO1_DR) > > + UINT32 GDIR; // 0x04 GPIO direction registe= r (GPIO1_GDIR) > > + UINT32 PSR; // 0x08 GPIO pad status regist= er (GPIO1_PSR) > > + UINT32 ICR1; // 0x0C GPIO interrupt configu= ration register1 > (GPIO1_ICR1) > > + UINT32 ICR2; // 0x10 GPIO interrupt configu= ration register2 > (GPIO1_ICR2) > > + UINT32 IMR; // 0x14 GPIO interrupt mask re= gister > (GPIO1_IMR) > > + UINT32 ISR; // 0x18 GPIO interrupt status = register > (GPIO1_ISR) > > + UINT32 EDGE_SEL; // 0x1C GPIO edge select regis= ter > (GPIO1_EDGE_SEL) > > + UINT32 reserved[GPIO_RESERVED_SIZE]; } IMX_GPIO_BANK_REGISTERS; > > + > > +#pragma pack(pop) > > + > > +typedef struct { > > + IMX_GPIO_BANK_REGISTERS Banks[7]; > > +} IMX_GPIO_REGISTERS; > > + > > +/** > > + Set the specified GPIO to the specified direction. > > +**/ > > +VOID > > +ImxGpioDirection ( > > + IMX_GPIO_BANK Bank, > > + UINT32 IoNumber, > > + IMX_GPIO_DIR Direction > > + ); > > + > > +/** > > + Write a value to a GPIO pin. > > +**/ > > +VOID > > +ImxGpioWrite ( > > + IMX_GPIO_BANK Bank, > > + UINT32 IoNumber, > > + IMX_GPIO_VALUE Value > > + ); > > + > > +/** > > + Read a GPIO pin input value. > > +**/ > > +IMX_GPIO_VALUE > > +ImxGpioRead ( > > + IMX_GPIO_BANK Bank, > > + UINT32 IoNumber > > + ); > > + > > +#endif > > diff --git a/Silicon/NXP/iMXPlatformPkg/Include/iMXIoMux.h > > b/Silicon/NXP/iMXPlatformPkg/Include/iMXIoMux.h > > new file mode 100644 > > index 000000000000..7696af57d7ea > > --- /dev/null > > +++ b/Silicon/NXP/iMXPlatformPkg/Include/iMXIoMux.h > > @@ -0,0 +1,24 @@ > > +/** @file > > +* > > +* Copyright (c) 2018 Microsoft Corporation. All rights reserved. > > +* > > +* This program and the accompanying materials > > +* are licensed and made available under the terms and conditions of > > +the BSD License > > +* which accompanies this distribution. The full text of the license > > +may be found at > > +* > > +https://na01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fopen= s > > +ource.org%2Flicenses%2Fbsd- > license.php&data=3D02%7C01%7CChristopher > > > +.Co%40microsoft.com%7C53adf4afe364416fab0c08d64026b170%7C72f988bf8 > 6f1 > > > +41af91ab2d7cd011db47%7C1%7C0%7C636766932265064004&sdata=3DlEf > %2Bq2l > > +nuxJ3cw%2BL91rhCTJ2e3jzWZfvgZZY8cyHswY%3D&reserved=3D0 > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > > +BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > > +* > > +**/ > > + > > +#ifndef _IMX_IO_MUX_H_ > > +#define _IMX_IO_MUX_H_ > > + > > +#define _IMX_PAD(CtlRegOffset, MuxRegOffset) \ >=20 > No _ for macros. Why does one pad an iMX? Can the name be more > descriptive? (applies to next few macros too). >=20 > / > Leif >=20 > > + ((((CtlRegOffset) & 0xffff) << 16) | ((MuxRegOffset) & 0xffff)) > > + > > +#define _IMX_PAD_CTL_OFFSET(ImxPadVal) ((ImxPadVal) >> 16) #define > > +_IMX_PAD_MUX_OFFSET(ImxPadVal) ((ImxPadVal) & 0xffff) > > + > > +#endif // _IMX_IO_MUX_H_ > > -- > > 2.16.2.gvfs.1.33.gf5370f1 > >