Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpc/stand SH4 and HD64465(SH4 companion chip) seria...



details:   https://anonhg.NetBSD.org/src/rev/204e33666015
branches:  trunk
changeset: 521752:204e33666015
user:      uch <uch%NetBSD.org@localhost>
date:      Mon Feb 04 17:38:26 2002 +0000

description:
SH4 and HD64465(SH4 companion chip) serial console support.

diffstat:

 sys/arch/hpc/stand/Makefile                   |   4 +-
 sys/arch/hpc/stand/README                     |   5 +-
 sys/arch/hpc/stand/hpcboot/sh3/hd64461.h      |  38 ++++++++++-
 sys/arch/hpc/stand/hpcboot/sh3/hd64465.h      |  63 ++++++++++++++++++
 sys/arch/hpc/stand/hpcboot/sh3/sh3.h          |  42 ++++++++++-
 sys/arch/hpc/stand/hpcboot/sh3/sh_7750.h      |  94 +++++++++++++++++++++++++++
 sys/arch/hpc/stand/hpcboot/sh3/sh_arch.cpp    |  42 ++++++++---
 sys/arch/hpc/stand/hpcboot/sh3/sh_arch.h      |  54 +++++++++++---
 sys/arch/hpc/stand/hpcboot/sh3/sh_boot.cpp    |  30 ++++++--
 sys/arch/hpc/stand/hpcboot/sh3/sh_console.cpp |  31 ++++++--
 sys/arch/hpc/stand/hpcboot/sh3/sh_console.h   |   5 +-
 sys/arch/hpc/stand/hpcboot/sh3/sh_mmu.cpp     |  12 ++-
 sys/arch/hpc/stand/hpcboot/sh3/sh_mmu.h       |   6 +-
 13 files changed, 367 insertions(+), 59 deletions(-)

diffs (truncated from 908 to 300 lines):

diff -r ffc40e41a84c -r 204e33666015 sys/arch/hpc/stand/Makefile
--- a/sys/arch/hpc/stand/Makefile       Mon Feb 04 17:33:08 2002 +0000
+++ b/sys/arch/hpc/stand/Makefile       Mon Feb 04 17:38:26 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.9 2002/01/31 19:15:23 tv Exp $
+#      $NetBSD: Makefile,v 1.10 2002/02/04 17:38:26 uch Exp $
 #
 
 PROJECT_DIRS=  hpcboot libz libsa
@@ -62,7 +62,7 @@
 
 # WCE210 or later binary
 install:
-       for a in SH3 ARM MIPS; do                                       \
+       for a in SH3 SH4 ARM MIPS; do                                   \
                file=`echo "compile/"$$a"Release/hpcboot.exe"`;         \
                cp $$file binary/$$a/hpcboot.exe;                       \
        done
diff -r ffc40e41a84c -r 204e33666015 sys/arch/hpc/stand/README
--- a/sys/arch/hpc/stand/README Mon Feb 04 17:33:08 2002 +0000
+++ b/sys/arch/hpc/stand/README Mon Feb 04 17:38:26 2002 +0000
@@ -1,12 +1,13 @@
-$NetBSD: README,v 1.2 2001/06/19 17:50:39 uch Exp $
+$NetBSD: README,v 1.3 2002/02/04 17:38:26 uch Exp $
 
 How to use
        'make all' uudecode all binaries.
        hpcboot.exe were compiled for H/PC Pro 2.11 by eMbedded Visual C++ 3.0 
        executable are located in
                binary/ARM/hpcboot.exe
+               binary/MIPS/hpcboot.exe *
                binary/SH3/hpcboot.exe
-               binary/MIPS/hpcboot.exe *
+               binary/SH4/hpcboot.exe
        * for MIPS, use pbsdboot.exe (sys/arch/hpcmips/stand/pbsdboot)
 
 How to compile
diff -r ffc40e41a84c -r 204e33666015 sys/arch/hpc/stand/hpcboot/sh3/hd64461.h
--- a/sys/arch/hpc/stand/hpcboot/sh3/hd64461.h  Mon Feb 04 17:33:08 2002 +0000
+++ b/sys/arch/hpc/stand/hpcboot/sh3/hd64461.h  Mon Feb 04 17:38:26 2002 +0000
@@ -1,4 +1,40 @@
-/*     $NetBSD: hd64461.h,v 1.2 2001/03/22 18:27:51 uch Exp $  */
+/*     $NetBSD: hd64461.h,v 1.3 2002/02/04 17:38:27 uch Exp $  */
+
+/*-
+ * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by UCHIYAMA Yasushi.
+ *
+ * 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 by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 THE FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
 
 #include "../../../../hpcsh/dev/hd64461/hd64461reg.h"
 #include "../../../../hpcsh/dev/hd64461/hd64461intcreg.h"
diff -r ffc40e41a84c -r 204e33666015 sys/arch/hpc/stand/hpcboot/sh3/hd64465.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpc/stand/hpcboot/sh3/hd64465.h  Mon Feb 04 17:38:26 2002 +0000
@@ -0,0 +1,63 @@
+/*     $NetBSD: hd64465.h,v 1.1 2002/02/04 17:38:27 uch Exp $  */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by UCHIYAMA Yasushi.
+ *
+ * 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 by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 THE FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include "../../../../hpcsh/dev/hd64465/hd64465uartreg.h"
+
+#define        LSR_TXRDY       0x20    /* Transmitter buffer empty */
+
+#define HD64465COM_TX_BUSY()                                           \
+       while ((VOLATILE_REF8(HD64465_ULSR_REG8) & LSR_TXRDY) == 0)
+
+#define HD64465COM_PUTC(c)                                             \
+__BEGIN_MACRO                                                          \
+       HD64465COM_TX_BUSY();                                           \
+       VOLATILE_REF8(HD64465_UTBR_REG8) = (c);                         \
+       HD64465COM_TX_BUSY();                                           \
+__END_MACRO
+
+#define HD64465COM_PRINT(s)                                            \
+__BEGIN_MACRO                                                          \
+       char *__s =(char *)(s);                                         \
+       int __i;                                                        \
+       for (__i = 0; __s[__i] != '\0'; __i++) {                        \
+               char __c = __s[__i];                                    \
+               if (__c == '\n')                                        \
+                       HD64465COM_PUTC('\r');                          \
+               HD64465COM_PUTC(__c);                                   \
+       }                                                               \
+__END_MACRO
diff -r ffc40e41a84c -r 204e33666015 sys/arch/hpc/stand/hpcboot/sh3/sh3.h
--- a/sys/arch/hpc/stand/hpcboot/sh3/sh3.h      Mon Feb 04 17:33:08 2002 +0000
+++ b/sys/arch/hpc/stand/hpcboot/sh3/sh3.h      Mon Feb 04 17:38:26 2002 +0000
@@ -1,7 +1,7 @@
-/* -*-C++-*-   $NetBSD: sh3.h,v 1.4 2001/03/22 18:27:51 uch Exp $      */
+/* -*-C++-*-   $NetBSD: sh3.h,v 1.5 2002/02/04 17:38:27 uch Exp $      */
 
 /*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -69,14 +69,20 @@
 #define MMU_WAY                        4
 #define MMU_ENTRY              32
 
-/* Windows CE uses 1Kbyte page */
-#define PAGE_SIZE              0x400
-#define PAGE_MASK              (~(PAGE_SIZE - 1))
+/* Windows CE uses 1Kbyte page for SH3, 4Kbyte for SH4 */
+#define SH3_PAGE_SIZE          0x400
+#define SH3_PAGE_MASK          (~(SH3_PAGE_SIZE - 1))
+#define SH4_PAGE_SIZE          0x1000
+#define SH4_PAGE_MASK          (~(SH4_PAGE_SIZE - 1))
 
 #define MMUPTEH                        0xfffffff0
 #define MMUPTEH_ASID_MASK      0x0000000f
 #define MMUPTEH_VPN_MASK       0xfffffc00
+#ifdef SH4
+#define MMUCR                  0xff000010
+#else
 #define MMUCR                  0xffffffe0
+#endif
 #define MMUCR_AT               0x00000001
 #define MMUCR_IX               0x00000002
 #define MMUCR_TF               0x00000004
@@ -265,6 +271,14 @@
 /*
  * SCI
  */
+#ifdef SH4
+#define SCI_SCSMR_REG8                 0xffe00000
+#define SCI_SCBRR_REG8                 0xffe00004
+#define SCI_SCSCR_REG8                 0xffe00008
+#define SCI_SCTDR_REG8                 0xffe0000c
+#define SCI_SCSSR_REG8                 0xffe00010
+#define SCI_SCRDR_REG8                 0xffe00014
+#else
 #define SCI_SCRSR_REG8                 /* can't access from CPU */
 #define SCI_SCTSR_REG8                 /* can't access from CPU */
 #define SCI_SCSMR_REG8                 0xfffffe80
@@ -272,10 +286,11 @@
 #define SCI_SCSCR_REG8                 0xfffffe84
 #define SCI_SCTDR_REG8                 0xfffffe86
 #define SCI_SCSSR_REG8                 0xfffffe88
-#define SCI_SCSSR_TDRE                 0x80
 #define SCI_SCRDR_REG8                 0xfffffe8a
 #define SCI_SCPCR_REG16                        0xa4000116
 #define SCI_SCPDR_REG16                        0xa4000136
+#endif
+#define SCI_SCSSR_TDRE                 0x80
 
 #define SCI_TX_BUSY()                                                  \
        while ((VOLATILE_REF8(SCI_SCSSR_REG8) & SCI_SCSSR_TDRE) == 0)
@@ -302,6 +317,19 @@
 /* 
  * SCIF
  */
+#ifdef SH4
+#define SCIF_SCSMR2_REG16              0xffe80000
+#define SCIF_SCBRR2_REG8               0xffe80004
+#define SCIF_SCSCR2_REG16              0xffe80008
+#define SCIF_SCFTDR2_REG8              0xffe8000c
+#define SCIF_SCFSR2_REG16              0xffe80010
+#define SCIF_SCFRDR2_REG8              0xffe80014
+#define SCIF_SCFCR2_REG16              0xffe80018
+#define SCIF_SCFDR2_REG16              0xffe8001c
+#define SCIF_SCSPTR2_REG16             0xffe80020
+#define SCIF_SCLSR2_REG16              0xffe80024
+#define        SCIF_SCSSR2_REG16               SCIF_SCFSR2_REG16
+#else
 #define SCIF_SCSMR2_REG8               0xa4000150      /* R/W */
 #define SCIF_SCBRR2_REG8               0xa4000152      /* R/W */
 #define SCIF_SCSCR2_REG8               0xa4000154      /* R/W */
@@ -310,6 +338,7 @@
 #define SCIF_SCFRDR2_REG8              0xa400015a      /* R */
 #define SCIF_SCFCR2_REG8               0xa400015c      /* R/W */
 #define SCIF_SCFDR2_REG16              0xa400015e      /* R */
+#endif
 
 /* Transmit FIFO Data Empty */
 #define SCIF_SCSSR2_TDFE               0x00000020
@@ -361,5 +390,6 @@
 #include <sh3/sh_7707.h>
 #include <sh3/sh_7709.h>
 #include <sh3/sh_7709a.h>
+#include <sh3/sh_7750.h>
 
 #endif // _HPCBOOT_SH3_H_
diff -r ffc40e41a84c -r 204e33666015 sys/arch/hpc/stand/hpcboot/sh3/sh_7750.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpc/stand/hpcboot/sh3/sh_7750.h  Mon Feb 04 17:38:26 2002 +0000
@@ -0,0 +1,94 @@
+/*     $NetBSD: sh_7750.h,v 1.1 2002/02/04 17:38:28 uch Exp $  */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by UCHIYAMA Yasushi.
+ *
+ * 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 by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 THE FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#ifndef _HPCBOOT_SH_7750_H_
+#define _HPCBOOT_SH_7750_H_
+#ifndef _HPCBOOT_SH3_H_
+#error "include sh3.h"
+#endif
+
+#define SH4_ICACHE_SIZE                8192
+#define SH4_DCACHE_SIZE                16384
+#define SH4_CACHE_LINESZ       32



Home | Main Index | Thread Index | Old Index