--- /dev/null
+/*
+ * 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 <common.h>
+#include <asm/arch/sc520.h>
+
+#include <linux/kbuild.h>
+
+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;
+}
#include <config.h>
#include <asm/processor-flags.h>
#include <asm/arch/sc520.h>
+#include <generated/asm-offsets.h>
.section .text
/* 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 */
#include <version.h>
#include <asm/global_data.h>
#include <asm/processor-flags.h>
+#include <generated/asm-offsets.h>
.section .text
.code32
/* 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
/* 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
#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
*/
#include "config.h"
#include "hardware.h"
#include <asm/arch/sc520.h>
+#include <generated/asm-offsets.h>
.text
.section .start16, "ax"
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)