From patchwork Mon Jul 25 14:07:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Longchamp X-Patchwork-Id: 106677 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 E3145B6F8F for ; Tue, 26 Jul 2011 00:07:27 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 333DB2807E; Mon, 25 Jul 2011 16:07:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 LR0es1i1ua5t; Mon, 25 Jul 2011 16:07:24 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EABBF2807F; Mon, 25 Jul 2011 16:07:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C89D02807F for ; Mon, 25 Jul 2011 16:07:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 WCOgrN3q7vqu for ; Mon, 25 Jul 2011 16:07:18 +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.ch.keymile.com (mail.ch.keymile.com [193.17.201.103]) by theia.denx.de (Postfix) with SMTP id 51E0A2807E for ; Mon, 25 Jul 2011 16:07:16 +0200 (CEST) Received: from SRVCHBER1212.ch.keymile.net ([172.31.32.9]) by eSafe SMTP Relay 1310478291; Mon, 25 Jul 2011 15:52:34 +0200 Received: from chber1-10533x.ch.keymile.net ([172.31.32.81]) by SRVCHBER1212.ch.keymile.net with Microsoft SMTPSVC(6.0.3790.4675); Mon, 25 Jul 2011 16:07:15 +0200 From: Valentin Longchamp To: u-boot@lists.denx.de Date: Mon, 25 Jul 2011 16:07:13 +0200 Message-Id: <1311602833-29320-1-git-send-email-valentin.longchamp@keymile.com> X-Mailer: git-send-email 1.7.1 X-OriginalArrivalTime: 25 Jul 2011 14:07:15.0199 (UTC) FILETIME=[280748F0:01CC4AD4] X-ESAFE-STATUS: Mail allowed X-ESAFE-DETAILS: Cc: Valentin Longchamp , holger.brunck@keymile.com Subject: [U-Boot] [RFC PATCH] POST: add test before execution of post_run to avoid unneeded run X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Some boards have the environment variables defined in a slow EEPROM. post_run accesses these environment variables to define which tests have to be run (in post_get_flags). This is very slow before the code relocation on some boards with a slow I2C EEPROM for environement variables. This patch adds a check at the beginning of post_run to avoid to run post_get_flags (which may be slow on some boards for the above reason) for some given POST flags if no tests are defined with these flags (for instance, no need to run POST tests with POST_ROM if no tests for POST_ROM are defined). Signed-off-by: Valentin Longchamp cc: Holger Brunck cc: Wolfgang Denk --- post/post.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/post/post.c b/post/post.c index 1b7f2aa..d97f330 100644 --- a/post/post.c +++ b/post/post.c @@ -169,6 +169,18 @@ static void post_bootmode_test_off (void) post_word_store (word); } +static int post_test_defined(int flags) +{ + int i; + int run_flags = flags & ~(POST_RAM | POST_ROM); + + for (i = 0; i < post_list_size; i++) + if (post_list[i].flags & run_flags) + return 1; + + return 0; +} + static void post_get_flags (int *test_flags) { int flag[] = { POST_POWERON, POST_NORMAL, POST_SLOWTEST, @@ -301,6 +313,9 @@ int post_run (char *name, int flags) unsigned int i; int test_flags[POST_MAX_NUMBER]; + if (!post_test_defined(flags)) + return 0; + post_get_flags (test_flags); if (name == NULL) {