From patchwork Fri Feb 4 12:35:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 81861 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 B1584B7121 for ; Fri, 4 Feb 2011 23:37:26 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 11EA628318; Fri, 4 Feb 2011 13:36:54 +0100 (CET) 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 8VDE41DYJXbE; Fri, 4 Feb 2011 13:36:53 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 791CE2834C; Fri, 4 Feb 2011 13:36:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 07F8328376 for ; Fri, 4 Feb 2011 13:36:28 +0100 (CET) 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 wM6YVtWWRytY for ; Fri, 4 Feb 2011 13:36:25 +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-gy0-f172.google.com (mail-gy0-f172.google.com [209.85.160.172]) by theia.denx.de (Postfix) with ESMTPS id 062F32831E for ; Fri, 4 Feb 2011 13:36:18 +0100 (CET) Received: by gyd12 with SMTP id 12so991762gyd.3 for ; Fri, 04 Feb 2011 04:36:17 -0800 (PST) Received: by 10.151.42.3 with SMTP id u3mr14513689ybj.122.1296822977197; Fri, 04 Feb 2011 04:36:17 -0800 (PST) Received: from helios.localdomain6 (d122-104-34-241.sbr6.nsw.optusnet.com.au [122.104.34.241]) by mx.google.com with ESMTPS id g27sm398868yhc.8.2011.02.04.04.36.14 (version=SSLv3 cipher=RC4-MD5); Fri, 04 Feb 2011 04:36:16 -0800 (PST) From: Graeme Russ To: u-boot@lists.denx.de Date: Fri, 4 Feb 2011 23:35:31 +1100 Message-Id: <1296822959-3927-5-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.1.422.g049e9 In-Reply-To: <1296822959-3927-1-git-send-email-graeme.russ@gmail.com> References: <1296822959-3927-1-git-send-email-graeme.russ@gmail.com> Subject: [U-Boot] [PATCH 04/32] x86: Parametize values used in linker script X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 Signed-off-by: Graeme Russ --- arch/i386/config.mk | 1 + arch/i386/cpu/config.mk | 6 ++++++ arch/i386/cpu/u-boot.lds | 24 ++++++++---------------- arch/i386/lib/realmode.c | 8 ++++---- board/eNET/config.mk | 1 + 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/i386/config.mk b/arch/i386/config.mk index 77a33dd..5a62a98 100644 --- a/arch/i386/config.mk +++ b/arch/i386/config.mk @@ -32,6 +32,7 @@ PLATFORM_CPPFLAGS += $(call cc-option, -fno-toplevel-reorder, $(call cc-option, PLATFORM_CPPFLAGS += $(call cc-option, -fno-stack-protector) PLATFORM_CPPFLAGS += $(call cc-option, -mpreferred-stack-boundary=2) PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm +PLATFORM_CPPFLAGS += -DREALMODE_BASE=0x7c0 PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden diff --git a/arch/i386/cpu/config.mk b/arch/i386/cpu/config.mk index ec1d102..9b2e2c9 100644 --- a/arch/i386/cpu/config.mk +++ b/arch/i386/cpu/config.mk @@ -24,3 +24,9 @@ CROSS_COMPILE ?= i386-linux- PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__ -march=i386 -Werror + +# DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING! +LDPPFLAGS += -DRESET_SEG_START=0xffff0000 +LDPPFLAGS += -DRESET_SEG_SIZE=0x10000 +LDPPFLAGS += -DRESET_VEC_LOC=0xfff0 +LDPPFLAGS += -DSTART_16=0xf800 diff --git a/arch/i386/cpu/u-boot.lds b/arch/i386/cpu/u-boot.lds index 3eeb2a2..98a548d 100644 --- a/arch/i386/cpu/u-boot.lds +++ b/arch/i386/cpu/u-boot.lds @@ -73,7 +73,7 @@ SECTIONS /DISCARD/ : { *(.gnu*) } /* 16bit realmode trampoline code */ - .realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) } + .realmode REALMODE_BASE : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) } __realmode_start = LOADADDR(.realmode); __realmode_size = SIZEOF(.realmode); @@ -84,21 +84,13 @@ SECTIONS __bios_start = LOADADDR(.bios); __bios_size = SIZEOF(.bios); - /* The load addresses below assumes that the flash - * will be mapped so that 0x387f0000 == 0xffff0000 - * at reset time - * - * The fe00 and ff00 offsets of the start32 and start16 - * segments are arbitrary, the just have to be mapped - * at reset and the code have to fit. - * The fff0 offset of resetvec is important, however. + /* + * The following expressions place the 16-bit Real-Mode code and + * Reset Vector at the end of the Flash ROM */ - . = 0xfffffe00; - .start32 : AT (CONFIG_SYS_TEXT_BASE + 0x3fe00) { KEEP(*(.start32)); } + . = START_16; + .start16 : AT (CONFIG_SYS_TEXT_BASE + (FLASH_SIZE - RESET_SEG_SIZE + START_16)) { KEEP(*(.start16)); } - . = 0xf800; - .start16 : AT (CONFIG_SYS_TEXT_BASE + 0x3f800) { KEEP(*(.start16)); } - - . = 0xfff0; - .resetvec : AT (CONFIG_SYS_TEXT_BASE + 0x3fff0) { KEEP(*(.resetvec)); } + . = RESET_VEC_LOC; + .resetvec : AT (CONFIG_SYS_TEXT_BASE + (FLASH_SIZE - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); } } diff --git a/arch/i386/lib/realmode.c b/arch/i386/lib/realmode.c index 60fe181..2dda95b 100644 --- a/arch/i386/lib/realmode.c +++ b/arch/i386/lib/realmode.c @@ -27,7 +27,6 @@ #include -#define REALMODE_BASE ((char*)0x7c0) #define REALMODE_MAILBOX ((char*)0xe00) @@ -41,13 +40,14 @@ int realmode_setup(void) ulong realmode_size = (ulong)&__realmode_size; /* copy the realmode switch code */ - if (realmode_size > (REALMODE_MAILBOX-REALMODE_BASE)) { + if (realmode_size > (REALMODE_MAILBOX - (char *)REALMODE_BASE)) { printf("realmode switch too large (%ld bytes, max is %d)\n", - realmode_size, (REALMODE_MAILBOX-REALMODE_BASE)); + realmode_size, + (REALMODE_MAILBOX - (char *)REALMODE_BASE)); return -1; } - memcpy(REALMODE_BASE, (void*)realmode_start, realmode_size); + memcpy((char *)REALMODE_BASE, (void *)realmode_start, realmode_size); asm("wbinvd\n"); return 0; diff --git a/board/eNET/config.mk b/board/eNET/config.mk index 4257141..9d2dfa5 100644 --- a/board/eNET/config.mk +++ b/board/eNET/config.mk @@ -21,3 +21,4 @@ # MA 02111-1307 USA # +LDPPFLAGS += -DFLASH_SIZE=0x40000