From patchwork Sun Apr 26 15:12:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1277075 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=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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=DqD1WXv1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 499BJt4t3cz9sRY for ; Mon, 27 Apr 2020 01:14:22 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 518A981D31; Sun, 26 Apr 2020 17:13:39 +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="DqD1WXv1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 138B981D17; Sun, 26 Apr 2020 17:13:16 +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 20BED81D00 for ; Sun, 26 Apr 2020 17:13:11 +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 e9so16069104iok.9 for ; Sun, 26 Apr 2020 08:13:11 -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=AivYv1+h3YkvaL+iMdBcpFntwKhLCBmmkZizrGM41lw=; b=DqD1WXv1/zPBZCCTcvU7vG0qhLOSokC5VuV3MVwQWNJ0G/T0EMJXoFtWAaw5/pSyZq ycYXGeMxAGXAQTNOWjwxiDcPnl/JiSLA2GWuvWA87Pgx4rcPA9LExGAX+iAVVZNWA+Ut KvteU32GpgCJzEKMyq0YNxeWQ8RumMceFZ8lc= 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=AivYv1+h3YkvaL+iMdBcpFntwKhLCBmmkZizrGM41lw=; b=j5im88K2fVhJ2m2tpHfGhx6H+9JIaRQX+WmyG5fQAWkqP02/BIHio1j9NCP0xK0rnA WTJn7IZ2Ym3Om+aSJ/XB2cOLcz3Msy6hfyKPhpBefJzL6Cd8M6mJJ2ifCygQVZqclIem Aw8gxfS3eHkYTxpuQXeibVOcdSJclj8GPw8fD24QsG50tAHdatXfYzP53RT3Qmp0wUqa 2E5IyKr6MuKw75x/UxgI6PiOkyX3NVyXctt4uZA39qH3HY/F0BvCDo50wq1QUczlCb5c lU/2e+HP1dsAmB+YAlVtRb2UGIwQBa+jEoxF2UPXTHzZoOqviZIV21u6QC9xkMqbWV6y SK1A== X-Gm-Message-State: AGi0Pua22jmkm+eVr+P/q0/tZRYedQV3XKPlhgEQ3miaTU6iOzeDOkdq O5cFuziDuJF7aAUcrlg1euPJ9uSDQ8Txug== X-Google-Smtp-Source: APiQypLhkXYvgvphHpJLWigyY/iZcQo8kVfABN3Xe2O9V5e5mqoCPWYa/b9Po0X3RZUJoHC/4SiKUg== X-Received: by 2002:a5e:c804:: with SMTP id y4mr17309218iol.58.1587913989843; Sun, 26 Apr 2020 08:13:09 -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 n25sm3981978ion.34.2020.04.26.08.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2020 08:13:09 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Andy Shevchenko , Heinrich Schuchardt , "Park, Aiden" , Vagrant Cascadian , Wolfgang Wallner Subject: [PATCH v4 3/9] x86: cpu: Skip init code when chain loading Date: Sun, 26 Apr 2020 09:12:55 -0600 Message-Id: <20200426151302.93418-4-sjg@chromium.org> X-Mailer: git-send-email 2.26.2.303.gf8c07b1a785-goog In-Reply-To: <20200426151302.93418-1-sjg@chromium.org> References: <20200426151302.93418-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean When U-Boot is not the first-stage bootloader the interrupt and cache init must be skipped, as well as init for various peripherals. Update the code to add checks for this. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v4: None Changes in v3: None Changes in v2: - Drop the other check in interrupt_init() which is not needed now arch/x86/cpu/cpu.c | 4 +++- arch/x86/cpu/i386/interrupt.c | 6 ++++-- arch/x86/lib/init_helpers.c | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index cec04b481b..8526e856d7 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -239,8 +239,10 @@ int cpu_init_r(void) struct udevice *dev; int ret; - if (!ll_boot_init()) + if (!ll_boot_init()) { + uclass_first_device(UCLASS_PCI, &dev); return 0; + } ret = x86_init_cpus(); if (ret) diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c index 4c7e9ea215..e67a116ac1 100644 --- a/arch/x86/cpu/i386/interrupt.c +++ b/arch/x86/cpu/i386/interrupt.c @@ -264,6 +264,9 @@ int interrupt_init(void) struct udevice *dev; int ret; + if (!ll_boot_init()) + return 0; + /* Try to set up the interrupt router, but don't require one */ ret = irq_first_device_type(X86_IRQT_BASE, &dev); if (ret && ret != -ENODEV) @@ -295,8 +298,7 @@ int interrupt_init(void) * TODO(sjg@chromium.org): But we don't handle these correctly when * booted from EFI. */ - if (ll_boot_init()) - enable_interrupts(); + enable_interrupts(); #endif return 0; diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 5bb55e256f..d906b528b3 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -30,6 +30,9 @@ int init_cache_f_r(void) return ret; } + if (!ll_boot_init()) + return 0; + /* Initialise the CPU cache(s) */ return init_cache(); }