hpcboot.h revision 1.1.10.1 1 /* $NetBSD: hpcboot.h,v 1.1.10.1 2002/02/28 04:09:45 nathanw Exp $ */
2
3 /*-
4 * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by UCHIYAMA Yasushi.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
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.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #ifndef _HPCBOOT_H_
40 #define _HPCBOOT_H_
41
42 #include <hpcdefs.h>
43 #include <res/resource.h>
44
45 #include <machine/bootinfo.h>
46 #include <machine/platid.h>
47 #include <machine/platid_mask.h>
48 #include <machine/platid_generated.h>
49
50 enum { KERNEL_PAGE_SIZE = 0x1000 };
51
52 enum ArchitectureOps {
53 #ifdef ARM
54 ARCHITECTURE_ARM_SA1100 = PLATID_CPU_ARM_STRONGARM_SA1100,
55 #endif
56 #ifdef SHx
57 ARCHITECTURE_SH3_7709 = PLATID_CPU_SH_3_7709,
58 ARCHITECTURE_SH3_7709A = PLATID_CPU_SH_3_7709A,
59 ARCHITECTURE_SH4_7750 = PLATID_CPU_SH_4_7750,
60 #endif
61 #ifdef MIPS
62 ARCHITECTURE_MIPS_TX3900= PLATID_CPU_MIPS_TX_3900,
63 ARCHITECTURE_MIPS_TX3920= PLATID_CPU_MIPS_TX_3920,
64 ARCHITECTURE_MIPS_VR41 = PLATID_CPU_MIPS_VR_41XX
65 #endif
66 };
67
68 enum ConsoleOps {
69 CONSOLE_LCD,
70 CONSOLE_SERIAL
71 };
72
73 enum MemoryManagerOps {
74 MEMORY_MANAGER_VIRTUALCOPY,
75 MEMORY_MANAGER_LOCKPAGES,
76 MEMORY_MANAGER_SOFTMMU,
77 MEMORY_MANAGER_HARDMMU
78 };
79
80 enum FileOps {
81 FILE_FAT,
82 FILE_UFS,
83 FILE_HTTP
84 };
85
86 enum LoaderOps {
87 LOADER_UNKNOWN,
88 LOADER_ELF,
89 LOADER_COFF,
90 LOADER_AOUT
91 };
92
93 struct BootSetupArgs {
94 enum ArchitectureOps architecture;
95 BOOL architectureDebug;
96 enum ConsoleOps console;
97 BOOL consoleEnable;
98 enum MemoryManagerOps memory;
99 BOOL memorymanagerDebug;
100 enum FileOps file;
101 BOOL fileDebug;
102 TCHAR fileRoot[MAX_PATH];
103 TCHAR fileName[MAX_PATH];
104 BOOL loadmfs;
105 TCHAR mfsName[MAX_PATH];
106 enum LoaderOps loader;
107 BOOL loaderDebug;
108 };
109
110 struct PageTag {
111 u_int32_t next; /* next tagged page kernel virtual address; */
112 u_int32_t src; /* kernel virtual or physical address */
113 u_int32_t dst; /* kernel virtual or physical address */
114 u_int32_t sz; /* copy size or zero-clear size; */
115 };
116
117 struct BootArgs {
118 kaddr_t kernel_entry;
119 kaddr_t argc;
120 kaddr_t argv;
121 kaddr_t bootinfo;
122 struct bootinfo bi;
123 };
124
125 #define VOLATILE_REF(x) (*(volatile u_int32_t *)(x))
126 #define VOLATILE_REF16(x) (*(volatile u_int16_t *)(x))
127 #define VOLATILE_REF8(x) (*(volatile u_int8_t *)(x))
128 #define _reg_read_1(a) (*(volatile u_int8_t *)(a))
129 #define _reg_read_2(a) (*(volatile u_int16_t *)(a))
130 #define _reg_read_4(a) (*(volatile u_int32_t *)(a))
131 #define _reg_write_1(a, v) (*(volatile u_int8_t *)(a) = (v))
132 #define _reg_write_2(a, v) (*(volatile u_int16_t *)(a) = (v))
133 #define _reg_write_4(a, v) (*(volatile u_int32_t *)(a) = (v))
134
135 #ifdef ARM
136 #define ptokv(x) (x) /* UNCACHED FLAT */
137 #elif defined SHx
138 #define ptokv(x) ((x) | 0x80000000) /* CACHED P1 */
139 #elif defined MIPS
140 #define ptokv(x) ((x) | 0x80000000) /* CACHED kseg0 */
141 #else
142 #error "physical address to kernel virtual macro not defined."
143 #endif
144
145 __BEGIN_DECLS
146 /* Windows CE API */
147 BOOL VirtualCopy(LPVOID, LPVOID, DWORD, DWORD);
148 BOOL SetKMode(BOOL);
149 BOOL LockPages(LPVOID, DWORD, PDWORD, int);
150 BOOL UnlockPages(LPVOID, DWORD);
151 void CacheSync(int);
152 #define CACHE_D_WBINV 1
153 #define CACHE_I_INV 2
154 /* ExtEscape */
155 #define GETVFRAMEPHYSICAL 6144
156 #define GETVFRAMELEN 6145
157
158 /* debug utility */
159 void _bitdisp(u_int32_t, int, int, int, int);
160 void _dbg_bit_print(u_int32_t, u_int32_t, const char *);
161 #define bitdisp(a) _bitdisp((a), 0, 0, 0, 1)
162 __END_DECLS
163
164 #endif /* _HPCBOOT_H_ */
165