145b5a378SSimon Glass /* 245b5a378SSimon Glass * Copyright (c) 2015 Gooogle, Inc 345b5a378SSimon Glass * Written by Simon Glass <sjg@chromium.org> 445b5a378SSimon Glass * 545b5a378SSimon Glass * SPDX-License-Identifier: GPL-2.0+ 645b5a378SSimon Glass */ 745b5a378SSimon Glass 845b5a378SSimon Glass #ifndef _ASM_SIPI_H 945b5a378SSimon Glass #define _ASM_SIPI_H 1045b5a378SSimon Glass 1145b5a378SSimon Glass #define AP_DEFAULT_BASE 0x30000 1245b5a378SSimon Glass #define AP_DEFAULT_SIZE 0x10000 1345b5a378SSimon Glass 1445b5a378SSimon Glass #ifndef __ASSEMBLER__ 1545b5a378SSimon Glass 1645b5a378SSimon Glass /** 1745b5a378SSimon Glass * struct sipi_params_16bit - 16-bit SIPI entry-point parameters 1845b5a378SSimon Glass * 1945b5a378SSimon Glass * These are set up in the same space as the SIPI 16-bit code so that each AP 2045b5a378SSimon Glass * can access the parameters when it boots. 2145b5a378SSimon Glass * 2245b5a378SSimon Glass * Each of these must be set up for the AP to boot, except @segment which is 2345b5a378SSimon Glass * set in the assembly code. 2445b5a378SSimon Glass * 2545b5a378SSimon Glass * @ap_start: 32-bit SIPI entry point for U-Boot 2645b5a378SSimon Glass * @segment: Code segment for U-Boot 2745b5a378SSimon Glass * @pad: Padding (not used) 2845b5a378SSimon Glass * @gdt_limit: U-Boot GDT limit (X86_GDT_SIZE - 1) 2945b5a378SSimon Glass * @gdt: U-Boot GDT (gd->arch.gdt) 3045b5a378SSimon Glass * @unused: Not used 3145b5a378SSimon Glass */ 3245b5a378SSimon Glass struct __packed sipi_params_16bit { 3345b5a378SSimon Glass u32 ap_start; 3445b5a378SSimon Glass u16 segment; 3545b5a378SSimon Glass u16 pad; 3645b5a378SSimon Glass u16 gdt_limit; 3745b5a378SSimon Glass u32 gdt; 3845b5a378SSimon Glass u16 unused; 3945b5a378SSimon Glass }; 4045b5a378SSimon Glass 4145b5a378SSimon Glass /** 4245b5a378SSimon Glass * struct sipi_params - 32-bit SIP entry-point parameters 4345b5a378SSimon Glass * 4445b5a378SSimon Glass * These are used by the AP init code and must be set up before the APs start. 45*d116b53fSSimon Glass * The members must match with the sipi_params layout in sipi_vector.S. 4645b5a378SSimon Glass * 4745b5a378SSimon Glass * The stack area extends down from @stack_top, with @stack_size allocated 4845b5a378SSimon Glass * for each AP. 4945b5a378SSimon Glass * 5045b5a378SSimon Glass * @idt_ptr: Interrupt descriptor table pointer 5145b5a378SSimon Glass * @stack_top: Top of the AP stack area 5245b5a378SSimon Glass * @stack_size: Size of each AP's stack 5345b5a378SSimon Glass * @microcode_lock: Used to ensure only one AP loads microcode at once 5445b5a378SSimon Glass * 0xffffffff enables parallel loading. 5545b5a378SSimon Glass * @microcode_ptr: Pointer to microcode, or 0 if none 5645b5a378SSimon Glass * @msr_table_ptr: Pointer to saved MSRs, a list of struct saved_msr 5745b5a378SSimon Glass * @msr_count: Number of saved MSRs 5845b5a378SSimon Glass * @c_handler: C function to call once early init is complete 5945b5a378SSimon Glass * @ap_count: Shared atomic value to allocate CPU indexes 6045b5a378SSimon Glass */ 6145b5a378SSimon Glass struct sipi_params { 6245b5a378SSimon Glass u32 idt_ptr; 6345b5a378SSimon Glass u32 stack_top; 6445b5a378SSimon Glass u32 stack_size; 6545b5a378SSimon Glass u32 microcode_lock; 6645b5a378SSimon Glass u32 microcode_ptr; 6745b5a378SSimon Glass u32 msr_table_ptr; 6845b5a378SSimon Glass u32 msr_count; 6945b5a378SSimon Glass u32 c_handler; 7045b5a378SSimon Glass atomic_t ap_count; 7145b5a378SSimon Glass }; 7245b5a378SSimon Glass 7345b5a378SSimon Glass /* 16-bit AP entry point */ 7445b5a378SSimon Glass void ap_start16(void); 7545b5a378SSimon Glass 7645b5a378SSimon Glass /* end of 16-bit code/data, marks the region to be copied to SIP vector */ 7745b5a378SSimon Glass void ap_start16_code_end(void); 7845b5a378SSimon Glass 7945b5a378SSimon Glass /* 32-bit AP entry point */ 8045b5a378SSimon Glass void ap_start(void); 8145b5a378SSimon Glass 8245b5a378SSimon Glass extern char sipi_params_16bit[]; 8345b5a378SSimon Glass extern char sipi_params[]; 8445b5a378SSimon Glass 8545b5a378SSimon Glass #endif /* __ASSEMBLER__ */ 8645b5a378SSimon Glass 8745b5a378SSimon Glass #endif 88