Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/stand Add gzboot support for NSLU2. This is...
details: https://anonhg.NetBSD.org/src/rev/b02c5db0231f
branches: trunk
changeset: 744758:b02c5db0231f
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Feb 12 06:57:35 2020 +0000
description:
Add gzboot support for NSLU2. This is a work-in-progress. This configuration
follows the existing NSLU2 RedBoot default bootstrap procedure. (Other
configurations are possible, but not yet implemented.)
diffstat:
sys/arch/evbarm/stand/board/ixp425_mem.c | 95 +++++++++++++
sys/arch/evbarm/stand/board/nslu2.c | 59 ++++++++
sys/arch/evbarm/stand/gzboot/NSLU2_dram_0x01d00000/Makefile | 30 ++++
sys/arch/evbarm/stand/gzboot/NSLU2_dram_0x01d00000/ldscript | 90 ++++++++++++
4 files changed, 274 insertions(+), 0 deletions(-)
diffs (290 lines):
diff -r 74f1439dadf9 -r b02c5db0231f sys/arch/evbarm/stand/board/ixp425_mem.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/stand/board/ixp425_mem.c Wed Feb 12 06:57:35 2020 +0000
@@ -0,0 +1,95 @@
+/* $NetBSD: ixp425_mem.c,v 1.1 2020/02/12 06:57:35 thorpej Exp $ */
+
+/*
+ * Copyright (c) 2003 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This file provides the mem_init() function for boards using the
+ * Intel IXP425 Network Processor.
+ */
+
+#include <sys/types.h>
+#include <lib/libsa/stand.h>
+
+#include <arm/xscale/ixp425reg.h>
+
+#include "board.h"
+
+#define MCU_REG_READ(x) (*(volatile uint32_t *)(IXP425_MCU_HWBASE + (x)))
+
+static const uint32_t sdram_64bit[] = {
+ 0x00800000, /* 8M: One 2M x 32 chip */
+ 0x01000000, /* 16M: Two 2M x 32 chips */
+ 0x01000000, /* 16M: One 4M x 32 chip */
+ 0x02000000, /* 32M: Two 4M x 32 chips */
+ 0, 0, 0, 0
+};
+
+static const uint32_t sdram_other[] = {
+ 0x02000000, /* 32M: Two 8M x 16 chips */
+ 0x04000000, /* 64M: Four 8M x 16 chips */
+ 0x04000000, /* 64M: Two 16M x 16 chips */
+ 0x08000000, /* 128M: Four 16M x 16 chips */
+ 0x08000000, /* 128M: Two 32M x 16 chips */
+ 0x10000000, /* 256M: Four 32M x 16 chips */
+ 0, 0
+};
+
+void
+mem_init(void)
+{
+ uint32_t sdr_config;
+ uint32_t start, size, heap;
+
+ sdr_config = MCU_REG_READ(MCU_SDR_CONFIG);
+
+ start = 0x00000000; /* fixed SDRAM base address */
+
+ if (sdr_config & MCU_SDR_CONFIG_64MBIT)
+ size = sdram_64bit[MCU_SDR_CONFIG_MCONF(sdr_config)];
+ else
+ size = sdram_other[MCU_SDR_CONFIG_MCONF(sdr_config)];
+
+ if (size == 0) {
+ printf("** SDR_CONFIG returns unknown value, using 32M\n");
+ size = 32 * 1024 * 1024;
+ }
+
+ heap = (start + size) - BOARD_HEAP_SIZE;
+
+ printf(">> RAM 0x%x - 0x%x, heap at 0x%x\n",
+ start, (start + size) - 1, heap);
+ setheap((void *)heap, (void *)(start + size - 1));
+}
diff -r 74f1439dadf9 -r b02c5db0231f sys/arch/evbarm/stand/board/nslu2.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/stand/board/nslu2.c Wed Feb 12 06:57:35 2020 +0000
@@ -0,0 +1,59 @@
+/* $NetBSD: nslu2.c,v 1.1 2020/02/12 06:57:35 thorpej Exp $ */
+
+/*
+ * Copyright (c) 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Board initialization routines for the Linksys NSLU2.
+ */
+
+#include <sys/types.h>
+#include <lib/libsa/stand.h>
+
+#include "board.h"
+
+void
+board_init(void)
+{
+
+ mem_init();
+}
+
+void
+board_fini(void)
+{
+
+ /* Nothing to do here. */
+}
diff -r 74f1439dadf9 -r b02c5db0231f sys/arch/evbarm/stand/gzboot/NSLU2_dram_0x01d00000/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/stand/gzboot/NSLU2_dram_0x01d00000/Makefile Wed Feb 12 06:57:35 2020 +0000
@@ -0,0 +1,30 @@
+# $NetBSD: Makefile,v 1.1 2020/02/12 06:57:35 thorpej Exp $
+
+S= ${.CURDIR}/../../../../..
+
+#
+# This image is for the stock RedBoot configuration. The self-extracting
+# kernel image is copied from FIS partition 3 (@ 0x50060000) to 0x01d00000
+# by RedBoot. RedBoot then copies the ramdisk from FIS partition 4
+# (@ 0x50160000) to 0x01000000, and jumps to 0x01d00000.
+#
+# NOTE: While there is room for 3MB of gzboot+compressed kernel at the
+# designationed location in SDRAM, there is only 1MB of space available
+# in FIS partition 3!
+#
+
+PLATFORM= NSLU2
+RELOC= 0x01d00000
+MAXIMAGESIZE= 0 # concatenate
+LOADADDR= 0x00200000
+
+CPPFLAGS+= -DCONSPEED=115200
+CPPFLAGS+= -DCONADDR=0xc8000000UL
+
+CPUFLAGS= -mcpu=xscale
+
+LDSCRIPT= ${.CURDIR}/ldscript
+
+SRCS+= nslu2.c ns16550.c ixp425_mem.c
+
+.include "${S}/arch/evbarm/stand/gzboot/Makefile.gzboot"
diff -r 74f1439dadf9 -r b02c5db0231f sys/arch/evbarm/stand/gzboot/NSLU2_dram_0x01d00000/ldscript
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/stand/gzboot/NSLU2_dram_0x01d00000/ldscript Wed Feb 12 06:57:35 2020 +0000
@@ -0,0 +1,90 @@
+/* $NetBSD: ldscript,v 1.1 2020/02/12 06:57:35 thorpej Exp $ */
+
+OUTPUT_FORMAT("elf32-bigarm", "elf32-bigarm",
+ "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(SDRAM)
+MEMORY
+{
+ /* RedBoot will copy the gzboot+compressed kernel image from the
+ FIS partition starting @ 0x50060000 to the SDRAM location starting
+ at 0x01d00000. gzboot will uncompress the kernel to 0x00200000.
+ NOTE: Even though there is room for 3M of gzboot+compressed kernel,
+ there is only room for 1M of this in the FIS partition. So we declare
+ that same limit for "sdram" to simplify the linker script. */
+ flash : o = 0x50060000, l = 1M
+ sdram : o = 0x01d00000, l = 1M /* kernel loads at 0x00200000 */
+}
+SECTIONS
+{
+ SDRAM = 0x01d00000;
+
+ /DISCARD/ : { *(.ARM.attributes*) *(.ARM.exidx) }
+
+ /* Read-only sections, merged into text segment: */
+ __text_store = SDRAM;
+ .text :
+ AT (SDRAM)
+ {
+ *(.text)
+ *(.text.*)
+ *(.stub)
+ *(.glue_7t) *(.glue_7)
+ *(.rodata) *(.rodata.*)
+ } > sdram =0
+ PROVIDE (__etext = .);
+ PROVIDE (_etext = .);
+ PROVIDE (etext = .);
+ __data_store = SDRAM + SIZEOF(.text);
+ .data :
+ AT (LOADADDR(.text) + SIZEOF(.text))
+ {
+ __data_start = . ;
+ *(.data)
+ *(.data.*)
+ } > sdram
+ .sdata :
+ AT (LOADADDR(.data) + SIZEOF(.data))
+ {
+ *(.sdata)
+ *(.sdata.*)
+ . = ALIGN(32 / 8);
+ } > sdram
+ _edata = .;
+ PROVIDE (edata = .);
+ __bss_start = .;
+ __bss_start__ = .;
+ .sbss :
+ AT (ADDR(.sbss))
+ {
+ PROVIDE (__sbss_start = .);
+ PROVIDE (___sbss_start = .);
+ *(.dynsbss)
+ *(.sbss)
+ *(.sbss.*)
+ *(.scommon)
+ PROVIDE (__sbss_end = .);
+ PROVIDE (___sbss_end = .);
+ } > sdram
+ .bss :
+ AT (ADDR(.bss))
+ {
+ *(.dynbss)
+ *(.bss)
+ *(.bss.*)
+ *(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections. */
+ . = ALIGN(32 / 8);
+ } > sdram
+ . = ALIGN(32 / 8);
+ _end = .;
+ _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
+ PROVIDE (end = .);
+ .image (SDRAM + SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.sdata)) :
+ AT (LOADADDR(.sdata) + SIZEOF(.sdata))
+ {
+ *(.image)
+ }
+}
Home |
Main Index |
Thread Index |
Old Index