From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz,
akpm@osdl.org, greg@kroah.com
Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
ak@suse.de, rmk+lkml@arm.linux.org.uk
Subject: [PATCH 1/6] PCI legacy I/O port free driver (take2) - Add no_ioport flag into pci_dev
Date: Tue, 21 Feb 2006 15:28:01 +0900 [thread overview]
Message-ID: <43FAB2F1.5030106@jp.fujitsu.com> (raw)
In-Reply-To: <43FAB283.8090206@jp.fujitsu.com>
This patch adds the no_ioport field into struct pci_dev, which is used
to tell the kernel not to touch any I/O port regions.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
drivers/pci/pci.c | 33 +++++++++++++++++++++++++--------
include/linux/pci.h | 1 +
2 files changed, 26 insertions(+), 8 deletions(-)
Index: linux-2.6.16-rc4/include/linux/pci.h
===================================================================
--- linux-2.6.16-rc4.orig/include/linux/pci.h 2006-02-21 14:40:46.000000000 +0900
+++ linux-2.6.16-rc4/include/linux/pci.h 2006-02-21 14:40:54.000000000 +0900
@@ -152,6 +152,7 @@
unsigned int is_busmaster:1; /* device is busmaster */
unsigned int no_msi:1; /* device may not use msi */
unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
+ unsigned int no_ioport:1; /* device may not use ioport */
u32 saved_config_space[16]; /* config space saved at suspend time */
struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
Index: linux-2.6.16-rc4/drivers/pci/pci.c
===================================================================
--- linux-2.6.16-rc4.orig/drivers/pci/pci.c 2006-02-21 14:40:46.000000000 +0900
+++ linux-2.6.16-rc4/drivers/pci/pci.c 2006-02-21 14:40:54.000000000 +0900
@@ -495,9 +495,14 @@
int
pci_enable_device(struct pci_dev *dev)
{
- int err;
+ int err, i, bars = (1 << PCI_NUM_RESOURCES) - 1;
- if ((err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1)))
+ if (dev->no_ioport)
+ for (i = 0; i < PCI_NUM_RESOURCES; i++)
+ if (pci_resource_flags(dev, i) & IORESOURCE_IO)
+ bars &= ~(1 << i);
+
+ if ((err = pci_enable_device_bars(dev, bars)))
return err;
pci_fixup_device(pci_fixup_enable, dev);
dev->is_enabled = 1;
@@ -617,9 +622,11 @@
{
if (pci_resource_len(pdev, bar) == 0)
return;
- if (pci_resource_flags(pdev, bar) & IORESOURCE_IO)
+ if (pci_resource_flags(pdev, bar) & IORESOURCE_IO) {
+ WARN_ON(pdev->no_ioport);
release_region(pci_resource_start(pdev, bar),
pci_resource_len(pdev, bar));
+ }
else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM)
release_mem_region(pci_resource_start(pdev, bar),
pci_resource_len(pdev, bar));
@@ -645,6 +652,7 @@
return 0;
if (pci_resource_flags(pdev, bar) & IORESOURCE_IO) {
+ WARN_ON(pdev->no_ioport);
if (!request_region(pci_resource_start(pdev, bar),
pci_resource_len(pdev, bar), res_name))
goto err_out;
@@ -678,10 +686,13 @@
void pci_release_regions(struct pci_dev *pdev)
{
- int i;
+ int i, no_ioport = pdev->no_ioport;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < 6; i++) {
+ if (no_ioport && (pci_resource_flags(pdev, i) & IORESOURCE_IO))
+ continue;
pci_release_region(pdev, i);
+ }
}
/**
@@ -699,16 +710,22 @@
*/
int pci_request_regions(struct pci_dev *pdev, char *res_name)
{
- int i;
+ int i, no_ioport = pdev->no_ioport;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < 6; i++) {
+ if (no_ioport && (pci_resource_flags(pdev, i) & IORESOURCE_IO))
+ continue;
if(pci_request_region(pdev, i, res_name))
goto err_out;
+ }
return 0;
err_out:
- while(--i >= 0)
+ while(--i >= 0) {
+ if (no_ioport && (pci_resource_flags(pdev, i) & IORESOURCE_IO))
+ continue;
pci_release_region(pdev, i);
+ }
return -EBUSY;
}
next prev parent reply other threads:[~2006-02-21 6:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-21 6:26 [PATCH 0/6] PCI legacy I/O port free driver (take2) Kenji Kaneshige
2006-02-21 6:28 ` Kenji Kaneshige [this message]
2006-02-21 21:01 ` [PATCH 1/6] PCI legacy I/O port free driver (take2) - Add no_ioport flag into pci_dev Greg KH
2006-02-21 6:29 ` [PATCH 2/6] PCI legacy I/O port free driver (take2) - Fix minor bug in store_new_id() Kenji Kaneshige
2006-02-21 6:30 ` [PATCH 3/6] PCI legacy I/O port free driver (take2) - Add device_flags into pci_device_id Kenji Kaneshige
2006-02-21 13:57 ` Andi Kleen
2006-02-21 20:56 ` Greg KH
2006-02-21 20:59 ` Andi Kleen
2006-02-21 21:10 ` Greg KH
2006-02-21 21:31 ` Andi Kleen
2006-02-21 21:55 ` Jeff Garzik
2006-02-21 22:06 ` Andi Kleen
2006-02-22 0:09 ` Jeff Garzik
2006-02-22 0:11 ` Greg KH
2006-02-22 2:34 ` Kenji Kaneshige
2006-02-23 2:37 ` Benjamin Herrenschmidt
2006-02-23 6:33 ` Kenji Kaneshige
2006-02-21 6:31 ` [PATCH 4/6] PCI legacy I/O port free driver (take2) - Update Documentation/pci.txt Kenji Kaneshige
2006-02-21 6:32 ` [PATCH 5/6] PCI legacy I/O port free driver (take2) - Make Intel e1000 driver legacy I/O port free Kenji Kaneshige
2006-02-21 6:33 ` [PATCH 6/6] PCI legacy I/O port free driver (take2) - Make Emulex lpfc " Kenji Kaneshige
2006-02-21 20:56 ` Greg KH
2006-02-23 2:34 ` [PATCH 0/6] PCI legacy I/O port free driver (take2) Benjamin Herrenschmidt
2006-02-23 5:58 ` Kenji Kaneshige
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43FAB2F1.5030106@jp.fujitsu.com \
--to=kaneshige.kenji@jp.fujitsu.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=rmk+lkml@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).