1 /* pci_schizo.c: SCHIZO/TOMATILLO specific PCI controller support.
3 * Copyright (C) 2001, 2002, 2003, 2007 David S. Miller (davem@davemloft.net)
6 #include <linux/kernel.h>
7 #include <linux/types.h>
9 #include <linux/init.h>
10 #include <linux/slab.h>
11 #include <linux/interrupt.h>
14 #include <asm/iommu.h>
17 #include <asm/pstate.h>
21 #include "iommu_common.h"
23 /* All SCHIZO registers are 64-bits. The following accessor
24 * routines are how they are accessed. The REG parameter
25 * is a physical address.
27 #define schizo_read(__reg) \
29 __asm__ __volatile__("ldxa [%1] %2, %0" \
31 : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \
35 #define schizo_write(__reg, __val) \
36 __asm__ __volatile__("stxa %0, [%1] %2" \
38 : "r" (__val), "r" (__reg), \
39 "i" (ASI_PHYS_BYPASS_EC_E) \
42 /* This is a convention that at least Excalibur and Merlin
43 * follow. I suppose the SCHIZO used in Starcat and friends
46 * The only way I could see this changing is if the newlink
47 * block requires more space in Schizo's address space than
48 * they predicted, thus requiring an address space reorg when
49 * the newer Schizo is taped out.
52 /* Streaming buffer control register. */
53 #define SCHIZO_STRBUF_CTRL_LPTR 0x00000000000000f0UL /* LRU Lock Pointer */
54 #define SCHIZO_STRBUF_CTRL_LENAB 0x0000000000000008UL /* LRU Lock Enable */
55 #define SCHIZO_STRBUF_CTRL_RRDIS 0x0000000000000004UL /* Rerun Disable */
56 #define SCHIZO_STRBUF_CTRL_DENAB 0x0000000000000002UL /* Diagnostic Mode Enable */
57 #define SCHIZO_STRBUF_CTRL_ENAB 0x0000000000000001UL /* Streaming Buffer Enable */
59 /* IOMMU control register. */
60 #define SCHIZO_IOMMU_CTRL_RESV 0xfffffffff9000000UL /* Reserved */
61 #define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status */
62 #define SCHIZO_IOMMU_CTRL_XLTEERR 0x0000000001000000UL /* Translation Error encountered */
63 #define SCHIZO_IOMMU_CTRL_LCKEN 0x0000000000800000UL /* Enable translation locking */
64 #define SCHIZO_IOMMU_CTRL_LCKPTR 0x0000000000780000UL /* Translation lock pointer */
65 #define SCHIZO_IOMMU_CTRL_TSBSZ 0x0000000000070000UL /* TSB Size */
66 #define SCHIZO_IOMMU_TSBSZ_1K 0x0000000000000000UL /* TSB Table 1024 8-byte entries */
67 #define SCHIZO_IOMMU_TSBSZ_2K 0x0000000000010000UL /* TSB Table 2048 8-byte entries */
68 #define SCHIZO_IOMMU_TSBSZ_4K 0x0000000000020000UL /* TSB Table 4096 8-byte entries */
69 #define SCHIZO_IOMMU_TSBSZ_8K 0x0000000000030000UL /* TSB Table 8192 8-byte entries */
70 #define SCHIZO_IOMMU_TSBSZ_16K 0x0000000000040000UL /* TSB Table 16k 8-byte entries */
71 #define SCHIZO_IOMMU_TSBSZ_32K 0x0000000000050000UL /* TSB Table 32k 8-byte entries */
72 #define SCHIZO_IOMMU_TSBSZ_64K 0x0000000000060000UL /* TSB Table 64k 8-byte entries */
73 #define SCHIZO_IOMMU_TSBSZ_128K 0x0000000000070000UL /* TSB Table 128k 8-byte entries */
74 #define SCHIZO_IOMMU_CTRL_RESV2 0x000000000000fff8UL /* Reserved */
75 #define SCHIZO_IOMMU_CTRL_TBWSZ 0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */
76 #define SCHIZO_IOMMU_CTRL_DENAB 0x0000000000000002UL /* Diagnostic mode enable */
77 #define SCHIZO_IOMMU_CTRL_ENAB 0x0000000000000001UL /* IOMMU Enable */
79 /* Schizo config space address format is nearly identical to
82 * 32 24 23 16 15 11 10 8 7 2 1 0
83 * ---------------------------------------------------------
84 * |0 0 0 0 0 0 0 0 0| bus | device | function | reg | 0 0 |
85 * ---------------------------------------------------------
87 #define SCHIZO_CONFIG_BASE(PBM) ((PBM)->config_space)
88 #define SCHIZO_CONFIG_ENCODE(BUS, DEVFN, REG) \
89 (((unsigned long)(BUS) << 16) | \
90 ((unsigned long)(DEVFN) << 8) | \
91 ((unsigned long)(REG)))
93 static void *schizo_pci_config_mkaddr(struct pci_pbm_info *pbm,
100 bus -= pbm->pci_first_busno;
102 (SCHIZO_CONFIG_BASE(pbm) |
103 SCHIZO_CONFIG_ENCODE(bus, devfn, where));
106 /* Just make sure the bus number is in range. */
107 static int schizo_out_of_range(struct pci_pbm_info *pbm,
111 if (bus < pbm->pci_first_busno ||
112 bus > pbm->pci_last_busno)
117 /* SCHIZO PCI configuration space accessors. */
119 static int schizo_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
120 int where, int size, u32 *value)
122 struct pci_pbm_info *pbm = bus_dev->sysdata;
123 unsigned char bus = bus_dev->number;
140 addr = schizo_pci_config_mkaddr(pbm, bus, devfn, where);
142 return PCIBIOS_SUCCESSFUL;
144 if (schizo_out_of_range(pbm, bus, devfn))
145 return PCIBIOS_SUCCESSFUL;
148 pci_config_read8((u8 *)addr, &tmp8);
154 printk("pci_read_config_word: misaligned reg [%x]\n",
156 return PCIBIOS_SUCCESSFUL;
158 pci_config_read16((u16 *)addr, &tmp16);
164 printk("pci_read_config_dword: misaligned reg [%x]\n",
166 return PCIBIOS_SUCCESSFUL;
168 pci_config_read32(addr, value);
171 return PCIBIOS_SUCCESSFUL;
174 static int schizo_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
175 int where, int size, u32 value)
177 struct pci_pbm_info *pbm = bus_dev->sysdata;
178 unsigned char bus = bus_dev->number;
181 addr = schizo_pci_config_mkaddr(pbm, bus, devfn, where);
183 return PCIBIOS_SUCCESSFUL;
185 if (schizo_out_of_range(pbm, bus, devfn))
186 return PCIBIOS_SUCCESSFUL;
190 pci_config_write8((u8 *)addr, value);
195 printk("pci_write_config_word: misaligned reg [%x]\n",
197 return PCIBIOS_SUCCESSFUL;
199 pci_config_write16((u16 *)addr, value);
204 printk("pci_write_config_dword: misaligned reg [%x]\n",
206 return PCIBIOS_SUCCESSFUL;
209 pci_config_write32(addr, value);
211 return PCIBIOS_SUCCESSFUL;
214 static struct pci_ops schizo_ops = {
215 .read = schizo_read_pci_cfg,
216 .write = schizo_write_pci_cfg,
219 /* SCHIZO error handling support. */
220 enum schizo_error_type {
221 UE_ERR, CE_ERR, PCI_ERR, SAFARI_ERR
224 static DEFINE_SPINLOCK(stc_buf_lock);
225 static unsigned long stc_error_buf[128];
226 static unsigned long stc_tag_buf[16];
227 static unsigned long stc_line_buf[16];
229 #define SCHIZO_UE_INO 0x30 /* Uncorrectable ECC error */
230 #define SCHIZO_CE_INO 0x31 /* Correctable ECC error */
231 #define SCHIZO_PCIERR_A_INO 0x32 /* PBM A PCI bus error */
232 #define SCHIZO_PCIERR_B_INO 0x33 /* PBM B PCI bus error */
233 #define SCHIZO_SERR_INO 0x34 /* Safari interface error */
235 struct pci_pbm_info *pbm_for_ino(struct pci_controller_info *p, u32 ino)
238 if (p->pbm_A.ino_bitmap & (1UL << ino))
240 if (p->pbm_B.ino_bitmap & (1UL << ino))
243 printk("PCI%d: No ino_bitmap entry for ino[%x], bitmaps "
244 "PBM_A[%016lx] PBM_B[%016lx]",
247 p->pbm_B.ino_bitmap);
248 printk("PCI%d: Using PBM_A, report this problem immediately.\n",
254 #define SCHIZO_STC_ERR 0xb800UL /* --> 0xba00 */
255 #define SCHIZO_STC_TAG 0xba00UL /* --> 0xba80 */
256 #define SCHIZO_STC_LINE 0xbb00UL /* --> 0xbb80 */
258 #define SCHIZO_STCERR_WRITE 0x2UL
259 #define SCHIZO_STCERR_READ 0x1UL
261 #define SCHIZO_STCTAG_PPN 0x3fffffff00000000UL
262 #define SCHIZO_STCTAG_VPN 0x00000000ffffe000UL
263 #define SCHIZO_STCTAG_VALID 0x8000000000000000UL
264 #define SCHIZO_STCTAG_READ 0x4000000000000000UL
266 #define SCHIZO_STCLINE_LINDX 0x0000000007800000UL
267 #define SCHIZO_STCLINE_SPTR 0x000000000007e000UL
268 #define SCHIZO_STCLINE_LADDR 0x0000000000001fc0UL
269 #define SCHIZO_STCLINE_EPTR 0x000000000000003fUL
270 #define SCHIZO_STCLINE_VALID 0x0000000000600000UL
271 #define SCHIZO_STCLINE_FOFN 0x0000000000180000UL
273 static void __schizo_check_stc_error_pbm(struct pci_pbm_info *pbm,
274 enum schizo_error_type type)
276 struct pci_strbuf *strbuf = &pbm->stc;
277 unsigned long regbase = pbm->pbm_regs;
278 unsigned long err_base, tag_base, line_base;
282 err_base = regbase + SCHIZO_STC_ERR;
283 tag_base = regbase + SCHIZO_STC_TAG;
284 line_base = regbase + SCHIZO_STC_LINE;
286 spin_lock(&stc_buf_lock);
288 /* This is __REALLY__ dangerous. When we put the
289 * streaming buffer into diagnostic mode to probe
290 * it's tags and error status, we _must_ clear all
291 * of the line tag valid bits before re-enabling
292 * the streaming buffer. If any dirty data lives
293 * in the STC when we do this, we will end up
294 * invalidating it before it has a chance to reach
297 control = schizo_read(strbuf->strbuf_control);
298 schizo_write(strbuf->strbuf_control,
299 (control | SCHIZO_STRBUF_CTRL_DENAB));
300 for (i = 0; i < 128; i++) {
303 val = schizo_read(err_base + (i * 8UL));
304 schizo_write(err_base + (i * 8UL), 0UL);
305 stc_error_buf[i] = val;
307 for (i = 0; i < 16; i++) {
308 stc_tag_buf[i] = schizo_read(tag_base + (i * 8UL));
309 stc_line_buf[i] = schizo_read(line_base + (i * 8UL));
310 schizo_write(tag_base + (i * 8UL), 0UL);
311 schizo_write(line_base + (i * 8UL), 0UL);
314 /* OK, state is logged, exit diagnostic mode. */
315 schizo_write(strbuf->strbuf_control, control);
317 for (i = 0; i < 16; i++) {
318 int j, saw_error, first, last;
323 for (j = first; j < last; j++) {
324 unsigned long errval = stc_error_buf[j];
327 printk("%s: STC_ERR(%d)[wr(%d)rd(%d)]\n",
330 (errval & SCHIZO_STCERR_WRITE) ? 1 : 0,
331 (errval & SCHIZO_STCERR_READ) ? 1 : 0);
334 if (saw_error != 0) {
335 unsigned long tagval = stc_tag_buf[i];
336 unsigned long lineval = stc_line_buf[i];
337 printk("%s: STC_TAG(%d)[PA(%016lx)VA(%08lx)V(%d)R(%d)]\n",
340 ((tagval & SCHIZO_STCTAG_PPN) >> 19UL),
341 (tagval & SCHIZO_STCTAG_VPN),
342 ((tagval & SCHIZO_STCTAG_VALID) ? 1 : 0),
343 ((tagval & SCHIZO_STCTAG_READ) ? 1 : 0));
345 /* XXX Should spit out per-bank error information... -DaveM */
346 printk("%s: STC_LINE(%d)[LIDX(%lx)SP(%lx)LADDR(%lx)EP(%lx)"
350 ((lineval & SCHIZO_STCLINE_LINDX) >> 23UL),
351 ((lineval & SCHIZO_STCLINE_SPTR) >> 13UL),
352 ((lineval & SCHIZO_STCLINE_LADDR) >> 6UL),
353 ((lineval & SCHIZO_STCLINE_EPTR) >> 0UL),
354 ((lineval & SCHIZO_STCLINE_VALID) ? 1 : 0),
355 ((lineval & SCHIZO_STCLINE_FOFN) ? 1 : 0));
359 spin_unlock(&stc_buf_lock);
362 /* IOMMU is per-PBM in Schizo, so interrogate both for anonymous
363 * controller level errors.
366 #define SCHIZO_IOMMU_TAG 0xa580UL
367 #define SCHIZO_IOMMU_DATA 0xa600UL
369 #define SCHIZO_IOMMU_TAG_CTXT 0x0000001ffe000000UL
370 #define SCHIZO_IOMMU_TAG_ERRSTS 0x0000000001800000UL
371 #define SCHIZO_IOMMU_TAG_ERR 0x0000000000400000UL
372 #define SCHIZO_IOMMU_TAG_WRITE 0x0000000000200000UL
373 #define SCHIZO_IOMMU_TAG_STREAM 0x0000000000100000UL
374 #define SCHIZO_IOMMU_TAG_SIZE 0x0000000000080000UL
375 #define SCHIZO_IOMMU_TAG_VPAGE 0x000000000007ffffUL
377 #define SCHIZO_IOMMU_DATA_VALID 0x0000000100000000UL
378 #define SCHIZO_IOMMU_DATA_CACHE 0x0000000040000000UL
379 #define SCHIZO_IOMMU_DATA_PPAGE 0x000000003fffffffUL
381 static void schizo_check_iommu_error_pbm(struct pci_pbm_info *pbm,
382 enum schizo_error_type type)
384 struct pci_iommu *iommu = pbm->iommu;
385 unsigned long iommu_tag[16];
386 unsigned long iommu_data[16];
391 spin_lock_irqsave(&iommu->lock, flags);
392 control = schizo_read(iommu->iommu_control);
393 if (control & SCHIZO_IOMMU_CTRL_XLTEERR) {
397 /* Clear the error encountered bit. */
398 control &= ~SCHIZO_IOMMU_CTRL_XLTEERR;
399 schizo_write(iommu->iommu_control, control);
401 switch((control & SCHIZO_IOMMU_CTRL_XLTESTAT) >> 25UL) {
403 type_string = "Protection Error";
406 type_string = "Invalid Error";
409 type_string = "TimeOut Error";
413 type_string = "ECC Error";
416 printk("%s: IOMMU Error, type[%s]\n",
417 pbm->name, type_string);
419 /* Put the IOMMU into diagnostic mode and probe
420 * it's TLB for entries with error status.
422 * It is very possible for another DVMA to occur
423 * while we do this probe, and corrupt the system
424 * further. But we are so screwed at this point
425 * that we are likely to crash hard anyways, so
426 * get as much diagnostic information to the
429 schizo_write(iommu->iommu_control,
430 control | SCHIZO_IOMMU_CTRL_DENAB);
432 base = pbm->pbm_regs;
434 for (i = 0; i < 16; i++) {
436 schizo_read(base + SCHIZO_IOMMU_TAG + (i * 8UL));
438 schizo_read(base + SCHIZO_IOMMU_DATA + (i * 8UL));
440 /* Now clear out the entry. */
441 schizo_write(base + SCHIZO_IOMMU_TAG + (i * 8UL), 0);
442 schizo_write(base + SCHIZO_IOMMU_DATA + (i * 8UL), 0);
445 /* Leave diagnostic mode. */
446 schizo_write(iommu->iommu_control, control);
448 for (i = 0; i < 16; i++) {
449 unsigned long tag, data;
452 if (!(tag & SCHIZO_IOMMU_TAG_ERR))
455 data = iommu_data[i];
456 switch((tag & SCHIZO_IOMMU_TAG_ERRSTS) >> 23UL) {
458 type_string = "Protection Error";
461 type_string = "Invalid Error";
464 type_string = "TimeOut Error";
468 type_string = "ECC Error";
471 printk("%s: IOMMU TAG(%d)[error(%s) ctx(%x) wr(%d) str(%d) "
472 "sz(%dK) vpg(%08lx)]\n",
473 pbm->name, i, type_string,
474 (int)((tag & SCHIZO_IOMMU_TAG_CTXT) >> 25UL),
475 ((tag & SCHIZO_IOMMU_TAG_WRITE) ? 1 : 0),
476 ((tag & SCHIZO_IOMMU_TAG_STREAM) ? 1 : 0),
477 ((tag & SCHIZO_IOMMU_TAG_SIZE) ? 64 : 8),
478 (tag & SCHIZO_IOMMU_TAG_VPAGE) << IOMMU_PAGE_SHIFT);
479 printk("%s: IOMMU DATA(%d)[valid(%d) cache(%d) ppg(%016lx)]\n",
481 ((data & SCHIZO_IOMMU_DATA_VALID) ? 1 : 0),
482 ((data & SCHIZO_IOMMU_DATA_CACHE) ? 1 : 0),
483 (data & SCHIZO_IOMMU_DATA_PPAGE) << IOMMU_PAGE_SHIFT);
486 if (pbm->stc.strbuf_enabled)
487 __schizo_check_stc_error_pbm(pbm, type);
488 spin_unlock_irqrestore(&iommu->lock, flags);
491 static void schizo_check_iommu_error(struct pci_controller_info *p,
492 enum schizo_error_type type)
494 schizo_check_iommu_error_pbm(&p->pbm_A, type);
495 schizo_check_iommu_error_pbm(&p->pbm_B, type);
498 /* Uncorrectable ECC error status gathering. */
499 #define SCHIZO_UE_AFSR 0x10030UL
500 #define SCHIZO_UE_AFAR 0x10038UL
502 #define SCHIZO_UEAFSR_PPIO 0x8000000000000000UL /* Safari */
503 #define SCHIZO_UEAFSR_PDRD 0x4000000000000000UL /* Safari/Tomatillo */
504 #define SCHIZO_UEAFSR_PDWR 0x2000000000000000UL /* Safari */
505 #define SCHIZO_UEAFSR_SPIO 0x1000000000000000UL /* Safari */
506 #define SCHIZO_UEAFSR_SDMA 0x0800000000000000UL /* Safari/Tomatillo */
507 #define SCHIZO_UEAFSR_ERRPNDG 0x0300000000000000UL /* Safari */
508 #define SCHIZO_UEAFSR_BMSK 0x000003ff00000000UL /* Safari */
509 #define SCHIZO_UEAFSR_QOFF 0x00000000c0000000UL /* Safari/Tomatillo */
510 #define SCHIZO_UEAFSR_AID 0x000000001f000000UL /* Safari/Tomatillo */
511 #define SCHIZO_UEAFSR_PARTIAL 0x0000000000800000UL /* Safari */
512 #define SCHIZO_UEAFSR_OWNEDIN 0x0000000000400000UL /* Safari */
513 #define SCHIZO_UEAFSR_MTAGSYND 0x00000000000f0000UL /* Safari */
514 #define SCHIZO_UEAFSR_MTAG 0x000000000000e000UL /* Safari */
515 #define SCHIZO_UEAFSR_ECCSYND 0x00000000000001ffUL /* Safari */
517 static irqreturn_t schizo_ue_intr(int irq, void *dev_id)
519 struct pci_controller_info *p = dev_id;
520 unsigned long afsr_reg = p->pbm_B.controller_regs + SCHIZO_UE_AFSR;
521 unsigned long afar_reg = p->pbm_B.controller_regs + SCHIZO_UE_AFAR;
522 unsigned long afsr, afar, error_bits;
525 /* Latch uncorrectable error status. */
526 afar = schizo_read(afar_reg);
528 /* If either of the error pending bits are set in the
529 * AFSR, the error status is being actively updated by
530 * the hardware and we must re-read to get a clean value.
534 afsr = schizo_read(afsr_reg);
535 } while ((afsr & SCHIZO_UEAFSR_ERRPNDG) != 0 && --limit);
537 /* Clear the primary/secondary error status bits. */
539 (SCHIZO_UEAFSR_PPIO | SCHIZO_UEAFSR_PDRD | SCHIZO_UEAFSR_PDWR |
540 SCHIZO_UEAFSR_SPIO | SCHIZO_UEAFSR_SDMA);
543 schizo_write(afsr_reg, error_bits);
546 printk("PCI%d: Uncorrectable Error, primary error type[%s]\n",
548 (((error_bits & SCHIZO_UEAFSR_PPIO) ?
550 ((error_bits & SCHIZO_UEAFSR_PDRD) ?
552 ((error_bits & SCHIZO_UEAFSR_PDWR) ?
553 "DMA Write" : "???")))));
554 printk("PCI%d: bytemask[%04lx] qword_offset[%lx] SAFARI_AID[%02lx]\n",
556 (afsr & SCHIZO_UEAFSR_BMSK) >> 32UL,
557 (afsr & SCHIZO_UEAFSR_QOFF) >> 30UL,
558 (afsr & SCHIZO_UEAFSR_AID) >> 24UL);
559 printk("PCI%d: partial[%d] owned_in[%d] mtag[%lx] mtag_synd[%lx] ecc_sync[%lx]\n",
561 (afsr & SCHIZO_UEAFSR_PARTIAL) ? 1 : 0,
562 (afsr & SCHIZO_UEAFSR_OWNEDIN) ? 1 : 0,
563 (afsr & SCHIZO_UEAFSR_MTAG) >> 13UL,
564 (afsr & SCHIZO_UEAFSR_MTAGSYND) >> 16UL,
565 (afsr & SCHIZO_UEAFSR_ECCSYND) >> 0UL);
566 printk("PCI%d: UE AFAR [%016lx]\n", p->index, afar);
567 printk("PCI%d: UE Secondary errors [", p->index);
569 if (afsr & SCHIZO_UEAFSR_SPIO) {
573 if (afsr & SCHIZO_UEAFSR_SDMA) {
581 /* Interrogate IOMMU for error status. */
582 schizo_check_iommu_error(p, UE_ERR);
587 #define SCHIZO_CE_AFSR 0x10040UL
588 #define SCHIZO_CE_AFAR 0x10048UL
590 #define SCHIZO_CEAFSR_PPIO 0x8000000000000000UL
591 #define SCHIZO_CEAFSR_PDRD 0x4000000000000000UL
592 #define SCHIZO_CEAFSR_PDWR 0x2000000000000000UL
593 #define SCHIZO_CEAFSR_SPIO 0x1000000000000000UL
594 #define SCHIZO_CEAFSR_SDMA 0x0800000000000000UL
595 #define SCHIZO_CEAFSR_ERRPNDG 0x0300000000000000UL
596 #define SCHIZO_CEAFSR_BMSK 0x000003ff00000000UL
597 #define SCHIZO_CEAFSR_QOFF 0x00000000c0000000UL
598 #define SCHIZO_CEAFSR_AID 0x000000001f000000UL
599 #define SCHIZO_CEAFSR_PARTIAL 0x0000000000800000UL
600 #define SCHIZO_CEAFSR_OWNEDIN 0x0000000000400000UL
601 #define SCHIZO_CEAFSR_MTAGSYND 0x00000000000f0000UL
602 #define SCHIZO_CEAFSR_MTAG 0x000000000000e000UL
603 #define SCHIZO_CEAFSR_ECCSYND 0x00000000000001ffUL
605 static irqreturn_t schizo_ce_intr(int irq, void *dev_id)
607 struct pci_controller_info *p = dev_id;
608 unsigned long afsr_reg = p->pbm_B.controller_regs + SCHIZO_CE_AFSR;
609 unsigned long afar_reg = p->pbm_B.controller_regs + SCHIZO_CE_AFAR;
610 unsigned long afsr, afar, error_bits;
613 /* Latch error status. */
614 afar = schizo_read(afar_reg);
616 /* If either of the error pending bits are set in the
617 * AFSR, the error status is being actively updated by
618 * the hardware and we must re-read to get a clean value.
622 afsr = schizo_read(afsr_reg);
623 } while ((afsr & SCHIZO_UEAFSR_ERRPNDG) != 0 && --limit);
625 /* Clear primary/secondary error status bits. */
627 (SCHIZO_CEAFSR_PPIO | SCHIZO_CEAFSR_PDRD | SCHIZO_CEAFSR_PDWR |
628 SCHIZO_CEAFSR_SPIO | SCHIZO_CEAFSR_SDMA);
631 schizo_write(afsr_reg, error_bits);
634 printk("PCI%d: Correctable Error, primary error type[%s]\n",
636 (((error_bits & SCHIZO_CEAFSR_PPIO) ?
638 ((error_bits & SCHIZO_CEAFSR_PDRD) ?
640 ((error_bits & SCHIZO_CEAFSR_PDWR) ?
641 "DMA Write" : "???")))));
643 /* XXX Use syndrome and afar to print out module string just like
644 * XXX UDB CE trap handler does... -DaveM
646 printk("PCI%d: bytemask[%04lx] qword_offset[%lx] SAFARI_AID[%02lx]\n",
648 (afsr & SCHIZO_UEAFSR_BMSK) >> 32UL,
649 (afsr & SCHIZO_UEAFSR_QOFF) >> 30UL,
650 (afsr & SCHIZO_UEAFSR_AID) >> 24UL);
651 printk("PCI%d: partial[%d] owned_in[%d] mtag[%lx] mtag_synd[%lx] ecc_sync[%lx]\n",
653 (afsr & SCHIZO_UEAFSR_PARTIAL) ? 1 : 0,
654 (afsr & SCHIZO_UEAFSR_OWNEDIN) ? 1 : 0,
655 (afsr & SCHIZO_UEAFSR_MTAG) >> 13UL,
656 (afsr & SCHIZO_UEAFSR_MTAGSYND) >> 16UL,
657 (afsr & SCHIZO_UEAFSR_ECCSYND) >> 0UL);
658 printk("PCI%d: CE AFAR [%016lx]\n", p->index, afar);
659 printk("PCI%d: CE Secondary errors [", p->index);
661 if (afsr & SCHIZO_CEAFSR_SPIO) {
665 if (afsr & SCHIZO_CEAFSR_SDMA) {
676 #define SCHIZO_PCI_AFSR 0x2010UL
677 #define SCHIZO_PCI_AFAR 0x2018UL
679 #define SCHIZO_PCIAFSR_PMA 0x8000000000000000UL /* Schizo/Tomatillo */
680 #define SCHIZO_PCIAFSR_PTA 0x4000000000000000UL /* Schizo/Tomatillo */
681 #define SCHIZO_PCIAFSR_PRTRY 0x2000000000000000UL /* Schizo/Tomatillo */
682 #define SCHIZO_PCIAFSR_PPERR 0x1000000000000000UL /* Schizo/Tomatillo */
683 #define SCHIZO_PCIAFSR_PTTO 0x0800000000000000UL /* Schizo/Tomatillo */
684 #define SCHIZO_PCIAFSR_PUNUS 0x0400000000000000UL /* Schizo */
685 #define SCHIZO_PCIAFSR_SMA 0x0200000000000000UL /* Schizo/Tomatillo */
686 #define SCHIZO_PCIAFSR_STA 0x0100000000000000UL /* Schizo/Tomatillo */
687 #define SCHIZO_PCIAFSR_SRTRY 0x0080000000000000UL /* Schizo/Tomatillo */
688 #define SCHIZO_PCIAFSR_SPERR 0x0040000000000000UL /* Schizo/Tomatillo */
689 #define SCHIZO_PCIAFSR_STTO 0x0020000000000000UL /* Schizo/Tomatillo */
690 #define SCHIZO_PCIAFSR_SUNUS 0x0010000000000000UL /* Schizo */
691 #define SCHIZO_PCIAFSR_BMSK 0x000003ff00000000UL /* Schizo/Tomatillo */
692 #define SCHIZO_PCIAFSR_BLK 0x0000000080000000UL /* Schizo/Tomatillo */
693 #define SCHIZO_PCIAFSR_CFG 0x0000000040000000UL /* Schizo/Tomatillo */
694 #define SCHIZO_PCIAFSR_MEM 0x0000000020000000UL /* Schizo/Tomatillo */
695 #define SCHIZO_PCIAFSR_IO 0x0000000010000000UL /* Schizo/Tomatillo */
697 #define SCHIZO_PCI_CTRL (0x2000UL)
698 #define SCHIZO_PCICTRL_BUS_UNUS (1UL << 63UL) /* Safari */
699 #define SCHIZO_PCICTRL_DTO_INT (1UL << 61UL) /* Tomatillo */
700 #define SCHIZO_PCICTRL_ARB_PRIO (0x1ff << 52UL) /* Tomatillo */
701 #define SCHIZO_PCICTRL_ESLCK (1UL << 51UL) /* Safari */
702 #define SCHIZO_PCICTRL_ERRSLOT (7UL << 48UL) /* Safari */
703 #define SCHIZO_PCICTRL_TTO_ERR (1UL << 38UL) /* Safari/Tomatillo */
704 #define SCHIZO_PCICTRL_RTRY_ERR (1UL << 37UL) /* Safari/Tomatillo */
705 #define SCHIZO_PCICTRL_DTO_ERR (1UL << 36UL) /* Safari/Tomatillo */
706 #define SCHIZO_PCICTRL_SBH_ERR (1UL << 35UL) /* Safari */
707 #define SCHIZO_PCICTRL_SERR (1UL << 34UL) /* Safari/Tomatillo */
708 #define SCHIZO_PCICTRL_PCISPD (1UL << 33UL) /* Safari */
709 #define SCHIZO_PCICTRL_MRM_PREF (1UL << 30UL) /* Tomatillo */
710 #define SCHIZO_PCICTRL_RDO_PREF (1UL << 29UL) /* Tomatillo */
711 #define SCHIZO_PCICTRL_RDL_PREF (1UL << 28UL) /* Tomatillo */
712 #define SCHIZO_PCICTRL_PTO (3UL << 24UL) /* Safari/Tomatillo */
713 #define SCHIZO_PCICTRL_PTO_SHIFT 24UL
714 #define SCHIZO_PCICTRL_TRWSW (7UL << 21UL) /* Tomatillo */
715 #define SCHIZO_PCICTRL_F_TGT_A (1UL << 20UL) /* Tomatillo */
716 #define SCHIZO_PCICTRL_S_DTO_INT (1UL << 19UL) /* Safari */
717 #define SCHIZO_PCICTRL_F_TGT_RT (1UL << 19UL) /* Tomatillo */
718 #define SCHIZO_PCICTRL_SBH_INT (1UL << 18UL) /* Safari */
719 #define SCHIZO_PCICTRL_T_DTO_INT (1UL << 18UL) /* Tomatillo */
720 #define SCHIZO_PCICTRL_EEN (1UL << 17UL) /* Safari/Tomatillo */
721 #define SCHIZO_PCICTRL_PARK (1UL << 16UL) /* Safari/Tomatillo */
722 #define SCHIZO_PCICTRL_PCIRST (1UL << 8UL) /* Safari */
723 #define SCHIZO_PCICTRL_ARB_S (0x3fUL << 0UL) /* Safari */
724 #define SCHIZO_PCICTRL_ARB_T (0xffUL << 0UL) /* Tomatillo */
726 static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm)
728 unsigned long csr_reg, csr, csr_error_bits;
729 irqreturn_t ret = IRQ_NONE;
732 csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL;
733 csr = schizo_read(csr_reg);
735 csr & (SCHIZO_PCICTRL_BUS_UNUS |
736 SCHIZO_PCICTRL_TTO_ERR |
737 SCHIZO_PCICTRL_RTRY_ERR |
738 SCHIZO_PCICTRL_DTO_ERR |
739 SCHIZO_PCICTRL_SBH_ERR |
740 SCHIZO_PCICTRL_SERR);
741 if (csr_error_bits) {
742 /* Clear the errors. */
743 schizo_write(csr_reg, csr);
746 if (csr_error_bits & SCHIZO_PCICTRL_BUS_UNUS)
747 printk("%s: Bus unusable error asserted.\n",
749 if (csr_error_bits & SCHIZO_PCICTRL_TTO_ERR)
750 printk("%s: PCI TRDY# timeout error asserted.\n",
752 if (csr_error_bits & SCHIZO_PCICTRL_RTRY_ERR)
753 printk("%s: PCI excessive retry error asserted.\n",
755 if (csr_error_bits & SCHIZO_PCICTRL_DTO_ERR)
756 printk("%s: PCI discard timeout error asserted.\n",
758 if (csr_error_bits & SCHIZO_PCICTRL_SBH_ERR)
759 printk("%s: PCI streaming byte hole error asserted.\n",
761 if (csr_error_bits & SCHIZO_PCICTRL_SERR)
762 printk("%s: PCI SERR signal asserted.\n",
766 pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat);
767 if (stat & (PCI_STATUS_PARITY |
768 PCI_STATUS_SIG_TARGET_ABORT |
769 PCI_STATUS_REC_TARGET_ABORT |
770 PCI_STATUS_REC_MASTER_ABORT |
771 PCI_STATUS_SIG_SYSTEM_ERROR)) {
772 printk("%s: PCI bus error, PCI_STATUS[%04x]\n",
774 pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff);
780 static irqreturn_t schizo_pcierr_intr(int irq, void *dev_id)
782 struct pci_pbm_info *pbm = dev_id;
783 struct pci_controller_info *p = pbm->parent;
784 unsigned long afsr_reg, afar_reg, base;
785 unsigned long afsr, afar, error_bits;
788 base = pbm->pbm_regs;
790 afsr_reg = base + SCHIZO_PCI_AFSR;
791 afar_reg = base + SCHIZO_PCI_AFAR;
793 /* Latch error status. */
794 afar = schizo_read(afar_reg);
795 afsr = schizo_read(afsr_reg);
797 /* Clear primary/secondary error status bits. */
799 (SCHIZO_PCIAFSR_PMA | SCHIZO_PCIAFSR_PTA |
800 SCHIZO_PCIAFSR_PRTRY | SCHIZO_PCIAFSR_PPERR |
801 SCHIZO_PCIAFSR_PTTO | SCHIZO_PCIAFSR_PUNUS |
802 SCHIZO_PCIAFSR_SMA | SCHIZO_PCIAFSR_STA |
803 SCHIZO_PCIAFSR_SRTRY | SCHIZO_PCIAFSR_SPERR |
804 SCHIZO_PCIAFSR_STTO | SCHIZO_PCIAFSR_SUNUS);
806 return schizo_pcierr_intr_other(pbm);
807 schizo_write(afsr_reg, error_bits);
810 printk("%s: PCI Error, primary error type[%s]\n",
812 (((error_bits & SCHIZO_PCIAFSR_PMA) ?
814 ((error_bits & SCHIZO_PCIAFSR_PTA) ?
816 ((error_bits & SCHIZO_PCIAFSR_PRTRY) ?
817 "Excessive Retries" :
818 ((error_bits & SCHIZO_PCIAFSR_PPERR) ?
820 ((error_bits & SCHIZO_PCIAFSR_PTTO) ?
822 ((error_bits & SCHIZO_PCIAFSR_PUNUS) ?
823 "Bus Unusable" : "???"))))))));
824 printk("%s: bytemask[%04lx] was_block(%d) space(%s)\n",
826 (afsr & SCHIZO_PCIAFSR_BMSK) >> 32UL,
827 (afsr & SCHIZO_PCIAFSR_BLK) ? 1 : 0,
828 ((afsr & SCHIZO_PCIAFSR_CFG) ?
830 ((afsr & SCHIZO_PCIAFSR_MEM) ?
832 ((afsr & SCHIZO_PCIAFSR_IO) ?
834 printk("%s: PCI AFAR [%016lx]\n",
836 printk("%s: PCI Secondary errors [",
839 if (afsr & SCHIZO_PCIAFSR_SMA) {
841 printk("(Master Abort)");
843 if (afsr & SCHIZO_PCIAFSR_STA) {
845 printk("(Target Abort)");
847 if (afsr & SCHIZO_PCIAFSR_SRTRY) {
849 printk("(Excessive Retries)");
851 if (afsr & SCHIZO_PCIAFSR_SPERR) {
853 printk("(Parity Error)");
855 if (afsr & SCHIZO_PCIAFSR_STTO) {
859 if (afsr & SCHIZO_PCIAFSR_SUNUS) {
861 printk("(Bus Unusable)");
867 /* For the error types shown, scan PBM's PCI bus for devices
868 * which have logged that error type.
871 /* If we see a Target Abort, this could be the result of an
872 * IOMMU translation error of some sort. It is extremely
873 * useful to log this information as usually it indicates
874 * a bug in the IOMMU support code or a PCI device driver.
876 if (error_bits & (SCHIZO_PCIAFSR_PTA | SCHIZO_PCIAFSR_STA)) {
877 schizo_check_iommu_error(p, PCI_ERR);
878 pci_scan_for_target_abort(p, pbm, pbm->pci_bus);
880 if (error_bits & (SCHIZO_PCIAFSR_PMA | SCHIZO_PCIAFSR_SMA))
881 pci_scan_for_master_abort(p, pbm, pbm->pci_bus);
883 /* For excessive retries, PSYCHO/PBM will abort the device
884 * and there is no way to specifically check for excessive
885 * retries in the config space status registers. So what
886 * we hope is that we'll catch it via the master/target
890 if (error_bits & (SCHIZO_PCIAFSR_PPERR | SCHIZO_PCIAFSR_SPERR))
891 pci_scan_for_parity_error(p, pbm, pbm->pci_bus);
896 #define SCHIZO_SAFARI_ERRLOG 0x10018UL
898 #define SAFARI_ERRLOG_ERROUT 0x8000000000000000UL
900 #define BUS_ERROR_BADCMD 0x4000000000000000UL /* Schizo/Tomatillo */
901 #define BUS_ERROR_SSMDIS 0x2000000000000000UL /* Safari */
902 #define BUS_ERROR_BADMA 0x1000000000000000UL /* Safari */
903 #define BUS_ERROR_BADMB 0x0800000000000000UL /* Safari */
904 #define BUS_ERROR_BADMC 0x0400000000000000UL /* Safari */
905 #define BUS_ERROR_SNOOP_GR 0x0000000000200000UL /* Tomatillo */
906 #define BUS_ERROR_SNOOP_PCI 0x0000000000100000UL /* Tomatillo */
907 #define BUS_ERROR_SNOOP_RD 0x0000000000080000UL /* Tomatillo */
908 #define BUS_ERROR_SNOOP_RDS 0x0000000000020000UL /* Tomatillo */
909 #define BUS_ERROR_SNOOP_RDSA 0x0000000000010000UL /* Tomatillo */
910 #define BUS_ERROR_SNOOP_OWN 0x0000000000008000UL /* Tomatillo */
911 #define BUS_ERROR_SNOOP_RDO 0x0000000000004000UL /* Tomatillo */
912 #define BUS_ERROR_CPU1PS 0x0000000000002000UL /* Safari */
913 #define BUS_ERROR_WDATA_PERR 0x0000000000002000UL /* Tomatillo */
914 #define BUS_ERROR_CPU1PB 0x0000000000001000UL /* Safari */
915 #define BUS_ERROR_CTRL_PERR 0x0000000000001000UL /* Tomatillo */
916 #define BUS_ERROR_CPU0PS 0x0000000000000800UL /* Safari */
917 #define BUS_ERROR_SNOOP_ERR 0x0000000000000800UL /* Tomatillo */
918 #define BUS_ERROR_CPU0PB 0x0000000000000400UL /* Safari */
919 #define BUS_ERROR_JBUS_ILL_B 0x0000000000000400UL /* Tomatillo */
920 #define BUS_ERROR_CIQTO 0x0000000000000200UL /* Safari */
921 #define BUS_ERROR_LPQTO 0x0000000000000100UL /* Safari */
922 #define BUS_ERROR_JBUS_ILL_C 0x0000000000000100UL /* Tomatillo */
923 #define BUS_ERROR_SFPQTO 0x0000000000000080UL /* Safari */
924 #define BUS_ERROR_UFPQTO 0x0000000000000040UL /* Safari */
925 #define BUS_ERROR_RD_PERR 0x0000000000000040UL /* Tomatillo */
926 #define BUS_ERROR_APERR 0x0000000000000020UL /* Safari/Tomatillo */
927 #define BUS_ERROR_UNMAP 0x0000000000000010UL /* Safari/Tomatillo */
928 #define BUS_ERROR_BUSERR 0x0000000000000004UL /* Safari/Tomatillo */
929 #define BUS_ERROR_TIMEOUT 0x0000000000000002UL /* Safari/Tomatillo */
930 #define BUS_ERROR_ILL 0x0000000000000001UL /* Safari */
932 /* We only expect UNMAP errors here. The rest of the Safari errors
933 * are marked fatal and thus cause a system reset.
935 static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id)
937 struct pci_controller_info *p = dev_id;
940 errlog = schizo_read(p->pbm_B.controller_regs + SCHIZO_SAFARI_ERRLOG);
941 schizo_write(p->pbm_B.controller_regs + SCHIZO_SAFARI_ERRLOG,
942 errlog & ~(SAFARI_ERRLOG_ERROUT));
944 if (!(errlog & BUS_ERROR_UNMAP)) {
945 printk("PCI%d: Unexpected Safari/JBUS error interrupt, errlog[%016lx]\n",
951 printk("PCI%d: Safari/JBUS interrupt, UNMAPPED error, interrogating IOMMUs.\n",
953 schizo_check_iommu_error(p, SAFARI_ERR);
958 /* Nearly identical to PSYCHO equivalents... */
959 #define SCHIZO_ECC_CTRL 0x10020UL
960 #define SCHIZO_ECCCTRL_EE 0x8000000000000000UL /* Enable ECC Checking */
961 #define SCHIZO_ECCCTRL_UE 0x4000000000000000UL /* Enable UE Interrupts */
962 #define SCHIZO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */
964 #define SCHIZO_SAFARI_ERRCTRL 0x10008UL
965 #define SCHIZO_SAFERRCTRL_EN 0x8000000000000000UL
966 #define SCHIZO_SAFARI_IRQCTRL 0x10010UL
967 #define SCHIZO_SAFIRQCTRL_EN 0x8000000000000000UL
969 /* How the Tomatillo IRQs are routed around is pure guesswork here.
971 * All the Tomatillo devices I see in prtconf dumps seem to have only
972 * a single PCI bus unit attached to it. It would seem they are seperate
973 * devices because their PortID (ie. JBUS ID) values are all different
974 * and thus the registers are mapped to totally different locations.
976 * However, two Tomatillo's look "similar" in that the only difference
977 * in their PortID is the lowest bit.
979 * So if we were to ignore this lower bit, it certainly looks like two
980 * PCI bus units of the same Tomatillo. I still have not really
981 * figured this out...
983 static void tomatillo_register_error_handlers(struct pci_controller_info *p)
985 struct pci_pbm_info *pbm;
986 struct of_device *op;
987 u64 tmp, err_mask, err_no_mask;
989 /* Tomatillo IRQ property layout is:
997 pbm = pbm_for_ino(p, SCHIZO_UE_INO);
998 op = of_find_device_by_node(pbm->prom_node);
1000 request_irq(op->irqs[1], schizo_ue_intr, IRQF_SHARED,
1003 pbm = pbm_for_ino(p, SCHIZO_CE_INO);
1004 op = of_find_device_by_node(pbm->prom_node);
1006 request_irq(op->irqs[2], schizo_ce_intr, IRQF_SHARED,
1009 pbm = pbm_for_ino(p, SCHIZO_PCIERR_A_INO);
1010 op = of_find_device_by_node(pbm->prom_node);
1012 request_irq(op->irqs[0], schizo_pcierr_intr, IRQF_SHARED,
1013 "TOMATILLO PCIERR-A", pbm);
1016 pbm = pbm_for_ino(p, SCHIZO_PCIERR_B_INO);
1017 op = of_find_device_by_node(pbm->prom_node);
1019 request_irq(op->irqs[0], schizo_pcierr_intr, IRQF_SHARED,
1020 "TOMATILLO PCIERR-B", pbm);
1022 pbm = pbm_for_ino(p, SCHIZO_SERR_INO);
1023 op = of_find_device_by_node(pbm->prom_node);
1025 request_irq(op->irqs[3], schizo_safarierr_intr, IRQF_SHARED,
1026 "TOMATILLO SERR", p);
1028 /* Enable UE and CE interrupts for controller. */
1029 schizo_write(p->pbm_A.controller_regs + SCHIZO_ECC_CTRL,
1030 (SCHIZO_ECCCTRL_EE |
1032 SCHIZO_ECCCTRL_CE));
1034 schizo_write(p->pbm_B.controller_regs + SCHIZO_ECC_CTRL,
1035 (SCHIZO_ECCCTRL_EE |
1037 SCHIZO_ECCCTRL_CE));
1039 /* Enable PCI Error interrupts and clear error
1042 err_mask = (SCHIZO_PCICTRL_BUS_UNUS |
1043 SCHIZO_PCICTRL_TTO_ERR |
1044 SCHIZO_PCICTRL_RTRY_ERR |
1045 SCHIZO_PCICTRL_SERR |
1046 SCHIZO_PCICTRL_EEN);
1048 err_no_mask = SCHIZO_PCICTRL_DTO_ERR;
1050 tmp = schizo_read(p->pbm_A.pbm_regs + SCHIZO_PCI_CTRL);
1052 tmp &= ~err_no_mask;
1053 schizo_write(p->pbm_A.pbm_regs + SCHIZO_PCI_CTRL, tmp);
1055 tmp = schizo_read(p->pbm_B.pbm_regs + SCHIZO_PCI_CTRL);
1057 tmp &= ~err_no_mask;
1058 schizo_write(p->pbm_B.pbm_regs + SCHIZO_PCI_CTRL, tmp);
1060 err_mask = (SCHIZO_PCIAFSR_PMA | SCHIZO_PCIAFSR_PTA |
1061 SCHIZO_PCIAFSR_PRTRY | SCHIZO_PCIAFSR_PPERR |
1062 SCHIZO_PCIAFSR_PTTO |
1063 SCHIZO_PCIAFSR_SMA | SCHIZO_PCIAFSR_STA |
1064 SCHIZO_PCIAFSR_SRTRY | SCHIZO_PCIAFSR_SPERR |
1065 SCHIZO_PCIAFSR_STTO);
1067 schizo_write(p->pbm_A.pbm_regs + SCHIZO_PCI_AFSR, err_mask);
1068 schizo_write(p->pbm_B.pbm_regs + SCHIZO_PCI_AFSR, err_mask);
1070 err_mask = (BUS_ERROR_BADCMD | BUS_ERROR_SNOOP_GR |
1071 BUS_ERROR_SNOOP_PCI | BUS_ERROR_SNOOP_RD |
1072 BUS_ERROR_SNOOP_RDS | BUS_ERROR_SNOOP_RDSA |
1073 BUS_ERROR_SNOOP_OWN | BUS_ERROR_SNOOP_RDO |
1074 BUS_ERROR_WDATA_PERR | BUS_ERROR_CTRL_PERR |
1075 BUS_ERROR_SNOOP_ERR | BUS_ERROR_JBUS_ILL_B |
1076 BUS_ERROR_JBUS_ILL_C | BUS_ERROR_RD_PERR |
1077 BUS_ERROR_APERR | BUS_ERROR_UNMAP |
1078 BUS_ERROR_BUSERR | BUS_ERROR_TIMEOUT);
1080 schizo_write(p->pbm_A.controller_regs + SCHIZO_SAFARI_ERRCTRL,
1081 (SCHIZO_SAFERRCTRL_EN | err_mask));
1082 schizo_write(p->pbm_B.controller_regs + SCHIZO_SAFARI_ERRCTRL,
1083 (SCHIZO_SAFERRCTRL_EN | err_mask));
1085 schizo_write(p->pbm_A.controller_regs + SCHIZO_SAFARI_IRQCTRL,
1086 (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP)));
1087 schizo_write(p->pbm_B.controller_regs + SCHIZO_SAFARI_IRQCTRL,
1088 (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP)));
1091 static void schizo_register_error_handlers(struct pci_controller_info *p)
1093 struct pci_pbm_info *pbm;
1094 struct of_device *op;
1095 u64 tmp, err_mask, err_no_mask;
1097 /* Schizo IRQ property layout is:
1105 pbm = pbm_for_ino(p, SCHIZO_UE_INO);
1106 op = of_find_device_by_node(pbm->prom_node);
1108 request_irq(op->irqs[1], schizo_ue_intr, IRQF_SHARED,
1111 pbm = pbm_for_ino(p, SCHIZO_CE_INO);
1112 op = of_find_device_by_node(pbm->prom_node);
1114 request_irq(op->irqs[2], schizo_ce_intr, IRQF_SHARED,
1117 pbm = pbm_for_ino(p, SCHIZO_PCIERR_A_INO);
1118 op = of_find_device_by_node(pbm->prom_node);
1120 request_irq(op->irqs[0], schizo_pcierr_intr, IRQF_SHARED,
1121 "SCHIZO PCIERR-A", pbm);
1124 pbm = pbm_for_ino(p, SCHIZO_PCIERR_B_INO);
1125 op = of_find_device_by_node(pbm->prom_node);
1127 request_irq(op->irqs[0], schizo_pcierr_intr, IRQF_SHARED,
1128 "SCHIZO PCIERR-B", pbm);
1130 pbm = pbm_for_ino(p, SCHIZO_SERR_INO);
1131 op = of_find_device_by_node(pbm->prom_node);
1133 request_irq(op->irqs[3], schizo_safarierr_intr, IRQF_SHARED,
1136 /* Enable UE and CE interrupts for controller. */
1137 schizo_write(p->pbm_A.controller_regs + SCHIZO_ECC_CTRL,
1138 (SCHIZO_ECCCTRL_EE |
1140 SCHIZO_ECCCTRL_CE));
1142 err_mask = (SCHIZO_PCICTRL_BUS_UNUS |
1143 SCHIZO_PCICTRL_ESLCK |
1144 SCHIZO_PCICTRL_TTO_ERR |
1145 SCHIZO_PCICTRL_RTRY_ERR |
1146 SCHIZO_PCICTRL_SBH_ERR |
1147 SCHIZO_PCICTRL_SERR |
1148 SCHIZO_PCICTRL_EEN);
1150 err_no_mask = (SCHIZO_PCICTRL_DTO_ERR |
1151 SCHIZO_PCICTRL_SBH_INT);
1153 /* Enable PCI Error interrupts and clear error
1154 * bits for each PBM.
1156 tmp = schizo_read(p->pbm_A.pbm_regs + SCHIZO_PCI_CTRL);
1158 tmp &= ~err_no_mask;
1159 schizo_write(p->pbm_A.pbm_regs + SCHIZO_PCI_CTRL, tmp);
1161 schizo_write(p->pbm_A.pbm_regs + SCHIZO_PCI_AFSR,
1162 (SCHIZO_PCIAFSR_PMA | SCHIZO_PCIAFSR_PTA |
1163 SCHIZO_PCIAFSR_PRTRY | SCHIZO_PCIAFSR_PPERR |
1164 SCHIZO_PCIAFSR_PTTO | SCHIZO_PCIAFSR_PUNUS |
1165 SCHIZO_PCIAFSR_SMA | SCHIZO_PCIAFSR_STA |
1166 SCHIZO_PCIAFSR_SRTRY | SCHIZO_PCIAFSR_SPERR |
1167 SCHIZO_PCIAFSR_STTO | SCHIZO_PCIAFSR_SUNUS));
1169 tmp = schizo_read(p->pbm_B.pbm_regs + SCHIZO_PCI_CTRL);
1171 tmp &= ~err_no_mask;
1172 schizo_write(p->pbm_B.pbm_regs + SCHIZO_PCI_CTRL, tmp);
1174 schizo_write(p->pbm_B.pbm_regs + SCHIZO_PCI_AFSR,
1175 (SCHIZO_PCIAFSR_PMA | SCHIZO_PCIAFSR_PTA |
1176 SCHIZO_PCIAFSR_PRTRY | SCHIZO_PCIAFSR_PPERR |
1177 SCHIZO_PCIAFSR_PTTO | SCHIZO_PCIAFSR_PUNUS |
1178 SCHIZO_PCIAFSR_SMA | SCHIZO_PCIAFSR_STA |
1179 SCHIZO_PCIAFSR_SRTRY | SCHIZO_PCIAFSR_SPERR |
1180 SCHIZO_PCIAFSR_STTO | SCHIZO_PCIAFSR_SUNUS));
1182 /* Make all Safari error conditions fatal except unmapped
1183 * errors which we make generate interrupts.
1185 err_mask = (BUS_ERROR_BADCMD | BUS_ERROR_SSMDIS |
1186 BUS_ERROR_BADMA | BUS_ERROR_BADMB |
1188 BUS_ERROR_CPU1PS | BUS_ERROR_CPU1PB |
1189 BUS_ERROR_CPU0PS | BUS_ERROR_CPU0PB |
1191 BUS_ERROR_LPQTO | BUS_ERROR_SFPQTO |
1192 BUS_ERROR_UFPQTO | BUS_ERROR_APERR |
1193 BUS_ERROR_BUSERR | BUS_ERROR_TIMEOUT |
1196 /* XXX Something wrong with some Excalibur systems
1197 * XXX Sun is shipping. The behavior on a 2-cpu
1198 * XXX machine is that both CPU1 parity error bits
1199 * XXX are set and are immediately set again when
1200 * XXX their error status bits are cleared. Just
1201 * XXX ignore them for now. -DaveM
1203 err_mask &= ~(BUS_ERROR_CPU1PS | BUS_ERROR_CPU1PB |
1204 BUS_ERROR_CPU0PS | BUS_ERROR_CPU0PB);
1207 schizo_write(p->pbm_A.controller_regs + SCHIZO_SAFARI_ERRCTRL,
1208 (SCHIZO_SAFERRCTRL_EN | err_mask));
1210 schizo_write(p->pbm_A.controller_regs + SCHIZO_SAFARI_IRQCTRL,
1211 (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP)));
1214 static void pbm_config_busmastering(struct pci_pbm_info *pbm)
1218 /* Set cache-line size to 64 bytes, this is actually
1219 * a nop but I do it for completeness.
1221 addr = schizo_pci_config_mkaddr(pbm, pbm->pci_first_busno,
1222 0, PCI_CACHE_LINE_SIZE);
1223 pci_config_write8(addr, 64 / sizeof(u32));
1225 /* Set PBM latency timer to 64 PCI clocks. */
1226 addr = schizo_pci_config_mkaddr(pbm, pbm->pci_first_busno,
1227 0, PCI_LATENCY_TIMER);
1228 pci_config_write8(addr, 64);
1231 static void schizo_scan_bus(struct pci_controller_info *p)
1233 pbm_config_busmastering(&p->pbm_B);
1234 p->pbm_B.is_66mhz_capable =
1235 (of_find_property(p->pbm_B.prom_node, "66mhz-capable", NULL)
1237 pbm_config_busmastering(&p->pbm_A);
1238 p->pbm_A.is_66mhz_capable =
1239 (of_find_property(p->pbm_A.prom_node, "66mhz-capable", NULL)
1242 p->pbm_B.pci_bus = pci_scan_one_pbm(&p->pbm_B);
1243 p->pbm_A.pci_bus = pci_scan_one_pbm(&p->pbm_A);
1245 /* After the PCI bus scan is complete, we can register
1246 * the error interrupt handlers.
1248 if (p->pbm_B.chip_type == PBM_CHIP_TYPE_TOMATILLO)
1249 tomatillo_register_error_handlers(p);
1251 schizo_register_error_handlers(p);
1254 static void schizo_base_address_update(struct pci_dev *pdev, int resource)
1256 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
1257 struct resource *res, *root;
1259 int where, size, is_64bit;
1261 res = &pdev->resource[resource];
1263 where = PCI_BASE_ADDRESS_0 + (resource * 4);
1264 } else if (resource == PCI_ROM_RESOURCE) {
1265 where = pdev->rom_base_reg;
1267 /* Somebody might have asked allocation of a non-standard resource */
1272 if (res->flags & IORESOURCE_IO)
1273 root = &pbm->io_space;
1275 root = &pbm->mem_space;
1276 if ((res->flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK)
1277 == PCI_BASE_ADDRESS_MEM_TYPE_64)
1281 size = res->end - res->start;
1282 pci_read_config_dword(pdev, where, ®);
1283 reg = ((reg & size) |
1284 (((u32)(res->start - root->start)) & ~size));
1285 if (resource == PCI_ROM_RESOURCE) {
1286 reg |= PCI_ROM_ADDRESS_ENABLE;
1287 res->flags |= IORESOURCE_ROM_ENABLE;
1289 pci_write_config_dword(pdev, where, reg);
1291 /* This knows that the upper 32-bits of the address
1292 * must be zero. Our PCI common layer enforces this.
1295 pci_write_config_dword(pdev, where + 4, 0);
1298 static void schizo_resource_adjust(struct pci_dev *pdev,
1299 struct resource *res,
1300 struct resource *root)
1302 res->start += root->start;
1303 res->end += root->start;
1306 #define SCHIZO_STRBUF_CONTROL (0x02800UL)
1307 #define SCHIZO_STRBUF_FLUSH (0x02808UL)
1308 #define SCHIZO_STRBUF_FSYNC (0x02810UL)
1309 #define SCHIZO_STRBUF_CTXFLUSH (0x02818UL)
1310 #define SCHIZO_STRBUF_CTXMATCH (0x10000UL)
1312 static void schizo_pbm_strbuf_init(struct pci_pbm_info *pbm)
1314 unsigned long base = pbm->pbm_regs;
1317 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) {
1318 /* TOMATILLO lacks streaming cache. */
1322 /* SCHIZO has context flushing. */
1323 pbm->stc.strbuf_control = base + SCHIZO_STRBUF_CONTROL;
1324 pbm->stc.strbuf_pflush = base + SCHIZO_STRBUF_FLUSH;
1325 pbm->stc.strbuf_fsync = base + SCHIZO_STRBUF_FSYNC;
1326 pbm->stc.strbuf_ctxflush = base + SCHIZO_STRBUF_CTXFLUSH;
1327 pbm->stc.strbuf_ctxmatch_base = base + SCHIZO_STRBUF_CTXMATCH;
1329 pbm->stc.strbuf_flushflag = (volatile unsigned long *)
1330 ((((unsigned long)&pbm->stc.__flushflag_buf[0])
1333 pbm->stc.strbuf_flushflag_pa = (unsigned long)
1334 __pa(pbm->stc.strbuf_flushflag);
1336 /* Turn off LRU locking and diag mode, enable the
1337 * streaming buffer and leave the rerun-disable
1338 * setting however OBP set it.
1340 control = schizo_read(pbm->stc.strbuf_control);
1341 control &= ~(SCHIZO_STRBUF_CTRL_LPTR |
1342 SCHIZO_STRBUF_CTRL_LENAB |
1343 SCHIZO_STRBUF_CTRL_DENAB);
1344 control |= SCHIZO_STRBUF_CTRL_ENAB;
1345 schizo_write(pbm->stc.strbuf_control, control);
1347 pbm->stc.strbuf_enabled = 1;
1350 #define SCHIZO_IOMMU_CONTROL (0x00200UL)
1351 #define SCHIZO_IOMMU_TSBBASE (0x00208UL)
1352 #define SCHIZO_IOMMU_FLUSH (0x00210UL)
1353 #define SCHIZO_IOMMU_CTXFLUSH (0x00218UL)
1355 static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
1357 struct pci_iommu *iommu = pbm->iommu;
1358 unsigned long i, tagbase, database;
1359 struct property *prop;
1360 u32 vdma[2], dma_mask;
1364 prop = of_find_property(pbm->prom_node, "virtual-dma", NULL);
1366 u32 *val = prop->value;
1371 /* No property, use default values. */
1372 vdma[0] = 0xc0000000;
1373 vdma[1] = 0x40000000;
1379 dma_mask |= 0x1fffffff;
1384 dma_mask |= 0x3fffffff;
1389 dma_mask |= 0x7fffffff;
1394 prom_printf("SCHIZO: strange virtual-dma size.\n");
1398 /* Register addresses, SCHIZO has iommu ctx flushing. */
1399 iommu->iommu_control = pbm->pbm_regs + SCHIZO_IOMMU_CONTROL;
1400 iommu->iommu_tsbbase = pbm->pbm_regs + SCHIZO_IOMMU_TSBBASE;
1401 iommu->iommu_flush = pbm->pbm_regs + SCHIZO_IOMMU_FLUSH;
1402 iommu->iommu_ctxflush = pbm->pbm_regs + SCHIZO_IOMMU_CTXFLUSH;
1404 /* We use the main control/status register of SCHIZO as the write
1405 * completion register.
1407 iommu->write_complete_reg = pbm->controller_regs + 0x10000UL;
1410 * Invalidate TLB Entries.
1412 control = schizo_read(iommu->iommu_control);
1413 control |= SCHIZO_IOMMU_CTRL_DENAB;
1414 schizo_write(iommu->iommu_control, control);
1416 tagbase = SCHIZO_IOMMU_TAG, database = SCHIZO_IOMMU_DATA;
1418 for(i = 0; i < 16; i++) {
1419 schizo_write(pbm->pbm_regs + tagbase + (i * 8UL), 0);
1420 schizo_write(pbm->pbm_regs + database + (i * 8UL), 0);
1423 /* Leave diag mode enabled for full-flushing done
1426 pci_iommu_table_init(iommu, tsbsize * 8 * 1024, vdma[0], dma_mask);
1428 schizo_write(iommu->iommu_tsbbase, __pa(iommu->page_table));
1430 control = schizo_read(iommu->iommu_control);
1431 control &= ~(SCHIZO_IOMMU_CTRL_TSBSZ | SCHIZO_IOMMU_CTRL_TBWSZ);
1434 control |= SCHIZO_IOMMU_TSBSZ_64K;
1437 control |= SCHIZO_IOMMU_TSBSZ_128K;
1441 control |= SCHIZO_IOMMU_CTRL_ENAB;
1442 schizo_write(iommu->iommu_control, control);
1445 #define SCHIZO_PCI_IRQ_RETRY (0x1a00UL)
1446 #define SCHIZO_IRQ_RETRY_INF 0xffUL
1448 #define SCHIZO_PCI_DIAG (0x2020UL)
1449 #define SCHIZO_PCIDIAG_D_BADECC (1UL << 10UL) /* Disable BAD ECC errors (Schizo) */
1450 #define SCHIZO_PCIDIAG_D_BYPASS (1UL << 9UL) /* Disable MMU bypass mode (Schizo/Tomatillo) */
1451 #define SCHIZO_PCIDIAG_D_TTO (1UL << 8UL) /* Disable TTO errors (Schizo/Tomatillo) */
1452 #define SCHIZO_PCIDIAG_D_RTRYARB (1UL << 7UL) /* Disable retry arbitration (Schizo) */
1453 #define SCHIZO_PCIDIAG_D_RETRY (1UL << 6UL) /* Disable retry limit (Schizo/Tomatillo) */
1454 #define SCHIZO_PCIDIAG_D_INTSYNC (1UL << 5UL) /* Disable interrupt/DMA synch (Schizo/Tomatillo) */
1455 #define SCHIZO_PCIDIAG_I_DMA_PARITY (1UL << 3UL) /* Invert DMA parity (Schizo/Tomatillo) */
1456 #define SCHIZO_PCIDIAG_I_PIOD_PARITY (1UL << 2UL) /* Invert PIO data parity (Schizo/Tomatillo) */
1457 #define SCHIZO_PCIDIAG_I_PIOA_PARITY (1UL << 1UL) /* Invert PIO address parity (Schizo/Tomatillo) */
1459 #define TOMATILLO_PCI_IOC_CSR (0x2248UL)
1460 #define TOMATILLO_IOC_PART_WPENAB 0x0000000000080000UL
1461 #define TOMATILLO_IOC_RDMULT_PENAB 0x0000000000040000UL
1462 #define TOMATILLO_IOC_RDONE_PENAB 0x0000000000020000UL
1463 #define TOMATILLO_IOC_RDLINE_PENAB 0x0000000000010000UL
1464 #define TOMATILLO_IOC_RDMULT_PLEN 0x000000000000c000UL
1465 #define TOMATILLO_IOC_RDMULT_PLEN_SHIFT 14UL
1466 #define TOMATILLO_IOC_RDONE_PLEN 0x0000000000003000UL
1467 #define TOMATILLO_IOC_RDONE_PLEN_SHIFT 12UL
1468 #define TOMATILLO_IOC_RDLINE_PLEN 0x0000000000000c00UL
1469 #define TOMATILLO_IOC_RDLINE_PLEN_SHIFT 10UL
1470 #define TOMATILLO_IOC_PREF_OFF 0x00000000000003f8UL
1471 #define TOMATILLO_IOC_PREF_OFF_SHIFT 3UL
1472 #define TOMATILLO_IOC_RDMULT_CPENAB 0x0000000000000004UL
1473 #define TOMATILLO_IOC_RDONE_CPENAB 0x0000000000000002UL
1474 #define TOMATILLO_IOC_RDLINE_CPENAB 0x0000000000000001UL
1476 #define TOMATILLO_PCI_IOC_TDIAG (0x2250UL)
1477 #define TOMATILLO_PCI_IOC_DDIAG (0x2290UL)
1479 static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1481 struct property *prop;
1484 schizo_write(pbm->pbm_regs + SCHIZO_PCI_IRQ_RETRY, 5);
1486 tmp = schizo_read(pbm->pbm_regs + SCHIZO_PCI_CTRL);
1488 /* Enable arbiter for all PCI slots. */
1491 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO &&
1492 pbm->chip_version >= 0x2)
1493 tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT;
1495 prop = of_find_property(pbm->prom_node, "no-bus-parking", NULL);
1497 tmp |= SCHIZO_PCICTRL_PARK;
1499 tmp &= ~SCHIZO_PCICTRL_PARK;
1501 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO &&
1502 pbm->chip_version <= 0x1)
1503 tmp |= SCHIZO_PCICTRL_DTO_INT;
1505 tmp &= ~SCHIZO_PCICTRL_DTO_INT;
1507 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO)
1508 tmp |= (SCHIZO_PCICTRL_MRM_PREF |
1509 SCHIZO_PCICTRL_RDO_PREF |
1510 SCHIZO_PCICTRL_RDL_PREF);
1512 schizo_write(pbm->pbm_regs + SCHIZO_PCI_CTRL, tmp);
1514 tmp = schizo_read(pbm->pbm_regs + SCHIZO_PCI_DIAG);
1515 tmp &= ~(SCHIZO_PCIDIAG_D_RTRYARB |
1516 SCHIZO_PCIDIAG_D_RETRY |
1517 SCHIZO_PCIDIAG_D_INTSYNC);
1518 schizo_write(pbm->pbm_regs + SCHIZO_PCI_DIAG, tmp);
1520 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) {
1521 /* Clear prefetch lengths to workaround a bug in
1524 tmp = (TOMATILLO_IOC_PART_WPENAB |
1525 (1 << TOMATILLO_IOC_PREF_OFF_SHIFT) |
1526 TOMATILLO_IOC_RDMULT_CPENAB |
1527 TOMATILLO_IOC_RDONE_CPENAB |
1528 TOMATILLO_IOC_RDLINE_CPENAB);
1530 schizo_write(pbm->pbm_regs + TOMATILLO_PCI_IOC_CSR,
1535 static void schizo_pbm_init(struct pci_controller_info *p,
1536 struct device_node *dp, u32 portid,
1539 struct linux_prom64_registers *regs;
1540 unsigned int *busrange;
1541 struct pci_pbm_info *pbm;
1542 const char *chipset_name;
1546 switch (chip_type) {
1547 case PBM_CHIP_TYPE_TOMATILLO:
1548 chipset_name = "TOMATILLO";
1551 case PBM_CHIP_TYPE_SCHIZO_PLUS:
1552 chipset_name = "SCHIZO+";
1555 case PBM_CHIP_TYPE_SCHIZO:
1557 chipset_name = "SCHIZO";
1561 /* For SCHIZO, three OBP regs:
1562 * 1) PBM controller regs
1563 * 2) Schizo front-end controller regs (same for both PBMs)
1564 * 3) PBM PCI config space
1566 * For TOMATILLO, four OBP regs:
1567 * 1) PBM controller regs
1568 * 2) Tomatillo front-end controller regs
1569 * 3) PBM PCI config space
1572 regs = of_get_property(dp, "reg", NULL);
1574 is_pbm_a = ((regs[0].phys_addr & 0x00700000) == 0x00600000);
1580 pbm->portid = portid;
1582 pbm->prom_node = dp;
1583 pbm->pci_first_slot = 1;
1585 pbm->chip_type = chip_type;
1586 pbm->chip_version = of_getintprop_default(dp, "version#", 0);
1587 pbm->chip_revision = of_getintprop_default(dp, "module-version#", 0);
1589 pbm->pbm_regs = regs[0].phys_addr;
1590 pbm->controller_regs = regs[1].phys_addr - 0x10000UL;
1592 if (chip_type == PBM_CHIP_TYPE_TOMATILLO)
1593 pbm->sync_reg = regs[3].phys_addr + 0x1a18UL;
1595 pbm->name = dp->full_name;
1597 printk("%s: %s PCI Bus Module ver[%x:%x]\n",
1598 pbm->name, chipset_name,
1599 pbm->chip_version, pbm->chip_revision);
1601 schizo_pbm_hw_init(pbm);
1603 pci_determine_mem_io_space(pbm);
1605 ino_bitmap = of_get_property(dp, "ino-bitmap", NULL);
1606 pbm->ino_bitmap = (((u64)ino_bitmap[1] << 32UL) |
1607 ((u64)ino_bitmap[0] << 0UL));
1609 busrange = of_get_property(dp, "bus-range", NULL);
1610 pbm->pci_first_busno = busrange[0];
1611 pbm->pci_last_busno = busrange[1];
1613 schizo_pbm_iommu_init(pbm);
1614 schizo_pbm_strbuf_init(pbm);
1617 static inline int portid_compare(u32 x, u32 y, int chip_type)
1619 if (chip_type == PBM_CHIP_TYPE_TOMATILLO) {
1627 static void __schizo_init(struct device_node *dp, char *model_name, int chip_type)
1629 struct pci_controller_info *p;
1630 struct pci_iommu *iommu;
1633 portid = of_getintprop_default(dp, "portid", 0xff);
1635 for (p = pci_controller_root; p; p = p->next) {
1636 struct pci_pbm_info *pbm;
1638 if (p->pbm_A.prom_node && p->pbm_B.prom_node)
1641 pbm = (p->pbm_A.prom_node ?
1645 if (portid_compare(pbm->portid, portid, chip_type)) {
1646 schizo_pbm_init(p, dp, portid, chip_type);
1651 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
1655 iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
1659 p->pbm_A.iommu = iommu;
1661 iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
1665 p->pbm_B.iommu = iommu;
1667 p->next = pci_controller_root;
1668 pci_controller_root = p;
1670 p->index = pci_num_controllers++;
1671 p->scan_bus = schizo_scan_bus;
1672 p->base_address_update = schizo_base_address_update;
1673 p->resource_adjust = schizo_resource_adjust;
1674 p->pci_ops = &schizo_ops;
1676 /* Like PSYCHO we have a 2GB aligned area for memory space. */
1677 pci_memspace_mask = 0x7fffffffUL;
1679 schizo_pbm_init(p, dp, portid, chip_type);
1683 prom_printf("SCHIZO: Fatal memory allocation error.\n");
1687 void schizo_init(struct device_node *dp, char *model_name)
1689 __schizo_init(dp, model_name, PBM_CHIP_TYPE_SCHIZO);
1692 void schizo_plus_init(struct device_node *dp, char *model_name)
1694 __schizo_init(dp, model_name, PBM_CHIP_TYPE_SCHIZO_PLUS);
1697 void tomatillo_init(struct device_node *dp, char *model_name)
1699 __schizo_init(dp, model_name, PBM_CHIP_TYPE_TOMATILLO);