1 /* -*-C++-*- $NetBSD: mips_boot.cpp,v 1.7 2005/12/11 12:17:28 christos Exp $ */
4 * Copyright (c) 2001 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.
38 #include <mips/mips_arch.h>
39 #include <mips/mips_boot.h>
40 #include <mips/mips_vr41.h>
41 #include <mips/mips_tx39.h>
42 #include <mips/mips_console.h>
55 MIPSConsole::Destroy();
61 struct HpcMenuInterface::HpcMenuPreferences
&pref
= HPC_PREFERENCE
;
64 platid
.dw
.dw0
= pref
.platid_hi
;
65 platid
.dw
.dw1
= pref
.platid_lo
;
67 if (platid_match(&platid
, &platid_mask_CPU_MIPS_VR
)) {
68 args
.architecture
= ARCHITECTURE_MIPS_VR41
;
69 } else if (platid_match(&platid
, &platid_mask_CPU_MIPS_TX_3900
)) {
70 args
.architecture
= ARCHITECTURE_MIPS_TX3900
;
71 } else if (platid_match(&platid
, &platid_mask_CPU_MIPS_TX_3920
)) {
72 args
.architecture
= ARCHITECTURE_MIPS_TX3920
;
74 DPRINTF((TEXT("unknown MIPS variants.\n")));
78 return super::setup();
87 BOOL(*lock_pages
)(LPVOID
, DWORD
, PDWORD
, int);
88 BOOL(*unlock_pages
)(LPVOID
, DWORD
);
91 if (args
.console
== CONSOLE_SERIAL
) {
92 _cons
= MIPSConsole::Instance();
94 _cons
= Console::Instance();
95 DPRINTF((TEXT("use LCD console instead.\n")));
98 _cons
= Console::Instance();
101 // Architercure dependent ops.
102 switch(args
.architecture
) {
104 DPRINTF((TEXT("unsupported architecture.\n")));
106 case ARCHITECTURE_MIPS_TX3900
:
108 case ARCHITECTURE_MIPS_TX3920
:
109 _arch
= new TX39XX(_cons
, _mem
, args
.architecture
);
113 case ARCHITECTURE_MIPS_VR41
:
114 _arch
= new VR41XX(_cons
, _mem
);
115 GetSystemInfo(&sysinfo
);
116 DPRINTF((TEXT("sysinfo.dwPageSize = %d\n"),
117 sysinfo
.dwPageSize
));
118 pagesz
= sysinfo
.dwPageSize
;
119 shift
= 4; // VR41 specific shift. for LockPages()
122 _arch
->setDebug() = args
.architectureDebug
;
125 // LockPages API exists in Windows CE 2.11 or later. check it.
126 lock_pages
= _arch
->_load_LockPages();
127 unlock_pages
= _arch
->_load_UnlockPages();
128 if (lock_pages
== 0 || unlock_pages
== 0)
129 args
.memory
= MEMORY_MANAGER_VIRTUALCOPY
;
131 args
.memory
= MEMORY_MANAGER_LOCKPAGES
;
133 switch(args
.memory
) {
136 case MEMORY_MANAGER_SOFTMMU
:
138 case MEMORY_MANAGER_HARDMMU
:
139 DPRINTF((TEXT("unsupported memory address detection method.\n")));
141 case MEMORY_MANAGER_LOCKPAGES
:
142 _mem
= new MemoryManager_LockPages(lock_pages
, unlock_pages
,
143 _cons
, pagesz
, shift
);
145 case MEMORY_MANAGER_VIRTUALCOPY
:
146 _mem
= new MemoryManager_VirtualCopy(_cons
, pagesz
);
149 _mem
->setDebug() = args
.memorymanagerDebug
;
151 // File Manager, Loader
152 return super::create();