xref: /openbmc/u-boot/arch/x86/include/asm/sipi.h (revision ebce73f0)
1 /*
2  * Copyright (c) 2015 Gooogle, Inc
3  * Written by Simon Glass <sjg@chromium.org>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef _ASM_SIPI_H
9 #define _ASM_SIPI_H
10 
11 #define AP_DEFAULT_BASE 0x30000
12 #define AP_DEFAULT_SIZE 0x10000
13 
14 #ifndef __ASSEMBLER__
15 
16 /**
17  * struct sipi_params_16bit - 16-bit SIPI entry-point parameters
18  *
19  * These are set up in the same space as the SIPI 16-bit code so that each AP
20  * can access the parameters when it boots.
21  *
22  * Each of these must be set up for the AP to boot, except @segment which is
23  * set in the assembly code.
24  *
25  * @ap_start:		32-bit SIPI entry point for U-Boot
26  * @segment:		Code segment for U-Boot
27  * @pad:		Padding (not used)
28  * @gdt_limit:		U-Boot GDT limit (X86_GDT_SIZE - 1)
29  * @gdt:		U-Boot GDT (gd->arch.gdt)
30  * @unused:		Not used
31  */
32 struct __packed sipi_params_16bit {
33 	u32 ap_start;
34 	u16 segment;
35 	u16 pad;
36 	u16 gdt_limit;
37 	u32 gdt;
38 	u16 unused;
39 };
40 
41 /**
42  * struct sipi_params - 32-bit SIP entry-point parameters
43  *
44  * These are used by the AP init code and must be set up before the APs start.
45  * The members must match with the sipi_params layout in sipi_vector.S.
46  *
47  * The stack area extends down from @stack_top, with @stack_size allocated
48  * for each AP.
49  *
50  * @idt_ptr:		Interrupt descriptor table pointer
51  * @stack_top:		Top of the AP stack area
52  * @stack_size:		Size of each AP's stack
53  * @microcode_lock:	Used to ensure only one AP loads microcode at once
54  *			0xffffffff enables parallel loading.
55  * @microcode_ptr:	Pointer to microcode, or 0 if none
56  * @msr_table_ptr:	Pointer to saved MSRs, a list of struct saved_msr
57  * @msr_count:		Number of saved MSRs
58  * @c_handler:		C function to call once early init is complete
59  * @ap_count:		Shared atomic value to allocate CPU indexes
60  */
61 struct sipi_params {
62 	u32 idt_ptr;
63 	u32 stack_top;
64 	u32 stack_size;
65 	u32 microcode_lock;
66 	u32 microcode_ptr;
67 	u32 msr_table_ptr;
68 	u32 msr_count;
69 	u32 c_handler;
70 	atomic_t ap_count;
71 };
72 
73 /* 16-bit AP entry point */
74 void ap_start16(void);
75 
76 /* end of 16-bit code/data, marks the region to be copied to SIP vector */
77 void ap_start16_code_end(void);
78 
79 /* 32-bit AP entry point */
80 void ap_start(void);
81 
82 extern char sipi_params_16bit[];
83 extern char sipi_params[];
84 
85 #endif /* __ASSEMBLER__ */
86 
87 #endif
88