From patchwork Thu Oct 22 03:02:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1385879 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bDTo4Qh5; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CGsgv0JL1z9sSn for ; Thu, 22 Oct 2020 14:06:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D81B824AD; Thu, 22 Oct 2020 05:04:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="bDTo4Qh5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6A82B82442; Thu, 22 Oct 2020 05:03:40 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2EA48823F3 for ; Thu, 22 Oct 2020 05:03:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id u19so36413ion.3 for ; Wed, 21 Oct 2020 20:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AzfUejb5/nW9Xm7/Rm87WQP9ZiNKeUXpFU7NNp/mO2U=; b=bDTo4Qh5Bka/POgCLRw312NZymR9gD+cfnhvtvGKumDcHlh/1FpjV0Y4J0afFr1pVv nL8NCU5cUXZSKYHxOtZhM849/6f7u1p0hkK+5J/Z9+dmvCrZGvDR0879Yxn9kKSgHR/V NB0CrdOE7cuC1KGiijuH1cFuMhCWjyWEymr1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AzfUejb5/nW9Xm7/Rm87WQP9ZiNKeUXpFU7NNp/mO2U=; b=eE3FYONNaee2/9eijSwp36Ot2VCejPUX3jWEzJfylDZmv2ViXTOSjwAih0YRj5oncD xyWIQwD5DUE95sqXZ7sJoxf4PnpBvPGbYSwX9zQHPw5AP22htaHj6a33PDZ21s4puX96 cRErSPHTBSoPSJzC/NMbXpLjuZn0lXFd2WbApIRg1yRIyUdy2zcJoZlej+cPIH5ntvw3 BiTgWW3LbXMNgupf+C6xG2gyJOyPLCkksF8WQkSe3bBCNODERXxHTzlVcHcmsUiWfeFd twJ5cAahdLtYqk8quHFACYorT+P4pbAjXybpiHQ97D1rCsdBlm1YToMcKTZgFF8f87wB TGwA== X-Gm-Message-State: AOAM530ATX2wVN0o8cNKN0rbjBEt+AnBSDIHVv7wpvYlqmIFt18abRY4 bSHuNQyYVAVSxb7o5im87PtP1CjTr5BnGlZG X-Google-Smtp-Source: ABdhPJx63L74rDGyGbhVtisAiiyCQLQFIvi0K3t/UgQ+iTAtR/Y9NOyPVt6TAw5iiVqYIxZ9bzJA/A== X-Received: by 2002:a6b:7f43:: with SMTP id m3mr423079ioq.114.1603335815928; Wed, 21 Oct 2020 20:03:35 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id p4sm206171ilg.79.2020.10.21.20.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 20:03:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Bernhard Messerklinger , Wolfgang Wallner , Walter Lozano , Simon Glass , Bin Meng Subject: [PATCH v2 11/30] x86: Use if instead of #ifdef in write_tables() Date: Wed, 21 Oct 2020 21:02:44 -0600 Message-Id: <20201022030303.584490-10-sjg@chromium.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201022030303.584490-1-sjg@chromium.org> References: <20201022030303.584490-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Use if() to remove the extra build path in this code. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v1) arch/x86/lib/tables.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c index 7099866a78a..f7b71c5cd13 100644 --- a/arch/x86/lib/tables.c +++ b/arch/x86/lib/tables.c @@ -68,10 +68,8 @@ int write_tables(void) { u32 rom_table_start = ROM_TABLE_ADDR; u32 rom_table_end; -#ifdef CONFIG_SEABIOS u32 high_table, table_size; struct memory_area cfg_tables[ARRAY_SIZE(table_list) + 1]; -#endif int i; debug("Writing tables to %x:\n", rom_table_start); @@ -81,30 +79,32 @@ int write_tables(void) rom_table_end = table->write(rom_table_start); rom_table_end = ALIGN(rom_table_end, ROM_TABLE_ALIGN); -#ifdef CONFIG_SEABIOS - table_size = rom_table_end - rom_table_start; - high_table = (u32)high_table_malloc(table_size); - if (high_table) { - table->write(high_table); - - cfg_tables[i].start = high_table; - cfg_tables[i].size = table_size; - } else { - printf("%d: no memory for configuration tables\n", i); - return -ENOSPC; + if (IS_ENABLED(CONFIG_SEABIOS)) { + table_size = rom_table_end - rom_table_start; + high_table = (u32)(ulong)high_table_malloc(table_size); + if (high_table) { + table->write(high_table); + + cfg_tables[i].start = high_table; + cfg_tables[i].size = table_size; + } else { + printf("%d: no memory for configuration tables\n", + i); + return -ENOSPC; + } } -#endif debug("- wrote '%s' to %x, end %x\n", table->name, rom_table_start, rom_table_end); rom_table_start = rom_table_end; } -#ifdef CONFIG_SEABIOS - /* make sure the last item is zero */ - cfg_tables[i].size = 0; - write_coreboot_table(CB_TABLE_ADDR, cfg_tables); -#endif + if (IS_ENABLED(CONFIG_SEABIOS)) { + /* make sure the last item is zero */ + cfg_tables[i].size = 0; + write_coreboot_table(CB_TABLE_ADDR, cfg_tables); + } + debug("- done writing tables\n"); return 0;