io-workarounds.c (cb54b53adae70701bdd77d848cea4b9b39b61cf9) io-workarounds.c (ecd73cc5c9e137559f4625b347f20cf9ed0de3d5)
1/*
2 * Support PCI IO workaround
3 *
4 * Copyright (C) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 * IBM, Corp.
6 * (C) Copyright 2007-2008 TOSHIBA CORPORATION
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 39 unchanged lines hidden (view full) ---

48 if (paddr >= res->start && paddr <= res->end)
49 return bus;
50 }
51 }
52
53 return NULL;
54}
55
1/*
2 * Support PCI IO workaround
3 *
4 * Copyright (C) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 * IBM, Corp.
6 * (C) Copyright 2007-2008 TOSHIBA CORPORATION
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 39 unchanged lines hidden (view full) ---

48 if (paddr >= res->start && paddr <= res->end)
49 return bus;
50 }
51 }
52
53 return NULL;
54}
55
56#ifdef CONFIG_PPC_INDIRECT_MMIO
56struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
57{
58 unsigned hugepage_shift;
59 struct iowa_bus *bus;
60 int token;
61
62 token = PCI_GET_ADDR_TOKEN(addr);
63

--- 21 unchanged lines hidden (view full) ---

85 bus = iowa_pci_find(vaddr, paddr);
86
87 if (bus == NULL)
88 return NULL;
89 }
90
91 return bus;
92}
57struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
58{
59 unsigned hugepage_shift;
60 struct iowa_bus *bus;
61 int token;
62
63 token = PCI_GET_ADDR_TOKEN(addr);
64

--- 21 unchanged lines hidden (view full) ---

86 bus = iowa_pci_find(vaddr, paddr);
87
88 if (bus == NULL)
89 return NULL;
90 }
91
92 return bus;
93}
94#else /* CONFIG_PPC_INDIRECT_MMIO */
95struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
96{
97 return NULL;
98}
99#endif /* !CONFIG_PPC_INDIRECT_MMIO */
93
100
101#ifdef CONFIG_PPC_INDIRECT_PIO
94struct iowa_bus *iowa_pio_find_bus(unsigned long port)
95{
96 unsigned long vaddr = (unsigned long)pci_io_base + port;
97 return iowa_pci_find(vaddr, 0);
98}
102struct iowa_bus *iowa_pio_find_bus(unsigned long port)
103{
104 unsigned long vaddr = (unsigned long)pci_io_base + port;
105 return iowa_pci_find(vaddr, 0);
106}
107#else
108struct iowa_bus *iowa_pio_find_bus(unsigned long port)
109{
110 return NULL;
111}
112#endif
99
113
100
101#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \
102static ret iowa_##name at \
103{ \
104 struct iowa_bus *bus; \
105 bus = iowa_##space##_find_bus(aa); \
106 if (bus && bus->ops && bus->ops->name) \
107 return bus->ops->name al; \
108 return __do_##name al; \

--- 23 unchanged lines hidden (view full) ---

132
133#include <asm/io-defs.h>
134
135#undef DEF_PCI_AC_RET
136#undef DEF_PCI_AC_NORET
137
138};
139
114#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \
115static ret iowa_##name at \
116{ \
117 struct iowa_bus *bus; \
118 bus = iowa_##space##_find_bus(aa); \
119 if (bus && bus->ops && bus->ops->name) \
120 return bus->ops->name al; \
121 return __do_##name al; \

--- 23 unchanged lines hidden (view full) ---

145
146#include <asm/io-defs.h>
147
148#undef DEF_PCI_AC_RET
149#undef DEF_PCI_AC_NORET
150
151};
152
153#ifdef CONFIG_PPC_INDIRECT_MMIO
140static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size,
141 unsigned long flags, void *caller)
142{
143 struct iowa_bus *bus;
144 void __iomem *res = __ioremap_caller(addr, size, flags, caller);
145 int busno;
146
147 bus = iowa_pci_find(0, (unsigned long)addr);
148 if (bus != NULL) {
149 busno = bus - iowa_busses;
150 PCI_SET_ADDR_TOKEN(res, busno + 1);
151 }
152 return res;
153}
154static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size,
155 unsigned long flags, void *caller)
156{
157 struct iowa_bus *bus;
158 void __iomem *res = __ioremap_caller(addr, size, flags, caller);
159 int busno;
160
161 bus = iowa_pci_find(0, (unsigned long)addr);
162 if (bus != NULL) {
163 busno = bus - iowa_busses;
164 PCI_SET_ADDR_TOKEN(res, busno + 1);
165 }
166 return res;
167}
168#else /* CONFIG_PPC_INDIRECT_MMIO */
169#define iowa_ioremap NULL
170#endif /* !CONFIG_PPC_INDIRECT_MMIO */
154
155/* Enable IO workaround */
156static void io_workaround_init(void)
157{
158 static int io_workaround_inited;
159
160 if (io_workaround_inited)
161 return;

--- 34 unchanged lines hidden ---
171
172/* Enable IO workaround */
173static void io_workaround_init(void)
174{
175 static int io_workaround_inited;
176
177 if (io_workaround_inited)
178 return;

--- 34 unchanged lines hidden ---