1 /* $NetBSD: hpcboot.h,v 1.7 2004/08/13 15:50:09 uch Exp $ */ 2 3 /*- 4 * Copyright (c) 2001, 2002, 2004 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_7707 = PLATID_CPU_SH_3_7707, 58 ARCHITECTURE_SH3_7709 = PLATID_CPU_SH_3_7709, 59 ARCHITECTURE_SH3_7709A = PLATID_CPU_SH_3_7709A, 60 ARCHITECTURE_SH4_7750 = PLATID_CPU_SH_4_7750, 61 #endif 62 #ifdef MIPS 63 ARCHITECTURE_MIPS_TX3900= PLATID_CPU_MIPS_TX_3900, 64 ARCHITECTURE_MIPS_TX3920= PLATID_CPU_MIPS_TX_3920, 65 ARCHITECTURE_MIPS_VR41 = PLATID_CPU_MIPS_VR_41XX 66 #endif 67 }; 68 69 enum ConsoleOps { 70 CONSOLE_LCD, 71 CONSOLE_SERIAL 72 }; 73 74 enum MemoryManagerOps { 75 MEMORY_MANAGER_VIRTUALCOPY, 76 MEMORY_MANAGER_LOCKPAGES, 77 MEMORY_MANAGER_SOFTMMU, 78 MEMORY_MANAGER_HARDMMU 79 }; 80 81 enum FileOps { 82 FILE_FAT, 83 FILE_UFS, 84 FILE_HTTP 85 }; 86 87 enum LoaderOps { 88 LOADER_UNKNOWN, 89 LOADER_ELF, 90 LOADER_COFF, 91 LOADER_AOUT 92 }; 93 94 struct BootSetupArgs { 95 enum ArchitectureOps architecture; 96 BOOL architectureDebug; 97 enum ConsoleOps console; 98 BOOL consoleEnable; 99 enum MemoryManagerOps memory; 100 BOOL memorymanagerDebug; 101 enum FileOps file; 102 BOOL fileDebug; 103 TCHAR fileRoot[MAX_PATH]; 104 TCHAR fileName[MAX_PATH]; 105 BOOL loadmfs; 106 TCHAR mfsName[MAX_PATH]; 107 enum LoaderOps loader; 108 BOOL loaderDebug; 109 }; 110 111 struct PageTag { 112 u_int32_t next; /* next tagged page kernel virtual address; */ 113 u_int32_t src; /* kernel virtual or physical address */ 114 u_int32_t dst; /* kernel virtual or physical address */ 115 u_int32_t sz; /* copy size or zero-clear size; */ 116 }; 117 118 struct BootArgs { 119 kaddr_t kernel_entry; 120 kaddr_t argc; 121 kaddr_t argv; 122 kaddr_t bootinfo; 123 struct bootinfo bi; 124 }; 125 126 #define VOLATILE_REF(x) (*(volatile u_int32_t *)(x)) 127 #define VOLATILE_REF16(x) (*(volatile u_int16_t *)(x)) 128 #define VOLATILE_REF8(x) (*(volatile u_int8_t *)(x)) 129 #define _reg_read_1(a) (*(volatile u_int8_t *)(a)) 130 #define _reg_read_2(a) (*(volatile u_int16_t *)(a)) 131 #define _reg_read_4(a) (*(volatile u_int32_t *)(a)) 132 #define _reg_write_1(a, v) (*(volatile u_int8_t *)(a) = (v)) 133 #define _reg_write_2(a, v) (*(volatile u_int16_t *)(a) = (v)) 134 #define _reg_write_4(a, v) (*(volatile u_int32_t *)(a) = (v)) 135 136 #ifdef ARM 137 #define ptokv(x) (x) /* UNCACHED FLAT */ 138 #elif defined SHx 139 #define ptokv(x) ((x) | 0x80000000) /* CACHED P1 */ 140 #elif defined MIPS 141 #define ptokv(x) ((x) | 0x80000000) /* CACHED kseg0 */ 142 #else 143 #error "physical address to kernel virtual macro not defined." 144 #endif 145 146 __BEGIN_DECLS 147 /* Windows CE API */ 148 BOOL VirtualCopy(LPVOID, LPVOID, DWORD, DWORD); 149 BOOL SetKMode(BOOL); 150 BOOL LockPages(LPVOID, DWORD, PDWORD, int); 151 BOOL UnlockPages(LPVOID, DWORD); 152 void CacheSync(int); 153 #define CACHE_D_WBINV 1 154 #define CACHE_I_INV 2 155 /* ExtEscape */ 156 #define GETVFRAMEPHYSICAL 6144 157 #define GETVFRAMELEN 6145 158 159 /* debug utility */ 160 void _bitdisp(u_int32_t, int, int, int, int); 161 void _dbg_bit_print(u_int32_t, u_int32_t, const char *); 162 #define bitdisp(a) _bitdisp((a), 0, 0, 0, 1) 163 __END_DECLS 164 165 /* Runtime Windows CE version */ 166 #if _WIN32_WCE <= 200 167 extern OSVERSIONINFO WinCEVersion; 168 #else 169 extern OSVERSIONINFOW WinCEVersion; 170 #endif 171 172 #endif /* _HPCBOOT_H_ */ 173