From patchwork Wed May 11 14:44:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 621116 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3r4f3m0PzGz9t3w for ; Thu, 12 May 2016 00:42:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Dg9rd3s9; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 32132A75C8; Wed, 11 May 2016 16:42:36 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5RCOe99F2PmY; Wed, 11 May 2016 16:42:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3EC29A75CD; Wed, 11 May 2016 16:42:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 453E24BF63 for ; Wed, 11 May 2016 16:41:55 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id czBhDH1gxEfL for ; Wed, 11 May 2016 16:41:55 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by theia.denx.de (Postfix) with ESMTPS id 408ADA74C6 for ; Wed, 11 May 2016 16:41:45 +0200 (CEST) Received: by mail-pf0-f195.google.com with SMTP id 145so3927038pfz.1 for ; Wed, 11 May 2016 07:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=lznMekXHABGxVfR2UBdxqyyel8uQuY4txPxGN+h/E0w=; b=Dg9rd3s93grcCsjMVaGp+tMU1OLmpNSO+2FSz2EKdXWqwfhONf/QnGXokTiUVHjKsq FQCyWtn4s1lDtaUjR2f1Jdo6M4UHbRX+LLiQ7elRuprLHhU6xmUHdG049ROU8FlQdtcv sraFJEcF5kf/Z1vd2t6Q+cIFjAkDuL0td2Ap2St+bpYQygOKjZGRgHIHuDTvBtnRvlmZ TqparlS9/v+P/4hsqoEj+imetlMzdfIbbM9ip6bvqB6NpZsXmoqHRxur/2fTVSSfqYr/ 0z481WWLgA7DTgAp9EEWstV+NQMl7od+HERD9Lffa00SPnL2kJkuxAydeSnaWiiNUeVu O5qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=lznMekXHABGxVfR2UBdxqyyel8uQuY4txPxGN+h/E0w=; b=cBrZ7ELyQvTSWrxNpHxdXkxg7SxVCHTgLWwsGgq5UECMg3ob1FsrqVsl9z97Qy7N0P 53Xx+/GoS8EeACcvBt/tKOI48MH2e1NeI+wibNNE51qWr9W8OvABlWfUJYANjDd3BTkL tHHfbYHTMLFHuFC147pZDVJnlJPr85fwZOOeFoC0vKIw5S6wPRST6AXH3YKRlsLzMO14 AhB0VGTNuMsXTRnWvg/udtkNGS0HZuh1IxDlD6cs9DVq//TidHQOnx9o972wpUqSm/gu snhQ4/S/kqq2N3sgy2zz0UyCJB8RV6yoUcl763aZlvr+X5BaN76aOIWDdu3rQ4I99wlZ dZzw== X-Gm-Message-State: AOPr4FV5BFs7Cu+L3TdxhsFVea+le2lRIaI0AxeBOGBST7CN4YvmGG+TBXwYlEEr7eci4A== X-Received: by 10.98.3.4 with SMTP id 4mr5515928pfd.33.1462977704288; Wed, 11 May 2016 07:41:44 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-157-139.windriver.com. [147.11.157.139]) by smtp.gmail.com with ESMTPSA id q20sm12744144pfa.90.2016.05.11.07.41.43 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 May 2016 07:41:43 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Date: Wed, 11 May 2016 07:44:56 -0700 Message-Id: <1462977912-13666-3-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1462977912-13666-1-git-send-email-bmeng.cn@gmail.com> References: <1462977912-13666-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v2 02/18] x86: Call board_final_cleanup() in last_stage_init() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" At present board_final_cleanup() is called before booting a Linux kernel. This actually needs to be done before booting anything, like SeaBIOS, VxWorks or Windows. Move the call to last_stage_init() instead. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- Changes in v2: None arch/x86/cpu/coreboot/coreboot.c | 20 +++++++++++--------- arch/x86/cpu/cpu.c | 10 ++++++++++ arch/x86/lib/bootm.c | 9 --------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index 845f86a..1b04203 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -39,15 +39,7 @@ int print_cpuinfo(void) return default_print_cpuinfo(); } -int last_stage_init(void) -{ - if (gd->flags & GD_FLG_COLD_BOOT) - timestamp_add_to_bootstage(); - - return 0; -} - -void board_final_cleanup(void) +static void board_final_cleanup(void) { /* * Un-cache the ROM so the kernel has one @@ -79,6 +71,16 @@ void board_final_cleanup(void) } } +int last_stage_init(void) +{ + if (gd->flags & GD_FLG_COLD_BOOT) + timestamp_add_to_bootstage(); + + board_final_cleanup(); + + return 0; +} + int misc_init_r(void) { return 0; diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 233a6c8..1482153 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -661,10 +661,20 @@ void show_boot_progress(int val) } #ifndef CONFIG_SYS_COREBOOT +/* + * Implement a weak default function for boards that optionally + * need to clean up the system before jumping to the kernel. + */ +__weak void board_final_cleanup(void) +{ +} + int last_stage_init(void) { write_tables(); + board_final_cleanup(); + return 0; } #endif diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 783be69..7cf9de4 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -26,14 +26,6 @@ DECLARE_GLOBAL_DATA_PTR; #define COMMAND_LINE_OFFSET 0x9000 -/* - * Implement a weak default function for boards that optionally - * need to clean up the system before jumping to the kernel. - */ -__weak void board_final_cleanup(void) -{ -} - void bootm_announce_and_cleanup(void) { printf("\nStarting kernel ...\n\n"); @@ -45,7 +37,6 @@ void bootm_announce_and_cleanup(void) #ifdef CONFIG_BOOTSTAGE_REPORT bootstage_report(); #endif - board_final_cleanup(); } #if defined(CONFIG_OF_LIBFDT) && !defined(CONFIG_OF_NO_KERNEL)