1 /* $NetBSD: sh_arch.cpp,v 1.14 2006/03/05 04:05:39 uwe Exp $ */
4 * Copyright (c) 2001, 2002, 2004 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
34 #include <sh3/sh_arch.h>
44 SHArchitecture::cpu_type()
52 _cpu_type
= si
.wProcessorLevel
;
60 SHArchitecture::init()
64 DPRINTF((TEXT("can't initialize memory manager.\n")));
68 DPRINTF((TEXT("Memory Bank:\n")));
74 SHArchitecture::systemInfo()
77 // Windows CE common information.
81 _dev
->dump(HPC_MENU
._cons_parameter
);
85 SHArchitecture::setupLoader()
89 if (!_mem
->getPage(v
, _loader_addr
)) {
90 DPRINTF((TEXT("can't get page for 2nd loader.\n")));
93 _loader_addr
= ptokv(_loader_addr
);
95 DPRINTF((TEXT("2nd bootloader address U0: 0x%08x P1: 0x%08x\n"),
96 (unsigned)v
,(unsigned)_loader_addr
));
98 memcpy(LPVOID(v
), LPVOID(_boot_func
), _mem
->getPageSize());
104 SHArchitecture::jump(paddr_t info
, paddr_t pvec
)
110 // stack for bootloader
112 sp
= ptokv(p
+ _mem
->getPageSize() / 2);
117 DPRINTF((TEXT("boot arg: 0x%08x stack: 0x%08x\nBooting kernel...\n"),
120 // Change to privilege-mode.
123 // Cache flush(for 2nd bootloader)
125 // SH4 uses WinCE CacheSync(). this routine may causes TLB
126 // exception. so calls before suspendIntr().
130 // Disable external interrupt.
133 // jump to 2nd loader.(run P1) at this time I still use MMU.
137 "nop \n", info
, pvec
, sp
, _loader_addr
);
141 // disable external interrupt and save its priority.
151 "ldc r0, sr\n", &sr
, 0x000000f0);
152 return sr
& 0x000000f0;
155 // resume external interrupt priority.
157 resumeIntr(uint32_t s
)
164 "ldc r0, sr\n", s
, 0xffffff0f);