[IA64] Add PAL_VM_SUMMARY/PAL_MEM_ATTRIB to bootloader for SKI
[linux-2.6.git] / arch / ia64 / hp / sim / boot / boot_head.S
1 /*
2  * Copyright (C) 1998-2003 Hewlett-Packard Co
3  *      David Mosberger-Tang <davidm@hpl.hp.com>
4  */
5
6 #include <asm/asmmacro.h>
7 #include <asm/pal.h>
8
9         .bss
10         .align 16
11 stack_mem:
12         .skip 16834
13
14         .text
15
16 /* This needs to be defined because lib/string.c:strlcat() calls it in case of error... */
17 GLOBAL_ENTRY(printk)
18         break 0
19 END(printk)
20
21 GLOBAL_ENTRY(_start)
22         .prologue
23         .save rp, r0
24         .body
25         movl gp = __gp
26         movl sp = stack_mem+16384-16
27         bsw.1
28         br.call.sptk.many rp=start_bootloader
29 END(_start)
30
31 /*
32  * Set a break point on this function so that symbols are available to set breakpoints in
33  * the kernel being debugged.
34  */
35 GLOBAL_ENTRY(debug_break)
36         br.ret.sptk.many b0
37 END(debug_break)
38
39 GLOBAL_ENTRY(ssc)
40         .regstk 5,0,0,0
41         mov r15=in4
42         break 0x80001
43         br.ret.sptk.many b0
44 END(ssc)
45
46 GLOBAL_ENTRY(jmp_to_kernel)
47         .regstk 2,0,0,0
48         mov r28=in0
49         mov b7=in1
50         br.sptk.few b7
51 END(jmp_to_kernel)
52
53 /*
54  * r28 contains the index of the PAL function
55  * r29--31 the args
56  * Return values in ret0--3 (r8--11)
57  */
58 GLOBAL_ENTRY(pal_emulator_static)
59         mov r8=-1
60         mov r9=256
61         ;;
62         cmp.gtu p6,p7=r9,r28            /* r28 <= 255? */
63 (p6)    br.cond.sptk.few static
64         ;;
65         mov r9=512
66         ;;
67         cmp.gtu p6,p7=r9,r28
68 (p6)    br.cond.sptk.few stacked
69         ;;
70 static: cmp.eq p6,p7=PAL_PTCE_INFO,r28
71 (p7)    br.cond.sptk.few 1f
72         ;;
73         mov r8=0                        /* status = 0 */
74         movl r9=0x100000000             /* tc.base */
75         movl r10=0x0000000200000003     /* count[0], count[1] */
76         movl r11=0x1000000000002000     /* stride[0], stride[1] */
77         br.cond.sptk.few rp
78 1:      cmp.eq p6,p7=PAL_FREQ_RATIOS,r28
79 (p7)    br.cond.sptk.few 1f
80         mov r8=0                        /* status = 0 */
81         movl r9 =0x100000064            /* proc_ratio (1/100) */
82         movl r10=0x100000100            /* bus_ratio<<32 (1/256) */
83         movl r11=0x100000064            /* itc_ratio<<32 (1/100) */
84         ;;
85 1:      cmp.eq p6,p7=PAL_RSE_INFO,r28
86 (p7)    br.cond.sptk.few 1f
87         mov r8=0                        /* status = 0 */
88         mov r9=96                       /* num phys stacked */
89         mov r10=0                       /* hints */
90         mov r11=0
91         br.cond.sptk.few rp
92 1:      cmp.eq p6,p7=PAL_CACHE_FLUSH,r28                /* PAL_CACHE_FLUSH */
93 (p7)    br.cond.sptk.few 1f
94         mov r9=ar.lc
95         movl r8=524288                  /* flush 512k million cache lines (16MB) */
96         ;;
97         mov ar.lc=r8
98         movl r8=0xe000000000000000
99         ;;
100 .loop:  fc r8
101         add r8=32,r8
102         br.cloop.sptk.few .loop
103         sync.i
104         ;;
105         srlz.i
106         ;;
107         mov ar.lc=r9
108         mov r8=r0
109         ;;
110 1:      cmp.eq p6,p7=PAL_PERF_MON_INFO,r28
111 (p7)    br.cond.sptk.few 1f
112         mov r8=0                        /* status = 0 */
113         movl r9 =0x08122f04             /* generic=4 width=47 retired=8 cycles=18 */
114         mov r10=0                       /* reserved */
115         mov r11=0                       /* reserved */
116         mov r16=0xffff                  /* implemented PMC */
117         mov r17=0x3ffff                 /* implemented PMD */
118         add r18=8,r29                   /* second index */
119         ;;
120         st8 [r29]=r16,16                /* store implemented PMC */
121         st8 [r18]=r0,16                 /* clear remaining bits  */
122         ;;
123         st8 [r29]=r0,16                 /* clear remaining bits  */
124         st8 [r18]=r0,16                 /* clear remaining bits  */
125         ;;
126         st8 [r29]=r17,16                /* store implemented PMD */
127         st8 [r18]=r0,16                 /* clear remaining bits  */
128         mov r16=0xf0                    /* cycles count capable PMC */
129         ;;
130         st8 [r29]=r0,16                 /* clear remaining bits  */
131         st8 [r18]=r0,16                 /* clear remaining bits  */
132         mov r17=0xf0                    /* retired bundles capable PMC */
133         ;;
134         st8 [r29]=r16,16                /* store cycles capable */
135         st8 [r18]=r0,16                 /* clear remaining bits  */
136         ;;
137         st8 [r29]=r0,16                 /* clear remaining bits  */
138         st8 [r18]=r0,16                 /* clear remaining bits  */
139         ;;
140         st8 [r29]=r17,16                /* store retired bundle capable */
141         st8 [r18]=r0,16                 /* clear remaining bits  */
142         ;;
143         st8 [r29]=r0,16                 /* clear remaining bits  */
144         st8 [r18]=r0,16                 /* clear remaining bits  */
145         ;;
146 1:      cmp.eq p6,p7=PAL_VM_SUMMARY,r28
147 (p7)    br.cond.sptk.few 1f
148         mov     r8=0                    /* status = 0  */
149         movl    r9=0x2044040020F1865    /* num_tc_levels=2, num_unique_tcs=4 */
150                                         /* max_itr_entry=64, max_dtr_entry=64 */
151                                         /* hash_tag_id=2, max_pkr=15 */
152                                         /* key_size=24, phys_add_size=50, vw=1 */
153         movl    r10=0x183C              /* rid_size=24, impl_va_msb=60 */
154         ;;
155 1:      cmp.eq p6,p7=PAL_MEM_ATTRIB,r28
156 (p7)    br.cond.sptk.few 1f
157         mov     r8=0                    /* status = 0 */
158         mov     r9=0x80|0x01            /* NatPage|WB */
159         ;;
160 1:      br.cond.sptk.few rp
161 stacked:
162         br.ret.sptk.few rp
163 END(pal_emulator_static)