From: Hanna Linder <hannal@us.ibm.com>
To: gregkh@us.ibm.com, greg@kroah.com
Cc: linux-kernel@vger.kernel.org, Hanna Linder <hannal@us.ibm.com>
Subject: Re: PCI Cleanup
Date: Wed, 21 Aug 2002 17:59:31 -0700 [thread overview]
Message-ID: <74760000.1029977971@w-hlinder> (raw)
Here is the first part of the sh port of the pci_ops
changes. If anyone can compile this for Sega let me
know if there are any problems.
Thanks.
Hanna Linder
hannal@us.ibm.com
ps -this patches against bk://linuxusb.bkbits.net/pci_hp-2.5
-----
diff -Nru a/arch/sh/kernel/pci-dc.c b/arch/sh/kernel/pci-dc.c
--- a/arch/sh/kernel/pci-dc.c Wed Aug 21 17:55:02 2002
+++ b/arch/sh/kernel/pci-dc.c Wed Aug 21 17:55:02 2002
@@ -31,76 +31,58 @@
{0, 0, 0, NULL}
};
-#define BBA_SELECTED(dev) (dev->bus->number==0 && dev->devfn==0)
+#define BBA_SELECTED(bus,devfn) (bus->number==0 && devfn==0)
-static int gapspci_read_config_byte(struct pci_dev *dev, int where,
- u8 * val)
+static int gapspci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 * val)
{
- if (BBA_SELECTED(dev))
- *val = inb(GAPSPCI_BBA_CONFIG+where);
- else
- *val = 0xff;
-
+ switch (size) {
+ case 1:
+ if (BBA_SELECTED(bus, devfn))
+ *val = (u8)inb(GAPSPCI_BBA_CONFIG+where);
+ else
+ *val = (u8)0xff;
+ break;
+ case 2:
+ if (BBA_SELECTED(bus, devfn))
+ *val = (u16)inw(GAPSPCI_BBA_CONFIG+where);
+ else
+ *val = (u16)0xffff;
+ break;
+ case 4:
+ if (BBA_SELECTED(bus, devfn))
+ *val = inl(GAPSPCI_BBA_CONFIG+where);
+ else
+ *val = 0xffffffff;
+ break;
+ }
return PCIBIOS_SUCCESSFUL;
}
-static int gapspci_read_config_word(struct pci_dev *dev, int where,
- u16 * val)
-{
- if (BBA_SELECTED(dev))
- *val = inw(GAPSPCI_BBA_CONFIG+where);
- else
- *val = 0xffff;
-
- return PCIBIOS_SUCCESSFUL;
-}
-
-static int gapspci_read_config_dword(struct pci_dev *dev, int where,
- u32 * val)
-{
- if (BBA_SELECTED(dev))
- *val = inl(GAPSPCI_BBA_CONFIG+where);
- else
- *val = 0xffffffff;
-
- return PCIBIOS_SUCCESSFUL;
-}
-
-static int gapspci_write_config_byte(struct pci_dev *dev, int where,
- u8 val)
-{
- if (BBA_SELECTED(dev))
- outb(val, GAPSPCI_BBA_CONFIG+where);
-
- return PCIBIOS_SUCCESSFUL;
-}
-
-
-static int gapspci_write_config_word(struct pci_dev *dev, int where,
- u16 val)
-{
- if (BBA_SELECTED(dev))
- outw(val, GAPSPCI_BBA_CONFIG+where);
-
- return PCIBIOS_SUCCESSFUL;
-}
-
-static int gapspci_write_config_dword(struct pci_dev *dev, int where,
- u32 val)
+static int gapspci_write(struct pci_bus *bus, unsigned int devfn,
+ int where, u32 val)
{
- if (BBA_SELECTED(dev))
- outl(val, GAPSPCI_BBA_CONFIG+where);
-
- return PCIBIOS_SUCCESSFUL;
+ if (BBA_SELECTED(bus, devfn)) {
+ switch (size) {
+ case 1:
+ if (BBA_SELECTED(bus, devfn))
+ outb((u8)val, GAPSPCI_BBA_CONFIG+where);
+ break;
+ case 2:
+ if (BBA_SELECTED(bus, devfn))
+ outw((u16)val, GAPSPCI_BBA_CONFIG+where);
+ break;
+ case 4:
+ if (BBA_SELECTED(bus, devfn))
+ outl(val, GAPSPCI_BBA_CONFIG+where);
+ break;
+ }
+ }
+ return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops pci_config_ops = {
- gapspci_read_config_byte,
- gapspci_read_config_word,
- gapspci_read_config_dword,
- gapspci_write_config_byte,
- gapspci_write_config_word,
- gapspci_write_config_dword
+ .read = gapspci_read,
+ .write = gapspci_write,
};
@@ -143,7 +125,7 @@
for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
dev = pci_dev_b(ln);
- if (!BBA_SELECTED(dev)) continue;
+ if (!BBA_SELECTED(bus, dev->devfn)) continue;
printk("PCI: MMIO fixup to %s\n", dev->name);
dev->resource[1].start=0x01001700;
next reply other threads:[~2002-08-22 0:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-22 0:59 Hanna Linder [this message]
2002-08-22 3:10 ` PCI Cleanup Greg KH
2002-08-22 10:11 ` Gérard Roudier
2002-08-22 15:42 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2002-08-22 23:54 Hanna Linder
2002-08-21 22:14 Hanna Linder
2002-08-20 17:58 Hanna Linder
2002-08-20 18:00 ` David Mosberger
2002-08-20 18:30 ` Hanna Linder
2002-08-20 18:44 ` David Mosberger
2002-08-20 22:14 ` Hanna Linder
2002-08-20 22:13 ` David Mosberger
2002-08-20 22:45 ` Hanna Linder
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=74760000.1029977971@w-hlinder \
--to=hannal@us.ibm.com \
--cc=greg@kroah.com \
--cc=gregkh@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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