From patchwork Mon Oct 29 15:23:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 195048 X-Patchwork-Delegate: trini@ti.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 C30F22C008B for ; Tue, 30 Oct 2012 02:31:55 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E42774A0BA; Mon, 29 Oct 2012 16:28:39 +0100 (CET) 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 z3bInbQSzi+3; Mon, 29 Oct 2012 16:28:39 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D4544A0BB; Mon, 29 Oct 2012 16:25:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AAE8F4A025 for ; Mon, 29 Oct 2012 16:25:05 +0100 (CET) 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 OZsb3fwExeik for ; Mon, 29 Oct 2012 16:25:02 +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 mail-vb0-f74.google.com (mail-vb0-f74.google.com [209.85.212.74]) by theia.denx.de (Postfix) with ESMTPS id 9D3DA4A053 for ; Mon, 29 Oct 2012 16:24:25 +0100 (CET) Received: by mail-vb0-f74.google.com with SMTP id s24so645835vbi.3 for ; Mon, 29 Oct 2012 08:24:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=XGi9P2/CKXEgcZZLZi+JD8oMMTkpjmytYiwcYWHBwug=; b=cgALGrV8OEI0xKXdx9jcTImnE/c0qGN7gxpDYeKrIfYmtzno9EEQGqTYh7JaaGuser AfpGlSfZjXx3SAueAPGorbFKUl7dNR7/adV0/qZME/1UvngUzVD6Lsyh072h0wUc07qz HGgyEyM0+MAAexKXp0TSVH/IIkNAhemITAoCBSjpayBCteiwDVyIT831OtUenDbv2XsO WYr3J0D6qDpNpxYkOZtDdR8rhr6QI33hVBLaGdGmc7DzoSyM3attSAOQpkMsqjA7c/BT 5O8XQHyTUHlt6lm40Hnzshg6VfaiAYRibm8dzIhgnmsQTmF7HNv4OQpUe9MaP9Ak+a/H Gy5Q== Received: by 10.236.118.161 with SMTP id l21mr21645311yhh.34.1351524260140; Mon, 29 Oct 2012 08:24:20 -0700 (PDT) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id i7si712643yhj.6.2012.10.29.08.24.20 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 29 Oct 2012 08:24:20 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id 0D8D11E0043; Mon, 29 Oct 2012 08:24:20 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id B37A0160862; Mon, 29 Oct 2012 08:24:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 29 Oct 2012 08:23:48 -0700 Message-Id: <1351524245-19584-6-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1351524245-19584-1-git-send-email-sjg@chromium.org> References: <1351524245-19584-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQkGAxSsGWc3NQytduumD4h4kAEhcMwiFU0oYT/qWR2O8jgWQS+VX5o9SGVSeFF822199Gj9koUe2iMy6867h/3qR10TsTtW7h1mhk3CNiUVHMVs7kcewIIolygY7XypuUehvpZLMD7IDQCVSjTy7JWEx5Z0d51fnQD5z0Nomlqo976DKIAneoM3mq0/wfUzscpfuFvY Cc: Tom Rini , Stefan Reinauer , Rob Herring Subject: [U-Boot] [PATCH v3 05/22] scsi: Add function and env var to report number of scsi drives X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 From: Stefan Reinauer Add a new function to find out the number of available SCSI disks. Also set the 'scsidevs' environment variable after each scan. Signed-off-by: Stefan Reinauer Signed-off-by: Simon Glass --- Changes in v3: - Fix setenv operation to use correct function Changes in v2: - Set 'scsidevs' environment variable to number of SCSI disks README | 3 +++ common/cmd_scsi.c | 8 ++++++++ include/scsi.h | 2 ++ 3 files changed, 13 insertions(+), 0 deletions(-) diff --git a/README b/README index 69da2b8..801772c 100644 --- a/README +++ b/README @@ -1039,6 +1039,9 @@ The following options need to be configured: devices. CONFIG_SYS_SCSI_SYM53C8XX_CCF to fix clock timing (80Mhz) + The environment variable 'scsidevs' is set to the number of + SCSI devices found during the last scan. + - NETWORK Support (PCI): CONFIG_E1000 Support for Intel 8254x/8257x gigabit chips. diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index 31ea788..9bd8ec9 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -184,6 +184,14 @@ removable: scsi_curr_dev=0; else scsi_curr_dev = -1; + + printf("Found %d device(s).\n", scsi_max_devs); + setenv_ulong("scsidevs", scsi_max_devs); +} + +int scsi_get_disk_count(void) +{ + return scsi_max_devs; } #ifdef CONFIG_PCI diff --git a/include/scsi.h b/include/scsi.h index 89ae45f..9681d19 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -189,6 +189,8 @@ void scsi_low_level_init(int busdevfunc); void scsi_init(void); void scsi_scan(int mode); +/** @return the number of scsi disks */ +int scsi_get_disk_count(void); #define SCSI_IDENTIFY 0xC0 /* not used */