From patchwork Thu Oct 4 00:39:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 188976 X-Patchwork-Delegate: graeme.russ@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 3C2012C007F for ; Thu, 4 Oct 2012 10:40:57 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9122228258; Thu, 4 Oct 2012 02:40:45 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 nHQyCexoqY7j; Thu, 4 Oct 2012 02:40:45 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C47692822F; Thu, 4 Oct 2012 02:40:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A11F2281F8 for ; Thu, 4 Oct 2012 02:40:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 BKt1Tcbg-JjJ for ; Thu, 4 Oct 2012 02:40:06 +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-wi0-f202.google.com (mail-wi0-f202.google.com [209.85.212.202]) by theia.denx.de (Postfix) with ESMTPS id 2B48B281FD for ; Thu, 4 Oct 2012 02:39:59 +0200 (CEST) Received: by wibhr7 with SMTP id hr7so163518wib.3 for ; Wed, 03 Oct 2012 17:39:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=c0KZ0pvuEMNt436UJk9H2ljWnk231kq6bAxXHYwYjiM=; b=DBodaYy4gj1zzsEABCc5bacoDwycsmhBCf16PdI0X4Mg5IDypsslfYNfSD2myHklHl fHWulwfXJlClxBwsY66hMjdgoeET+9XlPqWU6JS9Eltg1eyitNLkjE1gYOkXrdfVGqPP RcZdPhNS1j3RtfU5iCQLX/gIqw2mi+gxktXheLTE9hDEozt73kS277+rmwbxv1G6dDSD uuKjRV6wDDMVwPU5ZK53gDXFau3lNFeJiEOzcr9HmboQf5AsTlMqkamC6gt7CN7fZXdh w8CV7p3pubJG1fdoz+aAIUfraq6DWa10zVnLXPelVeWN7fy4BpQjvJ1iOhKRnfKBore4 CkeA== Received: by 10.180.94.98 with SMTP id db2mr4113266wib.2.1349311198460; Wed, 03 Oct 2012 17:39:58 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id cx9si615875wib.0.2012.10.03.17.39.58 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 03 Oct 2012 17:39:58 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id CE7C520004E; Wed, 3 Oct 2012 17:39:57 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 2FEB91604A3; Wed, 3 Oct 2012 17:39:57 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 3 Oct 2012 17:39:22 -0700 Message-Id: <1349311168-3524-4-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1349311168-3524-1-git-send-email-sjg@chromium.org> References: <1349311168-3524-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQm/bNnQjdzu8P3ZacWi90AkMhOndsOlvfXbr+eqwujHyxAcislLECT2wL1MBZGVQ1yAufuyB5ttFHnfB24LnB5pNA5ZWpX8qDGGa+ul4Tx89eUXXO9a8y7w07VSgRSpdKEpMl/oObdzM+bUc5iUnW35cS0UAdZrHaiHB+fZGc6mumIgoKkGUvX9tS7Y7RQbT+W7Dqe8 Subject: [U-Boot] [PATCH 3/9] x86: Allow excluding reset handling code from u-boot. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 From: Gabe Black When running from coreboot we don't want this code. This version works by ifdef-ing out all of the code that would go into those sections and all the code that refers to it. The sections are then empty, and the linker will either leave them empty for the loader to ignore or remove them entirely. Signed-off-by: Gabe Black Signed-off-by: Simon Glass --- arch/x86/cpu/resetvec.S | 6 ++++++ arch/x86/cpu/start16.S | 4 ++++ arch/x86/cpu/u-boot.lds | 3 +++ board/chromebook-x86/coreboot/coreboot_start16.S | 6 ++++++ board/eNET/eNET_start16.S | 4 ++++ 5 files changed, 23 insertions(+), 0 deletions(-) diff --git a/arch/x86/cpu/resetvec.S b/arch/x86/cpu/resetvec.S index 44aee5f..5b359ff 100644 --- a/arch/x86/cpu/resetvec.S +++ b/arch/x86/cpu/resetvec.S @@ -25,6 +25,10 @@ /* Reset vector, jumps to start16.S */ +#include + +#ifndef CONFIG_NO_RESET_CODE + .extern start16 .section .resetvec, "ax" @@ -36,3 +40,5 @@ reset_vector: .org 0xf nop + +#endif diff --git a/arch/x86/cpu/start16.S b/arch/x86/cpu/start16.S index cc393ff..d944840 100644 --- a/arch/x86/cpu/start16.S +++ b/arch/x86/cpu/start16.S @@ -28,11 +28,14 @@ #include #include +#include #define BOOT_SEG 0xffff0000 /* linear segment of boot code */ #define a32 .byte 0x67; #define o32 .byte 0x66; +#ifndef CONFIG_NO_RESET_CODE + .section .start16, "ax" .code16 .globl start16 @@ -141,3 +144,4 @@ gdt: .byte 0x93 /* access */ .byte 0xcf /* flags + limit_high */ .byte 0x00 /* base_high */ +#endif diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds index fe28030..2a90a01 100644 --- a/arch/x86/cpu/u-boot.lds +++ b/arch/x86/cpu/u-boot.lds @@ -85,6 +85,8 @@ SECTIONS __bios_start = LOADADDR(.bios); __bios_size = SIZEOF(.bios); +#ifndef CONFIG_NO_RESET_CODE + /* * The following expressions place the 16-bit Real-Mode code and * Reset Vector at the end of the Flash ROM @@ -94,4 +96,5 @@ SECTIONS . = RESET_VEC_LOC; .resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); } +#endif } diff --git a/board/chromebook-x86/coreboot/coreboot_start16.S b/board/chromebook-x86/coreboot/coreboot_start16.S index 9ad06df..6fac3d6 100644 --- a/board/chromebook-x86/coreboot/coreboot_start16.S +++ b/board/chromebook-x86/coreboot/coreboot_start16.S @@ -28,6 +28,10 @@ * that is used by U-boot to its final destination. */ +#include + +#ifndef CONFIG_NO_RESET_CODE + .text .section .start16, "ax" .code16 @@ -35,6 +39,8 @@ board_init16: jmp board_init16_ret +#endif + .section .bios, "ax" .code16 .globl realmode_reset diff --git a/board/eNET/eNET_start16.S b/board/eNET/eNET_start16.S index 5e3f44c..43dda2f 100644 --- a/board/eNET/eNET_start16.S +++ b/board/eNET/eNET_start16.S @@ -32,6 +32,8 @@ #include #include +#ifndef CONFIG_NO_RESET_CODE + .text .section .start16, "ax" .code16 @@ -63,6 +65,8 @@ board_init16: jmp board_init16_ret +#endif + .section .bios, "ax" .code16 .globl realmode_reset