From: Andrew Bradford Date: Thu, 4 Jun 2015 15:17:11 -0400 Subject: [U-Boot] [PATCH v2 2/3] x86: fsp: Load GDT before calling FspInitEntry In-Reply-To: References: <1433413739-20230-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <20150604191711.GC16990@rhino.kp.kodak.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 06/04 18:28, Bin Meng wrote: > Currently the FSP execution environment GDT is setup by U-Boot in > arch/x86/cpu/start16.S, which works pretty well. But if we try to > move the FspInitEntry call a little bit later to better fit into > U-Boot's initialization sequence, FSP will fail to bring up the AP > due to #GP fault as AP's GDT is duplicated from BSP whose GDT is > now moved into CAR, and unfortunately FSP calls AP initialization > after it disables the CAR. So basically the BSP's GDT still refers > to the one in the CAR, whose content is no longer available, so > when AP starts up and loads its segment register, it blows up. > > To resolve this, we load GDT before calling into FspInitEntry. > The GDT is the same one used in arch/x86/cpu/start16.S, which is > in the ROM and exists forever. > > Signed-off-by: Bin Meng > > --- > > Changes in v2: > - Use CONFIG_RESET_SEG_START to avoid duplication > > arch/x86/cpu/cpu.c | 20 ++++++++++++++++++++ > arch/x86/cpu/start16.S | 1 + > arch/x86/include/asm/u-boot-x86.h | 3 +++ > arch/x86/lib/fsp/fsp_support.c | 3 +++ > 4 files changed, 27 insertions(+) Tested-by: Andrew Bradford