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