From patchwork Tue Aug 20 16:47:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Park, Aiden" X-Patchwork-Id: 1150306 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46CcDL2Vvgz9sDQ for ; Wed, 21 Aug 2019 02:48:02 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E0C4BC21FC0; Tue, 20 Aug 2019 16:47:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6D24AC21EB1; Tue, 20 Aug 2019 16:47:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 799A4C21EB1; Tue, 20 Aug 2019 16:47:46 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lists.denx.de (Postfix) with ESMTPS id 96DB3C21D83 for ; Tue, 20 Aug 2019 16:47:45 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Aug 2019 09:47:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,408,1559545200"; d="scan'208";a="180752515" Received: from orsmsx104.amr.corp.intel.com ([10.22.225.131]) by orsmga003.jf.intel.com with ESMTP; 20 Aug 2019 09:47:43 -0700 Received: from orsmsx152.amr.corp.intel.com (10.22.226.39) by ORSMSX104.amr.corp.intel.com (10.22.225.131) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 20 Aug 2019 09:47:43 -0700 Received: from orsmsx116.amr.corp.intel.com ([169.254.7.63]) by ORSMSX152.amr.corp.intel.com ([169.254.8.159]) with mapi id 14.03.0439.000; Tue, 20 Aug 2019 09:47:43 -0700 From: "Park, Aiden" To: Simon Glass , Bin Meng , "U-Boot Mailing List" Thread-Topic: [PATCH 1/1] dm: scsi: Scan the actual number of ports Thread-Index: AdVXdrGp7ubxNzELTvWFEvLzGNHaAw== Date: Tue, 20 Aug 2019 16:47:42 +0000 Message-ID: Accept-Language: ko-KR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWEzODhlODYtOGM4MC00ZjlkLTlmMTUtZjc5ZDM4OTdmOWVjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaitSRUFsTTh0WTQ5XC94aXlqS0s0MlFhTDFNOTI0RU5LdWpwTFBzT0cxdnZPbitxdnFQXC84eTc1b2NySnk3KzBWIn0= x-ctpclassification: CTP_NT x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Subject: [U-Boot] [PATCH 1/1] dm: scsi: Scan the actual number of ports X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" The scsi_scan_dev() is looping over the number of uc_plat->max_id. The number of actual ports a AHCI controller has can be greater than max_id. Update uc_plat->max_id to make SCSI scan all detected ports. Signed-off-by: Aiden Park Reviewed-by: Bin Meng --- drivers/ata/ahci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index e3135bb75f..9a08575053 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1167,6 +1167,14 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) if (ret) return ret; + /* + * scsi_scan_dev() scans devices up-to the number of max_id. + * Update max_id if the number of detected ports exceeds max_id. + * This allows SCSI to scan all detected ports. + */ + uc_plat->max_id = max_t(unsigned long, uc_priv->n_ports, + uc_plat->max_id); + return 0; }