9 #define __EXTERN_INLINE inline
12 #undef __EXTERN_INLINE
14 #include <linux/types.h>
15 #include <linux/pci.h>
16 #include <linux/sched.h>
19 #include <asm/ptrace.h>
25 #define DEBUG_CONFIG 0
26 #define DEBUG_DUMP_REGS 0
27 #define DEBUG_DUMP_CONFIG 1
30 # define DBG_CFG(args) printk args
32 # define DBG_CFG(args)
36 static void wildfire_dump_pci_regs(
int qbbno,
int hoseno);
37 static void wildfire_dump_pca_regs(
int qbbno,
int pcano);
38 static void wildfire_dump_qsa_regs(
int qbbno);
39 static void wildfire_dump_qsd_regs(
int qbbno);
40 static void wildfire_dump_iop_regs(
int qbbno);
41 static void wildfire_dump_gp_regs(
int qbbno);
44 static void wildfire_dump_hardware_config(
void);
49 #define QBB_MAP_EMPTY 0xff
72 hose->sparse_mem_base = 0;
73 hose->sparse_io_base = 0;
78 hose->
index = (qbbno << 3) + hoseno;
86 hose->mem_space->end = hose->mem_space->start + 0xffffffff;
98 wildfire_dump_pci_regs(qbbno, hoseno);
118 pci->
pci_window[0].wbase.csr = hose->sg_isa->dma_base | 3;
119 pci->
pci_window[0].wmask.csr = (hose->sg_isa->size - 1) & 0xfff00000;
122 pci->
pci_window[1].wbase.csr = 0x40000000 | 1;
123 pci->
pci_window[1].wmask.csr = (0x40000000 -1) & 0xfff00000;
126 pci->
pci_window[2].wbase.csr = 0x80000000 | 1;
127 pci->
pci_window[2].wmask.csr = (0x40000000 -1) & 0xfff00000;
130 pci->
pci_window[3].wbase.csr = hose->sg_pci->dma_base | 3;
131 pci->
pci_window[3].wmask.csr = (hose->sg_pci->size - 1) & 0xfff00000;
146 wildfire_dump_pca_regs(qbbno, pcano);
164 wildfire_dump_qsa_regs(qbbno);
165 wildfire_dump_qsd_regs(qbbno);
166 wildfire_dump_iop_regs(qbbno);
167 wildfire_dump_gp_regs(qbbno);
180 unsigned int hard_qbb, soft_qbb;
192 printk(
KERN_ERR "fast QSD_WHAMI at base %p is 0x%lx\n", fast, temp);
195 hard_qbb = (temp >> 8) & 7;
196 soft_qbb = (temp >> 4) & 7;
228 for (i = 0; i < 4; i++) {
255 hard_qbb = (temp >> 8) & 7;
262 printk(
KERN_ERR "QSA_QBB_POP_0 at base %p is 0x%lx\n", qsa, temp);
269 printk(
KERN_ERR "QSA_QBB_POP_1 at base %p is 0x%lx\n", qsa, temp);
287 if ((iop->
iop_hose[i].init.csr & 1) == 1 &&
288 ((ne->
ne_what_am_i.csr & 0xf00000300UL) == 0x100000300UL) &&
289 ((fe->
fe_what_am_i.csr & 0xf00000300UL) == 0x100000200UL))
297 #if DEBUG_DUMP_CONFIG
298 wildfire_dump_hardware_config();
346 int qbbno = hose->
index >> 3;
347 int hoseno = hose->
index & 7;
355 mk_conf_addr(
struct pci_bus *pbus,
unsigned int device_fn,
int where,
356 unsigned long *
pci_addr,
unsigned char *type1)
362 DBG_CFG((
"mk_conf_addr(bus=%d ,device_fn=0x%x, where=0x%x, "
363 "pci_addr=0x%p, type1=0x%p)\n",
364 bus, device_fn, where, pci_addr, type1));
370 addr = (bus << 16) | (device_fn << 8) | where;
371 addr |= hose->config_space_base;
374 DBG_CFG((
"mk_conf_addr: returning pci_addr 0x%lx\n", addr));
379 wildfire_read_config(
struct pci_bus *bus,
unsigned int devfn,
int where,
385 if (mk_conf_addr(bus, devfn, where, &addr, &type1))
396 *value = *(
vuip)addr;
404 wildfire_write_config(
struct pci_bus *bus,
unsigned int devfn,
int where,
410 if (mk_conf_addr(bus, devfn, where, &addr, &type1))
436 .read = wildfire_read_config,
437 .write = wildfire_write_config,
458 return (
unsigned long)nid * (64
UL * 1024 * 1024 * 1024);
464 return 64
UL * 1024 * 1024 * 1024;
470 wildfire_dump_pci_regs(
int qbbno,
int hoseno)
487 printk(
KERN_ERR " DMA window registers for QBB %d hose %d (%p)\n",
489 for (i = 0; i < 4; i++) {
499 wildfire_dump_pca_regs(
int qbbno,
int pcano)
516 for (i = 0; i < 4; i++) {
526 wildfire_dump_qsa_regs(
int qbbno)
537 for (i = 0; i < 5; i++)
541 for (i = 0; i < 2; i++)
549 wildfire_dump_qsd_regs(
int qbbno)
574 wildfire_dump_iop_regs(
int qbbno)
588 for (i = 0; i < 4; i++)
591 for (i = 0; i < 4; i++)
599 wildfire_dump_gp_regs(
int qbbno)
605 for (i = 0; i < 4; i++)
621 #if DEBUG_DUMP_CONFIG
623 wildfire_dump_hardware_config(
void)
641 printk(
" hard_qbb_map: ");
649 printk(
" soft_qbb_map: ");