1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #include <xen/init.h>
3 #include <xen/lib.h>
4 #include <xen/mm.h>
5 #include <xen/shutdown.h>
6 
7 #include <public/version.h>
8 #include <asm/boot.h>
9 #include <asm/early_printk.h>
10 #include <asm/mm.h>
11 #include <asm/processor.h>
12 
13 /* Xen stack for bringing up the first CPU. */
14 unsigned char __initdata cpu0_boot_stack[STACK_SIZE] __aligned(STACK_SIZE);
15 
setup_exceptions(void)16 void setup_exceptions(void)
17 {
18     unsigned long lpcr;
19 
20     /* Set appropriate interrupt location in LPCR */
21     lpcr = mfspr(SPRN_LPCR);
22     mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
23 }
24 
start_xen(unsigned long r3,unsigned long r4,unsigned long r5,unsigned long r6,unsigned long r7)25 void __init noreturn start_xen(unsigned long r3, unsigned long r4,
26                                unsigned long r5, unsigned long r6,
27                                unsigned long r7)
28 {
29     if ( r5 )
30     {
31         /* Unsupported OpenFirmware boot protocol */
32         __builtin_trap();
33     }
34     else
35     {
36         /* kexec boot protocol */
37         boot_opal_init((void *)r3);
38     }
39 
40     setup_exceptions();
41 
42     setup_initial_pagetables();
43 
44     init_constructors();
45 
46     early_printk("Hello, ppc64le!\n");
47 
48     machine_halt();
49 }
50