Massive x86 Update - Bring x86 in line with ARM and PPC
cover Massive x86 Update - Bring x86 in line with ARM and PPC
This patch series marks a considerably significant milestone in the x86 port of U-Boot - Running the initial init sequence from Flash using the CPU on-die cache as a temporary stack.
Prior to this patch series, the low-level assembler code running in Flash was responsible for initialising SDRAM and getting the C environment (the stack) set up. The C code would then simply copy the U-Boot image to RAM, do some relocation adjustments and jump into the in-RAM copy - only then would the init sequence run.
Thank to the assistance of Juergen Beisert (who had done a Cache-As-RAM implementation for the sc520 quite some time ago), the x86 boot sequence is more 'standard':
- Initialise Cache-As-RAM (CAR)
- Setup a restricted 'C' environment
- Setup initial global data in CAR
- Run init sequence from Flash
- Copy global data to a newly malloc'd block
- Jump to RAM
This patch does have three 'negative' impacts:
- Boot time is slightly slower due to running the init sequence from Flash rather than SDRAM
- The image is no longer position independent - If you want to create a warm-boot u-boot image, you need to link it to a different address
- You can no longer do a warm-boot to a new u-boot image from SDARM (SDRAM is always re-initialised during the init sequence)
Regards,
Graeme
Changes since RFC:
- Ran checkpatch.pl and fixed (most) errors and warnings (a few long lines remain for readability and sc520_enable_ecc() in arch\i386\cpu\sc520 contains raw asm which is #ifdef'd out - This is ECC initialisation copied from the original asm file which is retained in case someone with ECC capable hardware (which I do not have) would care to implement properly
- Merged some patches that logically belonged together
- Added a code tidy-up for eNET
- #defined all 'magic numbers' in the eNET configuration file
- rebased to u-boot/master
Graeme Russ (32):
x86: Fix definition of global_data struct for asm-offsets.c
x86: Align config.mk and linker scripts with other arches
eNET: Create distinct board configurations
x86: Parametize values used in linker script
sc520: Sort Makefile
x86: Fix mangled umlauts
x86: Add stack dump to register dump
x86: Move Global Descriptor Table defines to processor.h
x86: Add processor flags header from linux
x86: Call early_board_init when warm booting
x86: Make cpu init functions weak
sc520: Define MMCR address in include file
sc520: Move board specific settings to board init function
sc520: Remove printf calls from cpu_init_f
eNET: Fix eNET Interrupt Setup for Linux
eNET: Add RTC support to eNET
eNET: Define MMCR values in config.h
eNET: Rearrange PAR assignments
eNET: General code cleanup
x86: Move initial gd to fixed location
x86: Use Cache-As-RAM for initial stack
sc520: Move RAM sizing code from asm to C
x86: Defer setup of final stack
x86: Move call to dram_init_f into board_init_f
x86: Move test for cold boot into init functions
x86: Move console initialisation into board_init_f
x86: Fix incorrect usage of relocation offset
x86: Split board_init_f() into init_fnc_t compatible functions
x86: Rearrange function calls in board_init_f
x86: Convert board_init_f to use an init_sequence
sc520: Release CAR and enable caching
eNET: Move initial Global Data into CAR
arch/i386/config.mk | 14 +- arch/i386/cpu/config.mk | 10 +- arch/i386/cpu/cpu.c | 35 +- arch/i386/cpu/interrupts.c | 19 +- arch/i386/cpu/sc520/Makefile | 5 +- arch/i386/cpu/sc520/sc520.c | 148 +------- arch/i386/cpu/sc520/sc520_asm.S | 615 ---------------------------- arch/i386/cpu/sc520/sc520_car.S | 94 +++++ arch/i386/cpu/sc520/sc520_sdram.c | 532 ++++++++++++++++++++++++ arch/i386/cpu/start.S | 107 +++--- arch/i386/cpu/start16.S | 5 +- arch/i386/cpu/u-boot.lds | 96 +++++ arch/i386/include/asm/global_data.h | 21 +- arch/i386/include/asm/ic/sc520.h | 93 ++++- arch/i386/include/asm/processor-flags.h | 100 +++++ arch/i386/include/asm/processor.h | 9 +- arch/i386/include/asm/u-boot-i386.h | 3 + arch/i386/lib/board.c | 144 ++++--- arch/i386/lib/realmode.c | 8 +- board/eNET/config.mk | 6 +- board/eNET/eNET.c | 192 +++++---- board/eNET/eNET_start.S | 7 - board/eNET/eNET_start16.S | 15 +- board/eNET/u-boot.lds | 104 ----- boards.cfg | 3 +- drivers/rtc/mc146818.c | 6 + include/configs/eNET.h | 678 +++++++++++++++++++++++-------- 27 files changed, 1786 insertions(+), 1283 deletions(-) delete mode 100644 arch/i386/cpu/sc520/sc520_asm.S create mode 100644 arch/i386/cpu/sc520/sc520_car.S create mode 100644 arch/i386/cpu/sc520/sc520_sdram.c create mode 100644 arch/i386/cpu/u-boot.lds create mode 100644 arch/i386/include/asm/processor-flags.h delete mode 100644 board/eNET/u-boot.lds
PATCH 1/32 x86: Fix definition of global_data struct for asm-offsets.c
--- arch/i386/include/asm/global_data.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/i386/include/asm/global_data.h +1 -1
@@ -35,7 +35,7 @@ #ifndef __ASSEMBLY__ -typedef struct { +typedef struct global_data { bd_t *bd; unsigned long flags; unsigned long baudrate;
Signature · 1 line
1.7.1.422.g049e9
PATCH 1/32 x86: Fix definition of global_data struct for asm-offsets.c
Quoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/include/asm/global_data.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 2/32 x86: Align config.mk and linker scripts with other arches
In reply to Graeme Russ--- arch/i386/config.mk | 13 ++++-- arch/i386/cpu/config.mk | 4 +- arch/i386/cpu/u-boot.lds | 104 ++++++++++++++++++++++++++++++++++++++++++++++ board/eNET/config.mk | 4 -- board/eNET/u-boot.lds | 104 ---------------------------------------------- 5 files changed, 114 insertions(+), 115 deletions(-) create mode 100644 arch/i386/cpu/u-boot.lds delete mode 100644 board/eNET/u-boot.lds
arch/i386/config.mk +8 -5
@@ -21,8 +21,6 @@ # MA 02111-1307 USA # -CROSS_COMPILE ?= i386-linux- - STANDALONE_LOAD_ADDR = 0x40000 PLATFORM_CPPFLAGS += -fno-strict-aliasing
@@ -33,8 +31,13 @@ PLATFORM_CPPFLAGS += $(call cc-option, -ffreestanding) PLATFORM_CPPFLAGS += $(call cc-option, -fno-toplevel-reorder, $(call cc-option, -fno-unit-at-a-time)) PLATFORM_CPPFLAGS += $(call cc-option, -fno-stack-protector) PLATFORM_CPPFLAGS += $(call cc-option, -mpreferred-stack-boundary=2) -PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__ +PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm + +PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden + +PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions LDFLAGS += --cref -LDFLAGS_u-boot += --gc-sections -PLATFORM_RELFLAGS += -ffunction-sections +LDFLAGS_u-boot += --gc-sections -pie +LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds +
arch/i386/cpu/config.mk +2 -2
@@ -21,6 +21,6 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += +CROSS_COMPILE ?= i386-linux- -PLATFORM_CPPFLAGS += -march=i386 -Werror +PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__ -march=i386 -Werror
arch/i386/cpu/u-boot.lds new file +104 -0
104 lines not on this page · raw message
board/eNET/config.mk +0 -4
@@ -22,7 +22,3 @@ # CONFIG_SYS_TEXT_BASE = 0x06000000 -CFLAGS_common/dlmalloc.o += -Wa,--no-warn -fno-strict-aliasing -PLATFORM_RELFLAGS += -fvisibility=hidden -PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm -PLATFORM_LDFLAGS += -pic --emit-relocs -Bsymbolic -Bsymbolic-functions
board/eNET/u-boot.lds deleted +0 -104
104 lines not on this page · raw message
Signature · 1 line
1.7.1.422.g049e9
PATCH 2/32 x86: Align config.mk and linker scripts with other arches
arch/i386/config.mk PLATFORM_CPPFLAGS += $(call cc-option, -ffreestanding) · line 42
Quoted 5 lines · On Fri, 4 Feb 2011 23:35:29 +1100 Graeme Russ <[email protected]> wrote:
LDFLAGS += --cref
arch/i386/config.mk +2
-2-LDFLAGS_u-boot += --gc-sections -PLATFORM_RELFLAGS += -ffunction-sections +LDFLAGS_u-boot += --gc-sections -pie +LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
The use of --cref came up recently (see
http://lists.denx.de/pipermail/u-boot/2011-February/086698.html).
During what link phase is --cref supposed to be used? Currently it is being used during partial links only, and not the final link, as a result of commit 8aba9dceebb14144e07d19593111ee3a999c37fc. As the toplevel config.mk currently stands, it would have to go in PLATFORM_LDFLAGS to be used in all link phases, or LDFLAGS_u-boot to be used when linking the final image only.
BTW, is it really enabled because of something to do with i386? Or just maintainer preference (in which case it should probably be a non-arch config, or in this case just enabled unconditionally, since I don't think there's any harm to it).
-Scott
PATCH 2/32 x86: Align config.mk and linker scripts with other arches
Quoted 19 lines · Scott Wood
arch/i386/config.mk PLATFORM_CPPFLAGS += $(call cc-option, -ffreestanding) · line 42
Quoted 5 lines · On Fri, 4 Feb 2011 23:35:29 +1100 Graeme Russ <[email protected]> wrote:
LDFLAGS += --cref
arch/i386/config.mk +2
-2-LDFLAGS_u-boot += --gc-sections -PLATFORM_RELFLAGS += -ffunction-sections +LDFLAGS_u-boot += --gc-sections -pie +LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.ldsThe use of --cref came up recently (see
http://lists.denx.de/pipermail/u-boot/2011-February/086698.html).During what link phase is --cref supposed to be used? Currently it is being used during partial links only, and not the final link, as a result of commit
8aba9dceebb14144e07d19593111ee3a999c37fc. As the toplevel config.mk currently stands, it would have to go inPLATFORM_LDFLAGSto be used in all link phases, or LDFLAGS_u-boot to be used when linking the final image only.
Quoted 4 lines
BTW, is it really enabled because of something to do with i386? Or just maintainer preference (in which case it should probably be a non-arch config, or in this case just enabled unconditionally, since I don't think there's any harm to it).
I think --cref is historical. I have just performed a build without it and it runs fine, so I think it can be safely removed.
Maybe it might be worth starting a separate discussion thread with the goal of unifying and documenting the linker, make and config.mk files?
Regards,
Graeme
PATCH 2/32 x86: Align config.mk and linker scripts with other arches
In reply to Graeme RussQuoted 265 lines · Graeme Russ
arch/i386/config.mk +8
-5@@ -21,8 +21,6 @@ # MA 02111-1307 USA # -CROSS_COMPILE ?= i386-linux- - STANDALONE_LOAD_ADDR = 0x40000 PLATFORM_CPPFLAGS += -fno-strict-aliasing@@ -33,8 +31,13 @@ PLATFORM_CPPFLAGS += $(call cc-option, -ffreestanding) PLATFORM_CPPFLAGS += $(call cc-option, -fno-toplevel-reorder, $(call cc-option, -fno-unit-at-a-time)) PLATFORM_CPPFLAGS += $(call cc-option, -fno-stack-protector) PLATFORM_CPPFLAGS += $(call cc-option, -mpreferred-stack-boundary=2) -PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__ +PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm + +PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden + +PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions LDFLAGS += --cref -LDFLAGS_u-boot += --gc-sections -PLATFORM_RELFLAGS += -ffunction-sections +LDFLAGS_u-boot += --gc-sections -pie +LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds +arch/i386/cpu/config.mk +2
-2@@ -21,6 +21,6 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += +CROSS_COMPILE ?= i386-linux- -PLATFORM_CPPFLAGS += -march=i386 -Werror +PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__ -march=i386 -Werrorarch/i386/cpu/u-boot.lds new file +104
-0@@ -0,0 +1,104 @@ +/* + * (C) Copyright 2002 + * Daniel Engstr?m, Omicron Ceti AB, daniel at omicron.se. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) + +SECTIONS +{ + . = CONFIG_SYS_TEXT_BASE; /* Location of bootcode in flash */ + __text_start = .; + .text : { *(.text*); } + + . = ALIGN(4); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + . = ALIGN(4); + __u_boot_cmd_end = .; + + . = ALIGN(4); + .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + + . = ALIGN(4); + .data : { *(.data*) } + + . = ALIGN(4); + .dynsym : { *(.dynsym*) } + + . = ALIGN(4); + .hash : { *(.hash*) } + + . = ALIGN(4); + .got : { *(.got*) } + + . = ALIGN(4); + __data_end = .; + + . = ALIGN(4); + __bss_start = ABSOLUTE(.); + .bss (NOLOAD) : { *(.bss) } + . = ALIGN(4); + __bss_end = ABSOLUTE(.); + + . = ALIGN(4); + __rel_dyn_start = .; + .rel.dyn : { *(.rel.dyn) } + __rel_dyn_end = .; + + /DISCARD/ : { *(.dynstr*) } + /DISCARD/ : { *(.dynamic*) } + /DISCARD/ : { *(.plt*) } + /DISCARD/ : { *(.interp*) } + /DISCARD/ : { *(.gnu*) } + + /* 16bit realmode trampoline code */ + .realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) } + + __realmode_start = LOADADDR(.realmode); + __realmode_size = SIZEOF(.realmode); + + /* 16bit BIOS emulation code (just enough to boot Linux) */ + .bios 0 : AT ( LOADADDR(.realmode) + SIZEOF(.realmode) ) { KEEP(*(.bios)) } + + __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. + */ + . = 0xfffffe00; + .start32 : AT (CONFIG_SYS_TEXT_BASE + 0x3fe00) { KEEP(*(.start32)); } + + . = 0xf800; + .start16 : AT (CONFIG_SYS_TEXT_BASE + 0x3f800) { KEEP(*(.start16)); } + + . = 0xfff0; + .resetvec : AT (CONFIG_SYS_TEXT_BASE + 0x3fff0) { KEEP(*(.resetvec)); } +}board/eNET/config.mk +0
-4@@ -22,7 +22,3 @@ # CONFIG_SYS_TEXT_BASE = 0x06000000 -CFLAGS_common/dlmalloc.o += -Wa,--no-warn -fno-strict-aliasing -PLATFORM_RELFLAGS += -fvisibility=hidden -PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm -PLATFORM_LDFLAGS += -pic --emit-relocs -Bsymbolic -Bsymbolic-functionsboard/eNET/u-boot.lds deleted +0
-94@@ -1,104 +0,0 @@ -/* - * (C) Copyright 2002 - * Daniel Engstr?m, Omicron Ceti AB, daniel at omicron.se. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") -OUTPUT_ARCH(i386) -ENTRY(_start) - -SECTIONS -{ - . = CONFIG_SYS_TEXT_BASE; /* Location of bootcode in flash */ - __text_start = .; - .text : { *(.text*); } - - . = ALIGN(4); - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - . = ALIGN(4); - __u_boot_cmd_end = .; - - . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } - - . = ALIGN(4); - .data : { *(.data*) } - - . = ALIGN(4); - .dynsym : { *(.dynsym*) } - - . = ALIGN(4); - .hash : { *(.hash*) } - - . = ALIGN(4); - .got : { *(.got*) } - - . = ALIGN(4); - __data_end = .; - - . = ALIGN(4); - __bss_start = ABSOLUTE(.); - .bss (NOLOAD) : { *(.bss) } - . = ALIGN(4); - __bss_end = ABSOLUTE(.); - - . = ALIGN(4); - __rel_dyn_start = .; - .rel.dyn : { *(.rel.dyn) } - __rel_dyn_end = .; - - /DISCARD/ : { *(.dynstr*) } - /DISCARD/ : { *(.dynamic*) } - /DISCARD/ : { *(.plt*) } - /DISCARD/ : { *(.interp*) } - /DISCARD/ : { *(.gnu*) } - - /* 16bit realmode trampoline code */ - .realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) } - - __realmode_start = LOADADDR(.realmode); - __realmode_size = SIZEOF(.realmode); - - /* 16bit BIOS emulation code (just enough to boot Linux) */ - .bios 0 : AT ( LOADADDR(.realmode) + SIZEOF(.realmode) ) { KEEP(*(.bios)) } - - __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.
board/eNET/u-boot.lds line 104
Quoted 10 lines
board/eNET/u-boot.lds deleted +0
-10- */ - . = 0xfffffe00; - .start32 : AT (CONFIG_SYS_TEXT_BASE + 0x3fe00) { KEEP(*(.start32)); } - - . = 0xf800; - .start16 : AT (CONFIG_SYS_TEXT_BASE + 0x3f800) { KEEP(*(.start16)); } - - . = 0xfff0; - .resetvec : AT (CONFIG_SYS_TEXT_BASE + 0x3fff0) { KEEP(*(.resetvec)); } -}
Build-tested on Debian i386 (native); fixes the build failure with tip
Signature · 1 line
Lo?c Minier
PATCH 2/32 x86: Align config.mk and linker scripts with other arches
In reply to Graeme RussQuoted 11 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/config.mk | 13 ++++-- arch/i386/cpu/config.mk | 4 +- arch/i386/cpu/u-boot.lds | 104 ++++++++++++++++++++++++++++++++++++++++++++++ board/eNET/config.mk | 4 -- board/eNET/u-boot.lds | 104 ---------------------------------------------- 5 files changed, 114 insertions(+), 115 deletions(-) create mode 100644 arch/i386/cpu/u-boot.lds delete mode 100644 board/eNET/u-boot.lds
Applied to u-boot-x86
(also added trivial removal of --cref)
Regards,
Graeme
PATCH 3/32 eNET: Create distinct board configurations
In reply to Graeme RussPosition independant functionality is due for removal from the x86 architecture, so create two distinct configurations - One for Flash and one for SRAM
--- board/eNET/config.mk | 1 - boards.cfg | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-)
board/eNET/config.mk +0 -1
@@ -21,4 +21,3 @@ # MA 02111-1307 USA # -CONFIG_SYS_TEXT_BASE = 0x06000000
boards.cfg +2 -1
@@ -199,7 +199,8 @@ ibf-dsp561 blackfin blackfin ip04 blackfin blackfin tcm-bf518 blackfin blackfin tcm-bf537 blackfin blackfin -eNET i386 i386 - - sc520 +eNET i386 i386 eNET - sc520 eNET:SYS_TEXT_BASE=0x38040000 +eNET_SRAM i386 i386 eNET - sc520 eNET:SYS_TEXT_BASE=0x19000000 idmr m68k mcf52x2 TASREG m68k mcf52x2 tasreg esd M5208EVBE m68k mcf52x2 m5208evbe freescale
Signature · 1 line
1.7.1.422.g049e9
PATCH 3/32 eNET: Create distinct board configurations
Quoted 10 lines · Graeme Russ
Position independant functionality is due for removal from the x86 architecture, so create two distinct configurations - One for Flash and one for SRAM
Signed-off-by Graeme Russ <[email protected]>--- board/eNET/config.mk | 1 - boards.cfg | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 4/32 x86: Parametize values used in linker script
In reply to 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(-)
arch/i386/config.mk +1 -0
@@ -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
arch/i386/cpu/config.mk +6 -0
@@ -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
arch/i386/cpu/u-boot.lds +8 -16
@@ -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)); } }
arch/i386/lib/realmode.c +4 -4
@@ -27,7 +27,6 @@#include <asm/realmode.h> -#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 ;
board/eNET/config.mk +1 -0
@@ -21,3 +21,4 @@ # MA 02111-1307 USA # +LDPPFLAGS += -DFLASH_SIZE=0x40000
Signature · 1 line
1.7.1.422.g049e9
PATCH 4/32 x86: Parametize values used in linker script
Quoted 9 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- 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(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 5/32 sc520: Sort Makefile
In reply to Graeme Russ--- arch/i386/cpu/sc520/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/i386/cpu/sc520/Makefile +1 -1
@@ -32,9 +32,9 @@ include $(TOPDIR)/config.mk LIB := $(obj)lib$(SOC).o COBJS-$(CONFIG_SYS_SC520) += sc520.o +COBJS-$(CONFIG_PCI) += sc520_pci.o COBJS-$(CONFIG_SYS_SC520_SSI) += sc520_ssi.o COBJS-$(CONFIG_SYS_SC520_TIMER) += sc520_timer.o -COBJS-$(CONFIG_PCI) += sc520_pci.o SOBJS-$(CONFIG_SYS_SC520) += sc520_asm.o
Signature · 1 line
1.7.1.422.g049e9
PATCH 5/32 sc520: Sort Makefile
Quoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 5/32 sc520: Sort Makefile
In reply to Graeme RussQuoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 6/32 x86: Fix mangled umlauts
In reply to Graeme Russgit mergetool has a nasty habit of mangling umlats - fix ones that have been missed in previous submissions
--- arch/i386/cpu/start.S | 2 +- arch/i386/lib/board.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/i386/cpu/start.S +1 -1
@@ -1,7 +1,7 @@ /* * U-boot - i386 Startup Code * - * Copyright (c) 2002 Omicron Ceti AB, Daniel Engstr???m <[email protected]> + * Copyright (c) 2002 Omicron Ceti AB, Daniel Engstr?m <[email protected]> * * See file CREDITS for list of people who contributed to this * project.
arch/i386/lib/board.c +1 -1
@@ -1,6 +1,6 @@/* * (C) Copyright 2002 -* Daniel Engstr???m, Omicron Ceti AB, daniel at omicron.se +* Daniel Engstr?m, Omicron Ceti AB, daniel at omicron.se * * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
Signature · 1 line
1.7.1.422.g049e9
PATCH 6/32 x86: Fix mangled umlauts
Quoted 9 lines · Graeme Russ
git mergetool has a nasty habit of mangling umlats - fix ones that have been missed in previous submissions
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/start.S | 2 +- arch/i386/lib/board.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 7/32 x86: Add stack dump to register dump
In reply to Graeme Russ--- arch/i386/cpu/interrupts.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
arch/i386/cpu/interrupts.c +16 -0
@@ -29,6 +29,7 @@#include <common.h> #include <asm/interrupt.h> +#include <asm/io.h> #define DECLARE_INTERRUPT (x) \ ".globl irq_"#x"\n" \
@@ -108,6 +109,7 @@ void dump_regs(struct irq_regs *regs) {unsigned long cr0 =0L , cr2 =0L , cr3 =0L , cr4 =0L ;unsigned long d0, d1, d2, d3, d6, d7; +unsigned long sp;printf ("EIP: %04x:[<%08lx>] EFLAGS: %08lx\n" , (u16 )regs->xcs, regs->eip, regs->eflags);
@@ -139,6 +141,20 @@ void dump_regs(struct irq_regs *regs) d7 =get_debugreg (7 );printf ("DR6: %08lx DR7: %08lx\n" , d6, d7); + +printf ("Stack:\n" ); + sp = regs->esp; + + sp +=64 ; + +while (sp > (regs->esp -16 )) { +if (sp == regs->esp) +printf ("--->" ); +else +printf (" " ); +printf ("0x%8.8lx : 0x%8.8lx\n" , sp, (ulong )readl (sp)); + sp -=4 ; + } }struct idt_entry {
Signature · 1 line
1.7.1.422.g049e9
PATCH 7/32 x86: Add stack dump to register dump
Quoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/interrupts.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 8/32 x86: Move Global Descriptor Table defines to processor.h
In reply to Graeme Russ--- arch/i386/cpu/cpu.c | 8 +------- arch/i386/include/asm/processor.h | 9 ++++++--- 2 files changed, 7 insertions(+), 10 deletions(-)
arch/i386/cpu/cpu.c +1 -7
@@ -35,6 +35,7 @@#include <common.h> #include <command.h> +#include <asm/processor.h> #include <asm/interrupt.h> /* Constructor for a conventional segment GDT (or LDT) entry */
@@ -46,13 +47,6 @@ (((base) &0x00ffffffULL ) <<16 ) | \ (((limit) & 0x0000ffffULL))) -/* Simple and small GDT entries for booting only */ - -#define GDT_ENTRY_32BIT_CS 2 -#define GDT_ENTRY_32BIT_DS (GDT_ENTRY_32BIT_CS + 1) -#define GDT_ENTRY_16BIT_CS (GDT_ENTRY_32BIT_DS + 1) -#define GDT_ENTRY_16BIT_DS (GDT_ENTRY_16BIT_CS + 1) -/* * Set up the GDT */
arch/i386/include/asm/processor.h +6 -3
@@ -23,7 +23,10 @@#ifndef __ASM_PROCESSOR_H_#define __ASM_PROCESSOR_H_ 1 -/* Currently this header is unused in the i386 port -* but some generic files #include <asm/processor.h> -* so this file is a placeholder. */ + +#define GDT_ENTRY_32BIT_CS 2 +#define GDT_ENTRY_32BIT_DS (GDT_ENTRY_32BIT_CS + 1) +#define GDT_ENTRY_16BIT_CS (GDT_ENTRY_32BIT_DS + 1) +#define GDT_ENTRY_16BIT_DS (GDT_ENTRY_16BIT_CS + 1) +#endif
Signature · 1 line
1.7.1.422.g049e9
PATCH 8/32 x86: Move Global Descriptor Table defines to processor.h
Quoted 6 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/cpu.c | 8 +------- arch/i386/include/asm/processor.h | 9 ++++++--- 2 files changed, 7 insertions(+), 10 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 9/32 x86: Add processor flags header from linux
In reply to Graeme Russ--- arch/i386/cpu/cpu.c | 13 +++- arch/i386/cpu/interrupts.c | 3 +- arch/i386/cpu/sc520/sc520.c | 7 ++- arch/i386/cpu/start.S | 3 +- arch/i386/cpu/start16.S | 5 +- arch/i386/include/asm/processor-flags.h | 100 +++++++++++++++++++++++++++++++ 6 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 arch/i386/include/asm/processor-flags.h
arch/i386/cpu/cpu.c +9 -4
@@ -36,6 +36,7 @@#include <common.h> #include <command.h> #include <asm/processor.h> +#include <asm/processor-flags.h> #include <asm/interrupt.h> /* Constructor for a conventional segment GDT (or LDT) entry */
@@ -88,12 +89,16 @@ static void reload_gdt(void)int cpu_init_f (void ) { +const u32 em_rst = ~X86_CR0_EM ; +const u32 mp_ne_set =X86_CR0_MP |X86_CR0_NE ; +/* initialize FPU, reset EM, set MP and NE */ asm ("fninit\n" \ -"movl %cr0, %eax\n" \ -"andl $~0x4, %eax\n" \ -"orl $0x22, %eax\n" \ -"movl %eax, %cr0\n" ); +"movl %%cr0, %%eax\n" \ +"andl %0, %%eax\n" \ +"orl %1, %%eax\n" \ +"movl %%eax, %%cr0\n" \ + : :"i" (em_rst),"i" (mp_ne_set) :"eax" );return 0 ; }
arch/i386/cpu/interrupts.c +2 -1
@@ -30,6 +30,7 @@#include <common.h> #include <asm/interrupt.h> #include <asm/io.h> +#include <asm/processor-flags.h> #define DECLARE_INTERRUPT (x) \ ".globl irq_"#x"\n" \
@@ -237,7 +238,7 @@ int disable_interrupts(void) asmvolatile ("pushfl ; popl %0 ; cli\n" :"=g" (flags) : ); -return (flags&0x200 );/* IE flags is bit 9 */ +return flags &X86_EFLAGS_IF ;/* IE flags is bit 9 */ }/* IRQ Low-Level Service Routine */
arch/i386/cpu/sc520/sc520.c +5 -2
@@ -26,6 +26,7 @@#include <common.h> #include <asm/io.h> +#include <asm/processor-flags.h> #include <asm/ic/sc520.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -41,6 +42,8 @@ volatile sc520_mmcr_t *sc520_mmcr = (sc520_mmcr_t *)0xfffef000;void init_sc520 (void ) { +const u32 nw_cd_rst = ~(X86_CR0_NW |X86_CR0_CD ); +/* * Set the UARTxCTL register at it's slower, * baud clock giving us a 1.8432 MHz reference
@@ -84,8 +87,8 @@ void init_sc520(void)/* turn on the cache and disable write through */ asm("movl %%cr0, %%eax\n" -"andl $0x9fffffff, %%eax\n" -"movl %%eax, %%cr0\n" : : :"eax" ); +"andl %0, %%eax\n" +"movl %%eax, %%cr0\n" : :"i" (nw_cd_rst) :"eax" ); }unsigned long init_sc520_dram (void )
arch/i386/cpu/start.S +2 -1
@@ -26,6 +26,7 @@ #include <config.h> #include <version.h> #include <asm/global_data.h> +#include <asm/processor-flags.h> .section .text
@@ -46,7 +47,7 @@ _i386boot_start: /* Turn of cache (this might require a 486-class CPU) */ movl %cr0, %eax - orl $0x60000000, %eax + orl $(X86_CR0_NW | X86_CR0_CD), %eax movl %eax, %cr0 wbinvd
arch/i386/cpu/start16.S +3 -2
@@ -23,6 +23,7 @@ */ #include <asm/global_data.h> +#include <asm/processor-flags.h> #define BOOT_SEG 0xffff0000 /* linear segment of boot code */ #define a32 .byte 0x67;
@@ -45,7 +46,7 @@ board_init16_ret: /* Turn of cache (this might require a 486-class CPU) */ movl %cr0, %eax - orl $0x60000000, %eax + orl $(X86_CR0_NW & X86_CR0_CD), %eax movl %eax, %cr0 wbinvd
@@ -55,7 +56,7 @@ o32 cs lgdt gdt_ptr /* Now, we enter protected mode */ movl %cr0, %eax - orl $1, %eax + orl $X86_CR0_PE, %eax movl %eax, %cr0 /* Flush the prefetch queue */
arch/i386/include/asm/processor-flags.h new file +100 -0
100 lines not on this page · raw message
Signature · 1 line
1.7.1.422.g049e9
PATCH 9/32 x86: Add processor flags header from linux
Quoted 11 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/cpu.c | 13 +++- arch/i386/cpu/interrupts.c | 3 +- arch/i386/cpu/sc520/sc520.c | 7 ++- arch/i386/cpu/start.S | 3 +- arch/i386/cpu/start16.S | 5 +- arch/i386/include/asm/processor-flags.h | 100 +++++++++++++++++++++++++++++++ 6 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 arch/i386/include/asm/processor-flags.h
Applied to u-boot-x86
Regards,
Graeme
PATCH 10/32 x86: Call early_board_init when warm booting
In reply to Graeme Russearly_board_init has been skipped to avoid SDRAM corruption in the case that a fully relocatable image has been loaded into SDRAM and is being executed from SDRAM. x86 is being aligned with other architectures (ARM and PPC in particlar) and will be using Cache-As-RAM to run a C environment from Flash (or SRAM if you have some). early_board_init may be needed to assist in the setup of Cache-As-RAM and the early C environment
--- arch/i386/cpu/start.S | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
arch/i386/cpu/start.S +5 -5
@@ -67,16 +67,16 @@ _start: /* Clear the interupt vectors */ lidt blank_idt_ptr - /* Skip low-level initialization if not starting from cold-reset */ - movl %ebx, %ecx - andl $GD_FLG_COLD_BOOT, %ecx - jz skip_mem_init - /* Early platform init (setup gpio, etc ) */ jmp early_board_init .globl early_board_init_ret early_board_init_ret: + /* Skip memory initialization if not starting from cold-reset */ + movl %ebx, %ecx + andl $GD_FLG_COLD_BOOT, %ecx + jz skip_mem_init + /* size memory */ jmp mem_init .globl mem_init_ret
Signature · 1 line
1.7.1.422.g049e9
PATCH 10/32 x86: Call early_board_init when warm booting
Quoted 8 lines · Graeme Russ
early_board_inithas been skipped to avoid SDRAM corruption in the case that a fully relocatable image has been loaded into SDRAM and is being executed from SDRAM. x86 is being aligned with other architectures (ARM and PPC in particlar) and will be using Cache-As-RAM to run a C environment from Flash (or SRAM if you have some).early_board_initmay be needed to assist in the setup of Cache-As-RAM and the early C environment
Quoted 5 lines
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/start.S | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 11/32 x86: Make cpu init functions weak
In reply to Graeme Russ--- arch/i386/cpu/cpu.c | 14 ++++++++++++-- arch/i386/cpu/sc520/sc520.c | 11 +++-------- arch/i386/include/asm/u-boot-i386.h | 2 ++ board/eNET/eNET.c | 22 ---------------------- 4 files changed, 17 insertions(+), 32 deletions(-)
arch/i386/cpu/cpu.c +12 -2
@@ -87,7 +87,7 @@ static void reload_gdt(void) } -int cpu_init_f (void ) +int x86_cpu_init_f (void ) {const u32 em_rst = ~X86_CR0_EM ;const u32 mp_ne_set =X86_CR0_MP |X86_CR0_NE ;
@@ -102,15 +102,25 @@ int cpu_init_f(void)return 0 ; } +int cpu_init_f (void ) __attribute__((weak,alias ("x86_cpu_init_f" ))); -int cpu_init_r (void ) +int x86_cpu_init_r (void ) { +const u32 nw_cd_rst = ~(X86_CR0_NW |X86_CR0_CD ); + +/* turn on the cache and disable write through */ + asm("movl %%cr0, %%eax\n" +"andl %0, %%eax\n" +"movl %%eax, %%cr0\n" +"wbinvd\n" : :"i" (nw_cd_rst) :"eax" ); +reload_gdt ();/* Initialize core interrupt and exception functionality of CPU */ cpu_init_interrupts ();return 0 ; } +int cpu_init_r (void ) __attribute__((weak,alias ("x86_cpu_init_r" )));int do_reset (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) {
arch/i386/cpu/sc520/sc520.c +3 -8
@@ -1,6 +1,6 @@/* * (C) Copyright 2002 -* Daniel Engstr?m, Omicron Ceti AB <[email protected]>. +* Daniel Engstr???m, Omicron Ceti AB <[email protected]>. * * See file CREDITS for list of people who contributed to this * project.
@@ -40,10 +40,8 @@ DECLARE_GLOBAL_DATA_PTR;volatile sc520_mmcr_t *sc520_mmcr = (sc520_mmcr_t *)0xfffef000 ; -void init_sc520 (void ) +int cpu_init_f (void ) { -const u32 nw_cd_rst = ~(X86_CR0_NW |X86_CR0_CD ); -/* * Set the UARTxCTL register at it's slower, * baud clock giving us a 1.8432 MHz reference
@@ -85,10 +83,7 @@ void init_sc520(void)/* turn on the SDRAM write buffer */ writeb (0x11 , &sc520_mmcr->dbctl); -/* turn on the cache and disable write through */ - asm("movl %%cr0, %%eax\n" -"andl %0, %%eax\n" -"movl %%eax, %%cr0\n" : :"i" (nw_cd_rst) :"eax" ); +return x86_cpu_init_f (); }unsigned long init_sc520_dram (void )
arch/i386/include/asm/u-boot-i386.h +2 -0
@@ -25,7 +25,9 @@#define _U_BOOT_I386_H_ 1/* cpu/.../cpu.c */ +int x86_cpu_init_r (void );int cpu_init_r (void ); +int x86_cpu_init_f (void );int cpu_init_f (void );/* cpu/.../timer.c */
board/eNET/eNET.c +0 -22
@@ -48,33 +48,11 @@ unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;static void enet_timer_isr (void );static void enet_toggle_run_led (void ); -void init_sc520_enet (void ) -{ -/* Set CPU Speed to 100MHz */ -writeb (0x01 , &sc520_mmcr->cpuctl); - -/* wait at least one millisecond */ - asm("movl $0x2000,%%ecx\n" -"0: pushl %%ecx\n" -"popl %%ecx\n" -"loop 0b\n" : : :"ecx" ); - -/* turn on the SDRAM write buffer */ -writeb (0x11 , &sc520_mmcr->dbctl); - -/* turn on the cache and disable write through */ - asm("movl %%cr0, %%eax\n" -"andl $0x9fffffff, %%eax\n" -"movl %%eax, %%cr0\n" : : :"eax" ); -} -/* * Miscellaneous platform dependent initializations */ int board_early_init_f (void ) { -init_sc520_enet (); -writeb (0x01 , &sc520_mmcr->gpcsrt);/* GP Chip Select Recovery Time */ writeb (0x07 , &sc520_mmcr->gpcspw);/* GP Chip Select Pulse Width */ writeb (0x00 , &sc520_mmcr->gpcsoff);/* GP Chip Select Offset */
Signature · 1 line
1.7.1.422.g049e9
PATCH 11/32 x86: Make cpu init functions weak
Quoted 8 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/cpu.c | 14 ++++++++++++-- arch/i386/cpu/sc520/sc520.c | 11 +++-------- arch/i386/include/asm/u-boot-i386.h | 2 ++ board/eNET/eNET.c | 22 ---------------------- 4 files changed, 17 insertions(+), 32 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 12/32 sc520: Define MMCR address in include file
In reply to Graeme Russ--- arch/i386/cpu/sc520/sc520.c | 2 +- arch/i386/cpu/sc520/sc520_asm.S | 49 ++++++++++++++++--------------------- arch/i386/include/asm/ic/sc520.h | 36 ++++++++++++++++++++++----- board/eNET/eNET_start16.S | 7 +++-- 4 files changed, 55 insertions(+), 39 deletions(-)
arch/i386/cpu/sc520/sc520.c +1 -1
@@ -38,7 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;* unsigned long init_sc520_dram(void) */ -volatile sc520_mmcr_t *sc520_mmcr = (sc520_mmcr_t *)0xfffef000 ; +sc520_mmcr_t *sc520_mmcr = (sc520_mmcr_t *)SC520_MMCR_BASE ;int cpu_init_f (void ) {
arch/i386/cpu/sc520/sc520_asm.S +21 -28
156 lines not on this page · raw message
arch/i386/include/asm/ic/sc520.h +29 -7
@@ -252,16 +252,38 @@ typedef struct sc520_mmcr { u8 pad_0xdc0[0x0240]; } sc520_mmcr_t; -extern volatile sc520_mmcr_t *sc520_mmcr; +extern sc520_mmcr_t *sc520_mmcr;#endif -/* MMCR Offsets (required for assembler code */ -#define SC520_DBCTL 0x0040/* SDRAM Buffer Control Register */ -#define SC520_PAR14 0x00c0/* Programmable Address Region 14 Register */ -#define SC520_PAR15 0x00c4/* Programmable Address Region 15 Register */ -#define SC520_SWTMRMILLI 0x0c60/* Software Timer Millisecond Count */ -#define SC520_SWTMRMICRO 0x0c62/* Software Timer Microsecond Count */ +/* 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))/* MMCR Register bits (not all of them :) ) */
board/eNET/eNET_start16.S +4 -3
@@ -30,6 +30,7 @@ /* #include <asm/ic/sc520_defs.h> */ #include "hardware.h" +#include <asm/ic/sc520.h> .text .section .start16, "ax"
@@ -46,17 +47,17 @@ board_init16: movw %ax, %ds /* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */ - movl $0x00c0, %edi /* SC520_PAR14 */ + movl $(SC520_PAR14 - SC520_MMCR_BASE), %edi movl $0x8bfff800, %eax /* TODO: Check this */ movl %eax, (%di) /* Map PAR for LED, Hex Switches (GPCS6, 20 Bytes @ 0x1000) */ - movl $0x00c4, %edi /* SC520_PAR15 */ + movl $(SC520_PAR15 - SC520_MMCR_BASE), %edi movl $0x38201000, %eax movl %eax, (%di) /* Disable SDRAM write buffer */ - movw $0x0040, %di /* SC520_DBCTL */ + movw $(SC520_DBCTL - SC520_MMCR_BASE), %di xorw %ax, %ax movb %al, (%di)
Signature · 1 line
1.7.1.422.g049e9
PATCH 12/32 sc520: Define MMCR address in include file
Quoted 8 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/sc520.c | 2 +- arch/i386/cpu/sc520/sc520_asm.S | 49 ++++++++++++++++--------------------- arch/i386/include/asm/ic/sc520.h | 36 ++++++++++++++++++++++----- board/eNET/eNET_start16.S | 7 +++-- 4 files changed, 55 insertions(+), 39 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 13/32 sc520: Move board specific settings to board init function
In reply to Graeme Russ--- arch/i386/cpu/sc520/sc520.c | 19 ------------------- board/eNET/eNET.c | 9 +++++++++ 2 files changed, 9 insertions(+), 19 deletions(-)
arch/i386/cpu/sc520/sc520.c +0 -19
@@ -42,25 +42,6 @@ sc520_mmcr_t *sc520_mmcr = (sc520_mmcr_t *)SC520_MMCR_BASE;int cpu_init_f (void ) { -/* -* Set the UARTxCTL register at it's slower, -* baud clock giving us a 1.8432 MHz reference -*/ -writeb (0x07 , &sc520_mmcr->uart1ctl); -writeb (0x07 , &sc520_mmcr->uart2ctl); - -/* first set the timer pin mapping */ -writeb (0x72 , &sc520_mmcr->clksel);/* no clock frequency selected, use 1.1892MHz */ - -/* enable PCI bus arbiter (concurrent mode) */ -writeb (0x02 , &sc520_mmcr->sysarbctl); - -/* enable external grants */ -writeb (0x1f , &sc520_mmcr->sysarbmenb); - -/* enable posted-writes */ -writeb (0x04 , &sc520_mmcr->hbctl); -if (CONFIG_SYS_SC520_HIGH_SPEED ) {/* set it to 133 MHz and write back */ writeb (0x02 , &sc520_mmcr->cpuctl);
board/eNET/eNET.c +9 -0
@@ -94,12 +94,21 @@ int board_early_init_f(void)writew (0x0615 , &sc520_mmcr->romcs1ctl);writew (0x0615 , &sc520_mmcr->romcs2ctl); +/* +* Set the timer pin mapping +* no clock frequency selected, use 1.1892MHz +*/ +writeb (0x72 , &sc520_mmcr->clksel); +writeb (0x00 , &sc520_mmcr->adddecctl);writeb (0x07 , &sc520_mmcr->uart1ctl);writeb (0x07 , &sc520_mmcr->uart2ctl);writeb (0x06 , &sc520_mmcr->sysarbctl);writew (0x0003 , &sc520_mmcr->sysarbmenb); +/* enable posted-writes */ +writeb (0x04 , &sc520_mmcr->hbctl); +return 0 ; }
Signature · 1 line
1.7.1.422.g049e9
PATCH 13/32 sc520: Move board specific settings to board init function
Quoted 6 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/sc520.c | 19 ------------------- board/eNET/eNET.c | 9 +++++++++ 2 files changed, 9 insertions(+), 19 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 14/32 sc520: Remove printf calls from cpu_init_f
In reply to Graeme RussIn later patches, cpu_init_f will be called before console has been initialised and printf will not be legitimately available
--- arch/i386/cpu/sc520/sc520.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
arch/i386/cpu/sc520/sc520.c +0 -2
@@ -46,11 +46,9 @@ int cpu_init_f(void)/* set it to 133 MHz and write back */ writeb (0x02 , &sc520_mmcr->cpuctl); gd->cpu_clk =133000000 ; -printf ("## CPU Speed set to 133MHz\n" ); }else {/* set it to 100 MHz and write back */ writeb (0x01 , &sc520_mmcr->cpuctl); -printf ("## CPU Speed set to 100MHz\n" ); gd->cpu_clk =100000000 ; }
Signature · 1 line
1.7.1.422.g049e9
PATCH 14/32 sc520: Remove printf calls from cpu_init_f
Quoted 8 lines · Graeme Russ
In later patches,
cpu_init_fwill be called before console has been initialised and printf will not be legitimately availableSigned-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/sc520.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 15/32 eNET: Fix eNET Interrupt Setup for Linux
In reply to Graeme RussFix minor issues with the configuration of the hardware interrupts for Linux when booting the eNET board
--- board/eNET/eNET.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
board/eNET/eNET.c +9 -6
@@ -191,10 +191,18 @@ void setup_pcat_compatibility()*/ writew (0x0000 ,&sc520_mmcr->intpinpol); -/* Set PIT 0 -> IRQ0, RTC -> IRQ8, FP error -> IRQ13 */ +/* +* PIT 0 -> IRQ0 +* RTC -> IRQ8 +* FP error -> IRQ13 +* UART1 -> IRQ4 +* UART2 -> IRQ3 +*/ writeb (SC520_IRQ0 , &sc520_mmcr->pit_int_map[0 ]);writeb (SC520_IRQ8 , &sc520_mmcr->rtcmap);writeb (SC520_IRQ13 , &sc520_mmcr->ferrmap); +writeb (SC520_IRQ4 , &sc520_mmcr->uart_int_map[0 ]); +writeb (SC520_IRQ3 , &sc520_mmcr->uart_int_map[1 ]);/* Disable all other interrupt sources */ writeb (SC520_IRQ_DISABLED , &sc520_mmcr->gp_tmr_int_map[0 ]);
@@ -202,11 +210,6 @@ void setup_pcat_compatibility()writeb (SC520_IRQ_DISABLED , &sc520_mmcr->gp_tmr_int_map[2 ]);writeb (SC520_IRQ_DISABLED , &sc520_mmcr->pit_int_map[1 ]);writeb (SC520_IRQ_DISABLED , &sc520_mmcr->pit_int_map[2 ]); -writeb (SC520_IRQ_DISABLED , &sc520_mmcr->pci_int_map[0 ]);/* disable PCI INT A */ -writeb (SC520_IRQ_DISABLED , &sc520_mmcr->pci_int_map[1 ]);/* disable PCI INT B */ -writeb (SC520_IRQ_DISABLED , &sc520_mmcr->pci_int_map[2 ]);/* disable PCI INT C */ -writeb (SC520_IRQ_DISABLED , &sc520_mmcr->pci_int_map[3 ]);/* disable PCI INT D */ -writeb (SC520_IRQ_DISABLED , &sc520_mmcr->dmabcintmap);/* disable DMA INT */ writeb (SC520_IRQ_DISABLED , &sc520_mmcr->ssimap);writeb (SC520_IRQ_DISABLED , &sc520_mmcr->wdtmap);writeb (SC520_IRQ_DISABLED , &sc520_mmcr->wpvmap);
Signature · 1 line
1.7.1.422.g049e9
PATCH 15/32 eNET: Fix eNET Interrupt Setup for Linux
Quoted 8 lines · Graeme Russ
Fix minor issues with the configuration of the hardware interrupts for Linux when booting the eNET board
Signed-off-by Graeme Russ <[email protected]>--- board/eNET/eNET.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 16/32 eNET: Add RTC support to eNET
In reply to Graeme RussThe SC520 has an inbuilt MC146818 - Enable it for the eNET board
--- drivers/rtc/mc146818.c | 6 ++++++ include/configs/eNET.h | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/rtc/mc146818.c +6 -0
@@ -31,6 +31,12 @@#include <command.h> #include <rtc.h> +#ifdef __I386__ +#include <asm/io.h> +#define in8 (p) inb(p) +#define out8 (p, v) outb(v, p) +#endif +#if defined(CONFIG_CMD_DATE )static uchar rtc_read (uchar reg);
include/configs/eNET.h +2 -0
@@ -33,6 +33,7 @@* Stuff still to be dealt with - */ #define CONFIG_RTC_MC146818 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS 0/* * High Level Configuration Options
@@ -91,6 +92,7 @@#define CONFIG_CMD_BDI /* bdinfo */ #define CONFIG_CMD_BOOTD /* bootd */ #define CONFIG_CMD_CONSOLE /* coninfo */ +#define CONFIG_CMD_DATE #define CONFIG_CMD_ECHO /* echo arguments */ #define CONFIG_CMD_FLASH /* flinfo, erase, protect */ #define CONFIG_CMD_FPGA /* FPGA configuration Support */
Signature · 1 line
1.7.1.422.g049e9
PATCH 16/32 eNET: Add RTC support to eNET
Quoted 8 lines · Graeme Russ
The SC520 has an inbuilt MC146818 - Enable it for the eNET board
Signed-off-by Graeme Russ <[email protected]>--- drivers/rtc/mc146818.c | 6 ++++++ include/configs/eNET.h | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 17/32 eNET: Define MMCR values in config.h
In reply to Graeme Russ--- board/eNET/eNET.c | 104 +++++++----- board/eNET/eNET_start16.S | 5 +- include/configs/eNET.h | 382 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 445 insertions(+), 46 deletions(-)
board/eNET/eNET.c +60 -44
@@ -53,36 +53,57 @@ static void enet_toggle_run_led(void);*/ int board_early_init_f (void ) { -writeb (0x01 , &sc520_mmcr->gpcsrt);/* GP Chip Select Recovery Time */ -writeb (0x07 , &sc520_mmcr->gpcspw);/* GP Chip Select Pulse Width */ -writeb (0x00 , &sc520_mmcr->gpcsoff);/* GP Chip Select Offset */ -writeb (0x05 , &sc520_mmcr->gprdw);/* GP Read pulse width */ -writeb (0x01 , &sc520_mmcr->gprdoff);/* GP Read offset */ -writeb (0x05 , &sc520_mmcr->gpwrw);/* GP Write pulse width */ -writeb (0x01 , &sc520_mmcr->gpwroff);/* GP Write offset */ - -writew (0x0630 , &sc520_mmcr->piodata15_0);/* PIO15_PIO0 Data */ -writew (0x2000 , &sc520_mmcr->piodata31_16);/* PIO31_PIO16 Data */ -writew (0x2000 , &sc520_mmcr->piodir31_16);/* GPIO Direction */ -writew (0x87b5 , &sc520_mmcr->piodir15_0);/* GPIO Direction */ -writew (0x0dfe , &sc520_mmcr->piopfs31_16);/* GPIO pin function 31-16 reg */ -writew (0x200a , &sc520_mmcr->piopfs15_0);/* GPIO pin function 15-0 reg */ -writeb (0xf8 , &sc520_mmcr->cspfs);/* Chip Select Pin Function Select */ - -writel (0x200713f8 , &sc520_mmcr->par[2 ]);/* Uart A (GPCS0, 0x013f8, 8 Bytes) */ -writel (0x2c0712f8 , &sc520_mmcr->par[3 ]);/* Uart B (GPCS3, 0x012f8, 8 Bytes) */ -writel (0x300711f8 , &sc520_mmcr->par[4 ]);/* Uart C (GPCS4, 0x011f8, 8 Bytes) */ -writel (0x340710f8 , &sc520_mmcr->par[5 ]);/* Uart D (GPCS5, 0x010f8, 8 Bytes) */ -writel (0xe3ffc000 , &sc520_mmcr->par[6 ]);/* SDRAM (0x00000000, 128MB) */ -writel (0xaa3fd000 , &sc520_mmcr->par[7 ]);/* StrataFlash (ROMCS1, 0x10000000, 16MB) */ -writel (0xca3fd100 , &sc520_mmcr->par[8 ]);/* StrataFlash (ROMCS2, 0x11000000, 16MB) */ -writel (0x4203d900 , &sc520_mmcr->par[9 ]);/* SRAM (GPCS0, 0x19000000, 1MB) */ -writel (0x4e03d910 , &sc520_mmcr->par[10 ]);/* SRAM (GPCS3, 0x19100000, 1MB) */ -writel (0x50018100 , &sc520_mmcr->par[11 ]);/* DP-RAM (GPCS4, 0x18100000, 4kB) */ -writel (0x54020000 , &sc520_mmcr->par[12 ]);/* CFLASH1 (0x200000000, 4kB) */ -writel (0x5c020001 , &sc520_mmcr->par[13 ]);/* CFLASH2 (0x200010000, 4kB) */ -/* writel(0x8bfff800, &sc520_mmcr->par14); */ /* BOOTCS at 0x18000000 */ -/* writel(0x38201000, &sc520_mmcr->par15); */ /* LEDs etc (GPCS6, 0x1000, 20 Bytes */ +u16 pio_out_cfg =0x0000 ; + +/* Configure General Purpose Bus timing */ +writeb (CONFIG_SYS_SC520_GPCSRT , &sc520_mmcr->gpcsrt); +writeb (CONFIG_SYS_SC520_GPCSPW , &sc520_mmcr->gpcspw); +writeb (CONFIG_SYS_SC520_GPCSOFF , &sc520_mmcr->gpcsoff); +writeb (CONFIG_SYS_SC520_GPRDW , &sc520_mmcr->gprdw); +writeb (CONFIG_SYS_SC520_GPRDOFF , &sc520_mmcr->gprdoff); +writeb (CONFIG_SYS_SC520_GPWRW , &sc520_mmcr->gpwrw); +writeb (CONFIG_SYS_SC520_GPWROFF , &sc520_mmcr->gpwroff); + +/* Configure Programmable Input/Output Pins */ +writew (CONFIG_SYS_SC520_PIODIR15_0 , &sc520_mmcr->piodir15_0); +writew (CONFIG_SYS_SC520_PIODIR31_16 , &sc520_mmcr->piodir31_16); +writew (CONFIG_SYS_SC520_PIOPFS31_16 , &sc520_mmcr->piopfs31_16); +writew (CONFIG_SYS_SC520_PIOPFS15_0 , &sc520_mmcr->piopfs15_0); +writeb (CONFIG_SYS_SC520_CSPFS , &sc520_mmcr->cspfs); +writeb (CONFIG_SYS_SC520_CLKSEL , &sc520_mmcr->clksel); + +/* +* Turn off top board +* Set StrataFlash chips to 16-bit width +* Set StrataFlash chips to normal (non reset/power down) mode +*/ + pio_out_cfg |=CONFIG_SYS_ENET_TOP_BRD_PWR ; + pio_out_cfg |=CONFIG_SYS_ENET_SF_WIDTH ; + pio_out_cfg |=CONFIG_SYS_ENET_SF1_MODE ; + pio_out_cfg |=CONFIG_SYS_ENET_SF2_MODE ; +writew (pio_out_cfg, &sc520_mmcr->pioset15_0); + +/* Turn off auxiliary power output */ +writew (CONFIG_SYS_ENET_AUX_PWR , &sc520_mmcr->pioclr15_0); + +/* Clear FPGA program mode */ +writew (CONFIG_SYS_ENET_FPGA_PROG , &sc520_mmcr->pioset31_16); + +/* Configure Programmable Address Regions */ +writel (CONFIG_SYS_SC520_UARTA_PAR , &sc520_mmcr->par[2 ]); +writel (CONFIG_SYS_SC520_UARTB_PAR , &sc520_mmcr->par[3 ]); +writel (CONFIG_SYS_SC520_UARTC_PAR , &sc520_mmcr->par[4 ]); +writel (CONFIG_SYS_SC520_UARTD_PAR , &sc520_mmcr->par[5 ]); +writel (CONFIG_SYS_SC520_SDRAM_PAR , &sc520_mmcr->par[6 ]); +writel (CONFIG_SYS_SC520_SF1_PAR , &sc520_mmcr->par[7 ]); +writel (CONFIG_SYS_SC520_SF2_PAR , &sc520_mmcr->par[8 ]); +writel (CONFIG_SYS_SC520_SRAM1_PAR , &sc520_mmcr->par[9 ]); +writel (CONFIG_SYS_SC520_SRAM2_PAR , &sc520_mmcr->par[10 ]); +writel (CONFIG_SYS_SC520_DPRAM_PAR , &sc520_mmcr->par[11 ]); +writel (CONFIG_SYS_SC520_CF1_PAR , &sc520_mmcr->par[12 ]); +writel (CONFIG_SYS_SC520_CF2_PAR , &sc520_mmcr->par[13 ]); +/* writel(CONFIG_SYS_SC520_BOOTCS_PAR, &sc520_mmcr->par14); */ +/* writel(CONFIG_SYS_SC520_LLIO_PAR, &sc520_mmcr->par15); */ /* Disable Watchdog */ writew (0x3333 , &sc520_mmcr->wdtmrctl);
@@ -90,24 +111,19 @@ int board_early_init_f(void)writew (0x0000 , &sc520_mmcr->wdtmrctl);/* Chip Select Configuration */ -writew (0x0033 , &sc520_mmcr->bootcsctl); -writew (0x0615 , &sc520_mmcr->romcs1ctl); -writew (0x0615 , &sc520_mmcr->romcs2ctl); +writew (CONFIG_SYS_SC520_BOOTCS_CTRL , &sc520_mmcr->bootcsctl); +writew (CONFIG_SYS_SC520_ROMCS1_CTRL , &sc520_mmcr->romcs1ctl); +writew (CONFIG_SYS_SC520_ROMCS2_CTRL , &sc520_mmcr->romcs2ctl); -/* -* Set the timer pin mapping -* no clock frequency selected, use 1.1892MHz -*/ -writeb (0x72 , &sc520_mmcr->clksel); +writeb (CONFIG_SYS_SC520_ADDDECCTL , &sc520_mmcr->adddecctl); +writeb (CONFIG_SYS_SC520_UART1CTL , &sc520_mmcr->uart1ctl); +writeb (CONFIG_SYS_SC520_UART2CTL , &sc520_mmcr->uart2ctl); -writeb (0x00 , &sc520_mmcr->adddecctl); -writeb (0x07 , &sc520_mmcr->uart1ctl); -writeb (0x07 , &sc520_mmcr->uart2ctl); -writeb (0x06 , &sc520_mmcr->sysarbctl); -writew (0x0003 , &sc520_mmcr->sysarbmenb); +writeb (CONFIG_SYS_SC520_SYSARBCTL , &sc520_mmcr->sysarbctl); +writew (CONFIG_SYS_SC520_SYSARBMENB , &sc520_mmcr->sysarbmenb);/* enable posted-writes */ -writeb (0x04 , &sc520_mmcr->hbctl); +writeb (CONFIG_SYS_SC520_HBCTL , &sc520_mmcr->hbctl);return 0 ; }
board/eNET/eNET_start16.S +3 -2
@@ -29,6 +29,7 @@ /* #include <asm/ic/sc520_defs.h> */ +#include "config.h" #include "hardware.h" #include <asm/ic/sc520.h>
@@ -48,12 +49,12 @@ board_init16: /* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */ movl $(SC520_PAR14 - SC520_MMCR_BASE), %edi - movl $0x8bfff800, %eax /* TODO: Check this */ + 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 $0x38201000, %eax + movl $CONFIG_SYS_SC520_LLIO_PAR, %eax movl %eax, (%di) /* Disable SDRAM write buffer */
include/configs/eNET.h +382 -0
388 lines not on this page · raw message
Signature · 1 line
1.7.1.422.g049e9
PATCH 17/32 eNET: Define MMCR values in config.h
Quoted 7 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- board/eNET/eNET.c | 104 +++++++----- board/eNET/eNET_start16.S | 5 +- include/configs/eNET.h | 382 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 445 insertions(+), 46 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 18/32 eNET: Rearrange PAR assignments
In reply to Graeme Russ--- board/eNET/eNET.c | 61 ++++++++++++++++++++++++++++++++++++----------- include/configs/eNET.h | 15 ----------- 2 files changed, 46 insertions(+), 30 deletions(-)
board/eNET/eNET.c +46 -15
@@ -47,6 +47,7 @@ unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;static void enet_timer_isr (void );static void enet_toggle_run_led (void ); +static void enet_setup_pars (void );/* * Miscellaneous platform dependent initializations
@@ -89,21 +90,7 @@ int board_early_init_f(void)/* Clear FPGA program mode */ writew (CONFIG_SYS_ENET_FPGA_PROG , &sc520_mmcr->pioset31_16); -/* Configure Programmable Address Regions */ -writel (CONFIG_SYS_SC520_UARTA_PAR , &sc520_mmcr->par[2 ]); -writel (CONFIG_SYS_SC520_UARTB_PAR , &sc520_mmcr->par[3 ]); -writel (CONFIG_SYS_SC520_UARTC_PAR , &sc520_mmcr->par[4 ]); -writel (CONFIG_SYS_SC520_UARTD_PAR , &sc520_mmcr->par[5 ]); -writel (CONFIG_SYS_SC520_SDRAM_PAR , &sc520_mmcr->par[6 ]); -writel (CONFIG_SYS_SC520_SF1_PAR , &sc520_mmcr->par[7 ]); -writel (CONFIG_SYS_SC520_SF2_PAR , &sc520_mmcr->par[8 ]); -writel (CONFIG_SYS_SC520_SRAM1_PAR , &sc520_mmcr->par[9 ]); -writel (CONFIG_SYS_SC520_SRAM2_PAR , &sc520_mmcr->par[10 ]); -writel (CONFIG_SYS_SC520_DPRAM_PAR , &sc520_mmcr->par[11 ]); -writel (CONFIG_SYS_SC520_CF1_PAR , &sc520_mmcr->par[12 ]); -writel (CONFIG_SYS_SC520_CF2_PAR , &sc520_mmcr->par[13 ]); -/* writel(CONFIG_SYS_SC520_BOOTCS_PAR, &sc520_mmcr->par14); */ -/* writel(CONFIG_SYS_SC520_LLIO_PAR, &sc520_mmcr->par15); */ +enet_setup_pars ();/* Disable Watchdog */ writew (0x3333 , &sc520_mmcr->wdtmrctl);
@@ -128,6 +115,50 @@ int board_early_init_f(void)return 0 ; } +static void enet_setup_pars (void ) +{ +/* +* PARs 11 and 12 are 2MB SRAM @ 0x19000000 +* +* These are setup now because older version of U-Boot have them +* mapped to a different PAR which gets clobbered which prevents +* using SRAM for warm-booting a new image +*/ +writel (CONFIG_SYS_SC520_SRAM1_PAR , &sc520_mmcr->par[11 ]); +writel (CONFIG_SYS_SC520_SRAM2_PAR , &sc520_mmcr->par[12 ]); + +/* PARs 0 and 1 are Compact Flash slots (4kB each) */ +writel (CONFIG_SYS_SC520_CF1_PAR , &sc520_mmcr->par[0 ]); +writel (CONFIG_SYS_SC520_CF2_PAR , &sc520_mmcr->par[1 ]); + +/* PAR 2 is used for Cache-As-RAM */ + +/* +* PARs 5 through 8 are additional NS16550 UARTS +* 8 bytes each @ 0x013f8, 0x012f8, 0x011f8 and 0x010f8 +*/ +writel (CONFIG_SYS_SC520_UARTA_PAR , &sc520_mmcr->par[5 ]); +writel (CONFIG_SYS_SC520_UARTB_PAR , &sc520_mmcr->par[6 ]); +writel (CONFIG_SYS_SC520_UARTC_PAR , &sc520_mmcr->par[7 ]); +writel (CONFIG_SYS_SC520_UARTD_PAR , &sc520_mmcr->par[8 ]); + +/* PARs 9 and 10 are 32MB StrataFlash @ 0x10000000 */ +writel (CONFIG_SYS_SC520_SF1_PAR , &sc520_mmcr->par[9 ]); +writel (CONFIG_SYS_SC520_SF2_PAR , &sc520_mmcr->par[10 ]); + +/* PAR 13 is 4kB DPRAM @ 0x18100000 (implemented in FPGA) */ +writel (CONFIG_SYS_SC520_DPRAM_PAR , &sc520_mmcr->par[13 ]); + +/* +* PAR 14 is Low Level I/O (LEDs, Hex Switches etc) +* Already configured in board_init16 (eNET_start16.S) +* +* PAR 15 is Boot ROM +* Already configured in board_init16 (eNET_start16.S) +*/ +} + +int board_early_init_r (void ) {/* CPU Speed to 100MHz */
include/configs/eNET.h +0 -15
@@ -614,21 +614,6 @@*/ #define CONFIG_SYS_SC520_DPRAM_PAR 0x50018100 -/*----------------------------------------------------------------------- -* PAR for SDRAM - 128MB @ 0x00000000 -* 111 0 0 0 1 11111111111 00000000000000 }- 0xe3ffc000 -* \ / | | | | \----+----/ \-----+------/ -* | | | | | | +---------- Start at 0x00000000 -* | | | | | +----------------------- 128MB Region Size -* | | | | | ((2047 + 1) * 64kB) -* | | | | +------------------------------ 64kB Page Size -* | | | +-------------------------------- Writes Enabled -* | | +---------------------------------- Caching Enabled -* | +------------------------------------ Execution Enabled -* +--------------------------------------- SDRAM -*/ -#define CONFIG_SYS_SC520_SDRAM_PAR 0xe3ffc000 -#ifndef __ASSEMBLER__extern unsigned long ip;
Signature · 1 line
1.7.1.422.g049e9
PATCH 18/32 eNET: Rearrange PAR assignments
Quoted 6 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- board/eNET/eNET.c | 61 ++++++++++++++++++++++++++++++++++++----------- include/configs/eNET.h | 15 ----------- 2 files changed, 46 insertions(+), 30 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 19/32 eNET: General code cleanup
In reply to Graeme Russ--- board/eNET/eNET.c | 17 +-- board/eNET/eNET_start.S | 7 - include/configs/eNET.h | 290 ++++++++++++++++++++--------------------------- 3 files changed, 129 insertions(+), 185 deletions(-)
board/eNET/eNET.c +4 -13
@@ -35,16 +35,6 @@DECLARE_GLOBAL_DATA_PTR ; -#undef SC520_CDP_DEBUG - -#ifdef SC520_CDP_DEBUG -#define PRINTF(fmt,args...) printf (fmt ,##args) -#else -#define PRINTF(fmt,args...) -#endif - -unsigned long monitor_flash_len =CONFIG_SYS_MONITOR_LEN ; -static void enet_timer_isr (void );static void enet_toggle_run_led (void );static void enet_setup_pars (void );
@@ -199,22 +189,23 @@ int last_stage_init(void)outb (0x00 ,LED_LATCH_ADDRESS ); -register_timer_isr (enet_timer_isr); +register_timer_isr (enet_timer_isr);printf ("Serck Controls eNET\n" );return 0 ; } -ulong board_flash_get_legacy (ulong base,int banknum,flash_info_t * info) +ulong board_flash_get_legacy (ulong base,int banknum,flash_info_t *info) {if (banknum ==0 ) {/* non-CFI boot flash */ info->portwidth =FLASH_CFI_8BIT ; info->chipwidth =FLASH_CFI_BY8 ; info->interface =FLASH_CFI_X8 ;return 1 ; - }else + }else {return 0 ; + } }int board_eth_init (bd_t *bis)
board/eNET/eNET_start.S +0 -7
@@ -29,10 +29,3 @@ early_board_init: /* No 32-bit board specific initialisation */ jmp early_board_init_ret -.globl cpu_halt_asm -cpu_halt_asm: - movb $0x0f, %al - movw $LED_LATCH_ADDRESS, %dx - outb %al, %dx - hlt - jmp cpu_halt_asm
include/configs/eNET.h +125 -165
361 lines not on this page · raw message
Signature · 1 line
1.7.1.422.g049e9
PATCH 19/32 eNET: General code cleanup
Quoted 7 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- board/eNET/eNET.c | 17 +-- board/eNET/eNET_start.S | 7 - include/configs/eNET.h | 290 ++++++++++++++++++++--------------------------- 3 files changed, 129 insertions(+), 185 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 20/32 x86: Move initial gd to fixed location
In reply to Graeme Russ--- arch/i386/cpu/start.S | 12 +++++----- arch/i386/include/asm/global_data.h | 7 +++++- arch/i386/lib/board.c | 36 +++++++++++++++++++++++----------- include/configs/eNET.h | 3 ++ 4 files changed, 39 insertions(+), 19 deletions(-)
arch/i386/cpu/start.S +6 -6
@@ -127,13 +127,13 @@ mem_ok: /* Set the upper memory limit parameter */ subl $CONFIG_SYS_STACK_SIZE, %eax - /* Reserve space for global data */ - subl $(GD_SIZE * 4), %eax + /* Pointer to temporary global data */ + movl $CONFIG_SYS_INIT_GD_ADDR, %edx - /* %eax points to the global data structure */ - movl %esp, (GD_RAM_SIZE * 4)(%eax) - movl %ebx, (GD_FLAGS * 4)(%eax) - movl %ecx, (GD_LOAD_OFF * 4)(%eax) + /* %edx points to the global data structure */ + movl %esp, (GD_RAM_SIZE * 4)(%edx) + movl %ebx, (GD_FLAGS * 4)(%edx) + movl %ecx, (GD_LOAD_OFF * 4)(%edx) call board_init_f /* Enter, U-boot! */
arch/i386/include/asm/global_data.h +6 -1
@@ -87,7 +87,12 @@ extern gd_t *gd;#define GD_FLG_COLD_BOOT 0x00100/* Cold Boot */ #define GD_FLG_WARM_BOOT 0x00200/* Warm Boot */ - +#if 0 #define DECLARE_GLOBAL_DATA_PTR +#else +#define XTRN_DECLARE_GLOBAL_DATA_PTR extern +#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \ +gd_t *gd +#endif #endif /* __ASM_GBL_DATA_H */
arch/i386/lib/board.c +24 -12
@@ -45,7 +45,15 @@#include <miiphy.h> #endif -DECLARE_GLOBAL_DATA_PTR ; +/* +* Pointer to initial global data area +* +* Here we initialize it. +*/ +#undef XTRN_DECLARE_GLOBAL_DATA_PTR +#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */ +DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_GD_ADDR ); +/* Exports from the Linker Script */ extern ulong __text_start;
@@ -168,7 +176,7 @@ gd_t *gd;/* * Load U-Boot into RAM, initialize BSS, perform relocation adjustments */ -void board_init_f (ulong gdp) +void board_init_f (ulong mem_top) {void *text_start = &__text_start;void *data_end = &__data_end;
@@ -187,11 +195,11 @@ void board_init_f (ulong gdp)Elf32_Rel *re_end;/* Calculate destination RAM Address and relocation offset */ - dest_addr = (void *)gdp - (bss_end - text_start); + dest_addr = (void *)mem_top - (bss_end - text_start); rel_offset = text_start - dest_addr;/* Perform low-level initialization only when cold booted */ -if (((gd_t *)gdp)->flags &GD_FLG_COLD_BOOT ) { +if (gd->flags &GD_FLG_COLD_BOOT ) {/* First stage CPU initialization */ if (cpu_init_f () !=0 )hang ();
@@ -203,8 +211,8 @@ void board_init_f (ulong gdp)/* Copy U-Boot into RAM */ dst_addr = (ulong *)dest_addr; - src_addr = (ulong *)(text_start + ((gd_t *)gdp)->load_off); - end_addr = (ulong *)(data_end + ((gd_t *)gdp)->load_off); + src_addr = (ulong *)(text_start + gd->load_off); + end_addr = (ulong *)(data_end + gd->load_off);while (src_addr < end_addr) *dst_addr++ = *src_addr++;
@@ -217,8 +225,8 @@ void board_init_f (ulong gdp) *dst_addr++ =0x00000000 ;/* Perform relocation adjustments */ - re_src = (Elf32_Rel *)(rel_dyn_start + ((gd_t *)gdp)->load_off); - re_end = (Elf32_Rel *)(rel_dyn_end + ((gd_t *)gdp)->load_off); + re_src = (Elf32_Rel *)(rel_dyn_start + gd->load_off); + re_end = (Elf32_Rel *)(rel_dyn_end + gd->load_off); do { if (re_src->r_offset >= CONFIG_SYS_TEXT_BASE)
@@ -226,11 +234,11 @@ void board_init_f (ulong gdp) *(Elf32_Addr *)(re_src->r_offset - rel_offset) -= rel_offset; }while (re_src++ < re_end); - ((gd_t *)gdp)->reloc_off = rel_offset; - ((gd_t *)gdp)->flags |=GD_FLG_RELOC ; + gd->reloc_off = rel_offset; + gd->flags |=GD_FLG_RELOC ;/* Enter the relocated U-Boot! */ - (board_init_r - rel_offset)((gd_t *)gdp, (ulong )dest_addr); + (board_init_r - rel_offset)(gd, (ulong )dest_addr);/* NOTREACHED - board_init_f() does not return */ while (1 );
@@ -242,11 +250,15 @@ void board_init_r(gd_t *id, ulong dest_addr)int i;ulong size;static bd_t bd_data; +static gd_t gd_data;init_fnc_t **init_fnc_ptr;show_boot_progress (0x21 ); - gd = id; +/* Global data pointer is now writable */ + gd = &gd_data; +memcpy (gd, id,sizeof (gd_t)); +/* compiler optimization barrier needed for GCC >= 3.4 */ __asm__ __volatile__("" : : :"memory" );
include/configs/eNET.h +3 -0
@@ -164,6 +164,9 @@#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE#define CONFIG_SYS_MONITOR_LEN (256 * 1024)#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024) +/* Address of temporary Global Data */ +#define CONFIG_SYS_INIT_GD_ADDR 0x19040000 +/* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE
Signature · 1 line
1.7.1.422.g049e9
PATCH 20/32 x86: Move initial gd to fixed location
Quoted 8 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/start.S | 12 +++++----- arch/i386/include/asm/global_data.h | 7 +++++- arch/i386/lib/board.c | 36 +++++++++++++++++++++++----------- include/configs/eNET.h | 3 ++ 4 files changed, 39 insertions(+), 19 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 21/32 x86: Use Cache-As-RAM for initial stack
In reply to Graeme Russ--- arch/i386/cpu/sc520/Makefile | 1 + arch/i386/cpu/sc520/sc520_asm.S | 6 +- arch/i386/cpu/sc520/sc520_car.S | 94 +++++++++++++++++++++++++++++++++++++++ arch/i386/cpu/start.S | 35 +++++++------- include/configs/eNET.h | 20 ++++++++ 5 files changed, 135 insertions(+), 21 deletions(-) create mode 100644 arch/i386/cpu/sc520/sc520_car.S
arch/i386/cpu/sc520/Makefile +1 -0
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_SYS_SC520_SSI) += sc520_ssi.o COBJS-$(CONFIG_SYS_SC520_TIMER) += sc520_timer.o SOBJS-$(CONFIG_SYS_SC520) += sc520_asm.o +SOBJS-$(CONFIG_SYS_SC520) += sc520_car.o SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
arch/i386/cpu/sc520/sc520_asm.S +3 -3
@@ -515,7 +515,7 @@ bad_ram: dram_done: /* Restore Boot Flags */ movl %ebx, %ebp - jmp mem_init_ret + ret #if CONFIG_SYS_SDRAM_ECC_ENABLE .globl init_ecc
@@ -560,7 +560,7 @@ set_ecc: movb %al,(%edi) out: - jmp init_ecc_ret + ret #endif /*
@@ -605,4 +605,4 @@ bank3: movl (%edi), %eax done: movl %edx, %eax - jmp get_mem_size_ret + ret
arch/i386/cpu/sc520/sc520_car.S new file +94 -0
94 lines not on this page · raw message
arch/i386/cpu/start.S +17 -18
@@ -72,41 +72,40 @@ _start: .globl early_board_init_ret early_board_init_ret: + /* Initialise Cache-As-RAM */ + jmp car_init +.globl car_init_ret +car_init_ret: + /* + * We now have CONFIG_SYS_CAR_SIZE bytes of Cache-As-RAM (or SRAM, + * or fully initialised SDRAM - we really don't care which) + * starting at CONFIG_SYS_CAR_ADDR to be used as a temporary stack + */ + movl $CONFIG_SYS_INIT_SP_ADDR, %esp + /* Skip memory initialization if not starting from cold-reset */ movl %ebx, %ecx andl $GD_FLG_COLD_BOOT, %ecx jz skip_mem_init /* size memory */ - jmp mem_init -.globl mem_init_ret -mem_init_ret: + call mem_init skip_mem_init: /* fetch memory size (into %eax) */ - jmp get_mem_size -.globl get_mem_size_ret -get_mem_size_ret: + call get_mem_size + movl %eax, %esp #if CONFIG_SYS_SDRAM_ECC_ENABLE /* Skip ECC initialization if not starting from cold-reset */ movl %ebx, %ecx andl $GD_FLG_COLD_BOOT, %ecx - jz init_ecc_ret - jmp init_ecc + jz skip_ecc_init + call init_ecc -.globl init_ecc_ret -init_ecc_ret: +skip_init_ecc: #endif - /* Check we have enough memory for stack */ - movl $CONFIG_SYS_STACK_SIZE, %ecx - cmpl %ecx, %eax - jb die -mem_ok: - /* Set stack pointer to upper memory limit*/ - movl %eax, %esp - /* Test the stack */ pushl $0 popl %ecx
include/configs/eNET.h +20 -0
@@ -161,6 +161,10 @@* 256kB Monitor */ #define CONFIG_SYS_STACK_SIZE 0x8000 +#define CONFIG_SYS_CAR_ADDR 0x19200000 +#define CONFIG_SYS_CAR_SIZE 0x00004000 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_CAR_ADDR + \ + CONFIG_SYS_CAR_SIZE)#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE#define CONFIG_SYS_MONITOR_LEN (256 * 1024)#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024)
@@ -480,6 +484,22 @@#define CONFIG_SYS_SC520_BOOTCS_PAR 0x8a01f800/*----------------------------------------------------------------------- +* Cache-As-RAM (Targets Boot Flash) +* +* 100 1 0 0 0 0001111 011001001000000000 }- 0x903d9200 +* \ / | | | | \--+--/ \-------+--------/ +* | | | | | | +------------ Start at 0x19200000 +* | | | | | +------------------------- 64k Region Size +* | | | | | ((15 + 1) * 4kB) +* | | | | +------------------------------ 4kB Page Size +* | | | +-------------------------------- Writes Enabled +* | | +---------------------------------- Caching Enabled +* | +------------------------------------ Execution Prevented +* +--------------------------------------- BOOTCS +*/ +#define CONFIG_SYS_SC520_CAR_PAR 0x903d9200 + +/*----------------------------------------------------------------------- * PAR for Low Level I/O (LEDs, Hex Switches etc) - 33 Bytes @ 0x1000, GPCS6 * * 001 110 0 000100000 0001000000000000 }- 0x38201000
Signature · 1 line
1.7.1.422.g049e9
PATCH 21/32 x86: Use Cache-As-RAM for initial stack
Quoted 10 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/Makefile | 1 + arch/i386/cpu/sc520/sc520_asm.S | 6 +- arch/i386/cpu/sc520/sc520_car.S | 94 +++++++++++++++++++++++++++++++++++++++ arch/i386/cpu/start.S | 35 +++++++------- include/configs/eNET.h | 20 ++++++++ 5 files changed, 135 insertions(+), 21 deletions(-) create mode 100644 arch/i386/cpu/sc520/sc520_car.S
Applied to u-boot-x86
Regards,
Graeme
PATCH 22/32 sc520: Move RAM sizing code from asm to C
In reply to Graeme Russ--- arch/i386/cpu/sc520/Makefile | 2 +- arch/i386/cpu/sc520/sc520.c | 110 ------- arch/i386/cpu/sc520/sc520_asm.S | 608 ------------------------------------- arch/i386/cpu/sc520/sc520_sdram.c | 532 ++++++++++++++++++++++++++++++++ arch/i386/cpu/start.S | 48 +-- arch/i386/include/asm/ic/sc520.h | 57 ++++ arch/i386/lib/board.c | 10 +- board/eNET/eNET.c | 6 - board/eNET/eNET_start16.S | 5 - include/configs/eNET.h | 2 +- 10 files changed, 612 insertions(+), 768 deletions(-) delete mode 100644 arch/i386/cpu/sc520/sc520_asm.S create mode 100644 arch/i386/cpu/sc520/sc520_sdram.c
arch/i386/cpu/sc520/Makefile +1 -1
@@ -33,10 +33,10 @@ LIB := $(obj)lib$(SOC).o COBJS-$(CONFIG_SYS_SC520) += sc520.o COBJS-$(CONFIG_PCI) += sc520_pci.o +COBJS-$(CONFIG_SYS_SC520) += sc520_sdram.o COBJS-$(CONFIG_SYS_SC520_SSI) += sc520_ssi.o COBJS-$(CONFIG_SYS_SC520_TIMER) += sc520_timer.o -SOBJS-$(CONFIG_SYS_SC520) += sc520_asm.o SOBJS-$(CONFIG_SYS_SC520) += sc520_car.o SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
arch/i386/cpu/sc520/sc520.c +0 -110
122 lines not on this page · raw message
arch/i386/cpu/sc520/sc520_asm.S deleted +0 -608
608 lines not on this page · raw message
arch/i386/cpu/sc520/sc520_sdram.c new file +532 -0
532 lines not on this page · raw message
arch/i386/cpu/start.S +14 -34
64 lines not on this page · raw message
arch/i386/include/asm/ic/sc520.h +57 -0
69 lines not on this page · raw message
arch/i386/lib/board.c +7 -3
@@ -1,6 +1,6 @@/* * (C) Copyright 2002 -* Daniel Engstr?m, Omicron Ceti AB, daniel at omicron.se +* Daniel Engstr???m, Omicron Ceti AB, daniel at omicron.se * * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
@@ -176,7 +176,7 @@ gd_t *gd;/* * Load U-Boot into RAM, initialize BSS, perform relocation adjustments */ -void board_init_f (ulong mem_top) +void board_init_f (ulong boot_flags) {void *text_start = &__text_start;void *data_end = &__data_end;
@@ -194,8 +194,12 @@ void board_init_f(ulong mem_top)Elf32_Rel *re_src;Elf32_Rel *re_end; + gd->flags = boot_flags; +/* Calculate destination RAM Address and relocation offset */ - dest_addr = (void *)mem_top - (bss_end - text_start); + dest_addr = (void *)gd->ram_size; + dest_addr -=CONFIG_SYS_STACK_SIZE ; + dest_addr -= (bss_end - text_start); rel_offset = text_start - dest_addr;/* Perform low-level initialization only when cold booted */
board/eNET/eNET.c +0 -6
@@ -160,12 +160,6 @@ int board_early_init_r(void)return 0 ; } -int dram_init (void ) -{ -init_sc520_dram (); -return 0 ; -} -void show_boot_progress (int val) {uchar led_mask;
board/eNET/eNET_start16.S +0 -5
@@ -57,11 +57,6 @@ board_init16: movl $CONFIG_SYS_SC520_LLIO_PAR, %eax movl %eax, (%di) - /* Disable SDRAM write buffer */ - movw $(SC520_DBCTL - SC520_MMCR_BASE), %di - xorw %ax, %ax - movb %al, (%di) - /* Disabe MMCR alias */ movw $0xfffc, %dx movl $0x000000cb, %eax
include/configs/eNET.h +1 -1
@@ -136,11 +136,11 @@* SDRAM Configuration */ #define CONFIG_SYS_SDRAM_DRCTMCTL 0x18 +#define CONFIG_SYS_SDRAM_REFRESH_RATE 156#define CONFIG_NR_DRAM_BANKS 4/* CONFIG_SYS_SDRAM_DRCTMCTL Overrides the following*/ #undef CONFIG_SYS_SDRAM_PRECHARGE_DELAY -#undef CONFIG_SYS_SDRAM_REFRESH_RATE#undef CONFIG_SYS_SDRAM_RAS_CAS_DELAY#undef CONFIG_SYS_SDRAM_CAS_LATENCY_2T#undef CONFIG_SYS_SDRAM_CAS_LATENCY_3T
Signature · 1 line
1.7.1.422.g049e9
PATCH 22/32 sc520: Move RAM sizing code from asm to C
Quoted 16 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/Makefile | 2 +- arch/i386/cpu/sc520/sc520.c | 110 ------- arch/i386/cpu/sc520/sc520_asm.S | 608 ------------------------------------- arch/i386/cpu/sc520/sc520_sdram.c | 532 ++++++++++++++++++++++++++++++++ arch/i386/cpu/start.S | 48 +-- arch/i386/include/asm/ic/sc520.h | 57 ++++ arch/i386/lib/board.c | 10 +- board/eNET/eNET.c | 6 - board/eNET/eNET_start16.S | 5 - include/configs/eNET.h | 2 +- 10 files changed, 612 insertions(+), 768 deletions(-) delete mode 100644 arch/i386/cpu/sc520/sc520_asm.S create mode 100644 arch/i386/cpu/sc520/sc520_sdram.c
Applied to u-boot-x86
Regards,
Graeme
PATCH 23/32 x86: Defer setup of final stack
In reply to Graeme Russ--- arch/i386/cpu/start.S | 44 +++++++++++++++++++++++++++++--------------- arch/i386/lib/board.c | 6 ++++-- 2 files changed, 33 insertions(+), 17 deletions(-)
arch/i386/cpu/start.S +29 -15
@@ -96,21 +96,6 @@ car_init_ret: /* size memory */ call dram_init_f - /* Setup stack in SDRAM */ - movl (GD_RAM_SIZE * 4)(%ebp), %esp - - /* Test the stack */ - pushl $0 - popl %ecx - cmpl $0, %ecx - jne die - push $0x55aa55aa - popl %ecx - cmpl $0x55aa55aa, %ecx - jne die - - wbinvd - /* Set parameter to board_init_f() to boot flags */ movl (GD_FLAGS * 4)(%ebp), %eax
@@ -118,6 +103,35 @@ car_init_ret: /* indicate (lack of) progress */ movw $0x85, %ax + jmp die + +.globl relocate_code +.type relocate_code, @function +relocate_code: + /* + * SDRAM has been initialised, U-Boot code has been copied into + * RAM, BSS has been cleared and relocation adjustments have been + * made. It is now time to jump into the in-RAM copy of U-Boot + * + * %eax = Address of top of stack + * %edx = Address of Global Data + * %ecx = Base address of in-RAM copy of U-Boot + */ + + /* Setup stack in RAM */ + movl %eax, %esp + + /* Setup call address of in-RAM copy of board_init_r() */ + movl $board_init_r, %ebp + subl (GD_RELOC_OFF * 4)(%edx), %ebp + + /* Setup parameters to board_init_r() */ + movl %edx, %eax + movl %ecx, %edx + + /* Jump to in-RAM copy of board_init_r() */ + call *%ebp + die: hlt jmp die hlt
arch/i386/lib/board.c +4 -2
@@ -189,6 +189,7 @@ void board_init_f(ulong boot_flags)ulong *src_addr;ulong *end_addr; +void *addr_sp;void *dest_addr;ulong rel_offset;Elf32_Rel *re_src;
@@ -198,6 +199,7 @@ void board_init_f(ulong boot_flags)/* Calculate destination RAM Address and relocation offset */ dest_addr = (void *)gd->ram_size; + addr_sp = dest_addr; dest_addr -=CONFIG_SYS_STACK_SIZE ; dest_addr -= (bss_end - text_start); rel_offset = text_start - dest_addr;
@@ -242,9 +244,9 @@ void board_init_f(ulong boot_flags) gd->flags |=GD_FLG_RELOC ;/* Enter the relocated U-Boot! */ - (board_init_r - rel_offset)(gd, (ulong )dest_addr); +relocate_code ((ulong )addr_sp, gd, (ulong )dest_addr); -/* NOTREACHED - board_init_f() does not return */ +/* NOTREACHED - relocate_code() does not return */ while (1 ); }
Signature · 1 line
1.7.1.422.g049e9
PATCH 23/32 x86: Defer setup of final stack
Quoted 6 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/start.S | 44 +++++++++++++++++++++++++++++--------------- arch/i386/lib/board.c | 6 ++++-- 2 files changed, 33 insertions(+), 17 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 24/32 x86: Move call to dram_init_f into board_init_f
In reply to Graeme Russ--- arch/i386/cpu/start.S | 3 --- arch/i386/include/asm/u-boot-i386.h | 1 + arch/i386/lib/board.c | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-)
arch/i386/cpu/start.S +0 -3
@@ -93,9 +93,6 @@ car_init_ret: subl $1b, %ecx movl %ecx, (GD_LOAD_OFF * 4)(%ebp) - /* size memory */ - call dram_init_f - /* Set parameter to board_init_f() to boot flags */ movl (GD_FLAGS * 4)(%ebp), %eax
arch/i386/include/asm/u-boot-i386.h +1 -0
@@ -37,6 +37,7 @@ int register_timer_isr (timer_fnc_t *isr_func);/* Architecture specific - can be in arch/i386/cpu/, arch/i386/lib/, or $(BOARD)/ */ int timer_init (void ); +int dram_init_f (void );/* cpu/.../interrupts.c */ int cpu_init_interrupts (void );
arch/i386/lib/board.c +3 -0
@@ -197,6 +197,9 @@ void board_init_f(ulong boot_flags) gd->flags = boot_flags; +if (dram_init_f () !=0 ) +hang (); +/* Calculate destination RAM Address and relocation offset */ dest_addr = (void *)gd->ram_size; addr_sp = dest_addr;
Signature · 1 line
1.7.1.422.g049e9
PATCH 24/32 x86: Move call to dram_init_f into board_init_f
Quoted 7 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/start.S | 3 --- arch/i386/include/asm/u-boot-i386.h | 1 + arch/i386/lib/board.c | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 25/32 x86: Move test for cold boot into init functions
In reply to Graeme Russ--- arch/i386/cpu/sc520/sc520.c | 7 ++++--- arch/i386/lib/board.c | 17 +++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-)
arch/i386/cpu/sc520/sc520.c +4 -3
@@ -45,15 +45,16 @@ int cpu_init_f(void) gd->cpu_clk =100000000 ; } -/* wait at least one millisecond */ asm("movl $0x2000, %%ecx\n" "0: pushl %%ecx\n" "popl %%ecx\n" "loop 0b\n" : : :"ecx" ); -/* turn on the SDRAM write buffer */ -writeb (0x11 , &sc520_mmcr->dbctl); +if (gd->flags &GD_FLG_COLD_BOOT ) { +/* turn on the SDRAM write buffer */ +writeb (0x11 , &sc520_mmcr->dbctl); + }return x86_cpu_init_f (); }
arch/i386/lib/board.c +7 -10
@@ -207,16 +207,13 @@ void board_init_f(ulong boot_flags) dest_addr -= (bss_end - text_start); rel_offset = text_start - dest_addr; -/* Perform low-level initialization only when cold booted */ -if (gd->flags &GD_FLG_COLD_BOOT ) { -/* First stage CPU initialization */ -if (cpu_init_f () !=0 ) -hang (); - -/* First stage Board initialization */ -if (board_early_init_f () !=0 ) -hang (); - } +/* First stage CPU initialization */ +if (cpu_init_f () !=0 ) +hang (); + +/* First stage Board initialization */ +if (board_early_init_f () !=0 ) +hang ();/* Copy U-Boot into RAM */ dst_addr = (ulong *)dest_addr;
Signature · 1 line
1.7.1.422.g049e9
PATCH 25/32 x86: Move test for cold boot into init functions
Quoted 6 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/sc520.c | 7 ++++--- arch/i386/lib/board.c | 17 +++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 26/32 x86: Move console initialisation into board_init_f
In reply to Graeme Russ--- arch/i386/lib/board.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
arch/i386/lib/board.c +12 -3
@@ -162,9 +162,6 @@ init_fnc_t *init_sequence[] = { dram_init,/* configure available RAM banks */ interrupt_init,/* set up exceptions */ timer_init, - env_init,/* initialize environment */ - init_baudrate,/* initialze baudrate settings */ - serial_init,/* serial communications setup */ display_banner, display_dram_config,
@@ -197,6 +194,18 @@ void board_init_f(ulong boot_flags) gd->flags = boot_flags; +if (env_init () !=0 ) +hang (); + +if (init_baudrate () !=0 ) +hang (); + +if (serial_init () !=0 ) +hang (); + +if (console_init_f () !=0 ) +hang (); +if (dram_init_f () !=0 )hang ();
Signature · 1 line
1.7.1.422.g049e9
PATCH 26/32 x86: Move console initialisation into board_init_f
Quoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/lib/board.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 27/32 x86: Fix incorrect usage of relocation offset
In reply to Graeme Russx86 has always used relocation offset in the opposite sense to the ELF standard - Fix this
--- arch/i386/cpu/start.S | 2 +- arch/i386/lib/board.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/i386/cpu/start.S +1 -1
@@ -120,7 +120,7 @@ relocate_code: /* Setup call address of in-RAM copy of board_init_r() */ movl $board_init_r, %ebp - subl (GD_RELOC_OFF * 4)(%edx), %ebp + addl (GD_RELOC_OFF * 4)(%edx), %ebp /* Setup parameters to board_init_r() */ movl %edx, %eax
arch/i386/lib/board.c +5 -5
@@ -214,7 +214,7 @@ void board_init_f(ulong boot_flags) addr_sp = dest_addr; dest_addr -=CONFIG_SYS_STACK_SIZE ; dest_addr -= (bss_end - text_start); - rel_offset = text_start - dest_addr; + rel_offset = dest_addr - text_start;/* First stage CPU initialization */ if (cpu_init_f () !=0 )
@@ -233,8 +233,8 @@ void board_init_f(ulong boot_flags) *dst_addr++ = *src_addr++;/* Clear BSS */ - dst_addr = (ulong *)(bss_start - rel_offset); - end_addr = (ulong *)(bss_end - rel_offset); + dst_addr = (ulong *)(bss_start + rel_offset); + end_addr = (ulong *)(bss_end + rel_offset);while (dst_addr < end_addr) *dst_addr++ =0x00000000 ;
@@ -245,8 +245,8 @@ void board_init_f(ulong boot_flags)do {if (re_src->r_offset >=CONFIG_SYS_TEXT_BASE ) -if (*(Elf32_Addr *)(re_src->r_offset - rel_offset) >=CONFIG_SYS_TEXT_BASE ) - *(Elf32_Addr *)(re_src->r_offset - rel_offset) -= rel_offset; +if (*(Elf32_Addr *)(re_src->r_offset + rel_offset) >=CONFIG_SYS_TEXT_BASE ) + *(Elf32_Addr *)(re_src->r_offset + rel_offset) += rel_offset; }while (re_src++ < re_end); gd->reloc_off = rel_offset;
Signature · 1 line
1.7.1.422.g049e9
PATCH 27/32 x86: Fix incorrect usage of relocation offset
Quoted 9 lines · Graeme Russ
x86 has always used relocation offset in the opposite sense to the ELF standard - Fix this
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/start.S | 2 +- arch/i386/lib/board.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 28/32 x86: Split board_init_f() into init_fnc_t compatible functions
In reply to Graeme Russ--- arch/i386/include/asm/global_data.h | 12 +++- arch/i386/lib/board.c | 111 +++++++++++++++++++++-------------- 2 files changed, 74 insertions(+), 49 deletions(-)
arch/i386/include/asm/global_data.h +8 -4
@@ -46,6 +46,8 @@ typedef struct global_data {unsigned long env_valid;/* Checksum of Environment valid? */ unsigned long cpu_clk;/* CPU clock in Hz! */ unsigned long bus_clk; +unsigned long relocaddr;/* Start address of U-Boot in RAM */ +unsigned long start_addr_sp;/* start_addr_stackpointer */ phys_size_t ram_size;/* RAM size */ unsigned long reset_status;/* reset status register at boot */ void **jt;/* jump table */
@@ -67,11 +69,13 @@ extern gd_t *gd;#define GD_ENV_VALID 7#define GD_CPU_CLK 8#define GD_BUS_CLK 9 -#define GD_RAM_SIZE 10 -#define GD_RESET_STATUS 11 -#define GD_JT 12 +#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 13 +#define GD_SIZE 15/* * Global Data Flags
arch/i386/lib/board.c +66 -45
143 lines not on this page · raw message
Signature · 1 line
1.7.1.422.g049e9
PATCH 28/32 x86: Split board_init_f() into init_fnc_t compatible functions
Quoted 6 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/include/asm/global_data.h | 12 +++- arch/i386/lib/board.c | 111 +++++++++++++++++++++-------------- 2 files changed, 74 insertions(+), 49 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 29/32 x86: Rearrange function calls in board_init_f
In reply to Graeme Russ--- arch/i386/lib/board.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
arch/i386/lib/board.c +8 -8
@@ -235,6 +235,14 @@ static int do_elf_reloc_fixups(void)*/ void board_init_f (ulong boot_flags) { +/* First stage CPU initialization */ +if (cpu_init_f () !=0 ) +hang (); + +/* First stage Board initialization */ +if (board_early_init_f () !=0 ) +hang (); +if (env_init () !=0 )hang ();
@@ -253,14 +261,6 @@ void board_init_f(ulong boot_flags)if (calculate_relocation_address () !=0 )hang (); -/* First stage CPU initialization */ -if (cpu_init_f () !=0 ) -hang (); - -/* First stage Board initialization */ -if (board_early_init_f () !=0 ) -hang (); -/* Copy U-Boot into RAM */ if (copy_uboot_to_ram () !=0 )hang ();
Signature · 1 line
1.7.1.422.g049e9
PATCH 29/32 x86: Rearrange function calls in board_init_f
Quoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/lib/board.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 30/32 x86: Convert board_init_f to use an init_sequence
In reply to Graeme Russ--- arch/i386/lib/board.c | 70 ++++++++++++++++++++---------------------------- 1 files changed, 29 insertions(+), 41 deletions(-)
arch/i386/lib/board.c +29 -41
@@ -156,7 +156,28 @@ static void display_flash_config (ulong size)*/ typedef int (init_fnc_t ) (void ); -init_fnc_t *init_sequence[] = { +static int calculate_relocation_address (void ); +static int copy_uboot_to_ram (void ); +static int clear_bss (void ); +static int do_elf_reloc_fixups (void ); + +init_fnc_t *init_sequence_f[] = { + cpu_init_f, + board_early_init_f, + env_init, + init_baudrate, + serial_init, + console_init_f, + dram_init_f, + calculate_relocation_address, + copy_uboot_to_ram, + clear_bss, + do_elf_reloc_fixups, + +NULL , +}; + +init_fnc_t *init_sequence_r[] = { cpu_init_r,/* basic cpu dependent setup */ board_early_init_r,/* basic board dependent setup */ dram_init,/* configure available RAM banks */
@@ -235,41 +256,12 @@ static int do_elf_reloc_fixups(void)*/ void board_init_f (ulong boot_flags) { -/* First stage CPU initialization */ -if (cpu_init_f () !=0 ) -hang (); - -/* First stage Board initialization */ -if (board_early_init_f () !=0 ) -hang (); - -if (env_init () !=0 ) -hang (); - -if (init_baudrate () !=0 ) -hang (); - -if (serial_init () !=0 ) -hang (); - -if (console_init_f () !=0 ) -hang (); - -if (dram_init_f () !=0 ) -hang (); - -if (calculate_relocation_address () !=0 ) -hang (); - -/* Copy U-Boot into RAM */ -if (copy_uboot_to_ram () !=0 ) -hang (); - -if (clear_bss () !=0 ) -hang (); +init_fnc_t **init_fnc_ptr; -if (do_elf_reloc_fixups () !=0 ) -hang (); +for (init_fnc_ptr = init_sequence_f; *init_fnc_ptr; ++init_fnc_ptr) { +if ((*init_fnc_ptr)() !=0 ) +hang (); + } gd->flags |=GD_FLG_RELOC ;
@@ -283,7 +275,6 @@ void board_init_f(ulong boot_flags)void board_init_r (gd_t *id,ulong dest_addr) {char *s; -int i;ulong size;static bd_t bd_data;static gd_t gd_data;
@@ -307,12 +298,9 @@ void board_init_r(gd_t *id, ulong dest_addr)mem_malloc_init ((((ulong )dest_addr -CONFIG_SYS_MALLOC_LEN )+3 )&~3 ,CONFIG_SYS_MALLOC_LEN ); -for (init_fnc_ptr = init_sequence, i=0 ; *init_fnc_ptr; ++init_fnc_ptr, i++) { -show_boot_progress (0xa130 |i); - -if ((*init_fnc_ptr)() !=0 ) { +for (init_fnc_ptr = init_sequence_r; *init_fnc_ptr; ++init_fnc_ptr) { +if ((*init_fnc_ptr)() !=0 )hang (); - } }show_boot_progress (0x23 );
Signature · 1 line
1.7.1.422.g049e9
PATCH 30/32 x86: Convert board_init_f to use an init_sequence
Quoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/lib/board.c | 70 ++++++++++++++++++++---------------------------- 1 files changed, 29 insertions(+), 41 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 31/32 sc520: Release CAR and enable caching
In reply to Graeme Russ--- arch/i386/cpu/sc520/sc520.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)
arch/i386/cpu/sc520/sc520.c +11 -5
@@ -51,14 +51,20 @@ int cpu_init_f(void) "popl %%ecx\n" "loop 0b\n": : : "ecx"); - if (gd->flags & GD_FLG_COLD_BOOT) { -/* turn on the SDRAM write buffer */ -writeb (0x11 , &sc520_mmcr->dbctl); - } - return x86_cpu_init_f(); } +int cpu_init_r (void ) +{ +/* Disable the PAR used for CAR */ +writel (0x0000000 , &sc520_mmcr->par[2 ]); + +/* turn on the SDRAM write buffer */ +writeb (0x11 , &sc520_mmcr->dbctl); + +return x86_cpu_init_r (); +} +#ifdef CONFIG_SYS_SC520_RESET void reset_cpu (ulong addr) {
Signature · 1 line
1.7.1.422.g049e9
PATCH 31/32 sc520: Release CAR and enable caching
Quoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- arch/i386/cpu/sc520/sc520.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)
Applied to u-boot-x86
Regards,
Graeme
PATCH 32/32 eNET: Move initial Global Data into CAR
In reply to Graeme Russ--- include/configs/eNET.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/configs/eNET.h +1 -1
@@ -169,7 +169,7 @@#define CONFIG_SYS_MONITOR_LEN (256 * 1024)#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024)/* Address of temporary Global Data */ -#define CONFIG_SYS_INIT_GD_ADDR 0x19040000 +#define CONFIG_SYS_INIT_GD_ADDR CONFIG_SYS_CAR_ADDR/* allow to overwrite serial and ethaddr */
Signature · 1 line
1.7.1.422.g049e9
PATCH 32/32 eNET: Move initial Global Data into CAR
Quoted 5 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>--- include/configs/eNET.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied to u-boot-x86
Regards,
Graeme