5 #include <linux/kernel.h>
14 #define PSYCHO_STRBUF_CTRL_DENAB 0x0000000000000002ULL
15 #define PSYCHO_STCERR_WRITE 0x0000000000000002ULL
16 #define PSYCHO_STCERR_READ 0x0000000000000001ULL
17 #define PSYCHO_STCTAG_PPN 0x0fffffff00000000ULL
18 #define PSYCHO_STCTAG_VPN 0x00000000ffffe000ULL
19 #define PSYCHO_STCTAG_VALID 0x0000000000000002ULL
20 #define PSYCHO_STCTAG_WRITE 0x0000000000000001ULL
21 #define PSYCHO_STCLINE_LINDX 0x0000000001e00000ULL
22 #define PSYCHO_STCLINE_SPTR 0x00000000001f8000ULL
23 #define PSYCHO_STCLINE_LADDR 0x0000000000007f00ULL
24 #define PSYCHO_STCLINE_EPTR 0x00000000000000fcULL
25 #define PSYCHO_STCLINE_VALID 0x0000000000000002ULL
26 #define PSYCHO_STCLINE_FOFN 0x0000000000000001ULL
29 static unsigned long stc_error_buf[128];
30 static unsigned long stc_tag_buf[16];
31 static unsigned long stc_line_buf[16];
33 static void psycho_check_stc_error(
struct pci_pbm_info *pbm)
35 unsigned long err_base, tag_base, line_base;
47 spin_lock(&stc_buf_lock);
59 for (i = 0; i < 128; i++) {
62 val = upa_readq(err_base + (i * 8
UL));
63 upa_writeq(0
UL, err_base + (i * 8
UL));
64 stc_error_buf[
i] =
val;
66 for (i = 0; i < 16; i++) {
67 stc_tag_buf[
i] = upa_readq(tag_base + (i * 8
UL));
68 stc_line_buf[
i] = upa_readq(line_base + (i * 8
UL));
69 upa_writeq(0
UL, tag_base + (i * 8
UL));
70 upa_writeq(0
UL, line_base + (i * 8
UL));
76 for (i = 0; i < 16; i++) {
82 for (j = first; j < last; j++) {
83 u64 errval = stc_error_buf[
j];
95 u64 tagval = stc_tag_buf[
i];
96 u64 lineval = stc_line_buf[
i];
106 "LADDR(%llx)EP(%llx)V(%d)FOFN(%d)]\n",
118 spin_unlock(&stc_buf_lock);
121 #define PSYCHO_IOMMU_TAG 0xa580UL
122 #define PSYCHO_IOMMU_DATA 0xa600UL
124 static void psycho_record_iommu_tags_and_data(
struct pci_pbm_info *pbm,
129 for (i = 0; i < 16; i++) {
131 unsigned long off = i * 8
UL;
142 #define PSYCHO_IOMMU_TAG_ERRSTS (0x3UL << 23UL)
143 #define PSYCHO_IOMMU_TAG_ERR (0x1UL << 22UL)
144 #define PSYCHO_IOMMU_TAG_WRITE (0x1UL << 21UL)
145 #define PSYCHO_IOMMU_TAG_STREAM (0x1UL << 20UL)
146 #define PSYCHO_IOMMU_TAG_SIZE (0x1UL << 19UL)
147 #define PSYCHO_IOMMU_TAG_VPAGE 0x7ffffULL
148 #define PSYCHO_IOMMU_DATA_VALID (1UL << 30UL)
149 #define PSYCHO_IOMMU_DATA_CACHE (1UL << 28UL)
150 #define PSYCHO_IOMMU_DATA_PPAGE 0xfffffffULL
152 static void psycho_dump_iommu_tags_and_data(
struct pci_pbm_info *pbm,
157 for (i = 0; i < 16; i++) {
158 u64 tag_val, data_val;
159 const char *type_str;
167 type_str =
"Protection Error";
170 type_str =
"Invalid Error";
173 type_str =
"TimeOut Error";
177 type_str =
"ECC Error";
182 "str(%d) sz(%dK) vpg(%08llx)]\n",
183 pbm->
name, i, type_str,
197 #define PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL
198 #define PSYCHO_IOMMU_CTRL_XLTEERR 0x0000000001000000UL
212 const char *type_str;
214 control &= ~PSYCHO_IOMMU_CTRL_XLTEERR;
219 type_str =
"Protection Error";
222 type_str =
"Invalid Error";
225 type_str =
"TimeOut Error";
229 type_str =
"ECC Error";
233 pbm->
name, type_str);
241 psycho_record_iommu_tags_and_data(pbm, iommu_tag, iommu_data);
242 psycho_dump_iommu_tags_and_data(pbm, iommu_tag, iommu_data);
244 psycho_check_stc_error(pbm);
245 spin_unlock_irqrestore(&iommu->
lock, flags);
248 #define PSYCHO_PCICTRL_SBH_ERR 0x0000000800000000UL
249 #define PSYCHO_PCICTRL_SERR 0x0000000400000000UL
259 if (csr_error_bits) {
266 "error asserted.\n", pbm->
name);
288 #define PSYCHO_PCIAFSR_PMA 0x8000000000000000ULL
289 #define PSYCHO_PCIAFSR_PTA 0x4000000000000000ULL
290 #define PSYCHO_PCIAFSR_PRTRY 0x2000000000000000ULL
291 #define PSYCHO_PCIAFSR_PPERR 0x1000000000000000ULL
292 #define PSYCHO_PCIAFSR_SMA 0x0800000000000000ULL
293 #define PSYCHO_PCIAFSR_STA 0x0400000000000000ULL
294 #define PSYCHO_PCIAFSR_SRTRY 0x0200000000000000ULL
295 #define PSYCHO_PCIAFSR_SPERR 0x0100000000000000ULL
296 #define PSYCHO_PCIAFSR_RESV1 0x00ff000000000000ULL
297 #define PSYCHO_PCIAFSR_BMSK 0x0000ffff00000000ULL
298 #define PSYCHO_PCIAFSR_BLK 0x0000000080000000ULL
299 #define PSYCHO_PCIAFSR_RESV2 0x0000000040000000ULL
300 #define PSYCHO_PCIAFSR_MID 0x000000003e000000ULL
301 #define PSYCHO_PCIAFSR_RESV3 0x0000000001ffffffULL
317 return psycho_pcierr_intr_other(pbm);
318 upa_writeq(error_bits, pbm->
pci_afsr);
326 "Excessive Retries" :
328 "Parity Error" :
"???"))))));
329 printk(
KERN_ERR "%s: bytemask[%04llx] UPA_MID[%02llx] was_block(%d)\n",
347 printk(
"(Excessive Retries)");
357 if (error_bits & (PSYCHO_PCIAFSR_PTA | PSYCHO_PCIAFSR_STA)) {
361 if (error_bits & (PSYCHO_PCIAFSR_PMA | PSYCHO_PCIAFSR_SMA))
364 if (error_bits & (PSYCHO_PCIAFSR_PPERR | PSYCHO_PCIAFSR_SPERR))
370 static void psycho_iommu_flush(
struct pci_pbm_info *pbm)
374 for (i = 0; i < 16; i++) {
375 unsigned long off = i * 8;
382 #define PSYCHO_IOMMU_CONTROL 0x0200UL
383 #define PSYCHO_IOMMU_CTRL_TSBSZ 0x0000000000070000UL
384 #define PSYCHO_IOMMU_TSBSZ_1K 0x0000000000000000UL
385 #define PSYCHO_IOMMU_TSBSZ_2K 0x0000000000010000UL
386 #define PSYCHO_IOMMU_TSBSZ_4K 0x0000000000020000UL
387 #define PSYCHO_IOMMU_TSBSZ_8K 0x0000000000030000UL
388 #define PSYCHO_IOMMU_TSBSZ_16K 0x0000000000040000UL
389 #define PSYCHO_IOMMU_TSBSZ_32K 0x0000000000050000UL
390 #define PSYCHO_IOMMU_TSBSZ_64K 0x0000000000060000UL
391 #define PSYCHO_IOMMU_TSBSZ_128K 0x0000000000070000UL
392 #define PSYCHO_IOMMU_CTRL_TBWSZ 0x0000000000000004UL
393 #define PSYCHO_IOMMU_CTRL_DENAB 0x0000000000000002UL
394 #define PSYCHO_IOMMU_CTRL_ENAB 0x0000000000000001UL
395 #define PSYCHO_IOMMU_FLUSH 0x0210UL
396 #define PSYCHO_IOMMU_TSBBASE 0x0208UL
399 u32 dvma_offset,
u32 dma_mask,
400 unsigned long write_complete_offset)
411 write_complete_offset);
419 psycho_iommu_flush(pbm);
468 pbm->
name, chip_name,