From patchwork Wed Jun 1 18:00:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 577792 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8f0c:0:0:0:0 with SMTP id mq12csp833591mab; Wed, 1 Jun 2022 11:01:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/lAKO+WO2VZv9KLtH5qtpdMjrh/niqOeZEaHxicwpfS17NwFrJ2vZOoCoC7b5DFjNFjVu X-Received: by 2002:a92:d68f:0:b0:2d3:a05b:6435 with SMTP id p15-20020a92d68f000000b002d3a05b6435mr785713iln.317.1654106483297; Wed, 01 Jun 2022 11:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654106483; cv=none; d=google.com; s=arc-20160816; b=KcJOjRFnexNTuC/ChYO5EXFIrzKWyo4O2wh9RHTXxCqOiNPzhdgyzX2SI6LCCq6Uzx W766Y+Wt9p3Kd3KqwA43/jnmK2jExmbT9lj5VUKfWYRRslrWqmagPNnFqmayBawh7/zz ODA8UpsUbE+Yw1Tz5u46QFVi1yChoYgCtGzUrSwsHmjc22mOdtFidI1zb1X0sKGkZawp E6m1RcrJECMGRhCtNS9DyOx9SMqK9wHHx68Ly0UMk2lWCZy0mAGpRyzaqYLkKniWt4uG YI3nC79kszOCqA7ALNo12ILhgJuNKv1OpHS9yILEYukbnvQzRZv5gKdMNG9vRBeOm13e rkNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=58XSahOb53w2F0PvGxhsbm1hiwPTljnWhgC8Nqb8qoo=; b=zwjgtUjESzvZgS4aEjgd1xdzOqdBLMeQ2zSswCmq3ogY4ams/kfFYVeuAkVG+rGv0X i+XcbLdyUD44J4jZUt/fQve53lyy5QEE4+s87k0MJEuppJmQT9AU5/iS2IXoq2n5kwQz MwZk+LMA1i3JfEXMAmocDIS+pqKJULynQUTN5ECxuHp7vcRqu0js5gXgRhbtKUtJOZWF YIpdi093b1vWX3rPUD3CZA83kaDGgPIc9bpilBA3s4M9t880fX0417Q0m1qLa58sD4oQ zcswWtttQKlHLnqevqTeY/gsvbYco2IzaCrgIgss+p+vSCv3ziW19PadCn1pQ4piMu8k BIFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id b7-20020a6b7c47000000b006525d83ea3dsi2761195ioq.5.2022.06.01.11.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 11:01:23 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DDB77842DE; Wed, 1 Jun 2022 20:01:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id EB178842EA; Wed, 1 Jun 2022 20:01:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 46ADC842BF for ; Wed, 1 Jun 2022 20:01:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 62D94D6E; Wed, 1 Jun 2022 11:01:02 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9EF763F766; Wed, 1 Jun 2022 11:01:00 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Sughosh Ganu Subject: [PATCH v2 1/4] EFI: Populate descriptor_count value only when image_info_size is not zero Date: Wed, 1 Jun 2022 23:30:38 +0530 Message-Id: <20220601180041.340240-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601180041.340240-1-sughosh.ganu@linaro.org> References: <20220601180041.340240-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 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.5 at phobos.denx.de X-Virus-Status: Clean The GetImageInfo function of the Firmware Mangement Protocol(FMP) gets called initially to query the size of the image descriptor array that would have to be allocated. During this call, the rest of the function arguments, specifically pointers might be passed as NULL. Do not populate the descriptor_count value before it is known that the call to GetImageInfo has been made with the allocated buffer for the image descriptors. Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas Tested-by: Peter Griffin --- Changes since V1: None lib/efi_loader/efi_firmware.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index fe4e084106..9cdefab41f 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -130,9 +130,6 @@ static efi_status_t efi_fill_image_desc_array( struct efi_fw_image *fw_array; int i; - fw_array = update_info.images; - *descriptor_count = num_image_type_guids; - total_size = sizeof(*image_info) * num_image_type_guids; if (*image_info_size < total_size) { @@ -142,6 +139,8 @@ static efi_status_t efi_fill_image_desc_array( } *image_info_size = total_size; + fw_array = update_info.images; + *descriptor_count = num_image_type_guids; *descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION; *descriptor_size = sizeof(*image_info); *package_version = 0xffffffff; /* not supported */ From patchwork Wed Jun 1 18:00:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 577793 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8f0c:0:0:0:0 with SMTP id mq12csp833763mab; Wed, 1 Jun 2022 11:01:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySr9dVYtkLQh7qQXAGa0u/CLNH7eQrFkemiwKxpugO4mLT7OjaVlG5+k6Qi13NOmKs6kmY X-Received: by 2002:a05:6e02:4a1:b0:2d3:a778:f0f1 with SMTP id e1-20020a056e0204a100b002d3a778f0f1mr829382ils.212.1654106494844; Wed, 01 Jun 2022 11:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654106494; cv=none; d=google.com; s=arc-20160816; b=beTdZHBMQVUt3s9f7XdmYIM1dJJV7A8luJ5triMadPhTUUr8wLEtJjBfz27avzoZy4 3UU1zkzjeMeLqBBOme0vkShDZhuBSp8QQeQutH4XfE60cdPllKjZ9SFbuhLA87bHkeKT 9YGNOkxBPLB44FXgl/iFfNU9EdNS8/wQ3BLYuItz121HX0/oH6sIAVwO7LDiAhaSj6PB 8hHkIChRhxkgzwnSAc5eclrnuN1frymZ9QebgYm8y5nmpIOZbrGTSkJcW9Czfjy9VlIH bRFFLQct1nQvC0mIVTVqn78sayGbhEAQVntaTHtaVT7j5qURxTxXi+8cIfn+mmgm6c7V 7OrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=gS8iTyZjRJRL9BGeq8/j3NgTGV9iVMiTHq3ly0FLP3c=; b=G7clLeZrTGVMfdyXSri2qmAj/PMCrv2i2fq6ocp1WVTUh+yf89fpUw250iM+Ard4qD DkUys01LTg7sptrV3VAi8uqCvaWBLyY96L+CQ8/s1/CS6FP5nsaGQ571kchIDXm14lT/ g4Q/BdMeVLyCbZLPBdqhT62TOwwPFER6L0Sy975kg1/pcazu9WlqJOYuhv/JFOuGJqJl QsqtLa01onyOd5eLwqWKdHKsEXZa674z9n1UKB6MKmjvtdWRPkaAJDT5S1YefHlz3NWx fXETTLwBY8Z0HosR5U4jth7Xl1qjpQVNoqqsAfDV42ApymALw2/WAQcrHJtHBP7xRO/3 3jog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id v40-20020a05663835a800b00330b30137bdsi2656829jal.42.2022.06.01.11.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 11:01:34 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D09F842F8; Wed, 1 Jun 2022 20:01:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 26EEB842C3; Wed, 1 Jun 2022 20:01:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 390DA842D4 for ; Wed, 1 Jun 2022 20:01:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9C83DD6E; Wed, 1 Jun 2022 11:01:04 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE1D23F766; Wed, 1 Jun 2022 11:01:02 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Sughosh Ganu Subject: [PATCH v2 2/4] EFI: Do not consider OsIndications variable if CONFIG_EFI_IGNORE_OSINDICATIONS is enabled Date: Wed, 1 Jun 2022 23:30:39 +0530 Message-Id: <20220601180041.340240-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601180041.340240-1-sughosh.ganu@linaro.org> References: <20220601180041.340240-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 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.5 at phobos.denx.de X-Virus-Status: Clean The EFI_IGNORE_OSINDICATIONS config symbol was introduced as a mechanism to have capsule updates work even on platforms where the SetVariable runtime service was not supported. The current logic requires the OsIndications variable to have been set to a 64 bit value even when the EFI_IGNORE_OSINDICATIONS config is enabled. Return an error code on not being able to read the variable only when EFI_IGNORE_OSINDICATIONS is not enabled. Signed-off-by: Sughosh Ganu --- Changes since V1: * Read the OsIndications variable, if present and clear the EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED flag even if the CONFIG_EFI_IGNORE_OSINDICATIONS config is enabled. lib/efi_loader/efi_capsule.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index c76a5f3570..a6b98f066a 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -1058,14 +1058,15 @@ static void efi_capsule_scan_done(void) */ static efi_status_t check_run_capsules(void) { - u64 os_indications; + u64 os_indications = 0x0; efi_uintn_t size; efi_status_t r; size = sizeof(os_indications); r = efi_get_variable_int(u"OsIndications", &efi_global_variable_guid, NULL, &size, &os_indications, NULL); - if (r != EFI_SUCCESS || size != sizeof(os_indications)) + if (!IS_ENABLED(CONFIG_EFI_IGNORE_OSINDICATIONS) && + (r != EFI_SUCCESS || size != sizeof(os_indications))) return EFI_NOT_FOUND; if (os_indications & @@ -1084,7 +1085,7 @@ static efi_status_t check_run_capsules(void) return EFI_SUCCESS; } else if (IS_ENABLED(CONFIG_EFI_IGNORE_OSINDICATIONS)) { return EFI_SUCCESS; - } else { + } else { return EFI_NOT_FOUND; } } From patchwork Wed Jun 1 18:00:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 577794 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8f0c:0:0:0:0 with SMTP id mq12csp833910mab; Wed, 1 Jun 2022 11:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVp7lHSbmvq/mmYGvJdHf/WUbU/0LtGlgx9P4/eY5vnfNk+E5MY131o3XmsicrxYLb7ViD X-Received: by 2002:a05:6e02:1245:b0:2d3:a86e:c587 with SMTP id j5-20020a056e02124500b002d3a86ec587mr692157ilq.274.1654106505797; Wed, 01 Jun 2022 11:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654106505; cv=none; d=google.com; s=arc-20160816; b=0jb0G/YypgyyBl5QKTAtTw6kJquCdxbpjTwS5Sg3PKMiQ/XKBy48CcRE7qKQEm2A19 CjXYOUNkHLhGZzR+Z2T2Ccn6CxCh9BZ7wP/Yxp2w7fVHIzSvvMI0WrOl4uHEnYu4p6oG FtgYnZtWfoaxRqOktA20/WQbIt5g77uIhLo1n1/EFZyPy19gCTRWfHYwxs+EyO5r01nT B1qkZbe4sa05Hoi8SAgAEns/CyzK0PzUk7LV7hLJkGAX7dNhn4xjoHh54zBm4w1WpK/D pPtiqixLrA9ZWj0T7IJuF4U8tRR7i2rL6ciglXfZ8PbeiOkWx8xQ8+foV13+EC0UqzIf OILA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=zlxYZzmEXFxVU9cPb9CeDTKtw3CKxMg8lBu7bl5iEUk=; b=KEP9JvSegJxZvAk17SBRAIp5MdiQ46GHmrZOWXxbkVy1EmC86v0QZoRqN7StN50Cnn pQSctnskyf11kyRlQFmSUpC5i0wuk3bm2e8pwpDqRJ/J4Ek/vEKWleVkheriK5usY8Ui ihHUN8Yivhniy7sNs22tYcjsb+KJoLT0Bu31R07d932SLsAPG5eUYqNHxPAaiNDL+1Ey /VD1bVPoXje+ns2MyU9my86UiUTYINXaMIoqH6tN9LQ0Tk5ltH6N1ppYTRzmO6QbrDsk dq49jblXXXSH8cmtCqqbH5leY6gOZmUVXRdf82d6CjLCBOrhJVe1lp7DcWnPSDwhlF7k MBhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id s8-20020a056e02216800b002d397282415si3030418ilv.175.2022.06.01.11.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 11:01:45 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EF9848430C; Wed, 1 Jun 2022 20:01:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 39A66842F2; Wed, 1 Jun 2022 20:01:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id BE30983E80 for ; Wed, 1 Jun 2022 20:01:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D7C15D6E; Wed, 1 Jun 2022 11:01:06 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E29F3F766; Wed, 1 Jun 2022 11:01:04 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Sughosh Ganu Subject: [PATCH v2 3/4] EFI: Update the documentation to reflect the correct value of OsIndications Date: Wed, 1 Jun 2022 23:30:40 +0530 Message-Id: <20220601180041.340240-4-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601180041.340240-1-sughosh.ganu@linaro.org> References: <20220601180041.340240-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 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.5 at phobos.denx.de X-Virus-Status: Clean The OsIndications is a 64 bit variable, and the current code expects the value of the variable to be 64 bit. Update the documentation to reflect this fact. Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- Changes since V1: None doc/develop/uefi/uefi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index 753a4e5e29..941e427093 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -326,7 +326,7 @@ bit in OsIndications variable with .. code-block:: console - => setenv -e -nv -bs -rt -v OsIndications =0x04 + => setenv -e -nv -bs -rt -v OsIndications =0x0000000000000004 Since U-boot doesn't currently support SetVariable at runtime, its value won't be taken over across the reboot. If this is the case, you can skip From patchwork Wed Jun 1 18:00:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 577795 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8f0c:0:0:0:0 with SMTP id mq12csp834119mab; Wed, 1 Jun 2022 11:01:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVBeZry70KJdgeQ+Kj7AdQKYm3oW2hOlyRfSBc5c7qZrBs/xlZSXmkmShIpodzfBdrper9 X-Received: by 2002:a05:6e02:18cd:b0:2cf:282c:be02 with SMTP id s13-20020a056e0218cd00b002cf282cbe02mr802198ilu.114.1654106517810; Wed, 01 Jun 2022 11:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654106517; cv=none; d=google.com; s=arc-20160816; b=hgtLHstUE05dgjY1KSwdKM2GoVSfCa67zGlsKrYemNsS323/Zjd4rKlDoGi5O5zhOO KAUAWTvFQwhTIjQM25XLR1jpJR6rgAPwc2JeSnS5ij22M7fsqd5jhGmKDViX2ajSJ+4N T7Osvhg6pDBjoHv02zlXlaejccYEd3LIzHcHQhZ8eihKyeY7VzUPqnWfrOXuphwkaARi O9tMROHXEKJxYSQTJWMnCL1emcYUqONcaRNO8zd0H348PU9hkg/e8cfTLlplTNxQt1pl E+iOVUx+oN2H38+zA5v8hxuFWNiiq9+3b7TYRtCGL4amhTDDyNPzOjFxN49fVjMYGhsG kKfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=jUKficrefF1qUBIuBK/64V8fW4fdF/Hm1EFMn5UoLQ8=; b=RgM/GCzQxzDjr4zbT7USA6GpLtKnD0/GDlhS+wlrMcLTXkKOcQD3+fdTJU6lPgKgxS ZYo2vgbzyjA+4yU+9BfFXHNVoqY2XVu1akX7l/5C9zRJ33o3KjT78fBhq0hJC0hX/8ga ENpVUEvitIt4kIMTuLtk1tecW5OVgllm3517H+Co2T0ycX4PSqpJk1HGGvBzdSOhnr8J psKJwstQjd9txVpxwoGTmbgU5kgHWN88LvE3l08twNdfiAY3egy4GOv2kgAom+PEFjOu YA80EEQXBXI69rnyv+zSseMEcNO9LL3KuMnWm/ry28C2LypERz0epnB+FiE+0BuLfxTX DCdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id p8-20020a056e02144800b002cde0eaf204si3481850ilo.15.2022.06.01.11.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 11:01:57 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1DB3D8431C; Wed, 1 Jun 2022 20:01:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id D7A5F842FE; Wed, 1 Jun 2022 20:01:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id CDC61842D4 for ; Wed, 1 Jun 2022 20:01:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1572DD6E; Wed, 1 Jun 2022 11:01:09 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 598F53F766; Wed, 1 Jun 2022 11:01:07 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Sughosh Ganu Subject: [PATCH v2 4/4] EFI: FMP: Use a common GetImageInfo function for FIT and raw images Date: Wed, 1 Jun 2022 23:30:41 +0530 Message-Id: <20220601180041.340240-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601180041.340240-1-sughosh.ganu@linaro.org> References: <20220601180041.340240-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 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.5 at phobos.denx.de X-Virus-Status: Clean The GetImageInfo function definitions for the FIT images and raw images are the same. Use a common function for the both the Firmware Management Protocol(FMP) instances for raw and FIT images. Signed-off-by: Sughosh Ganu --- Changes since V1: None lib/efi_loader/efi_firmware.c | 80 ++++++----------------------------- 1 file changed, 14 insertions(+), 66 deletions(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 9cdefab41f..0ffee3fb1f 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -177,18 +177,8 @@ static efi_status_t efi_fill_image_desc_array( return EFI_SUCCESS; } -#ifdef CONFIG_EFI_CAPSULE_FIRMWARE_FIT -/* - * This FIRMWARE_MANAGEMENT_PROTOCOL driver provides a firmware update - * method with existing FIT image format, and handles - * - multiple regions of firmware via DFU - * but doesn't support - * - versioning of firmware image - * - package information - */ - /** - * efi_firmware_fit_get_image_info - return information about the current + * efi_firmware_get_image_info - return information about the current * firmware image * @this: Protocol instance * @image_info_size: Size of @image_info @@ -206,7 +196,7 @@ static efi_status_t efi_fill_image_desc_array( * Return status code */ static -efi_status_t EFIAPI efi_firmware_fit_get_image_info( +efi_status_t EFIAPI efi_firmware_get_image_info( struct efi_firmware_management_protocol *this, efi_uintn_t *image_info_size, struct efi_firmware_image_descriptor *image_info, @@ -239,6 +229,16 @@ efi_status_t EFIAPI efi_firmware_fit_get_image_info( return EFI_EXIT(ret); } +#ifdef CONFIG_EFI_CAPSULE_FIRMWARE_FIT +/* + * This FIRMWARE_MANAGEMENT_PROTOCOL driver provides a firmware update + * method with existing FIT image format, and handles + * - multiple regions of firmware via DFU + * but doesn't support + * - versioning of firmware image + * - package information + */ + /** * efi_firmware_fit_set_image - update the firmware image * @this: Protocol instance @@ -278,7 +278,7 @@ efi_status_t EFIAPI efi_firmware_fit_set_image( } const struct efi_firmware_management_protocol efi_fmp_fit = { - .get_image_info = efi_firmware_fit_get_image_info, + .get_image_info = efi_firmware_get_image_info, .get_image = efi_firmware_get_image_unsupported, .set_image = efi_firmware_fit_set_image, .check_image = efi_firmware_check_image_unsupported, @@ -293,58 +293,6 @@ const struct efi_firmware_management_protocol efi_fmp_fit = { * method with raw data. */ -/** - * efi_firmware_raw_get_image_info - return information about the current - * firmware image - * @this: Protocol instance - * @image_info_size: Size of @image_info - * @image_info: Image information - * @descriptor_version: Pointer to version number - * @descriptor_count: Pointer to number of descriptors - * @descriptor_size: Pointer to descriptor size - * @package_version: Package version - * @package_version_name: Package version's name - * - * Return information bout the current firmware image in @image_info. - * @image_info will consist of a number of descriptors. - * Each descriptor will be created based on "dfu_alt_info" variable. - * - * Return status code - */ -static -efi_status_t EFIAPI efi_firmware_raw_get_image_info( - struct efi_firmware_management_protocol *this, - efi_uintn_t *image_info_size, - struct efi_firmware_image_descriptor *image_info, - u32 *descriptor_version, - u8 *descriptor_count, - efi_uintn_t *descriptor_size, - u32 *package_version, - u16 **package_version_name) -{ - efi_status_t ret = EFI_SUCCESS; - - EFI_ENTRY("%p %p %p %p %p %p %p %p\n", this, - image_info_size, image_info, - descriptor_version, descriptor_count, descriptor_size, - package_version, package_version_name); - - if (!image_info_size) - return EFI_EXIT(EFI_INVALID_PARAMETER); - - if (*image_info_size && - (!image_info || !descriptor_version || !descriptor_count || - !descriptor_size || !package_version || !package_version_name)) - return EFI_EXIT(EFI_INVALID_PARAMETER); - - ret = efi_fill_image_desc_array(image_info_size, image_info, - descriptor_version, descriptor_count, - descriptor_size, package_version, - package_version_name); - - return EFI_EXIT(ret); -} - /** * efi_firmware_raw_set_image - update the firmware image * @this: Protocol instance @@ -430,7 +378,7 @@ efi_status_t EFIAPI efi_firmware_raw_set_image( } const struct efi_firmware_management_protocol efi_fmp_raw = { - .get_image_info = efi_firmware_raw_get_image_info, + .get_image_info = efi_firmware_get_image_info, .get_image = efi_firmware_get_image_unsupported, .set_image = efi_firmware_raw_set_image, .check_image = efi_firmware_check_image_unsupported,