x86: Remove old bootmem code
[linux-2.6.git] / arch / blackfin / mach-common / dpmc_modes.S
1 /*
2  * Copyright 2004-2008 Analog Devices Inc.
3  *
4  * Licensed under the GPL-2 or later.
5  */
6
7 #include <linux/linkage.h>
8 #include <asm/blackfin.h>
9 #include <mach/irq.h>
10 #include <asm/dpmc.h>
11
12 .section .l1.text
13
14 ENTRY(_sleep_mode)
15         [--SP] = ( R7:0, P5:0 );
16         [--SP] =  RETS;
17
18         call _set_sic_iwr;
19
20         R0 = 0xFFFF (Z);
21         call _set_rtc_istat;
22
23         P0.H = hi(PLL_CTL);
24         P0.L = lo(PLL_CTL);
25         R1 = W[P0](z);
26         BITSET (R1, 3);
27         W[P0] = R1.L;
28
29         CLI R2;
30         SSYNC;
31         IDLE;
32         STI R2;
33
34         call _test_pll_locked;
35
36         R0 = IWR_ENABLE(0);
37         R1 = IWR_DISABLE_ALL;
38         R2 = IWR_DISABLE_ALL;
39
40         call _set_sic_iwr;
41
42         P0.H = hi(PLL_CTL);
43         P0.L = lo(PLL_CTL);
44         R7 = w[p0](z);
45         BITCLR (R7, 3);
46         BITCLR (R7, 5);
47         w[p0] = R7.L;
48         IDLE;
49         call _test_pll_locked;
50
51         RETS = [SP++];
52         ( R7:0, P5:0 ) = [SP++];
53         RTS;
54 ENDPROC(_sleep_mode)
55
56 ENTRY(_hibernate_mode)
57         [--SP] = ( R7:0, P5:0 );
58         [--SP] =  RETS;
59
60         R3 = R0;
61         R0 = IWR_DISABLE_ALL;
62         R1 = IWR_DISABLE_ALL;
63         R2 = IWR_DISABLE_ALL;
64         call _set_sic_iwr;
65         call _set_dram_srfs;
66         SSYNC;
67
68         R0 = 0xFFFF (Z);
69         call _set_rtc_istat;
70
71         P0.H = hi(VR_CTL);
72         P0.L = lo(VR_CTL);
73
74         W[P0] = R3.L;
75         CLI R2;
76         IDLE;
77 .Lforever:
78         jump .Lforever;
79 ENDPROC(_hibernate_mode)
80
81 ENTRY(_sleep_deeper)
82         [--SP] = ( R7:0, P5:0 );
83         [--SP] =  RETS;
84
85         CLI R4;
86
87         P3 = R0;
88         P4 = R1;
89         P5 = R2;
90
91         R0 = IWR_ENABLE(0);
92         R1 = IWR_DISABLE_ALL;
93         R2 = IWR_DISABLE_ALL;
94
95         call _set_sic_iwr;
96         call _set_dram_srfs;    /* Set SDRAM Self Refresh */
97
98         /* Clear all the interrupts,bits sticky */
99         R0 = 0xFFFF (Z);
100         call _set_rtc_istat;
101         P0.H = hi(PLL_DIV);
102         P0.L = lo(PLL_DIV);
103         R6 = W[P0](z);
104         R0.L = 0xF;
105         W[P0] = R0.l;           /* Set Max VCO to SCLK divider */
106
107         P0.H = hi(PLL_CTL);
108         P0.L = lo(PLL_CTL);
109         R5 = W[P0](z);
110         R0.L = (CONFIG_MIN_VCO_HZ/CONFIG_CLKIN_HZ) << 9;
111         W[P0] = R0.l;           /* Set Min CLKIN to VCO multiplier */
112
113         SSYNC;
114         IDLE;
115
116         call _test_pll_locked;
117
118         P0.H = hi(VR_CTL);
119         P0.L = lo(VR_CTL);
120         R7 = W[P0](z);
121         R1 = 0x6;
122         R1 <<= 16;
123         R2 = 0x0404(Z);
124         R1 = R1|R2;
125
126         R2 = DEPOSIT(R7, R1);
127         W[P0] = R2;             /* Set Min Core Voltage */
128
129         SSYNC;
130         IDLE;
131
132         call _test_pll_locked;
133
134         R0 = P3;
135         R1 = P4;
136         R3 = P5;
137         call _set_sic_iwr;      /* Set Awake from IDLE */
138
139         P0.H = hi(PLL_CTL);
140         P0.L = lo(PLL_CTL);
141         R0 = W[P0](z);
142         BITSET (R0, 3);
143         W[P0] = R0.L;           /* Turn CCLK OFF */
144         SSYNC;
145         IDLE;
146
147         call _test_pll_locked;
148
149         R0 = IWR_ENABLE(0);
150         R1 = IWR_DISABLE_ALL;
151         R2 = IWR_DISABLE_ALL;
152
153         call _set_sic_iwr;      /* Set Awake from IDLE PLL */
154
155         P0.H = hi(VR_CTL);
156         P0.L = lo(VR_CTL);
157         W[P0]= R7;
158
159         SSYNC;
160         IDLE;
161
162         call _test_pll_locked;
163
164         P0.H = hi(PLL_DIV);
165         P0.L = lo(PLL_DIV);
166         W[P0]= R6;              /* Restore CCLK and SCLK divider */
167
168         P0.H = hi(PLL_CTL);
169         P0.L = lo(PLL_CTL);
170         w[p0] = R5;             /* Restore VCO multiplier */
171         IDLE;
172         call _test_pll_locked;
173
174         call _unset_dram_srfs;  /* SDRAM Self Refresh Off */
175
176         STI R4;
177
178         RETS = [SP++];
179         ( R7:0, P5:0 ) = [SP++];
180         RTS;
181 ENDPROC(_sleep_deeper)
182
183 ENTRY(_set_dram_srfs)
184         /*  set the dram to self refresh mode */
185         SSYNC;
186 #if defined(EBIU_RSTCTL)        /* DDR */
187         P0.H = hi(EBIU_RSTCTL);
188         P0.L = lo(EBIU_RSTCTL);
189         R2 = [P0];
190         BITSET(R2, 3); /* SRREQ enter self-refresh mode */
191         [P0] = R2;
192         SSYNC;
193 1:
194         R2 = [P0];
195         CC = BITTST(R2, 4);
196         if !CC JUMP 1b;
197 #else                           /* SDRAM */
198         P0.L = lo(EBIU_SDGCTL);
199         P0.H = hi(EBIU_SDGCTL);
200         R2 = [P0];
201         BITSET(R2, 24); /* SRFS enter self-refresh mode */
202         [P0] = R2;
203         SSYNC;
204
205         P0.L = lo(EBIU_SDSTAT);
206         P0.H = hi(EBIU_SDSTAT);
207 1:
208         R2 = w[P0];
209         SSYNC;
210         cc = BITTST(R2, 1); /* SDSRA poll self-refresh status */
211         if !cc jump 1b;
212
213         P0.L = lo(EBIU_SDGCTL);
214         P0.H = hi(EBIU_SDGCTL);
215         R2 = [P0];
216         BITCLR(R2, 0); /* SCTLE disable CLKOUT */
217         [P0] = R2;
218 #endif
219         RTS;
220 ENDPROC(_set_dram_srfs)
221
222 ENTRY(_unset_dram_srfs)
223         /*  set the dram out of self refresh mode */
224 #if defined(EBIU_RSTCTL)        /* DDR */
225         P0.H = hi(EBIU_RSTCTL);
226         P0.L = lo(EBIU_RSTCTL);
227         R2 = [P0];
228         BITCLR(R2, 3); /* clear SRREQ bit */
229         [P0] = R2;
230 #elif defined(EBIU_SDGCTL)      /* SDRAM */
231
232         P0.L = lo(EBIU_SDGCTL); /* release CLKOUT from self-refresh */
233         P0.H = hi(EBIU_SDGCTL);
234         R2 = [P0];
235         BITSET(R2, 0); /* SCTLE enable CLKOUT */
236         [P0] = R2
237         SSYNC;
238
239         P0.L = lo(EBIU_SDGCTL); /* release SDRAM from self-refresh */
240         P0.H = hi(EBIU_SDGCTL);
241         R2 = [P0];
242         BITCLR(R2, 24); /* clear SRFS bit */
243         [P0] = R2
244 #endif
245         SSYNC;
246         RTS;
247 ENDPROC(_unset_dram_srfs)
248
249 ENTRY(_set_sic_iwr)
250 #if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) || \
251         defined(CONFIG_BF538) || defined(CONFIG_BF539) || defined(CONFIG_BF51x)
252         P0.H = hi(SIC_IWR0);
253         P0.L = lo(SIC_IWR0);
254         P1.H = hi(SIC_IWR1);
255         P1.L = lo(SIC_IWR1);
256         [P1] = R1;
257 #if defined(CONFIG_BF54x)
258         P1.H = hi(SIC_IWR2);
259         P1.L = lo(SIC_IWR2);
260         [P1] = R2;
261 #endif
262 #else
263         P0.H = hi(SIC_IWR);
264         P0.L = lo(SIC_IWR);
265 #endif
266         [P0] = R0;
267
268         SSYNC;
269         RTS;
270 ENDPROC(_set_sic_iwr)
271
272 ENTRY(_set_rtc_istat)
273 #ifndef CONFIG_BF561
274         P0.H = hi(RTC_ISTAT);
275         P0.L = lo(RTC_ISTAT);
276         w[P0] = R0.L;
277         SSYNC;
278 #elif (ANOMALY_05000371)
279         nop;
280         nop;
281         nop;
282         nop;
283 #endif
284         RTS;
285 ENDPROC(_set_rtc_istat)
286
287 ENTRY(_test_pll_locked)
288         P0.H = hi(PLL_STAT);
289         P0.L = lo(PLL_STAT);
290 1:
291         R0 = W[P0] (Z);
292         CC = BITTST(R0,5);
293         IF !CC JUMP 1b;
294         RTS;
295 ENDPROC(_test_pll_locked)
296
297 .section .text
298
299 ENTRY(_do_hibernate)
300         [--SP] = ( R7:0, P5:0 );
301         [--SP] =  RETS;
302         /* Save System MMRs */
303         R2 = R0;
304         P0.H = hi(PLL_CTL);
305         P0.L = lo(PLL_CTL);
306
307 #ifdef SIC_IMASK0
308         PM_SYS_PUSH(SIC_IMASK0)
309 #endif
310 #ifdef SIC_IMASK1
311         PM_SYS_PUSH(SIC_IMASK1)
312 #endif
313 #ifdef SIC_IMASK2
314         PM_SYS_PUSH(SIC_IMASK2)
315 #endif
316 #ifdef SIC_IMASK
317         PM_SYS_PUSH(SIC_IMASK)
318 #endif
319 #ifdef SICA_IMASK0
320         PM_SYS_PUSH(SICA_IMASK0)
321 #endif
322 #ifdef SICA_IMASK1
323         PM_SYS_PUSH(SICA_IMASK1)
324 #endif
325 #ifdef SIC_IAR2
326         PM_SYS_PUSH(SIC_IAR0)
327         PM_SYS_PUSH(SIC_IAR1)
328         PM_SYS_PUSH(SIC_IAR2)
329 #endif
330 #ifdef SIC_IAR3
331         PM_SYS_PUSH(SIC_IAR3)
332 #endif
333 #ifdef SIC_IAR4
334         PM_SYS_PUSH(SIC_IAR4)
335         PM_SYS_PUSH(SIC_IAR5)
336         PM_SYS_PUSH(SIC_IAR6)
337 #endif
338 #ifdef SIC_IAR7
339         PM_SYS_PUSH(SIC_IAR7)
340 #endif
341 #ifdef SIC_IAR8
342         PM_SYS_PUSH(SIC_IAR8)
343         PM_SYS_PUSH(SIC_IAR9)
344         PM_SYS_PUSH(SIC_IAR10)
345         PM_SYS_PUSH(SIC_IAR11)
346 #endif
347
348 #ifdef SICA_IAR0
349         PM_SYS_PUSH(SICA_IAR0)
350         PM_SYS_PUSH(SICA_IAR1)
351         PM_SYS_PUSH(SICA_IAR2)
352         PM_SYS_PUSH(SICA_IAR3)
353         PM_SYS_PUSH(SICA_IAR4)
354         PM_SYS_PUSH(SICA_IAR5)
355         PM_SYS_PUSH(SICA_IAR6)
356         PM_SYS_PUSH(SICA_IAR7)
357 #endif
358
359 #ifdef SIC_IWR
360         PM_SYS_PUSH(SIC_IWR)
361 #endif
362 #ifdef SIC_IWR0
363         PM_SYS_PUSH(SIC_IWR0)
364 #endif
365 #ifdef SIC_IWR1
366         PM_SYS_PUSH(SIC_IWR1)
367 #endif
368 #ifdef SIC_IWR2
369         PM_SYS_PUSH(SIC_IWR2)
370 #endif
371 #ifdef SICA_IWR0
372         PM_SYS_PUSH(SICA_IWR0)
373 #endif
374 #ifdef SICA_IWR1
375         PM_SYS_PUSH(SICA_IWR1)
376 #endif
377
378 #ifdef PINT0_ASSIGN
379         PM_SYS_PUSH(PINT0_MASK_SET)
380         PM_SYS_PUSH(PINT1_MASK_SET)
381         PM_SYS_PUSH(PINT2_MASK_SET)
382         PM_SYS_PUSH(PINT3_MASK_SET)
383         PM_SYS_PUSH(PINT0_ASSIGN)
384         PM_SYS_PUSH(PINT1_ASSIGN)
385         PM_SYS_PUSH(PINT2_ASSIGN)
386         PM_SYS_PUSH(PINT3_ASSIGN)
387         PM_SYS_PUSH(PINT0_INVERT_SET)
388         PM_SYS_PUSH(PINT1_INVERT_SET)
389         PM_SYS_PUSH(PINT2_INVERT_SET)
390         PM_SYS_PUSH(PINT3_INVERT_SET)
391         PM_SYS_PUSH(PINT0_EDGE_SET)
392         PM_SYS_PUSH(PINT1_EDGE_SET)
393         PM_SYS_PUSH(PINT2_EDGE_SET)
394         PM_SYS_PUSH(PINT3_EDGE_SET)
395 #endif
396
397         PM_SYS_PUSH(EBIU_AMBCTL0)
398         PM_SYS_PUSH(EBIU_AMBCTL1)
399         PM_SYS_PUSH16(EBIU_AMGCTL)
400
401 #ifdef EBIU_FCTL
402         PM_SYS_PUSH(EBIU_MBSCTL)
403         PM_SYS_PUSH(EBIU_MODE)
404         PM_SYS_PUSH(EBIU_FCTL)
405 #endif
406
407 #ifdef PORTCIO_FER
408         PM_SYS_PUSH16(PORTCIO_DIR)
409         PM_SYS_PUSH16(PORTCIO_INEN)
410         PM_SYS_PUSH16(PORTCIO)
411         PM_SYS_PUSH16(PORTCIO_FER)
412         PM_SYS_PUSH16(PORTDIO_DIR)
413         PM_SYS_PUSH16(PORTDIO_INEN)
414         PM_SYS_PUSH16(PORTDIO)
415         PM_SYS_PUSH16(PORTDIO_FER)
416         PM_SYS_PUSH16(PORTEIO_DIR)
417         PM_SYS_PUSH16(PORTEIO_INEN)
418         PM_SYS_PUSH16(PORTEIO)
419         PM_SYS_PUSH16(PORTEIO_FER)
420 #endif
421
422         PM_SYS_PUSH16(SYSCR)
423
424         /* Save Core MMRs */
425         P0.H = hi(SRAM_BASE_ADDRESS);
426         P0.L = lo(SRAM_BASE_ADDRESS);
427
428         PM_PUSH(DMEM_CONTROL)
429         PM_PUSH(DCPLB_ADDR0)
430         PM_PUSH(DCPLB_ADDR1)
431         PM_PUSH(DCPLB_ADDR2)
432         PM_PUSH(DCPLB_ADDR3)
433         PM_PUSH(DCPLB_ADDR4)
434         PM_PUSH(DCPLB_ADDR5)
435         PM_PUSH(DCPLB_ADDR6)
436         PM_PUSH(DCPLB_ADDR7)
437         PM_PUSH(DCPLB_ADDR8)
438         PM_PUSH(DCPLB_ADDR9)
439         PM_PUSH(DCPLB_ADDR10)
440         PM_PUSH(DCPLB_ADDR11)
441         PM_PUSH(DCPLB_ADDR12)
442         PM_PUSH(DCPLB_ADDR13)
443         PM_PUSH(DCPLB_ADDR14)
444         PM_PUSH(DCPLB_ADDR15)
445         PM_PUSH(DCPLB_DATA0)
446         PM_PUSH(DCPLB_DATA1)
447         PM_PUSH(DCPLB_DATA2)
448         PM_PUSH(DCPLB_DATA3)
449         PM_PUSH(DCPLB_DATA4)
450         PM_PUSH(DCPLB_DATA5)
451         PM_PUSH(DCPLB_DATA6)
452         PM_PUSH(DCPLB_DATA7)
453         PM_PUSH(DCPLB_DATA8)
454         PM_PUSH(DCPLB_DATA9)
455         PM_PUSH(DCPLB_DATA10)
456         PM_PUSH(DCPLB_DATA11)
457         PM_PUSH(DCPLB_DATA12)
458         PM_PUSH(DCPLB_DATA13)
459         PM_PUSH(DCPLB_DATA14)
460         PM_PUSH(DCPLB_DATA15)
461         PM_PUSH(IMEM_CONTROL)
462         PM_PUSH(ICPLB_ADDR0)
463         PM_PUSH(ICPLB_ADDR1)
464         PM_PUSH(ICPLB_ADDR2)
465         PM_PUSH(ICPLB_ADDR3)
466         PM_PUSH(ICPLB_ADDR4)
467         PM_PUSH(ICPLB_ADDR5)
468         PM_PUSH(ICPLB_ADDR6)
469         PM_PUSH(ICPLB_ADDR7)
470         PM_PUSH(ICPLB_ADDR8)
471         PM_PUSH(ICPLB_ADDR9)
472         PM_PUSH(ICPLB_ADDR10)
473         PM_PUSH(ICPLB_ADDR11)
474         PM_PUSH(ICPLB_ADDR12)
475         PM_PUSH(ICPLB_ADDR13)
476         PM_PUSH(ICPLB_ADDR14)
477         PM_PUSH(ICPLB_ADDR15)
478         PM_PUSH(ICPLB_DATA0)
479         PM_PUSH(ICPLB_DATA1)
480         PM_PUSH(ICPLB_DATA2)
481         PM_PUSH(ICPLB_DATA3)
482         PM_PUSH(ICPLB_DATA4)
483         PM_PUSH(ICPLB_DATA5)
484         PM_PUSH(ICPLB_DATA6)
485         PM_PUSH(ICPLB_DATA7)
486         PM_PUSH(ICPLB_DATA8)
487         PM_PUSH(ICPLB_DATA9)
488         PM_PUSH(ICPLB_DATA10)
489         PM_PUSH(ICPLB_DATA11)
490         PM_PUSH(ICPLB_DATA12)
491         PM_PUSH(ICPLB_DATA13)
492         PM_PUSH(ICPLB_DATA14)
493         PM_PUSH(ICPLB_DATA15)
494         PM_PUSH(EVT0)
495         PM_PUSH(EVT1)
496         PM_PUSH(EVT2)
497         PM_PUSH(EVT3)
498         PM_PUSH(EVT4)
499         PM_PUSH(EVT5)
500         PM_PUSH(EVT6)
501         PM_PUSH(EVT7)
502         PM_PUSH(EVT8)
503         PM_PUSH(EVT9)
504         PM_PUSH(EVT10)
505         PM_PUSH(EVT11)
506         PM_PUSH(EVT12)
507         PM_PUSH(EVT13)
508         PM_PUSH(EVT14)
509         PM_PUSH(EVT15)
510         PM_PUSH(IMASK)
511         PM_PUSH(ILAT)
512         PM_PUSH(IPRIO)
513         PM_PUSH(TCNTL)
514         PM_PUSH(TPERIOD)
515         PM_PUSH(TSCALE)
516         PM_PUSH(TCOUNT)
517         PM_PUSH(TBUFCTL)
518
519         /* Save Core Registers */
520         [--sp] = SYSCFG;
521         [--sp] = ( R7:0, P5:0 );
522         [--sp] = fp;
523         [--sp] = usp;
524
525         [--sp] = i0;
526         [--sp] = i1;
527         [--sp] = i2;
528         [--sp] = i3;
529
530         [--sp] = m0;
531         [--sp] = m1;
532         [--sp] = m2;
533         [--sp] = m3;
534
535         [--sp] = l0;
536         [--sp] = l1;
537         [--sp] = l2;
538         [--sp] = l3;
539
540         [--sp] = b0;
541         [--sp] = b1;
542         [--sp] = b2;
543         [--sp] = b3;
544         [--sp] = a0.x;
545         [--sp] = a0.w;
546         [--sp] = a1.x;
547         [--sp] = a1.w;
548
549         [--sp] = LC0;
550         [--sp] = LC1;
551         [--sp] = LT0;
552         [--sp] = LT1;
553         [--sp] = LB0;
554         [--sp] = LB1;
555
556         [--sp] = ASTAT;
557         [--sp] = CYCLES;
558         [--sp] = CYCLES2;
559
560         [--sp] = RETS;
561         r0 = RETI;
562         [--sp] = r0;
563         [--sp] = RETX;
564         [--sp] = RETN;
565         [--sp] = RETE;
566         [--sp] = SEQSTAT;
567
568         /* Save Magic, return address and Stack Pointer */
569         P0.H = 0;
570         P0.L = 0;
571         R0.H = 0xDEAD;  /* Hibernate Magic */
572         R0.L = 0xBEEF;
573         [P0++] = R0;    /* Store Hibernate Magic */
574         R0.H = .Lpm_resume_here;
575         R0.L = .Lpm_resume_here;
576         [P0++] = R0;    /* Save Return Address */
577         [P0++] = SP;    /* Save Stack Pointer */
578         P0.H = _hibernate_mode;
579         P0.L = _hibernate_mode;
580         R0 = R2;
581         call (P0); /* Goodbye */
582
583 .Lpm_resume_here:
584
585         /* Restore Core Registers */
586         SEQSTAT = [sp++];
587         RETE = [sp++];
588         RETN = [sp++];
589         RETX = [sp++];
590         r0 = [sp++];
591         RETI = r0;
592         RETS = [sp++];
593
594         CYCLES2 = [sp++];
595         CYCLES = [sp++];
596         ASTAT = [sp++];
597
598         LB1 = [sp++];
599         LB0 = [sp++];
600         LT1 = [sp++];
601         LT0 = [sp++];
602         LC1 = [sp++];
603         LC0 = [sp++];
604
605         a1.w = [sp++];
606         a1.x = [sp++];
607         a0.w = [sp++];
608         a0.x = [sp++];
609         b3 = [sp++];
610         b2 = [sp++];
611         b1 = [sp++];
612         b0 = [sp++];
613
614         l3 = [sp++];
615         l2 = [sp++];
616         l1 = [sp++];
617         l0 = [sp++];
618
619         m3 = [sp++];
620         m2 = [sp++];
621         m1 = [sp++];
622         m0 = [sp++];
623
624         i3 = [sp++];
625         i2 = [sp++];
626         i1 = [sp++];
627         i0 = [sp++];
628
629         usp = [sp++];
630         fp = [sp++];
631
632         ( R7 : 0, P5 : 0) = [ SP ++ ];
633         SYSCFG = [sp++];
634
635         /* Restore Core MMRs */
636
637         PM_POP(TBUFCTL)
638         PM_POP(TCOUNT)
639         PM_POP(TSCALE)
640         PM_POP(TPERIOD)
641         PM_POP(TCNTL)
642         PM_POP(IPRIO)
643         PM_POP(ILAT)
644         PM_POP(IMASK)
645         PM_POP(EVT15)
646         PM_POP(EVT14)
647         PM_POP(EVT13)
648         PM_POP(EVT12)
649         PM_POP(EVT11)
650         PM_POP(EVT10)
651         PM_POP(EVT9)
652         PM_POP(EVT8)
653         PM_POP(EVT7)
654         PM_POP(EVT6)
655         PM_POP(EVT5)
656         PM_POP(EVT4)
657         PM_POP(EVT3)
658         PM_POP(EVT2)
659         PM_POP(EVT1)
660         PM_POP(EVT0)
661         PM_POP(ICPLB_DATA15)
662         PM_POP(ICPLB_DATA14)
663         PM_POP(ICPLB_DATA13)
664         PM_POP(ICPLB_DATA12)
665         PM_POP(ICPLB_DATA11)
666         PM_POP(ICPLB_DATA10)
667         PM_POP(ICPLB_DATA9)
668         PM_POP(ICPLB_DATA8)
669         PM_POP(ICPLB_DATA7)
670         PM_POP(ICPLB_DATA6)
671         PM_POP(ICPLB_DATA5)
672         PM_POP(ICPLB_DATA4)
673         PM_POP(ICPLB_DATA3)
674         PM_POP(ICPLB_DATA2)
675         PM_POP(ICPLB_DATA1)
676         PM_POP(ICPLB_DATA0)
677         PM_POP(ICPLB_ADDR15)
678         PM_POP(ICPLB_ADDR14)
679         PM_POP(ICPLB_ADDR13)
680         PM_POP(ICPLB_ADDR12)
681         PM_POP(ICPLB_ADDR11)
682         PM_POP(ICPLB_ADDR10)
683         PM_POP(ICPLB_ADDR9)
684         PM_POP(ICPLB_ADDR8)
685         PM_POP(ICPLB_ADDR7)
686         PM_POP(ICPLB_ADDR6)
687         PM_POP(ICPLB_ADDR5)
688         PM_POP(ICPLB_ADDR4)
689         PM_POP(ICPLB_ADDR3)
690         PM_POP(ICPLB_ADDR2)
691         PM_POP(ICPLB_ADDR1)
692         PM_POP(ICPLB_ADDR0)
693         PM_POP(IMEM_CONTROL)
694         PM_POP(DCPLB_DATA15)
695         PM_POP(DCPLB_DATA14)
696         PM_POP(DCPLB_DATA13)
697         PM_POP(DCPLB_DATA12)
698         PM_POP(DCPLB_DATA11)
699         PM_POP(DCPLB_DATA10)
700         PM_POP(DCPLB_DATA9)
701         PM_POP(DCPLB_DATA8)
702         PM_POP(DCPLB_DATA7)
703         PM_POP(DCPLB_DATA6)
704         PM_POP(DCPLB_DATA5)
705         PM_POP(DCPLB_DATA4)
706         PM_POP(DCPLB_DATA3)
707         PM_POP(DCPLB_DATA2)
708         PM_POP(DCPLB_DATA1)
709         PM_POP(DCPLB_DATA0)
710         PM_POP(DCPLB_ADDR15)
711         PM_POP(DCPLB_ADDR14)
712         PM_POP(DCPLB_ADDR13)
713         PM_POP(DCPLB_ADDR12)
714         PM_POP(DCPLB_ADDR11)
715         PM_POP(DCPLB_ADDR10)
716         PM_POP(DCPLB_ADDR9)
717         PM_POP(DCPLB_ADDR8)
718         PM_POP(DCPLB_ADDR7)
719         PM_POP(DCPLB_ADDR6)
720         PM_POP(DCPLB_ADDR5)
721         PM_POP(DCPLB_ADDR4)
722         PM_POP(DCPLB_ADDR3)
723         PM_POP(DCPLB_ADDR2)
724         PM_POP(DCPLB_ADDR1)
725         PM_POP(DCPLB_ADDR0)
726         PM_POP(DMEM_CONTROL)
727
728         /* Restore System MMRs */
729
730         P0.H = hi(PLL_CTL);
731         P0.L = lo(PLL_CTL);
732         PM_SYS_POP16(SYSCR)
733
734 #ifdef PORTCIO_FER
735         PM_SYS_POP16(PORTEIO_FER)
736         PM_SYS_POP16(PORTEIO)
737         PM_SYS_POP16(PORTEIO_INEN)
738         PM_SYS_POP16(PORTEIO_DIR)
739         PM_SYS_POP16(PORTDIO_FER)
740         PM_SYS_POP16(PORTDIO)
741         PM_SYS_POP16(PORTDIO_INEN)
742         PM_SYS_POP16(PORTDIO_DIR)
743         PM_SYS_POP16(PORTCIO_FER)
744         PM_SYS_POP16(PORTCIO)
745         PM_SYS_POP16(PORTCIO_INEN)
746         PM_SYS_POP16(PORTCIO_DIR)
747 #endif
748
749 #ifdef EBIU_FCTL
750         PM_SYS_POP(EBIU_FCTL)
751         PM_SYS_POP(EBIU_MODE)
752         PM_SYS_POP(EBIU_MBSCTL)
753 #endif
754         PM_SYS_POP16(EBIU_AMGCTL)
755         PM_SYS_POP(EBIU_AMBCTL1)
756         PM_SYS_POP(EBIU_AMBCTL0)
757
758 #ifdef PINT0_ASSIGN
759         PM_SYS_POP(PINT3_EDGE_SET)
760         PM_SYS_POP(PINT2_EDGE_SET)
761         PM_SYS_POP(PINT1_EDGE_SET)
762         PM_SYS_POP(PINT0_EDGE_SET)
763         PM_SYS_POP(PINT3_INVERT_SET)
764         PM_SYS_POP(PINT2_INVERT_SET)
765         PM_SYS_POP(PINT1_INVERT_SET)
766         PM_SYS_POP(PINT0_INVERT_SET)
767         PM_SYS_POP(PINT3_ASSIGN)
768         PM_SYS_POP(PINT2_ASSIGN)
769         PM_SYS_POP(PINT1_ASSIGN)
770         PM_SYS_POP(PINT0_ASSIGN)
771         PM_SYS_POP(PINT3_MASK_SET)
772         PM_SYS_POP(PINT2_MASK_SET)
773         PM_SYS_POP(PINT1_MASK_SET)
774         PM_SYS_POP(PINT0_MASK_SET)
775 #endif
776
777 #ifdef SICA_IWR1
778         PM_SYS_POP(SICA_IWR1)
779 #endif
780 #ifdef SICA_IWR0
781         PM_SYS_POP(SICA_IWR0)
782 #endif
783 #ifdef SIC_IWR2
784         PM_SYS_POP(SIC_IWR2)
785 #endif
786 #ifdef SIC_IWR1
787         PM_SYS_POP(SIC_IWR1)
788 #endif
789 #ifdef SIC_IWR0
790         PM_SYS_POP(SIC_IWR0)
791 #endif
792 #ifdef SIC_IWR
793         PM_SYS_POP(SIC_IWR)
794 #endif
795
796 #ifdef SICA_IAR0
797         PM_SYS_POP(SICA_IAR7)
798         PM_SYS_POP(SICA_IAR6)
799         PM_SYS_POP(SICA_IAR5)
800         PM_SYS_POP(SICA_IAR4)
801         PM_SYS_POP(SICA_IAR3)
802         PM_SYS_POP(SICA_IAR2)
803         PM_SYS_POP(SICA_IAR1)
804         PM_SYS_POP(SICA_IAR0)
805 #endif
806
807 #ifdef SIC_IAR8
808         PM_SYS_POP(SIC_IAR11)
809         PM_SYS_POP(SIC_IAR10)
810         PM_SYS_POP(SIC_IAR9)
811         PM_SYS_POP(SIC_IAR8)
812 #endif
813 #ifdef SIC_IAR7
814         PM_SYS_POP(SIC_IAR7)
815 #endif
816 #ifdef SIC_IAR6
817         PM_SYS_POP(SIC_IAR6)
818         PM_SYS_POP(SIC_IAR5)
819         PM_SYS_POP(SIC_IAR4)
820 #endif
821 #ifdef SIC_IAR3
822         PM_SYS_POP(SIC_IAR3)
823 #endif
824 #ifdef SIC_IAR2
825         PM_SYS_POP(SIC_IAR2)
826         PM_SYS_POP(SIC_IAR1)
827         PM_SYS_POP(SIC_IAR0)
828 #endif
829 #ifdef SICA_IMASK1
830         PM_SYS_POP(SICA_IMASK1)
831 #endif
832 #ifdef SICA_IMASK0
833         PM_SYS_POP(SICA_IMASK0)
834 #endif
835 #ifdef SIC_IMASK
836         PM_SYS_POP(SIC_IMASK)
837 #endif
838 #ifdef SIC_IMASK2
839         PM_SYS_POP(SIC_IMASK2)
840 #endif
841 #ifdef SIC_IMASK1
842         PM_SYS_POP(SIC_IMASK1)
843 #endif
844 #ifdef SIC_IMASK0
845         PM_SYS_POP(SIC_IMASK0)
846 #endif
847
848         [--sp] = RETI;  /* Clear Global Interrupt Disable */
849         SP += 4;
850
851         RETS = [SP++];
852         ( R7:0, P5:0 ) = [SP++];
853         RTS;
854 ENDPROC(_do_hibernate)