From patchwork Sat Nov 19 20:25:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 696927 X-Patchwork-Delegate: bmeng.cn@gmail.com 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 3tLmlZ3cTtz9sfH for ; Sun, 20 Nov 2016 07:33:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="at3Q7++8"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6DAD4B38D2; Sat, 19 Nov 2016 21:30:41 +0100 (CET) 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 lzRlGNaYIa2d; Sat, 19 Nov 2016 21:30:41 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 62A0EB38D3; Sat, 19 Nov 2016 21:28:45 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6485DA75B7 for ; Sat, 19 Nov 2016 21:28:31 +0100 (CET) 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 QP3uGIJBHQ1K for ; Sat, 19 Nov 2016 21:28:31 +0100 (CET) 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-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by theia.denx.de (Postfix) with ESMTPS id 0F37EA762D for ; Sat, 19 Nov 2016 21:27:11 +0100 (CET) Received: by mail-oi0-f53.google.com with SMTP id v84so123546960oie.3 for ; Sat, 19 Nov 2016 12:27:11 -0800 (PST) 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=uLKgdYjN8vQIVaUKVyFHllGk4G8PPYuNu7N3CZYRRRE=; b=at3Q7++8eOwT0S2ba1o0cGCiTlUuXHvCBmugRIw4XhjV4A6/eGWR0Y/6iVuBWRSsKN tcJeGMSvYN3g3fTqupsPq0mOyI9OEQVaMgCzqZHM8leTjiK17slLdq4637xn1CD76c99 ZQiWsM4NIvlP8RWsPwE5XDvplOW6H5fJRbE7vxX9Z3kRgsur3sWboxcea+7PYw2DG+6B g/HmwNi0ctksSWX6iBJnEgJ0n8k4GQWDYepzX0hvDNyFb1zTBT8HHxCkj0krKhyBJav5 8RJ3JG3ljvWJ5Yt4hw+pIAI9Cm0lYrzCOTNwMpMPcabQk++gwRJvf7MO2N50DivMMBnO 4spA== 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=uLKgdYjN8vQIVaUKVyFHllGk4G8PPYuNu7N3CZYRRRE=; b=Vduu4vW+nJSw23d5JLvPvzWz6/tPfGQMKDwtsOjb1bZ3OdpwgASmLMKUoGyndVHnf3 5p6PgalIKOnoRj3jqGLNY8exdjO+ryekRChOyfwZF6yILJHTavAO33TMSf3Ord7/z44M 9s6yOoiQPqZHpoZVQm0PvSjMRvUA7lW/GDoGfThb/R+zkUGCHoLsbKuF4pcrkXw91Zgc 4denF1/7oebZiszv4F237jBVNwaVYUqMRy0s/crCTBr6D6qTwEgeCkIzTGnKSBQpiDKd aR1LYv26Bz5vKFIHMIdOyjTClmimepDoF91JTY5KHdYeApryLiXuHdlSLHLrqhSeVma/ r+vA== X-Gm-Message-State: AKaTC01C+x/T7VKistGUeSE2X0PgXFfJfmFT4gnu7I/SLrWKyQcCNbpXQPrk/iLCVtNx1luA X-Received: by 10.202.49.210 with SMTP id x201mr845453oix.129.1479587230534; Sat, 19 Nov 2016 12:27:10 -0800 (PST) Received: from kaki.bld.corp.google.com ([2620:0:10f2:12:28b9:cda2:f7f2:e7b8]) by smtp.gmail.com with ESMTPSA id s51sm4543117otb.31.2016.11.19.12.27.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Nov 2016 12:27:10 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 9A811403A3; Sat, 19 Nov 2016 13:27:09 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Sat, 19 Nov 2016 13:25:23 -0700 Message-Id: <1479587152-25065-35-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1479587152-25065-1-git-send-email-sjg@chromium.org> References: <1479587152-25065-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH v2 34/63] x86: Support global_data on x86_64 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" At present this is just an ordinary variable. We may consider making it a fixed register in the future. Signed-off-by: Simon Glass --- Changes in v2: None arch/x86/cpu/x86_64/cpu.c | 13 +++++++++++++ arch/x86/include/asm/global_data.h | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c index c1d3788..da2ad11 100644 --- a/arch/x86/cpu/x86_64/cpu.c +++ b/arch/x86/cpu/x86_64/cpu.c @@ -8,6 +8,19 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + +/* Global declaration of gd */ +struct global_data *global_data_ptr; + +void arch_setup_gd(gd_t *new_gd) +{ + global_data_ptr = new_gd; + + /* TODO(sjg@chromium.org): Why is this needed? */ + printch(' '); +} + int cpu_has_64bit(void) { return true; diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index 7434f77..ce9e5cc 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -104,7 +104,7 @@ struct arch_global_data { #include #ifndef __ASSEMBLY__ -# ifdef CONFIG_EFI_APP +# if defined(CONFIG_EFI_APP) || CONFIG_IS_ENABLED(X86_64) #define gd global_data_ptr @@ -114,7 +114,11 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void) { gd_t *gd_ptr; +#if CONFIG_IS_ENABLED(X86_64) + asm volatile("fs mov 0, %0\n" : "=r" (gd_ptr)); +#else asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr)); +#endif return gd_ptr; }