From patchwork Wed May 16 15:42:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914723 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; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="bNgEORFW"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJs41qnYz9s2R for ; Thu, 17 May 2018 01:54:16 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E6676C21FF5; Wed, 16 May 2018 15:53:06 +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_DNSWL_BLOCKED, 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 29861C21FFD; Wed, 16 May 2018 15:45:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3BDECC22016; Wed, 16 May 2018 15:42:57 +0000 (UTC) Received: from mail-it0-f68.google.com (mail-it0-f68.google.com [209.85.214.68]) by lists.denx.de (Postfix) with ESMTPS id B66B3C21FA3 for ; Wed, 16 May 2018 15:42:48 +0000 (UTC) Received: by mail-it0-f68.google.com with SMTP id q72-v6so3137558itc.0 for ; Wed, 16 May 2018 08:42:48 -0700 (PDT) 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=cHwRRus5BnCVHhCbRHvQWLVAhkTh+TBlvlhDaGARFqE=; b=bNgEORFWJdSTWND51olZ5YUkZvydljlneXLVkYknuUfwDsls0VQgzTor2r/xYL1i6O Xq+Lx7FEYR8uC807sJR6Gui+Ja2LwhUc2Zk7r7WBvi91d7Arct4J1LDP8WmnuSZ2nGiM IxsSqeSRohz9uUi6RxTgN7KAyHMvhry+k4wiQ8u2n6jZVLo8rw4WKW7HgmbvxPcFwQxl x2XyYcRVSnwIULPjtPDEHloT/OdLULoHfoxYUCcD43e2ChSuUqIQ4vxzs4SU0RxXaaHv Js8oZOjQWAxRAdZNqoPULxB/lJMU+hQdx8JDQoKtsUl7AYHndyWghWG5Jhlw1OaqUxvD fwNA== 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=cHwRRus5BnCVHhCbRHvQWLVAhkTh+TBlvlhDaGARFqE=; b=YmfOf623ydpf+U3hDL5Zr5M/oZERqJo3O8r1QLSnoUT4RUOxG2cRO1zrM6GxWkkc2f izTQ3AeULEIyxx3AwmYdxRReIBJblKuxj5yJgjGwkCkfpUy+BBZovBw9+Ein4W566L9K aSFTS9SInQ8b6UbY8uTNnx7gVK9/H38+sCJwV22tYFXnguCDLWoWsonbSekZbZPxNpjW uLm4Hx/0lRS9eaQbkdWV09CSaCZuHTxl9hQOF7JuUPpdBKWEF/RIeQcsJyLbqS2SDuQ6 LF5ZcJDf7EXWfw8gRgyBRVDTw0bj/BuNwf+QOPSh99cVEYijHuGFyjIUzeig1P0U94/c rdlw== X-Gm-Message-State: ALKqPwd2tqQDzk9NuD/8PdVgW35Qdkre4anlvuYKAj5tWeoqUA0LgrIN MQxSAVTdwbP5sMBmK1hD1ksmNQ== X-Google-Smtp-Source: AB8JxZr5AmfjCL6zoxnEX45rrlIUryH/OXDtt8S89cOzmJdepNEYmH1rRmSfC2lCztBPHmFBLhi3vg== X-Received: by 2002:a6b:f27:: with SMTP id x39-v6mr1756485ioi.91.1526485367139; Wed, 16 May 2018 08:42:47 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id v18-v6sm1767905ita.19.2018.05.16.08.42.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:46 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 83D40140208; Wed, 16 May 2018 09:42:45 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:19 -0600 Message-Id: <20180516154233.21457-3-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 02/16] efi: Update some comments related to smbios tables 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" Clarify the operation of this code with some additional comments. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- Changes in v4: - Remove code already applied - Update subject Changes in v3: - Add comments on aligment - Return error value of efi_allocate_pages() - Update function comment for write_smbios_table() 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 | 7 +++++++ include/smbios.h | 5 +++-- lib/efi_loader/efi_smbios.c | 7 ++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 2868ca25abb..2519a7c33a7 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -207,6 +207,13 @@ efi_status_t efi_net_register(void); /* Called by bootefi to make the watchdog available */ efi_status_t efi_watchdog_register(void); /* Called by bootefi to make SMBIOS tables available */ +/** + * 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 * diff --git a/include/smbios.h b/include/smbios.h index 79880ef5b5c..97b9ddce237 100644 --- a/include/smbios.h +++ b/include/smbios.h @@ -231,8 +231,9 @@ typedef int (*smbios_write_type)(ulong *addr, int handle); * * This writes SMBIOS table at a given address. * - * @addr: start address to write SMBIOS table - * @return: end address of SMBIOS table + * @addr: start address to write SMBIOS table. If this is not + * 16-byte-aligned then it will be aligned before the table is written + * @return: end address of SMBIOS table (and start address for next entry) */ ulong write_smbios_table(ulong addr); diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c index 482436e2adb..7c3fc8af0b2 100644 --- a/lib/efi_loader/efi_smbios.c +++ b/lib/efi_loader/efi_smbios.c @@ -29,7 +29,12 @@ efi_status_t efi_smbios_register(void) if (ret != EFI_SUCCESS) return ret; - /* Generate SMBIOS tables */ + /* + * Generate SMBIOS tables - we know that efi_allocate_pages() returns + * a 4k-aligned address, so it is safe to assume that + * write_smbios_table() will write the table at that address. + */ + assert(!(dmi & 0xf)); write_smbios_table(dmi); /* And expose them to our EFI payload */