From patchwork Tue Nov 11 01:00:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 409130 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 A947914011B for ; Tue, 11 Nov 2014 12:02:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0370A4B6FE; Tue, 11 Nov 2014 02:01:55 +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 2P6rj-sUN3mz; Tue, 11 Nov 2014 02:01:54 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AD2CD4B727; Tue, 11 Nov 2014 02:01:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 00FAA4B701 for ; Tue, 11 Nov 2014 02:01:20 +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 z7t1eqPJIQEl for ; Tue, 11 Nov 2014 02:01:19 +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-ie0-f202.google.com (mail-ie0-f202.google.com [209.85.223.202]) by theia.denx.de (Postfix) with ESMTPS id 6EC274B708 for ; Tue, 11 Nov 2014 02:01:16 +0100 (CET) Received: by mail-ie0-f202.google.com with SMTP id tr6so1547951ieb.1 for ; Mon, 10 Nov 2014 17:01:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6igatDBXuhbnsMF9cRv2I0M01iH6b0z/pVxrMJ/q3/Y=; b=NfqS1iC+4dE5FyHZwntQTdrFVnxGfTerCERCpK3jCr0inYb/cr92Dqw9jx5HVTXNxP w5VtbMPthNFcWzdwLp5KiL+KcftUi6mIDYVIfHXsrzeaXiDhL9ugnE0GDxFtuFw5ftzu fGb9fbLv+ZtaaQFOYuDLHAJiLqkNJzOT7geMZyu286awRKcafVtx0jiQ+XU1J9+X0mrX 2eNPvLUJuUy4v1sKdhL/KjsTnZaXe8xUnEeioYYFed0MvcTKlnsquiMMmmNyX1K15x3H 0f6RMIzTBP4VksKD9d+08/UF9C7jAZ+0MIsjYYpqV3hJiHlcYUp9B+0TLJOk4tmIvfvt 0weg== X-Gm-Message-State: ALoCoQmMLgWMPnM9GicJprykS9pgEGRlhgO8ApMRyYoHsnqLT3HejnmiaOwiJqcmRh4J0ynPrpdE X-Received: by 10.182.130.162 with SMTP id of2mr29820866obb.33.1415667675055; Mon, 10 Nov 2014 17:01:15 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id s23si751012yhf.0.2014.11.10.17.01.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Nov 2014 17:01:15 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id eQGdGIgS.1; Mon, 10 Nov 2014 17:01:14 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id E760D2211FB; Mon, 10 Nov 2014 18:01:13 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 10 Nov 2014 18:00:24 -0700 Message-Id: <1415667650-14899-8-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1415667650-14899-1-git-send-email-sjg@chromium.org> References: <1415667650-14899-1-git-send-email-sjg@chromium.org> Cc: Graeme Russ Subject: [U-Boot] [PATCH v2 07/33] x86: Add processor functions to halt and get stack pointer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add a function to get the stack pointer and another to halt the CPU. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Remove the cpuid functions since they were already added in another patch arch/x86/include/asm/processor.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index bb3172f..b2854a9 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -30,4 +30,23 @@ enum { #define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE) +#ifndef __ASSEMBLY__ + +static inline __attribute__((always_inline)) void cpu_hlt(void) +{ + asm("hlt"); +} + +static inline ulong cpu_get_sp(void) +{ + ulong result; + + asm volatile( + "mov %%esp, %%eax" + : "=a" (result)); + return result; +} + +#endif /* __ASSEMBLY__ */ + #endif