From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D85A8C6FA82 for ; Wed, 21 Sep 2022 16:06:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4634684CA6; Wed, 21 Sep 2022 18:06:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sancloud.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=sancloud.onmicrosoft.com header.i=@sancloud.onmicrosoft.com header.b="bR2sXTEg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BD77C84C9D; Wed, 21 Sep 2022 18:06:42 +0200 (CEST) Received: from GBR01-CWL-obe.outbound.protection.outlook.com (mail-cwlgbr01on2110.outbound.protection.outlook.com [40.107.11.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 965208491B for ; Wed, 21 Sep 2022 18:06:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sancloud.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=paul.barker@sancloud.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nkFOCjr0ivwPa4zCqw4SytrXvGEdIr2+fcEbnDFdk0WqnXmll0b2KkxeuUHnPH4A83JAuK4o52xHHhOmdUY5aHlabmdIlhCP0dHRPm8g5MHJRynV6xqY2khATLgEj7jAA2HUntn6XTSvDwMX2MBuYNdW8yAUr1/+qTcg52w8TdZbciTV5JD1iEisIfi02vEkS9c+SqYS52risztlml7AG61EsfgXsb8Ic9KT5QKe4VocF9YdJ2aYAQg2lNpbQe6ED1LfTIY79YjUTlKqlqrffxV2DYON0EKvyAVOZ45aXJeE2iqd7bkHGRohCNr3m6a6HqlrwM1ixUGZwSEOUaQoCQ== 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=km9ztmf3PIN9hHEwsj/36JZ7N1RWQAV7sfc/ZOVx4hU=; b=kJ0yoxa142jpVKmUrVdDdMmPvBCgTWts7gIyJzFfoaXtNNAqvLWwcJEZ0rhxXjutKSDt7cLseWpuYTTXRsJM9HovEKCe92Vgy6qd+GBstsQJcc1RmoQrUtfe53shK/+G5KuEVfNBbhTh0H4e+uDHbGx0LcAOqax5kJQ2vetDWH84GH/9A+6u0uzE6KqE+k+9rzYZZF1Uc8kRFBiXDHanlF7PfgmLie8ZAPqNW6d56LC1OtfEGVw7aIgVUyWhfxtlSmKbfdGy0ALc/lFwRV7TaMyZTfmSnEZtjJERTHTg07eG6ttH6P2HzNrddtbgpww9ry0vnHkE0GbDHni2y33DIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sancloud.com; dmarc=pass action=none header.from=sancloud.com; dkim=pass header.d=sancloud.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sancloud.onmicrosoft.com; s=selector2-sancloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=km9ztmf3PIN9hHEwsj/36JZ7N1RWQAV7sfc/ZOVx4hU=; b=bR2sXTEgN7g2Wqh9t54krDCRMII3k3lXfPLdPtxbMJTPcQQFQe5ZyIpp3aTXFpkO60Bwy+S2R3hxyst4HJX4xZU2ANeBkPL91oCb6Bg5siiWnL89vfvIJXFYlpFJYxsoPfu3l2S8dVt7kGeLFiM7oIO6P/JGUCERPfbvNeWoxrs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=sancloud.com; Received: from CWLP123MB2241.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:61::19) by LO0P123MB6186.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1ff::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21; Wed, 21 Sep 2022 16:06:38 +0000 Received: from CWLP123MB2241.GBRP123.PROD.OUTLOOK.COM ([fe80::11d5:40af:9060:6b08]) by CWLP123MB2241.GBRP123.PROD.OUTLOOK.COM ([fe80::11d5:40af:9060:6b08%6]) with mapi id 15.20.5654.016; Wed, 21 Sep 2022 16:06:38 +0000 From: Paul Barker To: u-boot@lists.denx.de, Heinrich Schuchardt , Tom Rini , Ilias Apalodimas Cc: Paul Barker Subject: [PATCH v3 0/3] Support UEFI SPI I/O protocol Date: Wed, 21 Sep 2022 17:06:25 +0100 Message-Id: <20220921160628.4166966-1-paul.barker@sancloud.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LO4P265CA0023.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ae::13) To CWLP123MB2241.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:61::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CWLP123MB2241:EE_|LO0P123MB6186:EE_ X-MS-Office365-Filtering-Correlation-Id: 6614c7ba-4cba-4596-fd91-08da9beb43b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NZJPQG62Lb3faYB8IG6x/njjIXjMAOvC/YCCoUUWNVgazVLLynNZK9y8wXEB+r95TXF7EyFI0SfkoOanaLJCrlj4OYtLFRiWrf3Ww7b0uo/PCXr2MwL+JNAxX3kxEOr3ev0DY0lhjKQ5RBN+3ZsdWJyteTgtwEMUbyIZjXQr58yq26IFefoftNVqe9C69PXfM6JPi5gJYrxriZ5HwtA+K08uFr/RSvdpARxk82tj2qEahdlIuePIe2CFmJynhoV+zF35LDb9jcMCP0mPd9fESFVpbidueYqTn9I5Tj97pg1si5IFsvmEsgQbR5kMg9wo0mzJXsRkc42FRYz+aE1V1S7S2JsywpnHLmKdvUPeOaolp/Co7X7W05zGz+GsByhDVugNTeGzZUm4cBoNI8AuB0DLvbcizK0U+0/jH448RTYqm0BQzuynUGETxcyzsIa3eb2VEKugKvVQ1z9jllfl/RNt5hrlZRZMgOimF36RVVvdxF9/DgCrf5EytT0moAzzFb9mUpZWpN+k3qh9O8FajeikGhpu3hul056jLP1o+hB+qOBssQa//yQ8wUNTotsLWrct7zcUJO/Rk07h9zopjm7r8Hb+qZyjQf2A4XFSKZJA0+/rO544UNJVEFAPmzRb0+hPgC+fjM/vf5/2zmIPeXBWvaMSCms4JkBl6MaIuSd6L7Ie9xXsU8MG77xJSx6XaOrzJjaJtbpKs8QbOLVfytJLFRSuJ9UsxhQDFgUMIMj8uFd8V2eqnTnIUtke5cRw1D4NfoEdOWXX8eZ89kbsF5UVMOAzLScbnIGysyyamjs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CWLP123MB2241.GBRP123.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230022)(136003)(396003)(39830400003)(346002)(376002)(366004)(451199015)(8936002)(5660300002)(38350700002)(38100700002)(83380400001)(44832011)(86362001)(2906002)(186003)(316002)(6486002)(966005)(1076003)(107886003)(2616005)(52116002)(6506007)(26005)(6512007)(4326008)(66556008)(66946007)(478600001)(110136005)(8676002)(6666004)(41300700001)(36756003)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?FlDITbMH4p4ky5et5AKx27QKPwC4Egll8BprckdqydYDd6xlL/e/ChwXitli?= =?us-ascii?Q?+4TgwR/jtf2f8wg6B+TGU0O9ItFPOv/HuUWmhliSoYKypkvVWh2805pad6kX?= =?us-ascii?Q?XXdz3DWXbObG3RG1zD6xm+IUtEzMrNfPm0BXyGLnEKwC+3PPbrCpCfv3I+3B?= =?us-ascii?Q?J24w5Nbe6FpTJgN+/AJURKbI9fI9ZyCaWY6XURb6UKdpEstY/ypBHXgfpOHv?= =?us-ascii?Q?T6avgXVLrj6o+ah7R5cfz7i179d/TtQBpzXhEruN8McsFDl8Yzh7iDjhl3ea?= =?us-ascii?Q?r5KBWPnUCt3UPWUgTdLMzOwBXgc63dsXdfJ9DRFh2IrHvoH94VVY/CoHd5Fk?= =?us-ascii?Q?qGg7+l+Vh19TaI8TLNg0IzAqbLkV3Gj6ooIBn5Ar192XGbKFNfZVnj2YQzx1?= =?us-ascii?Q?e7GX1+eCJh/iCVUMhy2PdpROSUViFV30wD+IiYduoPPdHE/fOjeBF8YRjxY8?= =?us-ascii?Q?4h0/tkqIRk8Ccvr+YwcHt6Wv5LPsYLHRWfBV97TU24FI/iMZ+ue7d6lA9E8z?= =?us-ascii?Q?eNcAjFSVtmYskmO4YhAv+j2vVbgG1PIm9HEZnJKIAB867D3tRPL/2nOYqk44?= =?us-ascii?Q?wVvI+RSe54vRpRwCJKOx7pRleBER2R7wLFt9bfpamuGoL805gNKAE/YKKfot?= =?us-ascii?Q?betAZxjGsfXSDaK1pdfbMmGsa9h8bcTAysnvOyoub+ciKnPrB+0lFXURgRRt?= =?us-ascii?Q?Zp0mNaisp/ncefgr9CasQ7VC0hp1YVkjr+p7GT2RF/z4rRmxqhqxcPEidxg1?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X-MS-Exchange-CrossTenant-Network-Message-Id: 6614c7ba-4cba-4596-fd91-08da9beb43b1 X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB2241.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 16:06:38.2954 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 840be37c-244a-450e-9bcc-2064862de1f4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: udglvAsLq7wGHUjlp33m72DcZ48zSbe9kOVLvvSuZ/fHLUROK2ciBJ8Tvb75ghH14bw0kKwKW6XbtzJ3IHQQ4UYI3xRezMvWIoz5GmoFwsc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P123MB6186 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean These patches add support for the UEFI SPI I/O protocol defined in the UEFI Platform Initialization (PI) Specification, Version 1.7 Errata A (April 2020). This allows a UEFI application to interact with devices on the SPI bus. This support is initially intended to be used to communicate with SPI devices from "pre-boot" UEFI applications which perform setup before the main OS is loaded. Other use cases may also be supported, however this is not intended to be a replacement for UEFI capsule updates. The "pre-boot" UEFI application which we are currently developing will interact with a Micron Authenta[1] flash device, sending vendor-specific commands over the SPI bus to make use of Authenta security features, to verify flash integrity and to generate ephemeral keys based on the flash contents. The code here is self-contained and easy to enable/disable at compile time. Compilation testing with am335x_evm_defconfig shows that the size of u-boot.img increases by less than 2kB when CONFIG_EFI_SPI_PROTOCOL is enabled. [1]: https://www.micron.com/-/media/client/global/documents/products/product-flyer/authenta_technology_solutions_brief.pdf Changes since v2: * Added description to efi_spi_protocol.h. * Moved definition of EFI_SPI_CONFIGURATION_GUID to efi_api.h and added it to the list in lib/uuid.c. * Fixed UEFI GUID byte order in test.dts and in debug output. * Use log_debug() instead of printf() for debug output. * Add test cases to confirm that efi_legacy_spi_controller_protocol functions return EFI_UNSUPPORTED (as they are not currently implemented) Changes since v1: * Skip emulated SPI peripherals. These appear as duplicates within the list of devices on the bus when using the sandbox SPI drivers. * Make most printf statements debug only. * Add efi_seltest unit test. * Do not enable config EFI_SPI_PROTOCOL by default. * Mark functions with EFIAPI where necessary. * Handle debug_transaction argument to efi_spi_io_transaction(). * Handle a value of zero for target->max_read_size & target->max_write_size. * Probe inactive SPI devices when initializing the EFI SPI protocol to ensure that dev_get_parent_priv() returns valid data and the exported devices are ready to use. Paul Barker (3): efi_loader: Add SPI I/O protocol support arm: dts: am335x-sancloud-bbe-lite: UEFI SPI export am335x_evm_defconfig: Enable Micron SPI flash support MAINTAINERS | 7 + arch/arm/dts/am335x-sancloud-bbe-lite.dts | 10 +- arch/sandbox/dts/test.dts | 13 + configs/am335x_evm_defconfig | 1 + include/efi_api.h | 4 + include/efi_loader.h | 4 + include/efi_spi_protocol.h | 166 +++++ lib/efi_loader/Kconfig | 8 + lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_setup.c | 6 + lib/efi_loader/efi_spi_protocol.c | 614 +++++++++++++++++++ lib/efi_selftest/Makefile | 1 + lib/efi_selftest/efi_selftest_spi_protocol.c | 284 +++++++++ lib/uuid.c | 4 + 14 files changed, 1121 insertions(+), 2 deletions(-) create mode 100644 include/efi_spi_protocol.h create mode 100644 lib/efi_loader/efi_spi_protocol.c create mode 100644 lib/efi_selftest/efi_selftest_spi_protocol.c -- 2.25.1