From patchwork Mon Aug 3 00:10:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 502960 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D7CDB1402CD for ; Mon, 3 Aug 2015 10:10:48 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=MvhVI7gL; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A61A0A7473; Mon, 3 Aug 2015 02:10:44 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yJ5ncWroE-8g; Mon, 3 Aug 2015 02:10:44 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2BD97A7442; Mon, 3 Aug 2015 02:10:36 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B0BCA4BF6D for ; Mon, 3 Aug 2015 02:10:30 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KuBzR7f2jf9p for ; Mon, 3 Aug 2015 02:10:30 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ig0-f178.google.com (mail-ig0-f178.google.com [209.85.213.178]) by theia.denx.de (Postfix) with ESMTPS id 4C3854BF68 for ; Mon, 3 Aug 2015 02:10:26 +0200 (CEST) Received: by igbij6 with SMTP id ij6so44880312igb.1 for ; Sun, 02 Aug 2015 17:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=w9OTazQwTiyLr5mF/S3L14Axdl0/QmBYJ/bOLAXnvAo=; b=MvhVI7gLRxcenDSxUN+0JuodqW5Tstnmr7Q+ONgWiHiQOqdZFIWXlJVQJS9J8QAfg3 r+1wdgVhANYHX0Od/yeGKhM3S3hnskiXMgAgZHeKc/UIk1j2GM37BGGQ1SduARkaRpjf 0uxQ8XTd4Y+bDMViRV6zKO3ItFkKplxvMpVCCOnXJBBgv++e0V9QDK+zuVSOhQ4Jqyzh /4Wxy+A4CJkps47Xmtj650i6L/jSiqPhmhIQmbEXdlqfkIGOEpKJXDjeBgdQH6w7FrFi fTlaAFTH1AwAcqKkT++hx9X//IdImNanCen1uKpUCdeCBwOEiXMAy2eTcYRov5zQn4Fo 5q+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=w9OTazQwTiyLr5mF/S3L14Axdl0/QmBYJ/bOLAXnvAo=; b=QVnrTXX1Dpb3W16dwMLl5/SdjGwYyj+HO+xcVEn1rJhmqEKvtzvrPCQ666/zt2zPAf 4ouhKRM42SKvBcr9GnJH8bih796s4/sUqunMsfKJcEvl1nent3M8WHI63xQ9vHQlYfkH Iqmrx2aZVx+2IX3wRQyP71mBZNnPmgC836cjAcRfUV1+jhnd+QnIizB1PW3de1vBsZGb vXdbPZbv/LA/ckTeH47tDfYrpQm9rtblgoUq2DmE4wY7KvUq5AQmJel6wOkLplxroTyq O+3QUrIU0G09yOzVXSeGphe/gZrmmxfZR2o+k08b0Egf+xYMVwqdeF7c2ZKlHbBxhaGo cctQ== X-Gm-Message-State: ALoCoQmsloL8T7Hu/7W986+Kcr881HyEre1wg3bmCoAeeHw43mwmIMZVaQmWFRQyVad42oN9CjVM X-Received: by 10.50.73.165 with SMTP id m5mr18999337igv.60.1438560625795; Sun, 02 Aug 2015 17:10:25 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:2963:d53d:d81a:9c37]) by smtp.gmail.com with ESMTPSA id o66sm8895748ioo.5.2015.08.02.17.10.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Aug 2015 17:10:24 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id F0AE2222147; Sun, 2 Aug 2015 18:10:22 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 2 Aug 2015 18:10:11 -0600 Message-Id: <1438560612-29910-5-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.5.0.rc2.392.g76e840b In-Reply-To: <1438560612-29910-1-git-send-email-sjg@chromium.org> References: <1438560612-29910-1-git-send-email-sjg@chromium.org> Cc: Graeme Russ , Tom Rini Subject: [U-Boot] [PATCH 4/5] x86: Move the GDT into global_data X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Rather than keeping track of the Global Descriptor Table in its own memory we may as well put it in global_data with everything else. As a first step, stop using the separately allocated GDT. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/cpu.c | 9 +++++---- arch/x86/include/asm/global_data.h | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 129777c..4f57145 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -136,9 +136,10 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries) asm volatile("lgdtl %0\n" : : "m" (gdt)); } -void setup_gdt(gd_t *id, u64 *gdt_addr) +void setup_gdt(gd_t *new_gd, u64 *gdt_addr) { - id->arch.gdt = gdt_addr; + gdt_addr = new_gd->arch.gdt; + /* CS: code, read/execute, 4 GB, base 0 */ gdt_addr[X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xfffff); @@ -146,9 +147,9 @@ void setup_gdt(gd_t *id, u64 *gdt_addr) gdt_addr[X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff); /* FS: data, read/write, 4 GB, base (Global Data Pointer) */ - id->arch.gd_addr = id; + new_gd->arch.gd_addr = new_gd; gdt_addr[X86_GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0xc093, - (ulong)&id->arch.gd_addr, 0xfffff); + (ulong)&new_gd->arch.gd_addr, 0xfffff); /* 16-bit CS: code, read/execute, 64 kB, base 0 */ gdt_addr[X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x009b, 0, 0x0ffff); diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index f7e3889..35148ab 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -10,6 +10,8 @@ #ifndef __ASSEMBLY__ +#include + enum pei_boot_mode_t { PEI_BOOT_NONE = 0, PEI_BOOT_SOFT_RESET, @@ -44,6 +46,7 @@ struct mtrr_request { /* Architecture-specific global data */ struct arch_global_data { + u64 gdt[X86_GDT_NUM_ENTRIES] __aligned(16); struct global_data *gd_addr; /* Location of Global Data */ uint8_t x86; /* CPU family */ uint8_t x86_vendor; /* CPU vendor */ @@ -68,7 +71,6 @@ struct arch_global_data { /* MRC training data to save for the next boot */ char *mrc_output; unsigned int mrc_output_len; - void *gdt; /* Global descriptor table */ ulong table; /* Table pointer from previous loader */ };