Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcsh SH3/SH4 common kernel support.
details: https://anonhg.NetBSD.org/src/rev/95831abaf91d
branches: trunk
changeset: 522350:95831abaf91d
user: uch <uch%NetBSD.org@localhost>
date: Sun Feb 17 21:01:15 2002 +0000
description:
SH3/SH4 common kernel support.
diffstat:
sys/arch/hpcsh/conf/files.hpcsh | 4 +-
sys/arch/hpcsh/dev/hd64461/hd64461.c | 12 +-
sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c | 9 +-
sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c | 19 +-
sys/arch/hpcsh/dev/pfckbd.c | 10 +-
sys/arch/hpcsh/hpcsh/clock.c | 338 ++++++++++++++++++++++++----
sys/arch/hpcsh/hpcsh/genassym.cf | 7 +-
sys/arch/hpcsh/hpcsh/kloader_machdep.c | 21 +-
sys/arch/hpcsh/hpcsh/locore.s | 263 +++------------------
sys/arch/hpcsh/hpcsh/machdep.c | 88 ++++---
sys/arch/hpcsh/hpcsh/shb.c | 272 +++++++++++-----------
11 files changed, 568 insertions(+), 475 deletions(-)
diffs (truncated from 1776 to 300 lines):
diff -r 4b5a00200412 -r 95831abaf91d sys/arch/hpcsh/conf/files.hpcsh
--- a/sys/arch/hpcsh/conf/files.hpcsh Sun Feb 17 20:59:33 2002 +0000
+++ b/sys/arch/hpcsh/conf/files.hpcsh Sun Feb 17 21:01:15 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hpcsh,v 1.18 2002/02/13 16:25:35 uch Exp $
+# $NetBSD: files.hpcsh,v 1.19 2002/02/17 21:01:15 uch Exp $
#
maxpartitions 8
@@ -97,7 +97,7 @@
define hd64465if {}
device hd64465if: hd64465if
attach hd64465if at shb
-file arch/hpcsh/dev/hd64465/hd64465.c hd64465if
+file arch/hpcsh/dev/hd64465/hd64465.c hd64465if needs-flag
attach com at hd64465if with hd64465uart
file arch/hpcsh/dev/hd64465/hd64465uart.c hd64465uart
diff -r 4b5a00200412 -r 95831abaf91d sys/arch/hpcsh/dev/hd64461/hd64461.c
--- a/sys/arch/hpcsh/dev/hd64461/hd64461.c Sun Feb 17 20:59:33 2002 +0000
+++ b/sys/arch/hpcsh/dev/hd64461/hd64461.c Sun Feb 17 21:01:15 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hd64461.c,v 1.4 2002/01/29 18:53:23 uch Exp $ */
+/* $NetBSD: hd64461.c,v 1.5 2002/02/17 21:01:16 uch Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -109,6 +109,16 @@
static int match;
struct shb_attach_args *ia = aux;
+ switch (cpu_product) {
+ default:
+ /* HD64461 only supports SH7709 interface */
+ return (0);
+ case CPU_PRODUCT_7709:
+ break;
+ case CPU_PRODUCT_7709A:
+ break;
+ }
+
if (match++)
return (0); /* only one instance */
diff -r 4b5a00200412 -r 95831abaf91d sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c
--- a/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c Sun Feb 17 20:59:33 2002 +0000
+++ b/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c Sun Feb 17 21:01:15 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hd64461pcmcia.c,v 1.11 2002/02/11 17:20:18 uch Exp $ */
+/* $NetBSD: hd64461pcmcia.c,v 1.12 2002/02/17 21:01:17 uch Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
#include <dev/pcmcia/pcmciavar.h>
#include <dev/pcmcia/pcmciachip.h>
-#include <sh3/bscreg.h>
+#include <sh3/cpufunc.h>
#include <hpcsh/dev/hd64461/hd64461reg.h>
#include <hpcsh/dev/hd64461/hd64461var.h>
@@ -1053,9 +1053,10 @@
void
hd64461_set_bus_width(enum controller_channel channel, int width)
{
+#define SH3_BCR2 0xffffff62
u_int16_t r16;
- r16 = SHREG_BCR2;
+ r16 = _reg_read_2(SH3_BCR2);
if (channel == CHANNEL_0) {
r16 &= ~((1 << 13)|(1 << 12));
r16 |= 1 << (width == PCMCIA_WIDTH_IO8 ? 12 : 13);
@@ -1063,7 +1064,7 @@
r16 &= ~((1 << 11)|(1 << 10));
r16 |= 1 << (width == PCMCIA_WIDTH_IO8 ? 10 : 11);
}
- SHREG_BCR2 = r16;
+ _reg_write_2(SH3_BCR2, r16);
}
void
diff -r 4b5a00200412 -r 95831abaf91d sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c
--- a/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c Sun Feb 17 20:59:33 2002 +0000
+++ b/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c Sun Feb 17 21:01:15 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hd64465pcmcia.c,v 1.1 2002/02/11 17:27:16 uch Exp $ */
+/* $NetBSD: hd64465pcmcia.c,v 1.2 2002/02/17 21:01:17 uch Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -187,12 +187,12 @@
/* hot plug */
STATIC void hd64465pcmcia_create_event_thread(void *);
STATIC void hd64465pcmcia_event_thread(void *);
-STATIC void queue_event(struct hd64465pcmcia_channel *,
+STATIC void __queue_event(struct hd64465pcmcia_channel *,
enum hd64465pcmcia_event_type);
/* interrupt handler */
STATIC int hd64465pcmcia_intr(void *);
/* card status */
-STATIC enum hd64465pcmcia_event_type detect_card(int);
+STATIC enum hd64465pcmcia_event_type __detect_card(int);
STATIC void hd64465pcmcia_memory_window16_switch(int, enum memory_window_16);
/* bus width */
STATIC void __sh_set_bus_width(int, int);
@@ -376,7 +376,7 @@
ch->ch_pcmcia = config_found_sm(parent, &paa, hd64465pcmcia_print,
hd64465pcmcia_submatch);
- if (ch->ch_pcmcia && (detect_card(ch->ch_channel) == EVENT_INSERT)) {
+ if (ch->ch_pcmcia && (__detect_card(ch->ch_channel) == EVENT_INSERT)) {
ch->ch_attached = 1;
pcmcia_card_attach(ch->ch_pcmcia);
}
@@ -405,13 +405,13 @@
}
if (r & HD64461_PCC0CSCR_P0CDC)
- queue_event(ch, detect_card(ch->ch_channel));
+ __queue_event(ch, __detect_card(ch->ch_channel));
return (ret);
}
void
-queue_event(struct hd64465pcmcia_channel *ch,
+__queue_event(struct hd64465pcmcia_channel *ch,
enum hd64465pcmcia_event_type type)
{
struct hd64465pcmcia_event *pe, *pool;
@@ -709,7 +709,7 @@
* Card detect
*/
enum hd64465pcmcia_event_type
-detect_card(int channel)
+__detect_card(int channel)
{
u_int8_t r;
@@ -764,9 +764,10 @@
void
__sh_set_bus_width(int channel, int width)
{
+#define SH4_BCR2 0xff800004
u_int16_t r16;
- r16 = SHREG_BCR2;
+ r16 = _reg_read_2(SH4_BCR2);
#ifdef HD64465PCMCIA_DEBUG
dbg_bit_print_msg(r16, "BCR2");
#endif
@@ -777,7 +778,7 @@
r16 &= ~((1 << 11)|(1 << 10));
r16 |= 1 << (width == PCMCIA_WIDTH_IO8 ? 10 : 11);
}
- SHREG_BCR2 = r16;
+ _reg_write_2(SH4_BCR2, r16);
}
vaddr_t
diff -r 4b5a00200412 -r 95831abaf91d sys/arch/hpcsh/dev/pfckbd.c
--- a/sys/arch/hpcsh/dev/pfckbd.c Sun Feb 17 20:59:33 2002 +0000
+++ b/sys/arch/hpcsh/dev/pfckbd.c Sun Feb 17 21:01:15 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pfckbd.c,v 1.5 2002/01/29 18:53:23 uch Exp $ */
+/* $NetBSD: pfckbd.c,v 1.6 2002/02/17 21:01:16 uch Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -49,6 +49,11 @@
#include <dev/hpc/hpckbdvar.h>
+/*
+ * pfckbd only supports SH7709.
+ */
+#undef SH4
+#define SH7709
#include <sh3/pfcreg.h>
#include <hpcsh/dev/pfckbdvar.h>
@@ -114,6 +119,9 @@
pfckbd_match(struct device *parent, struct cfdata *cf, void *aux)
{
+ if (CPU_IS_SH4)
+ return (0); /* not for SH4 */
+
return (!pfckbd_core.pc_attached);
}
diff -r 4b5a00200412 -r 95831abaf91d sys/arch/hpcsh/hpcsh/clock.c
--- a/sys/arch/hpcsh/hpcsh/clock.c Sun Feb 17 20:59:33 2002 +0000
+++ b/sys/arch/hpcsh/hpcsh/clock.c Sun Feb 17 21:01:15 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: clock.c,v 1.5 2002/02/11 17:32:35 uch Exp $ */
+/* $NetBSD: clock.c,v 1.6 2002/02/17 21:01:18 uch Exp $ */
/*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,14 +40,154 @@
#include <dev/clock_subr.h>
-#include <sh3/rtcreg.h>
-#include <sh3/tmureg.h>
+#include <sh3/cpufunc.h>
#include <machine/shbvar.h>
#include <machine/debug.h>
#include <hpcsh/hpcsh/clockvar.h>
+/* RTC */
+#define SH3_R64CNT 0xfffffec0
+#define SH3_RSECCNT 0xfffffec2
+#define SH3_RMINCNT 0xfffffec4
+#define SH3_RHRCNT 0xfffffec6
+#define SH3_RWKCNT 0xfffffec8
+#define SH3_RDAYCNT 0xfffffeca
+#define SH3_RMONCNT 0xfffffecc
+#define SH3_RYRCNT 0xfffffece
+#define SH3_RSECAR 0xfffffed0
+#define SH3_RMINAR 0xfffffed2
+#define SH3_RHRAR 0xfffffed4
+#define SH3_RWKAR 0xfffffed6
+#define SH3_RDAYAR 0xfffffed8
+#define SH3_RMONAR 0xfffffeda
+#define SH3_RCR1 0xfffffedc
+#define SH3_RCR2 0xfffffede
+
+#define SH4_R64CNT 0xffc80000
+#define SH4_RSECCNT 0xffc80004
+#define SH4_RMINCNT 0xffc80008
+#define SH4_RHRCNT 0xffc8000c
+#define SH4_RWKCNT 0xffc80010
+#define SH4_RDAYCNT 0xffc80014
+#define SH4_RMONCNT 0xffc80018
+#define SH4_RYRCNT 0xffc8001c /* 16 bit */
+#define SH4_RSECAR 0xffc80020
+#define SH4_RMINAR 0xffc80024
+#define SH4_RHRAR 0xffc80028
+#define SH4_RWKAR 0xffc8002c
+#define SH4_RDAYAR 0xffc80030
+#define SH4_RMONAR 0xffc80034
+#define SH4_RCR1 0xffc80038
+#define SH4_RCR2 0xffc8003c
+
+#if defined(SH3) && defined(SH4)
+int __sh_R64CNT;
+int __sh_RSECCNT;
+int __sh_RMINCNT;
+int __sh_RHRCNT;
+int __sh_RWKCNT;
+int __sh_RDAYCNT;
+int __sh_RMONCNT;
+int __sh_RYRCNT;
+int __sh_RSECAR;
+int __sh_RMINAR;
+int __sh_RHRAR;
+int __sh_RWKAR;
+int __sh_RDAYAR;
+int __sh_RMONAR;
+int __sh_RCR1;
+int __sh_RCR2;
+#endif /* SH3 && SH4 */
+
+#define SH_RCR1_CF 0x80
+#define SH_RCR1_CIE 0x10
+#define SH_RCR1_AIE 0x08
+#define SH_RCR1_AF 0x01
+#define SH_RCR2_PEF 0x80
+#define SH_RCR2_PES2 0x40
+#define SH_RCR2_PES1 0x20
+#define SH_RCR2_PES0 0x10
+#define SH_RCR2_ENABLE 0x08
+#define SH_RCR2_ADJ 0x04
+#define SH_RCR2_RESET 0x02
+#define SH_RCR2_START 0x01
+
+/* TMU */
+#define SH3_TOCR 0xfffffe90
+#define SH3_TSTR 0xfffffe92
+#define SH3_TCOR0 0xfffffe94
+#define SH3_TCNT0 0xfffffe98
+#define SH3_TCR0 0xfffffe9c
+#define SH3_TCOR1 0xfffffea0
+#define SH3_TCNT1 0xfffffea4
+#define SH3_TCR1 0xfffffea8
+#define SH3_TCOR2 0xfffffeac
+#define SH3_TCNT2 0xfffffeb0
+#define SH3_TCR2 0xfffffeb4
+#define SH3_TCPR2 0xfffffeb8
+
Home |
Main Index |
Thread Index |
Old Index