Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2979875pxf; Sun, 21 Mar 2021 13:58:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa04br9+MJg4qtad09/5pCAJgD8tulWQIdmEPMIS7H0w63teaCth+WHENCBNyID0aHjE5w X-Received: by 2002:a17:907:d10:: with SMTP id gn16mr15928710ejc.304.1616360280417; Sun, 21 Mar 2021 13:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616360280; cv=none; d=google.com; s=arc-20160816; b=ckqDSSlyPTGjigG2nLNdZnvtJoBpCX6iRvZMp7MH0MhQo9KJ4UoMdi/driEY4bgVh3 eDvdMjVw7TrbdaZ1rSSTOfZAZ3kqlk+QIQggzyDXJu33NGS3eFZNBGjGP5sOrDqf2zPz HYLftzfl4KOjD8rjizt5oLeT/qGmPUJ9ybPW7VmdjB3ksEsa7jtwBMRtO83IeE+8S3Kb zsW8gaebuCcH6VmKLMDpKNcFuoYSbu6Y47/PjIhi3GS/yH58RG0jbW3yEmuUpzmGpzgb g0t65z5+dzaEmK1Wzl5MULmfBCbaWndYk41HRTLmi4bJfG9XSg+YfrCJn26Hc7/A/TwF 8vAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=qcVKtWdaioM48TTB6KCPgjJ3NkWTq/v2CYjOvyWzhOY=; b=eGbGtpNUQkVR0jPpsloQG+AV+wX2M0YhVrpVhXoPkA2rer2pe7DJJPpbuSzvdcrNTJ WBfTxDU9zBPWftKfGK7VsVPI4H8kU8yZYVUTbY/G0BM5suePWa6BBlsJMrVD7C5d+fmT h/SlbRcoR10n+ogw5nsv/9KKNMzt/jT31yLhCaK1H0/zcql60PpcG6tg5GaLgLcI/Otg Gu5A5ORK9Kptl7vdRtSZxXEDfiiIWZEChAdXfa1JVwaBU6CKP77UXLyBiqMmqO4mNbG2 fw890f1FneiczQsrYbZ1BTzM2FB39UqGhszWZOBGcp+VstsVo7BPD0pdEcPsBVG5Gl04 CkiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si9923952ejv.67.2021.03.21.13.57.37; Sun, 21 Mar 2021 13:58:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230359AbhCUT4b (ORCPT + 99 others); Sun, 21 Mar 2021 15:56:31 -0400 Received: from angie.orcam.me.uk ([157.25.102.26]:38036 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbhCUTze (ORCPT ); Sun, 21 Mar 2021 15:55:34 -0400 Received: by angie.orcam.me.uk (Postfix, from userid 500) id A1CBC92009C; Sun, 21 Mar 2021 20:55:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 9CEF192009B; Sun, 21 Mar 2021 20:55:32 +0100 (CET) Date: Sun, 21 Mar 2021 20:55:32 +0100 (CET) From: "Maciej W. Rozycki" To: linux-ide@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org cc: Jens Axboe , Christoph Hellwig Subject: [PATCH 3/3] pata_legacy: Add `probe_mask' parameter like with ide-generic In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Carry the `probe_mask' parameter over from ide-generic to pata_legacy so that there is a way to prevent random poking at ISA port I/O locations in attempt to discover adapter option cards with libata like with the old IDE driver. By default all enabled locations are tried, however it may interfere with a different kind of hardware responding there. For example with a plain (E)ISA system the driver tries all the six possible locations: scsi host0: pata_legacy ata1: PATA max PIO4 cmd 0x1f0 ctl 0x3f6 irq 14 ata1.00: ATA-4: ST310211A, 3.54, max UDMA/100 ata1.00: 19541088 sectors, multi 16: LBA ata1.00: configured for PIO scsi 0:0:0:0: Direct-Access ATA ST310211A 3.54 PQ: 0 ANSI: 5 scsi 0:0:0:0: Attached scsi generic sg0 type 0 sd 0:0:0:0: [sda] 19541088 512-byte logical blocks: (10.0 GB/9.32 GiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00 sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sda2 sda3 sd 0:0:0:0: [sda] Attached SCSI disk scsi host1: pata_legacy ata2: PATA max PIO4 cmd 0x170 ctl 0x376 irq 15 scsi host1: pata_legacy ata3: PATA max PIO4 cmd 0x1e8 ctl 0x3ee irq 11 scsi host1: pata_legacy ata4: PATA max PIO4 cmd 0x168 ctl 0x36e irq 10 scsi host1: pata_legacy ata5: PATA max PIO4 cmd 0x1e0 ctl 0x3e6 irq 8 scsi host1: pata_legacy ata6: PATA max PIO4 cmd 0x160 ctl 0x366 irq 12 however giving the kernel "pata_legacy.probe_mask=21" makes it try every other location only: scsi host0: pata_legacy ata1: PATA max PIO4 cmd 0x1f0 ctl 0x3f6 irq 14 ata1.00: ATA-4: ST310211A, 3.54, max UDMA/100 ata1.00: 19541088 sectors, multi 16: LBA ata1.00: configured for PIO scsi 0:0:0:0: Direct-Access ATA ST310211A 3.54 PQ: 0 ANSI: 5 scsi 0:0:0:0: Attached scsi generic sg0 type 0 sd 0:0:0:0: [sda] 19541088 512-byte logical blocks: (10.0 GB/9.32 GiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00 sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sda2 sda3 sd 0:0:0:0: [sda] Attached SCSI disk scsi host1: pata_legacy ata2: PATA max PIO4 cmd 0x1e8 ctl 0x3ee irq 11 scsi host1: pata_legacy ata3: PATA max PIO4 cmd 0x1e0 ctl 0x3e6 irq 8 Signed-off-by: Maciej W. Rozycki --- Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++ drivers/ata/pata_legacy.c | 6 ++++++ 2 files changed, 17 insertions(+) linux-pata-legacy-probe-mask.diff Index: linux-dolch/Documentation/admin-guide/kernel-parameters.txt =================================================================== --- linux-dolch.orig/Documentation/admin-guide/kernel-parameters.txt +++ linux-dolch/Documentation/admin-guide/kernel-parameters.txt @@ -3627,6 +3627,17 @@ Set to non-zero to probe tertiary and further ISA port ranges on PCI systems. Disabled by default. + pata_legacy.probe_mask= [HW,LIBATA] + Format: + Probe mask for legacy ISA PATA ports. Depending on + platform configuration and the use of other driver + options up to 6 legacy ports are supported: 0x1f0, + 0x170, 0x1e8, 0x168, 0x1e0, 0x160, however probing + of individual ports can be disabled by setting the + corresponding bits in the mask to 1. Bit 0 is for + the first port in the list above (0x1f0), and so on. + By default all supported ports are probed. + pata_legacy.qdi= [HW,LIBATA] Format: Set to non-zero to probe QDI controllers. By default Index: linux-dolch/drivers/ata/pata_legacy.c =================================================================== --- linux-dolch.orig/drivers/ata/pata_legacy.c +++ linux-dolch/drivers/ata/pata_legacy.c @@ -71,6 +71,10 @@ module_param(probe_all, int, 0); MODULE_PARM_DESC(probe_all, "Set to probe tertiary+ ISA port ranges even if PCI"); +static int probe_mask = ~0; +module_param(probe_mask, int, 0); +MODULE_PARM_DESC(probe_mask, "Probe mask for legacy ISA PATA ports"); + static int autospeed; module_param(autospeed, int, 0); MODULE_PARM_DESC(autospeed, "Chip present that snoops speed changes"); @@ -199,6 +203,8 @@ static int legacy_probe_add(unsigned lon free = lp; /* Matching port, or the correct slot for ordering */ if (lp->port == port || legacy_port[i] == port) { + if (!(probe_mask & 1 << i)) + return -1; free = lp; break; }