diff options
author | Matthew Wilcox <matthew@wil.cx> | 2008-02-10 09:45:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-10 15:52:46 -0500 |
commit | b6ce068a1285a24185b01be8a49021827516b3e1 (patch) | |
tree | ea1420fefff86f2e2ee4ed83f08ec2dd99a86dc5 /arch/ia64 | |
parent | a0ca9909609470ad779b9b9cc68ce96e975afff7 (diff) |
Change pci_raw_ops to pci_raw_read/write
We want to allow different implementations of pci_raw_ops for standard
and extended config space on x86. Rather than clutter generic code with
knowledge of this, we make pci_raw_ops private to x86 and use it to
implement the new raw interface -- raw_pci_read() and raw_pci_write().
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/pci/pci.c | 25 | ||||
-rw-r--r-- | arch/ia64/sn/pci/tioce_provider.c | 16 |
2 files changed, 16 insertions, 25 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 488e48a5deea..8fd7e825192b 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -43,8 +43,7 @@ | |||
43 | #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ | 43 | #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ |
44 | (((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg)) | 44 | (((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg)) |
45 | 45 | ||
46 | static int | 46 | int raw_pci_read(unsigned int seg, unsigned int bus, unsigned int devfn, |
47 | pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn, | ||
48 | int reg, int len, u32 *value) | 47 | int reg, int len, u32 *value) |
49 | { | 48 | { |
50 | u64 addr, data = 0; | 49 | u64 addr, data = 0; |
@@ -68,8 +67,7 @@ pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn, | |||
68 | return 0; | 67 | return 0; |
69 | } | 68 | } |
70 | 69 | ||
71 | static int | 70 | int raw_pci_write(unsigned int seg, unsigned int bus, unsigned int devfn, |
72 | pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn, | ||
73 | int reg, int len, u32 value) | 71 | int reg, int len, u32 value) |
74 | { | 72 | { |
75 | u64 addr; | 73 | u64 addr; |
@@ -91,24 +89,17 @@ pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn, | |||
91 | return 0; | 89 | return 0; |
92 | } | 90 | } |
93 | 91 | ||
94 | static struct pci_raw_ops pci_sal_ops = { | 92 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, |
95 | .read = pci_sal_read, | 93 | int size, u32 *value) |
96 | .write = pci_sal_write | ||
97 | }; | ||
98 | |||
99 | struct pci_raw_ops *raw_pci_ops = &pci_sal_ops; | ||
100 | |||
101 | static int | ||
102 | pci_read (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | ||
103 | { | 94 | { |
104 | return raw_pci_ops->read(pci_domain_nr(bus), bus->number, | 95 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
105 | devfn, where, size, value); | 96 | devfn, where, size, value); |
106 | } | 97 | } |
107 | 98 | ||
108 | static int | 99 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, |
109 | pci_write (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) | 100 | int size, u32 value) |
110 | { | 101 | { |
111 | return raw_pci_ops->write(pci_domain_nr(bus), bus->number, | 102 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
112 | devfn, where, size, value); | 103 | devfn, where, size, value); |
113 | } | 104 | } |
114 | 105 | ||
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c index e1a3e19d3d9c..999f14f986e2 100644 --- a/arch/ia64/sn/pci/tioce_provider.c +++ b/arch/ia64/sn/pci/tioce_provider.c | |||
@@ -752,13 +752,13 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
752 | * Determine the secondary bus number of the port2 logical PPB. | 752 | * Determine the secondary bus number of the port2 logical PPB. |
753 | * This is used to decide whether a given pci device resides on | 753 | * This is used to decide whether a given pci device resides on |
754 | * port1 or port2. Note: We don't have enough plumbing set up | 754 | * port1 or port2. Note: We don't have enough plumbing set up |
755 | * here to use pci_read_config_xxx() so use the raw_pci_ops vector. | 755 | * here to use pci_read_config_xxx() so use raw_pci_read(). |
756 | */ | 756 | */ |
757 | 757 | ||
758 | seg = tioce_common->ce_pcibus.bs_persist_segment; | 758 | seg = tioce_common->ce_pcibus.bs_persist_segment; |
759 | bus = tioce_common->ce_pcibus.bs_persist_busnum; | 759 | bus = tioce_common->ce_pcibus.bs_persist_busnum; |
760 | 760 | ||
761 | raw_pci_ops->read(seg, bus, PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1,&tmp); | 761 | raw_pci_read(seg, bus, PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1,&tmp); |
762 | tioce_kern->ce_port1_secondary = (u8) tmp; | 762 | tioce_kern->ce_port1_secondary = (u8) tmp; |
763 | 763 | ||
764 | /* | 764 | /* |
@@ -799,11 +799,11 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
799 | 799 | ||
800 | /* mem base/limit */ | 800 | /* mem base/limit */ |
801 | 801 | ||
802 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 802 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
803 | PCI_MEMORY_BASE, 2, &tmp); | 803 | PCI_MEMORY_BASE, 2, &tmp); |
804 | base = (u64)tmp << 16; | 804 | base = (u64)tmp << 16; |
805 | 805 | ||
806 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 806 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
807 | PCI_MEMORY_LIMIT, 2, &tmp); | 807 | PCI_MEMORY_LIMIT, 2, &tmp); |
808 | limit = (u64)tmp << 16; | 808 | limit = (u64)tmp << 16; |
809 | limit |= 0xfffffUL; | 809 | limit |= 0xfffffUL; |
@@ -817,21 +817,21 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
817 | * attributes. | 817 | * attributes. |
818 | */ | 818 | */ |
819 | 819 | ||
820 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 820 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
821 | PCI_PREF_MEMORY_BASE, 2, &tmp); | 821 | PCI_PREF_MEMORY_BASE, 2, &tmp); |
822 | base = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; | 822 | base = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; |
823 | 823 | ||
824 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 824 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
825 | PCI_PREF_BASE_UPPER32, 4, &tmp); | 825 | PCI_PREF_BASE_UPPER32, 4, &tmp); |
826 | base |= (u64)tmp << 32; | 826 | base |= (u64)tmp << 32; |
827 | 827 | ||
828 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 828 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
829 | PCI_PREF_MEMORY_LIMIT, 2, &tmp); | 829 | PCI_PREF_MEMORY_LIMIT, 2, &tmp); |
830 | 830 | ||
831 | limit = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; | 831 | limit = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; |
832 | limit |= 0xfffffUL; | 832 | limit |= 0xfffffUL; |
833 | 833 | ||
834 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 834 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
835 | PCI_PREF_LIMIT_UPPER32, 4, &tmp); | 835 | PCI_PREF_LIMIT_UPPER32, 4, &tmp); |
836 | limit |= (u64)tmp << 32; | 836 | limit |= (u64)tmp << 32; |
837 | 837 | ||