1
/**************************************
3
* copyright @ Motorola, 1999
5
**************************************/
7
#include <ppc_asm.tmpl>
9
#include <asm/processor.h>
11
/*********************************************
12
* function: CoreExtIntEnable
14
* description: Enable 603e core external interrupt
16
* note: mtmsr is context-synchronization
17
**********************************************/
20
.global CoreExtIntEnable
24
ori r3,r3,0x8000 /* enable external interrupt */
29
/*******************************************
30
* function: CoreExtIntDisable
32
* description: Disable 603e core external interrupt
35
*******************************************/
38
.global CoreExtIntDisable
46
andi. r3,r3,0x7fff /* disable external interrupt */
53
/*********************************************************
56
* description: signal the EOI and restore machine status
57
* Input: r3 - value of eumbbar
58
* Output: r3 - value of eumbbar
59
* r4 - ISR vector value
61
********************************************************/
66
lis r5,0x0006 /* Build End Of Interrupt Register offset */
68
xor r7,r7,r7 /* Clear r7 */
69
stwbrx r7,r5,r3 /* Save r7, writing to this register will
70
* intidate the end of processing the
75
/* ---RESTORE MACHINE STATE */
76
mfmsr r13 /* Clear Recoverable Interrupt bit in MSR */
80
andi. r13,r13,0x7ffd /* (and disable interrupts) */
84
lwz r13,0x1c(r1) /* pull ctr */
87
lwz r13,0x18(r1) /* pull xer */
90
lwz r13,0x14(r1) /* pull lr */
93
lwz r13,0x10(r1) /* Pull SRR1 from stack */
94
mtspr SRR1,r13 /* Restore SRR1 */
96
lwz r13,0xc(r1) /* Pull SRR0 from stack */
97
mtspr SRR0,r13 /* Restore SRR0 */
99
lwz r13,0x8(r1) /* Pull User stack pointer from stack */
100
mtspr SPRG1,r13 /* Restore SPRG1 */
102
lwz r4,0x4(r1) /* vector value */
103
lwz r3,0x0(r1) /* eumbbar */
106
addi r1,r1,0x20 /* Deallocate stack */
107
mtspr SPRG0,r1 /* Save updated Supervisor stack pointer */
108
mfspr r1,SPRG1 /* Restore User stack pointer */
112
/***********************************************************
113
* function: exception routine called by exception vector
114
* at 0x500, external interrupt
116
* description: Kahlua EPIC controller
118
* input: r3 - content of eumbbar
119
* output: r3 - ISR return value
120
* r4 - Interrupt vector number
122
***********************************************************/
126
.global epic_exception
130
/*---SAVE MACHINE STATE TO A STACK */
131
mtspr SPRG1,r1 /* Save User stack pointer to SPRG1 */
132
mfspr r1,SPRG0 /* Load Supervisor stack pointer into r1 */
134
stwu r3,-0x20(r1) /* Push the value of eumbbar onto stack */
136
mfspr r3,SPRG1 /* Push User stack pointer onto stack */
138
mfspr r3,SRR0 /* Push SRR0 onto stack */
140
mfspr r3,SRR1 /* Push SRR1 onto stack */
143
stw r3,0x14(r1) /* Push LR */
145
stw r3,0x18(r1) /* Push Xer */
147
stw r3,0x1c(r1) /* Push CTR */
149
mtspr SPRG0,r1 /* Save updated Supervisor stack pointer
153
ori r3,r3,0x0002 /* Set Recoverable Interrupt bit in MSR */
156
/* ---READ IN THE EUMBAR REGISTER */
157
lwz r6,0(r1) /* this is eumbbar */
160
/* ---READ EPIC REGISTER: PROCESSOR INTERRUPT ACKNOWLEDGE REGISTER */
161
lis r5,0x0006 /* Build Interrupt Acknowledge Register
165
lwbrx r7,r5,r6 /* Load interrupt vector into r7 */
168
/* --MASK OFF ALL BITS EXCEPT THE VECTOR */
171
or r3, r3, r6 /* eumbbar in r3 */
172
andi. r4,r7,0x00ff /* Mask off bits, vector in r4 */
174
stw r4,0x04(r1) /* save the vector value */
182
or r30,r30,r3 /* save the r3 which containts the return value from epicISR */
184
/* ---READ IN THE EUMBAR REGISTER */
194
or r3,r3,r30 /* restore the ISR return value */