33 #include <linux/kernel.h>
34 #include <linux/pci.h>
60 #define MB (1024 * 1024)
62 #define SIZE_TO_MASK(size) (~(size - 1))
64 #define DEFINE_REG(device, func, offset, size, init_op, read_op, write_op)\
65 { PCI_DEVFN(device, func), offset, init_op, read_op, write_op,\
66 {0, SIZE_TO_MASK(size)} },
103 if (*value != reg->
sim_reg.mask)
109 reg->
sim_reg.value = 0x01060100;
124 *value = reg->
sim_reg.value & 0xfff00ff;
131 DEFINE_REG(2, 1, 0x10, (64*
KB), reg_init, reg_read,
reg_write)
132 DEFINE_REG(3, 0, 0x10, (64*KB), reg_init, reg_read,
reg_write)
133 DEFINE_REG(4, 0, 0x10, (128*KB), reg_init, reg_read,
reg_write)
134 DEFINE_REG(4, 1, 0x10, (128*KB), reg_init, reg_read,
reg_write)
135 DEFINE_REG(6, 0, 0x10, (512*KB), reg_init, reg_read,
reg_write)
136 DEFINE_REG(6, 1, 0x10, (512*KB), reg_init, reg_read,
reg_write)
137 DEFINE_REG(6, 2, 0x10, (64*KB), reg_init, reg_read,
reg_write)
138 DEFINE_REG(8, 0, 0x10, (1*
MB), reg_init, reg_read,
reg_write)
139 DEFINE_REG(8, 1, 0x10, (64*KB), reg_init, reg_read,
reg_write)
140 DEFINE_REG(8, 2, 0x10, (64*KB), reg_init, reg_read,
reg_write)
141 DEFINE_REG(9, 0, 0x10 , (1*MB), reg_init, reg_read,
reg_write)
142 DEFINE_REG(9, 0, 0x14, (64*KB), reg_init, reg_read,
reg_write)
143 DEFINE_REG(10, 0, 0x10, (256), reg_init, reg_read,
reg_write)
144 DEFINE_REG(10, 0, 0x14, (256*MB), reg_init, reg_read,
reg_write)
145 DEFINE_REG(11, 0, 0x10, (256), reg_init, reg_read,
reg_write)
146 DEFINE_REG(11, 0, 0x14, (256), reg_init, reg_read,
reg_write)
147 DEFINE_REG(11, 1, 0x10, (256), reg_init, reg_read,
reg_write)
148 DEFINE_REG(11, 2, 0x10, (256), reg_init, reg_read,
reg_write)
149 DEFINE_REG(11, 2, 0x14, (256), reg_init, reg_read,
reg_write)
150 DEFINE_REG(11, 2, 0x18, (256), reg_init, reg_read,
reg_write)
151 DEFINE_REG(11, 3, 0x10, (256), reg_init, reg_read,
reg_write)
152 DEFINE_REG(11, 3, 0x14, (256), reg_init, reg_read,
reg_write)
153 DEFINE_REG(11, 4, 0x10, (256), reg_init, reg_read,
reg_write)
154 DEFINE_REG(11, 5, 0x10, (64*KB), reg_init, reg_read,
reg_write)
155 DEFINE_REG(11, 6, 0x10, (256), reg_init, reg_read,
reg_write)
156 DEFINE_REG(11, 7, 0x10, (64*KB), reg_init, reg_read,
reg_write)
157 DEFINE_REG(11, 7, 0x3c, 256, reg_init, reg_noirq_read,
reg_write)
158 DEFINE_REG(12, 0, 0x10, (128*KB), reg_init, reg_read,
reg_write)
159 DEFINE_REG(12, 0, 0x14, (256), reg_init, reg_read,
reg_write)
160 DEFINE_REG(12, 1, 0x10, (1024), reg_init, reg_read,
reg_write)
161 DEFINE_REG(13, 0, 0x10, (32*KB), reg_init, ehci_reg_read,
reg_write)
162 DEFINE_REG(13, 1, 0x10, (32*KB), reg_init, ehci_reg_read,
reg_write)
164 DEFINE_REG(14, 0, 0x10, 0, reg_init, reg_read,
reg_write)
165 DEFINE_REG(14, 0, 0x14, 0, reg_init, reg_read,
reg_write)
166 DEFINE_REG(14, 0, 0x18, 0, reg_init, reg_read,
reg_write)
167 DEFINE_REG(14, 0, 0x1C, 0, reg_init, reg_read,
reg_write)
168 DEFINE_REG(14, 0, 0x20, 0, reg_init, reg_read,
reg_write)
169 DEFINE_REG(14, 0, 0x24, (0x200), sata_reg_init, reg_read,
reg_write)
170 DEFINE_REG(15, 0, 0x10, (64*KB), reg_init, reg_read,
reg_write)
171 DEFINE_REG(15, 0, 0x14, (64*KB), reg_init, reg_read,
reg_write)
172 DEFINE_REG(16, 0, 0x10, (64*KB), reg_init, reg_read,
reg_write)
173 DEFINE_REG(16, 0, 0x14, (64*MB), reg_init, reg_read,
reg_write)
174 DEFINE_REG(16, 0, 0x18, (64*MB), reg_init, reg_read,
reg_write)
175 DEFINE_REG(16, 0, 0x3c, 256, reg_init, reg_noirq_read,
reg_write)
176 DEFINE_REG(17, 0, 0x10, (128*KB), reg_init, reg_read,
reg_write)
177 DEFINE_REG(18, 0, 0x10, (1*KB), reg_init, reg_read,
reg_write)
178 DEFINE_REG(18, 0, 0x3c, 256, reg_init, reg_noirq_read,
reg_write)
181 static
void __init init_sim_regs(
void)
185 for (i = 0; i <
ARRAY_SIZE(bus1_fixups); i++) {
186 if (bus1_fixups[i].
init)
187 bus1_fixups[
i].
init(&bus1_fixups[i]);
191 static inline void extract_bytes(
u32 *value,
int reg,
int len)
195 *value >>= ((reg & 3) * 8);
196 mask = 0xFFFFFFFF >> ((4 - len) * 8);
202 u32 av_bridge_base, av_bridge_limit;
232 av_bridge_limit = av_bridge_base + (512*MB - 1);
233 av_bridge_limit >>= 16;
234 av_bridge_limit &= 0xFFF0;
236 av_bridge_base >>= 16;
237 av_bridge_base &= 0xFFF0;
240 *value = av_bridge_limit;
242 *value = av_bridge_base;
244 *value = (av_bridge_limit << 16) | av_bridge_base;
268 static int ce4100_conf_read(
unsigned int seg,
unsigned int bus,
269 unsigned int devfn,
int reg,
int len,
u32 *value)
275 for (i = 0; i <
ARRAY_SIZE(bus1_fixups); i++) {
276 if (bus1_fixups[i].
dev_func == devfn &&
277 bus1_fixups[i].reg == (reg & ~3) &&
278 bus1_fixups[
i].
read) {
279 bus1_fixups[
i].
read(&(bus1_fixups[i]),
281 extract_bytes(value, reg, len);
287 if (bus == 0 && (
PCI_DEVFN(1, 0) == devfn) &&
294 static int ce4100_conf_write(
unsigned int seg,
unsigned int bus,
295 unsigned int devfn,
int reg,
int len,
u32 value)
301 for (i = 0; i <
ARRAY_SIZE(bus1_fixups); i++) {
302 if (bus1_fixups[i].
dev_func == devfn &&
303 bus1_fixups[i].reg == (reg & ~3) &&
305 bus1_fixups[
i].
write(&(bus1_fixups[i]),
313 if (bus == 0 &&
PCI_DEVFN(1, 0) == devfn &&
320 static const struct pci_raw_ops ce4100_pci_conf = {
321 .read = ce4100_conf_read,
322 .write = ce4100_conf_write,