Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbsh5/evbsh5 - #define the physical start of RAM.
details: https://anonhg.NetBSD.org/src/rev/102179997543
branches: trunk
changeset: 536025:102179997543
user: scw <scw%NetBSD.org@localhost>
date: Wed Sep 04 15:14:46 2002 +0000
description:
- #define the physical start of RAM.
- Set up a Panic Stack,
- Don't pre-map the sysfpga at this time.
- Calculate the CPU speed only if SH5_CPU_SPEED isn't defined.
- On a related note, make the CPU speed probing code more accurate.
- Print the CPU speed at startup.
- Force RB_SINGLE for now, at least until I get a bootloader written.
diffstat:
sys/arch/evbsh5/evbsh5/machdep.c | 49 +++++++++++++++++++++++++++++----------
1 files changed, 36 insertions(+), 13 deletions(-)
diffs (155 lines):
diff -r 8a53504ab9ee -r 102179997543 sys/arch/evbsh5/evbsh5/machdep.c
--- a/sys/arch/evbsh5/evbsh5/machdep.c Wed Sep 04 14:55:42 2002 +0000
+++ b/sys/arch/evbsh5/evbsh5/machdep.c Wed Sep 04 15:14:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.3 2002/08/25 20:21:36 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.4 2002/09/04 15:14:46 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -35,6 +35,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "opt_sh5_debug.h"
+#include "opt_sh5_cpu.h"
#include "dtfcons.h"
#include <sys/param.h>
@@ -67,8 +69,10 @@
#include <evbsh5/evbsh5/machdep.h>
+#ifndef SH5_CPU_SPEED
+static void compute_ctc_tick_per_us(void);
+#endif
-static void compute_ctc_tick_per_us(void);
struct boot_params evbsh5_bootparams;
struct vm_map *exec_map;
@@ -79,6 +83,8 @@
char cpu_model[128];
+#define EVBSH5_RAM_START_PHYS 0x80000000
+
/*
* Physical addresses of important devices on the Cayman board
* which need to be mapped early on during bootstrap to gain
@@ -106,7 +112,7 @@
ksize = endkernel - SH5_KSEG0_BASE;
- mr[0].mr_start = 0x80000000 + ksize;
+ mr[0].mr_start = EVBSH5_RAM_START_PHYS + ksize;
mr[0].mr_kvastart = SH5_KSEG0_BASE + ksize;
mr[0].mr_size = sh5_trunc_page(evbsh5_bootparams.bp_physramsize)- ksize;
mr[1].mr_start = 0;
@@ -118,6 +124,7 @@
void
evbsh5_init(void)
{
+ extern char sh5_panic_stack[];
#if NDTFCONS > 0
extern char *_dtf_buffer;
extern void _dtf_trap_frob(void);
@@ -125,6 +132,11 @@
paddr_t frob_p;
#endif
+ /* XXX: Will need to be revisited for SMP */
+ curcpu()->ci_panicstkphys = EVBSH5_RAM_START_PHYS +
+ (((uintptr_t)&sh5_panic_stack[0]) - SH5_KSEG0_BASE) +
+ (USPACE - sizeof(struct trapframe));
+
/*
* Fix up the cpu-specific TLB/cache manipulation functions
*/
@@ -138,10 +150,11 @@
#if NDTFCONS > 0
dtfbuf = (vaddr_t) &_dtf_buffer;
frob_p = (paddr_t) (uintptr_t) _dtf_trap_frob;
- frob_p = 0x80000000 + (frob_p - SH5_KSEG0_BASE);
+ frob_p = EVBSH5_RAM_START_PHYS + (frob_p - SH5_KSEG0_BASE);
dtf_init(0xc100018, frob_p,
- (paddr_t)(0x80000000 + (dtfbuf - SH5_KSEG0_BASE)), dtfbuf);
+ (paddr_t)(EVBSH5_RAM_START_PHYS + (dtfbuf - SH5_KSEG0_BASE)),
+ dtfbuf);
#endif
/*
@@ -150,20 +163,22 @@
bus_space_map(&_sh5_bus_space_tag, EVBSH5_PBRIDGE_PHYS_ADDR,
EVBSH5_PBRIDGE_LEN, 0, &_evbsh5_bh_pbridge);
+#ifdef notyet
/*
* Map the system FPGA/Super IO area
*/
bus_space_map(&_sh5_bus_space_tag, EVBSH5_SYSFPGA_PHYS_ADDR,
EVBSH5_SYSFPGA_LEN, 0, &_evbsh5_bh_sysfpga);
+#endif
- /*
- * Figure out how fast the CPU is
- *
- * XXX: Should just read the relevant system FPGA bits ...
- */
+#ifndef SH5_CPU_SPEED
compute_ctc_tick_per_us();
+#else
+ _sh5_ctc_ticks_per_us = SH5_CPU_SPEED;
+#endif
}
+#ifndef SH5_CPU_SPEED
static void
compute_ctc_tick_per_us(void)
{
@@ -193,10 +208,14 @@
* Fetch the current value of the 128Hz RTC counter and
* add 16 so we can time the loop to pretty much exactly 125mS
*/
- r64cnt = (rtc_read_r64cnt(bt, bh) + 16) & RTC_R64CNT_MASK;
+ r64cnt = rtc_read_r64cnt(bt, bh);
+ while (r64cnt == rtc_read_r64cnt(bt, bh))
+ ;
__asm __volatile("putcon %0, ctc" :: "r"(ctcstart));
+ r64cnt = (r64cnt + 17) & RTC_R64CNT_MASK;
+
/*
* Wait 125mS
*/
@@ -213,6 +232,7 @@
bus_space_unmap(bt, bh, RTC_REG_SIZE);
}
+#endif
void
cpu_startup(void)
@@ -223,7 +243,7 @@
vsize_t size;
char pbuf[16];
- strcpy(cpu_model, "SuperH SH-5 STB1");
+ boothowto = RB_SINGLE;
/*
* Find out how much space we need, allocate it,
@@ -295,7 +315,10 @@
nmbclusters * mclbytes, VM_MAP_INTRSAFE,
FALSE, NULL);
- printf("%s%s\n", version, cpu_model);
+ strcpy(cpu_model, "SuperH SH5");
+
+ printf("%s%s running at %dMHz\n", version, cpu_model,
+ (u_int)_sh5_ctc_ticks_per_us);
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
printf("total memory = %s\n", pbuf);
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
Home |
Main Index |
Thread Index |
Old Index