1 /* $NetBSD: hpcboot.h,v 1.11 2008/04/28 20:23:20 martin 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 * 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. 30 */ 31 32 #ifndef _HPCBOOT_H_ 33 #define _HPCBOOT_H_ 34 35 #include <hpcdefs.h> 36 #include <res/resource.h> 37 38 #include <machine/bootinfo.h> 39 #include <machine/platid.h> 40 #include <machine/platid_mask.h> 41 #include <machine/platid_generated.h> 42 43 enum { KERNEL_PAGE_SIZE = 0x1000 }; 44 45 enum ArchitectureOps { 46 #ifdef ARM 47 ARCHITECTURE_ARM_SA1100 = PLATID_CPU_ARM_STRONGARM_SA1100, 48 ARCHITECTURE_ARM_PXA250 = PLATID_CPU_ARM_XSCALE_PXA250, 49 #endif 50 #ifdef SHx 51 ARCHITECTURE_SH3_7707 = PLATID_CPU_SH_3_7707, 52 ARCHITECTURE_SH3_7709 = PLATID_CPU_SH_3_7709, 53 ARCHITECTURE_SH3_7709A = PLATID_CPU_SH_3_7709A, 54 ARCHITECTURE_SH4_7750 = PLATID_CPU_SH_4_7750, 55 #endif 56 #ifdef MIPS 57 ARCHITECTURE_MIPS_TX3900= PLATID_CPU_MIPS_TX_3900, 58 ARCHITECTURE_MIPS_TX3920= PLATID_CPU_MIPS_TX_3920, 59 ARCHITECTURE_MIPS_VR41 = PLATID_CPU_MIPS_VR_41XX 60 #endif 61 }; 62 63 enum ConsoleOps { 64 CONSOLE_LCD, 65 CONSOLE_SERIAL 66 }; 67 68 enum MemoryManagerOps { 69 MEMORY_MANAGER_VIRTUALCOPY, 70 MEMORY_MANAGER_LOCKPAGES, 71 MEMORY_MANAGER_SOFTMMU, 72 MEMORY_MANAGER_HARDMMU 73 }; 74 75 enum FileOps { 76 FILE_FAT, 77 FILE_UFS, 78 FILE_HTTP 79 }; 80 81 enum LoaderOps { 82 LOADER_UNKNOWN, 83 LOADER_ELF, 84 LOADER_COFF, 85 LOADER_AOUT 86 }; 87 88 struct BootSetupArgs { 89 enum ArchitectureOps architecture; 90 BOOL architectureDebug; 91 enum ConsoleOps console; 92 BOOL consoleEnable; 93 enum MemoryManagerOps memory; 94 BOOL memorymanagerDebug; 95 enum FileOps file; 96 BOOL fileDebug; 97 TCHAR fileRoot[MAX_PATH]; 98 TCHAR fileName[MAX_PATH]; 99 BOOL loadmfs; 100 TCHAR mfsName[MAX_PATH]; 101 enum LoaderOps loader; 102 BOOL loaderDebug; 103 }; 104 105 struct PageTag { 106 uint32_t next; /* next tagged page kernel virtual address; */ 107 uint32_t src; /* kernel virtual or physical address */ 108 uint32_t dst; /* kernel virtual or physical address */ 109 uint32_t sz; /* copy size or zero-clear size; */ 110 }; 111 112 struct BootArgs { 113 kaddr_t kernel_entry; 114 kaddr_t argc; 115 kaddr_t argv; 116 kaddr_t bootinfo; 117 struct bootinfo bi; 118 }; 119 120 #define VOLATILE_REF(x) (*(volatile uint32_t *)(x)) 121 #define VOLATILE_REF16(x) (*(volatile uint16_t *)(x)) 122 #define VOLATILE_REF8(x) (*(volatile uint8_t *)(x)) 123 #define _reg_read_1(a) (*(volatile uint8_t *)(a)) 124 #define _reg_read_2(a) (*(volatile uint16_t *)(a)) 125 #define _reg_read_4(a) (*(volatile uint32_t *)(a)) 126 #define _reg_write_1(a, v) (*(volatile uint8_t *)(a) = (v)) 127 #define _reg_write_2(a, v) (*(volatile uint16_t *)(a) = (v)) 128 #define _reg_write_4(a, v) (*(volatile uint32_t *)(a) = (v)) 129 130 #ifdef ARM 131 #define ptokv(x) (x) /* UNCACHED FLAT */ 132 #elif defined SHx 133 #define ptokv(x) ((x) | 0x80000000) /* CACHED P1 */ 134 #elif defined MIPS 135 #define ptokv(x) ((x) | 0x80000000) /* CACHED kseg0 */ 136 #else 137 #error "physical address to kernel virtual macro not defined." 138 #endif 139 140 __BEGIN_DECLS 141 /* Windows CE API */ 142 BOOL VirtualCopy(LPVOID, LPVOID, DWORD, DWORD); 143 BOOL SetKMode(BOOL); 144 BOOL LockPages(LPVOID, DWORD, PDWORD, int); 145 BOOL UnlockPages(LPVOID, DWORD); 146 void CacheSync(int); 147 #define CACHE_D_WBINV 1 148 #define CACHE_I_INV 2 149 /* ExtEscape */ 150 #define GETVFRAMEPHYSICAL 6144 151 #define GETVFRAMELEN 6145 152 153 /* debug utility */ 154 void _bitdisp(uint32_t, int, int, int, int); 155 void _dbg_bit_print(uint32_t, uint32_t, const char *); 156 #define bitdisp(a) _bitdisp((a), 0, 0, 0, 1) 157 __END_DECLS 158 159 /* Runtime Windows CE version */ 160 #if _WIN32_WCE <= 200 161 extern OSVERSIONINFO WinCEVersion; 162 #else 163 extern OSVERSIONINFOW WinCEVersion; 164 #endif 165 166 #endif /* _HPCBOOT_H_ */ 167