11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * Macintosh interrupts 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * General design: 51da177e4SLinus Torvalds * In contrary to the Amiga and Atari platforms, the Mac hardware seems to 61da177e4SLinus Torvalds * exclusively use the autovector interrupts (the 'generic level0-level7' 71da177e4SLinus Torvalds * interrupts with exception vectors 0x19-0x1f). The following interrupt levels 81da177e4SLinus Torvalds * are used: 91da177e4SLinus Torvalds * 1 - VIA1 101da177e4SLinus Torvalds * - slot 0: one second interrupt (CA2) 111da177e4SLinus Torvalds * - slot 1: VBlank (CA1) 121da177e4SLinus Torvalds * - slot 2: ADB data ready (SR full) 131da177e4SLinus Torvalds * - slot 3: ADB data (CB2) 141da177e4SLinus Torvalds * - slot 4: ADB clock (CB1) 151da177e4SLinus Torvalds * - slot 5: timer 2 161da177e4SLinus Torvalds * - slot 6: timer 1 171da177e4SLinus Torvalds * - slot 7: status of IRQ; signals 'any enabled int.' 181da177e4SLinus Torvalds * 191da177e4SLinus Torvalds * 2 - VIA2 or RBV 201da177e4SLinus Torvalds * - slot 0: SCSI DRQ (CA2) 211da177e4SLinus Torvalds * - slot 1: NUBUS IRQ (CA1) need to read port A to find which 221da177e4SLinus Torvalds * - slot 2: /EXP IRQ (only on IIci) 231da177e4SLinus Torvalds * - slot 3: SCSI IRQ (CB2) 241da177e4SLinus Torvalds * - slot 4: ASC IRQ (CB1) 251da177e4SLinus Torvalds * - slot 5: timer 2 (not on IIci) 261da177e4SLinus Torvalds * - slot 6: timer 1 (not on IIci) 271da177e4SLinus Torvalds * - slot 7: status of IRQ; signals 'any enabled int.' 281da177e4SLinus Torvalds * 291da177e4SLinus Torvalds * 2 - OSS (IIfx only?) 301da177e4SLinus Torvalds * - slot 0: SCSI interrupt 311da177e4SLinus Torvalds * - slot 1: Sound interrupt 321da177e4SLinus Torvalds * 331da177e4SLinus Torvalds * Levels 3-6 vary by machine type. For VIA or RBV Macintoshes: 341da177e4SLinus Torvalds * 351da177e4SLinus Torvalds * 3 - unused (?) 361da177e4SLinus Torvalds * 37*80614e5aSFinn Thain * 4 - SCC 381da177e4SLinus Torvalds * 391da177e4SLinus Torvalds * 5 - unused (?) 401da177e4SLinus Torvalds * [serial errors or special conditions seem to raise level 6 411da177e4SLinus Torvalds * interrupts on some models (LC4xx?)] 421da177e4SLinus Torvalds * 431da177e4SLinus Torvalds * 6 - off switch (?) 441da177e4SLinus Torvalds * 451da177e4SLinus Torvalds * For OSS Macintoshes (IIfx only at this point): 461da177e4SLinus Torvalds * 471da177e4SLinus Torvalds * 3 - Nubus interrupt 481da177e4SLinus Torvalds * - slot 0: Slot $9 491da177e4SLinus Torvalds * - slot 1: Slot $A 501da177e4SLinus Torvalds * - slot 2: Slot $B 511da177e4SLinus Torvalds * - slot 3: Slot $C 521da177e4SLinus Torvalds * - slot 4: Slot $D 531da177e4SLinus Torvalds * - slot 5: Slot $E 541da177e4SLinus Torvalds * 551da177e4SLinus Torvalds * 4 - SCC IOP 561da177e4SLinus Torvalds * 571da177e4SLinus Torvalds * 5 - ISM IOP (ADB?) 581da177e4SLinus Torvalds * 591da177e4SLinus Torvalds * 6 - unused 601da177e4SLinus Torvalds * 611da177e4SLinus Torvalds * For PSC Macintoshes (660AV, 840AV): 621da177e4SLinus Torvalds * 631da177e4SLinus Torvalds * 3 - PSC level 3 641da177e4SLinus Torvalds * - slot 0: MACE 651da177e4SLinus Torvalds * 661da177e4SLinus Torvalds * 4 - PSC level 4 671da177e4SLinus Torvalds * - slot 1: SCC channel A interrupt 681da177e4SLinus Torvalds * - slot 2: SCC channel B interrupt 691da177e4SLinus Torvalds * - slot 3: MACE DMA 701da177e4SLinus Torvalds * 711da177e4SLinus Torvalds * 5 - PSC level 5 721da177e4SLinus Torvalds * 731da177e4SLinus Torvalds * 6 - PSC level 6 741da177e4SLinus Torvalds * 751da177e4SLinus Torvalds * Finally we have good 'ole level 7, the non-maskable interrupt: 761da177e4SLinus Torvalds * 771da177e4SLinus Torvalds * 7 - NMI (programmer's switch on the back of some Macs) 781da177e4SLinus Torvalds * Also RAM parity error on models which support it (IIc, IIfx?) 791da177e4SLinus Torvalds * 801da177e4SLinus Torvalds * The current interrupt logic looks something like this: 811da177e4SLinus Torvalds * 821da177e4SLinus Torvalds * - We install dispatchers for the autovector interrupts (1-7). These 831da177e4SLinus Torvalds * dispatchers are responsible for querying the hardware (the 841da177e4SLinus Torvalds * VIA/RBV/OSS/PSC chips) to determine the actual interrupt source. Using 851da177e4SLinus Torvalds * this information a machspec interrupt number is generated by placing the 861da177e4SLinus Torvalds * index of the interrupt hardware into the low three bits and the original 871da177e4SLinus Torvalds * autovector interrupt number in the upper 5 bits. The handlers for the 881da177e4SLinus Torvalds * resulting machspec interrupt are then called. 891da177e4SLinus Torvalds * 901da177e4SLinus Torvalds * - Nubus is a special case because its interrupts are hidden behind two 911da177e4SLinus Torvalds * layers of hardware. Nubus interrupts come in as index 1 on VIA #2, 921da177e4SLinus Torvalds * which translates to IRQ number 17. In this spot we install _another_ 931da177e4SLinus Torvalds * dispatcher. This dispatcher finds the interrupting slot number (9-F) and 941da177e4SLinus Torvalds * then forms a new machspec interrupt number as above with the slot number 951da177e4SLinus Torvalds * minus 9 in the low three bits and the pseudo-level 7 in the upper five 961da177e4SLinus Torvalds * bits. The handlers for this new machspec interrupt number are then 971da177e4SLinus Torvalds * called. This puts Nubus interrupts into the range 56-62. 981da177e4SLinus Torvalds * 991da177e4SLinus Torvalds * - The Baboon interrupts (used on some PowerBooks) are an even more special 1001da177e4SLinus Torvalds * case. They're hidden behind the Nubus slot $C interrupt thus adding a 1011da177e4SLinus Torvalds * third layer of indirection. Why oh why did the Apple engineers do that? 1021da177e4SLinus Torvalds * 1031da177e4SLinus Torvalds * - We support "fast" and "slow" handlers, just like the Amiga port. The 1041da177e4SLinus Torvalds * fast handlers are called first and with all interrupts disabled. They 1051da177e4SLinus Torvalds * are expected to execute quickly (hence the name). The slow handlers are 1061da177e4SLinus Torvalds * called last with interrupts enabled and the interrupt level restored. 1071da177e4SLinus Torvalds * They must therefore be reentrant. 1081da177e4SLinus Torvalds * 1091da177e4SLinus Torvalds * TODO: 1101da177e4SLinus Torvalds * 1111da177e4SLinus Torvalds */ 1121da177e4SLinus Torvalds 11366a3f820SAl Viro #include <linux/module.h> 1141da177e4SLinus Torvalds #include <linux/types.h> 1151da177e4SLinus Torvalds #include <linux/kernel.h> 1161da177e4SLinus Torvalds #include <linux/sched.h> 1171da177e4SLinus Torvalds #include <linux/kernel_stat.h> 1181da177e4SLinus Torvalds #include <linux/interrupt.h> /* for intr_count */ 1191da177e4SLinus Torvalds #include <linux/delay.h> 1201da177e4SLinus Torvalds #include <linux/seq_file.h> 1211da177e4SLinus Torvalds 1221da177e4SLinus Torvalds #include <asm/system.h> 1231da177e4SLinus Torvalds #include <asm/irq.h> 1241da177e4SLinus Torvalds #include <asm/traps.h> 1251da177e4SLinus Torvalds #include <asm/bootinfo.h> 1261da177e4SLinus Torvalds #include <asm/macintosh.h> 1271da177e4SLinus Torvalds #include <asm/mac_via.h> 1281da177e4SLinus Torvalds #include <asm/mac_psc.h> 1291da177e4SLinus Torvalds #include <asm/hwtest.h> 1301da177e4SLinus Torvalds #include <asm/errno.h> 1311da177e4SLinus Torvalds #include <asm/macints.h> 1322850bc27SAl Viro #include <asm/irq_regs.h> 133c85627fbSGeert Uytterhoeven #include <asm/mac_oss.h> 1341da177e4SLinus Torvalds 1351da177e4SLinus Torvalds #define SHUTUP_SONIC 1361da177e4SLinus Torvalds 1371da177e4SLinus Torvalds /* 1381da177e4SLinus Torvalds * VIA/RBV hooks 1391da177e4SLinus Torvalds */ 1401da177e4SLinus Torvalds 1411da177e4SLinus Torvalds extern void via_register_interrupts(void); 1421da177e4SLinus Torvalds extern void via_irq_enable(int); 1431da177e4SLinus Torvalds extern void via_irq_disable(int); 1441da177e4SLinus Torvalds extern void via_irq_clear(int); 1451da177e4SLinus Torvalds extern int via_irq_pending(int); 1461da177e4SLinus Torvalds 1471da177e4SLinus Torvalds /* 1481da177e4SLinus Torvalds * OSS hooks 1491da177e4SLinus Torvalds */ 1501da177e4SLinus Torvalds 1511da177e4SLinus Torvalds extern void oss_register_interrupts(void); 1521da177e4SLinus Torvalds extern void oss_irq_enable(int); 1531da177e4SLinus Torvalds extern void oss_irq_disable(int); 1541da177e4SLinus Torvalds extern void oss_irq_clear(int); 1551da177e4SLinus Torvalds extern int oss_irq_pending(int); 1561da177e4SLinus Torvalds 1571da177e4SLinus Torvalds /* 1581da177e4SLinus Torvalds * PSC hooks 1591da177e4SLinus Torvalds */ 1601da177e4SLinus Torvalds 1611da177e4SLinus Torvalds extern void psc_register_interrupts(void); 1621da177e4SLinus Torvalds extern void psc_irq_enable(int); 1631da177e4SLinus Torvalds extern void psc_irq_disable(int); 1641da177e4SLinus Torvalds extern void psc_irq_clear(int); 1651da177e4SLinus Torvalds extern int psc_irq_pending(int); 1661da177e4SLinus Torvalds 1671da177e4SLinus Torvalds /* 1681da177e4SLinus Torvalds * IOP hooks 1691da177e4SLinus Torvalds */ 1701da177e4SLinus Torvalds 1711da177e4SLinus Torvalds extern void iop_register_interrupts(void); 1721da177e4SLinus Torvalds 1731da177e4SLinus Torvalds /* 1741da177e4SLinus Torvalds * Baboon hooks 1751da177e4SLinus Torvalds */ 1761da177e4SLinus Torvalds 1771da177e4SLinus Torvalds extern int baboon_present; 1781da177e4SLinus Torvalds 1791da177e4SLinus Torvalds extern void baboon_register_interrupts(void); 1801da177e4SLinus Torvalds extern void baboon_irq_enable(int); 1811da177e4SLinus Torvalds extern void baboon_irq_disable(int); 1821da177e4SLinus Torvalds extern void baboon_irq_clear(int); 1831da177e4SLinus Torvalds 1841da177e4SLinus Torvalds /* 1851da177e4SLinus Torvalds * console_loglevel determines NMI handler function 1861da177e4SLinus Torvalds */ 1871da177e4SLinus Torvalds 1882850bc27SAl Viro irqreturn_t mac_nmi_handler(int, void *); 1892850bc27SAl Viro irqreturn_t mac_debug_handler(int, void *); 1901da177e4SLinus Torvalds 1911da177e4SLinus Torvalds /* #define DEBUG_MACINTS */ 1921da177e4SLinus Torvalds 193746e8d3bSFinn Thain void mac_enable_irq(unsigned int irq); 194746e8d3bSFinn Thain void mac_disable_irq(unsigned int irq); 1959c5f4afdSRoman Zippel 1969c5f4afdSRoman Zippel static struct irq_controller mac_irq_controller = { 1979c5f4afdSRoman Zippel .name = "mac", 198241258d1SMilind Arun Choudhary .lock = __SPIN_LOCK_UNLOCKED(mac_irq_controller.lock), 1999c5f4afdSRoman Zippel .enable = mac_enable_irq, 2009c5f4afdSRoman Zippel .disable = mac_disable_irq, 2019c5f4afdSRoman Zippel }; 2029c5f4afdSRoman Zippel 20366a3f820SAl Viro void __init mac_init_IRQ(void) 2041da177e4SLinus Torvalds { 2051da177e4SLinus Torvalds #ifdef DEBUG_MACINTS 2061da177e4SLinus Torvalds printk("mac_init_IRQ(): Setting things up...\n"); 2071da177e4SLinus Torvalds #endif 2089c5f4afdSRoman Zippel m68k_setup_irq_controller(&mac_irq_controller, IRQ_USER, 2099c5f4afdSRoman Zippel NUM_MAC_SOURCES - IRQ_USER); 2101da177e4SLinus Torvalds /* Make sure the SONIC interrupt is cleared or things get ugly */ 2111da177e4SLinus Torvalds #ifdef SHUTUP_SONIC 2121da177e4SLinus Torvalds printk("Killing onboard sonic... "); 2131da177e4SLinus Torvalds /* This address should hopefully be mapped already */ 2141da177e4SLinus Torvalds if (hwreg_present((void*)(0x50f0a000))) { 2151da177e4SLinus Torvalds *(long *)(0x50f0a014) = 0x7fffL; 2161da177e4SLinus Torvalds *(long *)(0x50f0a010) = 0L; 2171da177e4SLinus Torvalds } 2181da177e4SLinus Torvalds printk("Done.\n"); 2191da177e4SLinus Torvalds #endif /* SHUTUP_SONIC */ 2201da177e4SLinus Torvalds 2211da177e4SLinus Torvalds /* 2221da177e4SLinus Torvalds * Now register the handlers for the master IRQ handlers 2231da177e4SLinus Torvalds * at levels 1-7. Most of the work is done elsewhere. 2241da177e4SLinus Torvalds */ 2251da177e4SLinus Torvalds 2269c5f4afdSRoman Zippel if (oss_present) 2271da177e4SLinus Torvalds oss_register_interrupts(); 2289c5f4afdSRoman Zippel else 2291da177e4SLinus Torvalds via_register_interrupts(); 2309c5f4afdSRoman Zippel if (psc_present) 2319c5f4afdSRoman Zippel psc_register_interrupts(); 2329c5f4afdSRoman Zippel if (baboon_present) 2339c5f4afdSRoman Zippel baboon_register_interrupts(); 2341da177e4SLinus Torvalds iop_register_interrupts(); 23592c3dd15SGeert Uytterhoeven if (request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI", 23692c3dd15SGeert Uytterhoeven mac_nmi_handler)) 23792c3dd15SGeert Uytterhoeven pr_err("Couldn't register NMI\n"); 2381da177e4SLinus Torvalds #ifdef DEBUG_MACINTS 2391da177e4SLinus Torvalds printk("mac_init_IRQ(): Done!\n"); 2401da177e4SLinus Torvalds #endif 2411da177e4SLinus Torvalds } 2421da177e4SLinus Torvalds 2431da177e4SLinus Torvalds /* 2441da177e4SLinus Torvalds * mac_enable_irq - enable an interrupt source 2451da177e4SLinus Torvalds * mac_disable_irq - disable an interrupt source 2461da177e4SLinus Torvalds * mac_clear_irq - clears a pending interrupt 2471da177e4SLinus Torvalds * mac_pending_irq - Returns the pending status of an IRQ (nonzero = pending) 2481da177e4SLinus Torvalds * 2491da177e4SLinus Torvalds * These routines are just dispatchers to the VIA/OSS/PSC routines. 2501da177e4SLinus Torvalds */ 2511da177e4SLinus Torvalds 252746e8d3bSFinn Thain void mac_enable_irq(unsigned int irq) 2531da177e4SLinus Torvalds { 2541da177e4SLinus Torvalds int irq_src = IRQ_SRC(irq); 2551da177e4SLinus Torvalds 2561da177e4SLinus Torvalds switch(irq_src) { 2579c5f4afdSRoman Zippel case 1: 2581da177e4SLinus Torvalds via_irq_enable(irq); 2599c5f4afdSRoman Zippel break; 2609c5f4afdSRoman Zippel case 2: 2619c5f4afdSRoman Zippel case 7: 2629c5f4afdSRoman Zippel if (oss_present) 2639c5f4afdSRoman Zippel oss_irq_enable(irq); 2649c5f4afdSRoman Zippel else 2659c5f4afdSRoman Zippel via_irq_enable(irq); 2661da177e4SLinus Torvalds break; 2671da177e4SLinus Torvalds case 3: 2681da177e4SLinus Torvalds case 5: 2699c5f4afdSRoman Zippel case 6: 2709c5f4afdSRoman Zippel if (psc_present) 2711da177e4SLinus Torvalds psc_irq_enable(irq); 2729c5f4afdSRoman Zippel else if (oss_present) 2731da177e4SLinus Torvalds oss_irq_enable(irq); 274*80614e5aSFinn Thain break; 275*80614e5aSFinn Thain case 4: 276*80614e5aSFinn Thain if (psc_present) 277*80614e5aSFinn Thain psc_irq_enable(irq); 2781da177e4SLinus Torvalds break; 2799c5f4afdSRoman Zippel case 8: 2809c5f4afdSRoman Zippel if (baboon_present) 2811da177e4SLinus Torvalds baboon_irq_enable(irq); 2821da177e4SLinus Torvalds break; 2831da177e4SLinus Torvalds } 2841da177e4SLinus Torvalds } 2851da177e4SLinus Torvalds 286746e8d3bSFinn Thain void mac_disable_irq(unsigned int irq) 2871da177e4SLinus Torvalds { 2881da177e4SLinus Torvalds int irq_src = IRQ_SRC(irq); 2891da177e4SLinus Torvalds 2901da177e4SLinus Torvalds switch(irq_src) { 2919c5f4afdSRoman Zippel case 1: 2929c5f4afdSRoman Zippel via_irq_disable(irq); 2931da177e4SLinus Torvalds break; 2941da177e4SLinus Torvalds case 2: 2959c5f4afdSRoman Zippel case 7: 2969c5f4afdSRoman Zippel if (oss_present) 2971da177e4SLinus Torvalds oss_irq_disable(irq); 2989c5f4afdSRoman Zippel else 2991da177e4SLinus Torvalds via_irq_disable(irq); 3001da177e4SLinus Torvalds break; 3011da177e4SLinus Torvalds case 3: 3021da177e4SLinus Torvalds case 5: 3039c5f4afdSRoman Zippel case 6: 3049c5f4afdSRoman Zippel if (psc_present) 3051da177e4SLinus Torvalds psc_irq_disable(irq); 3069c5f4afdSRoman Zippel else if (oss_present) 3071da177e4SLinus Torvalds oss_irq_disable(irq); 308*80614e5aSFinn Thain break; 309*80614e5aSFinn Thain case 4: 310*80614e5aSFinn Thain if (psc_present) 311*80614e5aSFinn Thain psc_irq_disable(irq); 3121da177e4SLinus Torvalds break; 3139c5f4afdSRoman Zippel case 8: 3149c5f4afdSRoman Zippel if (baboon_present) 3151da177e4SLinus Torvalds baboon_irq_disable(irq); 3161da177e4SLinus Torvalds break; 3171da177e4SLinus Torvalds } 3181da177e4SLinus Torvalds } 3191da177e4SLinus Torvalds 3201da177e4SLinus Torvalds void mac_clear_irq(unsigned int irq) 3211da177e4SLinus Torvalds { 3221da177e4SLinus Torvalds switch(IRQ_SRC(irq)) { 3239c5f4afdSRoman Zippel case 1: 3249c5f4afdSRoman Zippel via_irq_clear(irq); 3251da177e4SLinus Torvalds break; 3261da177e4SLinus Torvalds case 2: 3279c5f4afdSRoman Zippel case 7: 3289c5f4afdSRoman Zippel if (oss_present) 3291da177e4SLinus Torvalds oss_irq_clear(irq); 3309c5f4afdSRoman Zippel else 3311da177e4SLinus Torvalds via_irq_clear(irq); 3321da177e4SLinus Torvalds break; 3331da177e4SLinus Torvalds case 3: 3341da177e4SLinus Torvalds case 5: 3359c5f4afdSRoman Zippel case 6: 3369c5f4afdSRoman Zippel if (psc_present) 3371da177e4SLinus Torvalds psc_irq_clear(irq); 3389c5f4afdSRoman Zippel else if (oss_present) 3391da177e4SLinus Torvalds oss_irq_clear(irq); 3401da177e4SLinus Torvalds break; 341*80614e5aSFinn Thain case 4: 342*80614e5aSFinn Thain if (psc_present) 343*80614e5aSFinn Thain psc_irq_clear(irq); 344*80614e5aSFinn Thain break; 3459c5f4afdSRoman Zippel case 8: 3469c5f4afdSRoman Zippel if (baboon_present) 3471da177e4SLinus Torvalds baboon_irq_clear(irq); 3481da177e4SLinus Torvalds break; 3491da177e4SLinus Torvalds } 3501da177e4SLinus Torvalds } 3511da177e4SLinus Torvalds 3521da177e4SLinus Torvalds int mac_irq_pending(unsigned int irq) 3531da177e4SLinus Torvalds { 3541da177e4SLinus Torvalds switch(IRQ_SRC(irq)) { 3559c5f4afdSRoman Zippel case 1: 3561da177e4SLinus Torvalds return via_irq_pending(irq); 3579c5f4afdSRoman Zippel case 2: 3589c5f4afdSRoman Zippel case 7: 3599c5f4afdSRoman Zippel if (oss_present) 3601da177e4SLinus Torvalds return oss_irq_pending(irq); 3619c5f4afdSRoman Zippel else 3629c5f4afdSRoman Zippel return via_irq_pending(irq); 3631da177e4SLinus Torvalds case 3: 3641da177e4SLinus Torvalds case 5: 3659c5f4afdSRoman Zippel case 6: 3669c5f4afdSRoman Zippel if (psc_present) 3679c5f4afdSRoman Zippel return psc_irq_pending(irq); 3689c5f4afdSRoman Zippel else if (oss_present) 3699c5f4afdSRoman Zippel return oss_irq_pending(irq); 370*80614e5aSFinn Thain break; 371*80614e5aSFinn Thain case 4: 372*80614e5aSFinn Thain if (psc_present) 373*80614e5aSFinn Thain psc_irq_pending(irq); 374*80614e5aSFinn Thain break; 3751da177e4SLinus Torvalds } 3761da177e4SLinus Torvalds return 0; 3771da177e4SLinus Torvalds } 37866a3f820SAl Viro EXPORT_SYMBOL(mac_irq_pending); 3791da177e4SLinus Torvalds 3801da177e4SLinus Torvalds static int num_debug[8]; 3811da177e4SLinus Torvalds 3822850bc27SAl Viro irqreturn_t mac_debug_handler(int irq, void *dev_id) 3831da177e4SLinus Torvalds { 3841da177e4SLinus Torvalds if (num_debug[irq] < 10) { 3851da177e4SLinus Torvalds printk("DEBUG: Unexpected IRQ %d\n", irq); 3861da177e4SLinus Torvalds num_debug[irq]++; 3871da177e4SLinus Torvalds } 3881da177e4SLinus Torvalds return IRQ_HANDLED; 3891da177e4SLinus Torvalds } 3901da177e4SLinus Torvalds 3911da177e4SLinus Torvalds static int in_nmi; 3921da177e4SLinus Torvalds static volatile int nmi_hold; 3931da177e4SLinus Torvalds 3942850bc27SAl Viro irqreturn_t mac_nmi_handler(int irq, void *dev_id) 3951da177e4SLinus Torvalds { 3961da177e4SLinus Torvalds int i; 3971da177e4SLinus Torvalds /* 3981da177e4SLinus Torvalds * generate debug output on NMI switch if 'debug' kernel option given 3991da177e4SLinus Torvalds * (only works with Penguin!) 4001da177e4SLinus Torvalds */ 4011da177e4SLinus Torvalds 4021da177e4SLinus Torvalds in_nmi++; 4031da177e4SLinus Torvalds for (i=0; i<100; i++) 4041da177e4SLinus Torvalds udelay(1000); 4051da177e4SLinus Torvalds 4061da177e4SLinus Torvalds if (in_nmi == 1) { 4071da177e4SLinus Torvalds nmi_hold = 1; 4081da177e4SLinus Torvalds printk("... pausing, press NMI to resume ..."); 4091da177e4SLinus Torvalds } else { 4101da177e4SLinus Torvalds printk(" ok!\n"); 4111da177e4SLinus Torvalds nmi_hold = 0; 4121da177e4SLinus Torvalds } 4131da177e4SLinus Torvalds 4141da177e4SLinus Torvalds barrier(); 4151da177e4SLinus Torvalds 4161da177e4SLinus Torvalds while (nmi_hold == 1) 4171da177e4SLinus Torvalds udelay(1000); 4181da177e4SLinus Torvalds 4191da177e4SLinus Torvalds if (console_loglevel >= 8) { 4201da177e4SLinus Torvalds #if 0 4212850bc27SAl Viro struct pt_regs *fp = get_irq_regs(); 4221da177e4SLinus Torvalds show_state(); 4231da177e4SLinus Torvalds printk("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp); 4241da177e4SLinus Torvalds printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n", 4251da177e4SLinus Torvalds fp->d0, fp->d1, fp->d2, fp->d3); 4261da177e4SLinus Torvalds printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", 4271da177e4SLinus Torvalds fp->d4, fp->d5, fp->a0, fp->a1); 4281da177e4SLinus Torvalds 4291da177e4SLinus Torvalds if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page) 4301da177e4SLinus Torvalds printk("Corrupted stack page\n"); 4311da177e4SLinus Torvalds printk("Process %s (pid: %d, stackpage=%08lx)\n", 4321da177e4SLinus Torvalds current->comm, current->pid, current->kernel_stack_page); 4331da177e4SLinus Torvalds if (intr_count == 1) 4341da177e4SLinus Torvalds dump_stack((struct frame *)fp); 4351da177e4SLinus Torvalds #else 4361da177e4SLinus Torvalds /* printk("NMI "); */ 4371da177e4SLinus Torvalds #endif 4381da177e4SLinus Torvalds } 4391da177e4SLinus Torvalds in_nmi--; 4401da177e4SLinus Torvalds return IRQ_HANDLED; 4411da177e4SLinus Torvalds } 442