From patchwork Tue Nov 29 17:53:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tedheadster X-Patchwork-Id: 700670 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tSrkJ3SQDz9t1Q for ; Wed, 30 Nov 2016 04:53:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GExU/6Vr"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756563AbcK2RxL (ORCPT ); Tue, 29 Nov 2016 12:53:11 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:36826 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755862AbcK2RxK (ORCPT ); Tue, 29 Nov 2016 12:53:10 -0500 Received: by mail-qt0-f194.google.com with SMTP id n34so16529118qtb.3 for ; Tue, 29 Nov 2016 09:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=eLcXoEjeoxRcdUG9M4hR+4/+5/p5jFl72eP8gax8oeI=; b=GExU/6VrlsJGKNS+71hrSnX2FnlxQbBlxSJ3FEIabspIzaW9Rzn0L8N3xEYLOhuKbt oVoO21WpcdJ8aTNcEkPuAdtrPwqYC5Pbo3ALuzZYQEaHote2AmYzn2619QBl25GCCBg6 wMYYCuAUkzcgfwl2CLSyWq6i+QVoStr/suHcvntNuUmFwyOZXUBi9o04uM6a/cTw4kkU dlAdR9FHN2l//JGSWKnKp1sCLYyISGmfhW+octo7427dzopE1Knzs4HonQSV+AikXY4o 30eG+rMPJPf7hLE4y1l8zlLFYP0Ms3CJInmbbMGpJ9sC3AfD+oJf6V2aYBrKqHnrnDLi fMfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eLcXoEjeoxRcdUG9M4hR+4/+5/p5jFl72eP8gax8oeI=; b=daU5eaCNuj5sspk9O2MONM7QAzqLokHkzBC5E/B9ijlhHD7k2FrT3w1LjvrZ0q6eX7 t1na8Dz02/Ig2UFtd5Yo/LShxhzeMMU8J1ldUDNg/CCDYo8ghlakwj1shIJg8i6zKevh v8LytPBmx2hLeoFL84r1134h5VoV797nyt1uJk4EaIgDZoy2Ze40HCXQo3HmDEoyzYQC RY6BaeK77ScusY7lFjetiKFpeQPkXm/dXA52Yg/iVFtIhDN0r0dvVdevS8ADnvCuhUY5 xCfZ33Rr3cddQAKGDKMLhjTvdSGPwZbPEG+HyFF5N8IexYRp1crNFn9oMH+lHF6hb068 d7bQ== X-Gm-Message-State: AKaTC02vhc/Gum48JUb2bfhC7F9UoD1aK7ZC/PLMiw/EKTtDgEN2WnyGp9D4ISWC3Kkjrg== X-Received: by 10.237.35.112 with SMTP id i45mr28590472qtc.257.1480441989605; Tue, 29 Nov 2016 09:53:09 -0800 (PST) Received: from localhost.localdomain ([138.20.184.2]) by smtp.gmail.com with ESMTPSA id b63sm31226414qka.39.2016.11.29.09.53.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 09:53:09 -0800 (PST) From: Matthew Whitehead To: linux-ide@vger.kernel.org Cc: Matthew Whitehead Subject: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems Date: Tue, 29 Nov 2016 12:53:02 -0500 Message-Id: <1480441982-20992-1-git-send-email-tedheadster@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org If there is no PCI bus detected in drivers/ata/pata_legacy.c, it registers all the common legacy PATA devices. This includes I/O ports (0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160) and also their associated interrupts (14,15,11,10,8,12). Unfortunately, on such systems those interrupt lines are at a premium because there is no PCI alternative. This patch allows you to disable individual port/interrupt pairs by providing a list of ports to skip allocating. modprobe pata_legacy ignore_ports=0x1e8,0x168,0x1e0,0x160 Signed-off-by: Matthew Whitehead --- drivers/ata/pata_legacy.c | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 4fe9d21..753c7ce 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c @@ -130,6 +130,8 @@ static struct legacy_data legacy_data[NR_HOST]; static struct ata_host *legacy_host[NR_HOST]; static int nr_legacy_host; +static int ignore_ports[NR_HOST]; +static int ignore_ports_count; static int probe_all; /* Set to check all ISA port ranges */ static int ht6560a; /* HT 6560A on primary 1, second 2, both 3 */ @@ -1168,6 +1170,17 @@ static __init void probe_qdi_vlb(void) } } +int find_port(int port) +{ + int i; + for (i = 0 ; i < ignore_ports_count; i++) { + if (port == ignore_ports[i]) + return 1; + } + return 0; +} + + /** * legacy_init - attach legacy interfaces * @@ -1212,17 +1225,22 @@ static __init int legacy_init(void) if (winbond == 1) winbond = 0x130; /* Default port, alt is 1B0 */ - if (primary == 0 || all) + if ((primary == 0 || all) && (!find_port(0x1F0))) legacy_probe_add(0x1F0, 14, UNKNOWN, 0); - if (secondary == 0 || all) + if ((secondary == 0 || all) && (!find_port(0x170))) legacy_probe_add(0x170, 15, UNKNOWN, 0); if (probe_all || !pci_present) { /* ISA/VLB extra ports */ - legacy_probe_add(0x1E8, 11, UNKNOWN, 0); - legacy_probe_add(0x168, 10, UNKNOWN, 0); - legacy_probe_add(0x1E0, 8, UNKNOWN, 0); - legacy_probe_add(0x160, 12, UNKNOWN, 0); + + if (!find_port(0x1E0)) + legacy_probe_add(0x1E8, 11, UNKNOWN, 0); + if (!find_port(0x168)) + legacy_probe_add(0x168, 10, UNKNOWN, 0); + if (!find_port(0x1E0)) + legacy_probe_add(0x1E0, 8, UNKNOWN, 0); + if (!find_port(0x160)) + legacy_probe_add(0x160, 12, UNKNOWN, 0); } if (opti82c46x) @@ -1272,6 +1290,6 @@ module_param(qdi, int, 0); module_param(winbond, int, 0); module_param(pio_mask, int, 0); module_param(iordy_mask, int, 0); - +module_param_array(ignore_ports, int, &ignore_ports_count, 0444); module_init(legacy_init); module_exit(legacy_exit);