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