From patchwork Tue Nov 3 12:20:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryanov X-Patchwork-Id: 539372 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 2BD1F140DAE for ; Tue, 3 Nov 2015 23:22:06 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=compulab.co.il header.i=@compulab.co.il header.b=n88gjsKx; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 97E2E4BA2B; Tue, 3 Nov 2015 13:22:04 +0100 (CET) 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 SA1ZZiHFZitf; Tue, 3 Nov 2015 13:22:04 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 318794BA2C; Tue, 3 Nov 2015 13:22:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7F8024BA2C for ; Tue, 3 Nov 2015 13:22:00 +0100 (CET) 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 9mB8pSY5Vs5s for ; Tue, 3 Nov 2015 13:22:00 +0100 (CET) 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 compulab.co.il (softlayer.compulab.co.il [50.23.254.55]) by theia.denx.de (Postfix) with ESMTPS id 111E04BA2B for ; Tue, 3 Nov 2015 13:21:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=compulab.co.il; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From; bh=43+d/FiH+I2YEXkIV6U/XIJWAJ7FTd7PugV/YLQdsVU=; b=n88gjsKx8oc1x 3lnZBk35TPPPlviCzuE5vYjh0Wi0cBu183SWuKGA/mZx0/utT5rnoHmSbYvkBoOC3DHRpbhVC+TAE xOrz09iGw1DgdThvPnOaYCuFirkohgz65McRx4BdCrgw90qTp/jXPD+Rwdh6PvfAlnqfPuCY8mIOV nltU=; Received: from [82.166.188.245] (port=44323 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.86) (envelope-from ) id 1Ztab6-0000Rb-PT; Tue, 03 Nov 2015 14:21:56 +0200 Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id AECA3488D6A; Tue, 3 Nov 2015 14:21:55 +0200 (IST) Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id CoT9xnM2NlBq; Tue, 3 Nov 2015 14:21:55 +0200 (IST) Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 17995488D6B; Tue, 3 Nov 2015 14:21:55 +0200 (IST) X-Virus-Scanned: amavisd-new at zimbra-mta.compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TFuWy4_SOBpt; Tue, 3 Nov 2015 14:21:55 +0200 (IST) Received: from skynet.compulab.local (nikita-pc.compulab.local [192.168.11.211]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id DE676488D6A; Tue, 3 Nov 2015 14:21:54 +0200 (IST) From: Nikita Kiryanov To: u-boot@lists.denx.de Date: Tue, 3 Nov 2015 14:20:41 +0200 Message-Id: <1446553241-27395-1-git-send-email-nikita@compulab.co.il> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446024210-16517-12-git-send-email-nikita@compulab.co.il> References: <1446024210-16517-12-git-send-email-nikita@compulab.co.il> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Get-Message-Sender-Via: softlayer.compulab.co.il: acl_c_recent_authed_mail_ips_text_entry: nikita@compulab.co.il|compulab.co.il X-Authenticated-Sender: softlayer.compulab.co.il: nikita@compulab.co.il Cc: Tom Rini Subject: [U-Boot] [PATCH V3 11/13] spl: announce boot devices 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" Now that we support alternative boot devices, it can sometimes be unclear which boot devices was actually used. Provide a function to announce which boot devices are attempted during boot. Signed-off-by: Nikita Kiryanov Cc: Igor Grinberg Cc: Tom Rini Cc: Simon Glass Reviewed-by: Tom Rini --- Changes in V3: - Reworked announce_boot_device() to make the code less repititive by utilizing a table of boot_device --> name. Changes in V2: - No changes. common/spl/spl.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/common/spl/spl.c b/common/spl/spl.c index 7913c52..11b452b 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -178,6 +178,84 @@ int spl_init(void) return 0; } +#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE +__weak void spl_board_announce_boot_device(void) { } +#endif + +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT +struct boot_device_name { + u32 boot_dev; + const char *name; +}; + +struct boot_device_name boot_name_table[] = { +#ifdef CONFIG_SPL_RAM_DEVICE + { BOOT_DEVICE_RAM, "RAM" }, +#endif +#ifdef CONFIG_SPL_MMC_SUPPORT + { BOOT_DEVICE_MMC1, "MMC" }, + { BOOT_DEVICE_MMC2, "MMC" }, + { BOOT_DEVICE_MMC2_2, "MMC" }, +#endif +#ifdef CONFIG_SPL_NAND_SUPPORT + { BOOT_DEVICE_NAND, "NAND" }, +#endif +#ifdef CONFIG_SPL_ONENAND_SUPPORT + { BOOT_DEVICE_ONENAND, "OneNAND" }, +#endif +#ifdef CONFIG_SPL_NOR_SUPPORT + { BOOT_DEVICE_NOR, "NOR" }, +#endif +#ifdef CONFIG_SPL_YMODEM_SUPPORT + { BOOT_DEVICE_UART, "UART" }, +#endif +#ifdef CONFIG_SPL_SPI_SUPPORT + { BOOT_DEVICE_SPI, "SPI" }, +#endif +#ifdef CONFIG_SPL_ETH_SUPPORT +#ifdef CONFIG_SPL_ETH_DEVICE + { BOOT_DEVICE_CPGMAC, "eth device" }, +#else + { BOOT_DEVICE_CPGMAC, "net" }, +#endif +#endif +#ifdef CONFIG_SPL_USBETH_SUPPORT + { BOOT_DEVICE_USBETH, "USB eth" }, +#endif +#ifdef CONFIG_SPL_USB_SUPPORT + { BOOT_DEVICE_USB, "USB" }, +#endif +#ifdef CONFIG_SPL_SATA_SUPPORT + { BOOT_DEVICE_SATA, "SATA" }, +#endif + /* Keep this entry last */ + { BOOT_DEVICE_NONE, "unknown boot device" }, +}; + +static void announce_boot_device(u32 boot_device) +{ + int i; + + puts("Trying to boot from "); + +#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE + if (boot_device == BOOT_DEVICE_BOARD) { + spl_board_announce_boot_device(); + puts("\n"); + return; + } +#endif + for (i = 0; i < ARRAY_SIZE(boot_name_table) - 1; i++) { + if (boot_name_table[i].boot_dev == boot_device) + break; + } + + printf("%s\n", boot_name_table[i].name); +} +#else +static inline void announce_boot_device(u32 boot_device) { } +#endif + #ifndef BOOT_DEVICE_NONE #define BOOT_DEVICE_NONE 0xdeadbeef #endif @@ -292,6 +370,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) board_boot_order(spl_boot_list); for (i = 0; i < ARRAY_SIZE(spl_boot_list) && spl_boot_list[i] != BOOT_DEVICE_NONE; i++) { + announce_boot_device(spl_boot_list[i]); if (!spl_load_image(spl_boot_list[i])) break; }