From patchwork Mon Dec 4 21:28:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 844461 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="GeI84UIx"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yrJ0g4cm6z9s7f for ; Tue, 5 Dec 2017 08:29:07 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 47C27C22096; Mon, 4 Dec 2017 21:29:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 992B9C21DAA; Mon, 4 Dec 2017 21:28:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 38DB4C21DAB; Mon, 4 Dec 2017 21:28:41 +0000 (UTC) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by lists.denx.de (Postfix) with ESMTPS id 9ABB0C21D79 for ; Mon, 4 Dec 2017 21:28:40 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id f143so10231945itb.0 for ; Mon, 04 Dec 2017 13:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=hATnclxMnMLncTXcUIhyEsxTT7pAmBjLte6deaAM2Mg=; b=GeI84UIxLfG9FO0RD8/bb53h0bH4+jrnY5V+wKMsWSq1+b8PjFEzJ8CS3rEN9f2MOA V/Bpp32nF04s21kdEv8kfXcAgTAP32Hy0lfBS/6DDXeAO0Sa2i+fdYcK6IU16cWxF3dl /bGcC1PlzeLSr/qhh5hHLb1WO5ctnQ3xC8u4veuhUzfw31zUOICGg541vxjT509aMdOp k6z1AECMLCXicsC2AVesnCAKq3+WT1oSecLmOHuq+GAIaYHyO4K+fmO+4zaR/LdIb8Xv Y3+IwH2/DfogMphOSqayb/n0DNcyeXihkkntn5XS5Pvfx1fXyJus+y8oyQLvqaS/fBa7 qvig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=hATnclxMnMLncTXcUIhyEsxTT7pAmBjLte6deaAM2Mg=; b=mhCpCFBYUJWpeB3PHe8+12b7LHtpKWzYgRrk0tSIk1PYufvo+1fNgNjL1OqOXEEmbw 7j+nHZ1t3G+zBOYOn4TWBNq1oyNJcAury/CQ2IT1l8UI4g6jXpuUNcXG7ZgaNmxlYczJ hThqy4oRbyh0IzZC+Rwaji5qWO83x9TLLl9D1Eb+sMH8wOpFaFG+H8c/JuewwHPX38jV EzqMcsZpFsAQz0CPjkbZdhKBnNUmxiRh4SYs1rJgfsY9pqWgo6HEtAkfHsvgxCcndhZy onlfgOLcM0hWfgLi81w+GCQXwi6r6LUr5PaGyI/vK0IsfY3sD0yeGfW1cVq/tSCxF6qp FpjQ== X-Gm-Message-State: AKGB3mICUsBbhuOSLd7AiVBg4a8BIUXJNNF3izeSyWjl1fBvHa9bNijm iFXack+LxMiwfeXDy1gsWfbvgw== X-Google-Smtp-Source: AGs4zMZFLuHESy9KaRFo+tP+XA9QTVMGM+4V4IDmPvwH0fz5rEau7NvLqHJlCbrhp5pa0c6pbi6KSA== X-Received: by 10.107.97.16 with SMTP id v16mr2964946iob.263.1512422919012; Mon, 04 Dec 2017 13:28:39 -0800 (PST) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id f202sm4288332itc.40.2017.12.04.13.28.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Dec 2017 13:28:38 -0800 (PST) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id F40E2143C42; Mon, 4 Dec 2017 14:28:36 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 4 Dec 2017 14:28:17 -0700 Message-Id: <20171204212832.130100-2-sjg@chromium.org> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171204212832.130100-1-sjg@chromium.org> References: <20171204212832.130100-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v2 01/16] efi: Update efi_smbios_register() to return error code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This function can fail but gives no indication of failure. Update it to return an error when something goes wrong. Signed-off-by: Simon Glass --- Changes in v2: - Update return type of efi_smbios_register() to efi_status_t - Use return value of efi_install_configuration_table include/efi_loader.h | 9 ++++++++- lib/efi_loader/efi_smbios.c | 7 ++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 1b92edbd77..35f8f84401 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -164,7 +164,14 @@ int efi_gop_register(void); /* Called by bootefi to make the network interface available */ int efi_net_register(void); /* Called by bootefi to make SMBIOS tables available */ -void efi_smbios_register(void); +/** + * efi_smbios_register() - write out SMBIOS tables + * + * Called by bootefi to make SMBIOS tables available + * + * @return 0 if OK, -ENOMEM if no memory is available for the tables + */ +efi_status_t efi_smbios_register(void); struct efi_simple_file_system_protocol * efi_fs_from_path(struct efi_device_path *fp); diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c index ac412e7362..67f71892ca 100644 --- a/lib/efi_loader/efi_smbios.c +++ b/lib/efi_loader/efi_smbios.c @@ -13,7 +13,7 @@ static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID; -void efi_smbios_register(void) +efi_status_t efi_smbios_register(void) { /* Map within the low 32 bits, to allow for 32bit SMBIOS tables */ uint64_t dmi = 0xffffffff; @@ -22,11 +22,12 @@ void efi_smbios_register(void) int memtype = EFI_RUNTIME_SERVICES_DATA; if (efi_allocate_pages(1, memtype, pages, &dmi) != EFI_SUCCESS) - return; + return EFI_OUT_OF_RESOURCES; /* Generate SMBIOS tables */ write_smbios_table(dmi); /* And expose them to our EFI payload */ - efi_install_configuration_table(&smbios_guid, (void*)(uintptr_t)dmi); + return efi_install_configuration_table(&smbios_guid, + (void *)(uintptr_t)dmi); }