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