9 #define __EXTERN_INLINE inline
12 #undef __EXTERN_INLINE
14 #include <linux/module.h>
15 #include <linux/types.h>
16 #include <linux/pci.h>
17 #include <linux/sched.h>
21 #include <asm/ptrace.h>
47 #define DEBUG_CONFIG 0
50 # define DBG_CFG(args) printk args
52 # define DBG_CFG(args)
91 mk_conf_addr(
struct pci_bus *pbus,
unsigned int device_fn,
int where,
92 unsigned long *
pci_addr,
unsigned char *type1)
98 DBG_CFG((
"mk_conf_addr(bus=%d ,device_fn=0x%x, where=0x%x, "
99 "pci_addr=0x%p, type1=0x%p)\n",
100 bus, device_fn, where, pci_addr, type1));
106 addr = (bus << 16) | (device_fn << 8) | where;
107 addr |= hose->config_space_base;
110 DBG_CFG((
"mk_conf_addr: returning pci_addr 0x%lx\n", addr));
115 tsunami_read_config(
struct pci_bus *
bus,
unsigned int devfn,
int where,
121 if (mk_conf_addr(bus, devfn, where, &addr, &type1))
132 *value = *(
vuip)addr;
140 tsunami_write_config(
struct pci_bus *bus,
unsigned int devfn,
int where,
146 if (mk_conf_addr(bus, devfn, where, &addr, &type1))
172 .read = tsunami_read_config,
173 .write = tsunami_write_config,
180 volatile unsigned long *
csr;
185 csr = &pchip->
tlbia.csr;
186 if (((start ^ end) & 0xffff0000) == 0)
187 csr = &pchip->
tlbiv.csr;
191 value = (start & 0xffff0000) >> 12;
198 #ifdef NXM_MACHINE_CHECKS_ON_TSUNAMI
202 long dont_care, probe_result;
216 printk(
"dont_care == 0x%lx\n", dont_care);
222 tsunami_probe_write(
volatile unsigned long *
vaddr)
224 long true_contents, probe_result = 1;
227 true_contents = *
vaddr;
234 printk(
"tsunami_probe_write: unit %d at 0x%016lx\n", source,
235 (
unsigned long)vaddr);
238 *vaddr = true_contents;
242 #define tsunami_probe_read(ADDR) 1
263 hose->sparse_mem_base = 0;
264 hose->sparse_io_base = 0;
266 = (
TSUNAMI_MEM(index) & 0xffffffffff
L) | 0x80000000000L;
268 = (
TSUNAMI_IO(index) & 0xffffffffff
L) | 0x80000000000L;
279 hose->mem_space->end = hose->mem_space->start + 0xffffffff;
293 saved_config[
index].wsba[0] = pchip->
wsba[0].csr;
294 saved_config[
index].wsm[0] = pchip->
wsm[0].csr;
295 saved_config[
index].tba[0] = pchip->
tba[0].csr;
297 saved_config[
index].wsba[1] = pchip->
wsba[1].csr;
298 saved_config[
index].wsm[1] = pchip->
wsm[1].csr;
299 saved_config[
index].tba[1] = pchip->
tba[1].csr;
301 saved_config[
index].wsba[2] = pchip->
wsba[2].csr;
302 saved_config[
index].wsm[2] = pchip->
wsm[2].csr;
303 saved_config[
index].tba[2] = pchip->
tba[2].csr;
305 saved_config[
index].wsba[3] = pchip->
wsba[3].csr;
306 saved_config[
index].wsm[3] = pchip->
wsm[3].csr;
307 saved_config[
index].tba[3] = pchip->
tba[3].csr;
323 hose->sg_isa->align_entry = 4;
327 hose->sg_pci->align_entry = 4;
332 pchip->
wsba[0].csr = hose->sg_isa->dma_base | 3;
333 pchip->
wsm[0].csr = (hose->sg_isa->size - 1) & 0xfff00000;
336 pchip->
wsba[1].csr = hose->sg_pci->dma_base | 3;
337 pchip->
wsm[1].csr = (hose->sg_pci->size - 1) & 0xfff00000;
340 pchip->
wsba[2].csr = 0x80000000 | 1;
341 pchip->
wsm[2].csr = (0x80000000 - 1) & 0xfff00000;
342 pchip->
tba[2].csr = 0;
344 pchip->
wsba[3].csr = 0;
367 #ifndef CONFIG_ALPHA_GENERIC
375 #ifdef NXM_MACHINE_CHECKS_ON_TSUNAMI
385 printk(
"%s: probing bogus address: 0x%016lx\n", __func__, bogus_addr);
387 tsunami_probe_write((
unsigned long *)bogus_addr)
388 ?
"succeeded" :
"failed");
392 printk(
"%s: CChip registers:\n", __func__);
402 printk(
"%s: DChip registers:\n");
418 find_console_vga_hose();
424 pchip->
wsba[0].csr = saved_config[
index].wsba[0];
425 pchip->
wsm[0].csr = saved_config[
index].wsm[0];
426 pchip->
tba[0].csr = saved_config[
index].tba[0];
428 pchip->
wsba[1].csr = saved_config[
index].wsba[1];
429 pchip->
wsm[1].csr = saved_config[
index].wsm[1];
430 pchip->
tba[1].csr = saved_config[
index].tba[1];
432 pchip->
wsba[2].csr = saved_config[
index].wsba[2];
433 pchip->
wsm[2].csr = saved_config[
index].wsm[2];
434 pchip->
tba[2].csr = saved_config[
index].tba[2];
436 pchip->
wsba[3].csr = saved_config[
index].wsba[3];
437 pchip->
wsm[3].csr = saved_config[
index].wsm[3];
438 pchip->
tba[3].csr = saved_config[
index].tba[3];
453 pchip->
perror.csr = 0x040;
459 tsunami_pci_clr_err(
void)
475 tsunami_pci_clr_err();