From patchwork Sat Nov 5 02:21:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 123793 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 5CA30B6F9F for ; Sat, 5 Nov 2011 13:22:39 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 34BD429AF0; Sat, 5 Nov 2011 03:22:36 +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 WzLhWjIABkvQ; Sat, 5 Nov 2011 03:22:35 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 050452982A; Sat, 5 Nov 2011 03:22:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 55C2C28ABE for ; Sat, 5 Nov 2011 03:22:09 +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 x10pDF4c2iFa for ; Sat, 5 Nov 2011 03:22:07 +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-iy0-f172.google.com (mail-iy0-f172.google.com [209.85.210.172]) by theia.denx.de (Postfix) with ESMTPS id 641FF289A7 for ; Sat, 5 Nov 2011 03:22:05 +0100 (CET) Received: by iaeo4 with SMTP id o4so3297296iae.3 for ; Fri, 04 Nov 2011 19:22:03 -0700 (PDT) Received: by 10.42.19.195 with SMTP id d3mr20285551icb.21.1320459723215; Fri, 04 Nov 2011 19:22:03 -0700 (PDT) Received: from localhost.localdomain (d122-104-32-210.sbr6.nsw.optusnet.com.au. [122.104.32.210]) by mx.google.com with ESMTPS id t5sm14414001pbb.13.2011.11.04.19.22.01 (version=SSLv3 cipher=OTHER); Fri, 04 Nov 2011 19:22:02 -0700 (PDT) From: Graeme Russ To: u-boot@lists.denx.de Date: Sat, 5 Nov 2011 13:21:46 +1100 Message-Id: <1320459711-20257-3-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.5.2.317.g391b14 In-Reply-To: <1320459711-20257-1-git-send-email-graeme.russ@gmail.com> References: <1320459711-20257-1-git-send-email-graeme.russ@gmail.com> Cc: Graeme Russ Subject: [U-Boot] [PATCH v0 2/7] sc520: Create arch asm-offsets 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/x86/cpu/sc520/asm-offsets.c | 45 +++++++++++++++++++++++++++++++ arch/x86/cpu/sc520/sc520_car.S | 3 +- arch/x86/cpu/start.S | 3 +- arch/x86/include/asm/arch-sc520/sc520.h | 26 ------------------ arch/x86/include/asm/global_data.h | 19 ------------- board/eNET/eNET_start16.S | 5 ++- 6 files changed, 52 insertions(+), 49 deletions(-) create mode 100644 arch/x86/cpu/sc520/asm-offsets.c diff --git a/arch/x86/cpu/sc520/asm-offsets.c b/arch/x86/cpu/sc520/asm-offsets.c new file mode 100644 index 0000000..794f00c --- /dev/null +++ b/arch/x86/cpu/sc520/asm-offsets.c @@ -0,0 +1,45 @@ +/* + * Adapted from Linux v2.6.36 kernel: arch/powerpc/kernel/asm-offsets.c + * + * This program is used to generate definitions needed by + * assembly language modules. + * + * We use the technique used in the OSF Mach kernel code: + * generate asm statements containing #defines, + * compile this file to assembler, and then extract the + * #defines from the assembly-language output. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include +#include + +#include + +int main(void) +{ + DEFINE(GENERATED_GD_RELOC_OFF, offsetof(gd_t, reloc_off)); + + DEFINE(GENERATED_SC520_PAR0, offsetof(struct sc520_mmcr, par[0])); + DEFINE(GENERATED_SC520_PAR1, offsetof(struct sc520_mmcr, par[1])); + DEFINE(GENERATED_SC520_PAR2, offsetof(struct sc520_mmcr, par[2])); + DEFINE(GENERATED_SC520_PAR3, offsetof(struct sc520_mmcr, par[3])); + DEFINE(GENERATED_SC520_PAR4, offsetof(struct sc520_mmcr, par[4])); + DEFINE(GENERATED_SC520_PAR5, offsetof(struct sc520_mmcr, par[5])); + DEFINE(GENERATED_SC520_PAR6, offsetof(struct sc520_mmcr, par[6])); + DEFINE(GENERATED_SC520_PAR7, offsetof(struct sc520_mmcr, par[7])); + DEFINE(GENERATED_SC520_PAR8, offsetof(struct sc520_mmcr, par[8])); + DEFINE(GENERATED_SC520_PAR9, offsetof(struct sc520_mmcr, par[9])); + DEFINE(GENERATED_SC520_PAR10, offsetof(struct sc520_mmcr, par[10])); + DEFINE(GENERATED_SC520_PAR11, offsetof(struct sc520_mmcr, par[11])); + DEFINE(GENERATED_SC520_PAR12, offsetof(struct sc520_mmcr, par[12])); + DEFINE(GENERATED_SC520_PAR13, offsetof(struct sc520_mmcr, par[13])); + DEFINE(GENERATED_SC520_PAR14, offsetof(struct sc520_mmcr, par[14])); + DEFINE(GENERATED_SC520_PAR15, offsetof(struct sc520_mmcr, par[15])); + + return 0; +} diff --git a/arch/x86/cpu/sc520/sc520_car.S b/arch/x86/cpu/sc520/sc520_car.S index 7cac4d1..c04cc1f 100644 --- a/arch/x86/cpu/sc520/sc520_car.S +++ b/arch/x86/cpu/sc520/sc520_car.S @@ -24,6 +24,7 @@ #include #include #include +#include .section .text @@ -55,7 +56,7 @@ car_init: /* Configure Cache-As-RAM PAR */ movl $CONFIG_SYS_SC520_CAR_PAR, %eax - movl $SC520_PAR2, %edi + movl $(SC520_MMCR_BASE + GENERATED_SC520_PAR2), %edi movl %eax, (%edi) /* Trash the cache then turn it on */ diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S index 1634eb1..5adb387 100644 --- a/arch/x86/cpu/start.S +++ b/arch/x86/cpu/start.S @@ -30,6 +30,7 @@ #include #include #include +#include .section .text .code32 @@ -112,7 +113,7 @@ relocate_code: /* Setup call address of in-RAM copy of board_init_r() */ movl $board_init_r, %ebp - addl (GD_RELOC_OFF * 4)(%edx), %ebp + addl (GENERATED_GD_RELOC_OFF)(%edx), %ebp /* Setup parameters to board_init_r() */ movl %edx, %eax diff --git a/arch/x86/include/asm/arch-sc520/sc520.h b/arch/x86/include/asm/arch-sc520/sc520.h index 5ac9bb8..9dc29d3 100644 --- a/arch/x86/include/asm/arch-sc520/sc520.h +++ b/arch/x86/include/asm/arch-sc520/sc520.h @@ -259,32 +259,6 @@ extern sc520_mmcr_t *sc520_mmcr; /* Memory Mapped Control Registers (MMCR) Base Address */ #define SC520_MMCR_BASE 0xfffef000 -/* MMCR Addresses (required for assembler code) */ -#define SC520_DRCCTL (SC520_MMCR_BASE + 0x010) -#define SC520_DRCTMCTL (SC520_MMCR_BASE + 0x012) -#define SC520_DRCCFG (SC520_MMCR_BASE + 0x014) -#define SC520_DRCBENDADR (SC520_MMCR_BASE + 0x018) -#define SC520_ECCCTL (SC520_MMCR_BASE + 0x020) -#define SC520_DBCTL (SC520_MMCR_BASE + 0x040) -#define SC520_ECCINT (SC520_MMCR_BASE + 0xd18) - -#define SC520_PAR0 (SC520_MMCR_BASE + 0x088) -#define SC520_PAR1 (SC520_PAR0 + (0x04 * 1)) -#define SC520_PAR2 (SC520_PAR0 + (0x04 * 2)) -#define SC520_PAR3 (SC520_PAR0 + (0x04 * 3)) -#define SC520_PAR4 (SC520_PAR0 + (0x04 * 4)) -#define SC520_PAR5 (SC520_PAR0 + (0x04 * 5)) -#define SC520_PAR6 (SC520_PAR0 + (0x04 * 6)) -#define SC520_PAR7 (SC520_PAR0 + (0x04 * 7)) -#define SC520_PAR8 (SC520_PAR0 + (0x04 * 8)) -#define SC520_PAR9 (SC520_PAR0 + (0x04 * 9)) -#define SC520_PAR10 (SC520_PAR0 + (0x04 * 10)) -#define SC520_PAR11 (SC520_PAR0 + (0x04 * 11)) -#define SC520_PAR12 (SC520_PAR0 + (0x04 * 12)) -#define SC520_PAR13 (SC520_PAR0 + (0x04 * 13)) -#define SC520_PAR14 (SC520_PAR0 + (0x04 * 14)) -#define SC520_PAR15 (SC520_PAR0 + (0x04 * 15)) - /* * PARs for maximum allowable 256MB of SDRAM @ 0x00000000 * Two PARs are required due to maximum PAR size of 128MB diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index c736549..05a2139 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -61,25 +61,6 @@ extern gd_t *gd; #endif -/* Word Offsets into Global Data - MUST match struct gd_t */ -#define GD_BD 0 -#define GD_FLAGS 1 -#define GD_BAUDRATE 2 -#define GD_HAVE_CONSOLE 3 -#define GD_RELOC_OFF 4 -#define GD_LOAD_OFF 5 -#define GD_ENV_ADDR 6 -#define GD_ENV_VALID 7 -#define GD_CPU_CLK 8 -#define GD_BUS_CLK 9 -#define GD_RELOC_ADDR 10 -#define GD_START_ADDR_SP 11 -#define GD_RAM_SIZE 12 -#define GD_RESET_STATUS 13 -#define GD_JT 14 - -#define GD_SIZE 15 - /* * Global Data Flags */ diff --git a/board/eNET/eNET_start16.S b/board/eNET/eNET_start16.S index 4241f6e..5e3f44c 100644 --- a/board/eNET/eNET_start16.S +++ b/board/eNET/eNET_start16.S @@ -30,6 +30,7 @@ #include "config.h" #include "hardware.h" #include +#include .text .section .start16, "ax" @@ -46,12 +47,12 @@ board_init16: movw %ax, %ds /* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */ - movl $(SC520_PAR14 - SC520_MMCR_BASE), %edi + movl $GENERATED_SC520_PAR14, %edi movl $CONFIG_SYS_SC520_BOOTCS_PAR, %eax movl %eax, (%di) /* Map PAR for LED, Hex Switches (GPCS6, 20 Bytes @ 0x1000) */ - movl $(SC520_PAR15 - SC520_MMCR_BASE), %edi + movl $GENERATED_SC520_PAR15, %edi movl $CONFIG_SYS_SC520_LLIO_PAR, %eax movl %eax, (%di)