Home | History | Annotate | Line # | Download | only in pbsdboot
pbsdboot.h revision 1.6
      1 /*	$NetBSD: pbsdboot.h,v 1.6 2000/01/16 03:07:33 takemura Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1999 Shin Takemura.
      5  * All rights reserved.
      6  *
      7  * This software is part of the PocketBSD.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  * 3. All advertising materials mentioning features or use of this software
     18  *    must display the following acknowledgement:
     19  *	This product includes software developed by the PocketBSD project
     20  *	and its contributors.
     21  * 4. Neither the name of the project nor the names of its contributors
     22  *    may be used to endorse or promote products derived from this software
     23  *    without specific prior written permission.
     24  *
     25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     35  * SUCH DAMAGE.
     36  *
     37  */
     38 #define STANDALONE_WINDOWS_SIDE
     39 #include <stand.h>
     40 #include <machine/bootinfo.h>
     41 #include <machine/platid.h>
     42 
     43 extern TCHAR szAppName[ ];
     44 #define whoami szAppName
     45 #define PREFNAME TEXT("pbsdboot.ini")
     46 #define PATHBUFLEN 200
     47 
     48 
     49 /*
     50  *  For some reason, we can't include Windows' header files.
     51  *  So we must declare here.
     52  */
     53 double wcstod(const wchar_t *, wchar_t **);
     54 long wcstol(const wchar_t *, wchar_t **, int);
     55 unsigned long wcstoul(const wchar_t *, wchar_t **, int);
     56 BOOL VirtualCopy(LPVOID, LPVOID, DWORD, DWORD);
     57 
     58 /*
     59  *  structure declarations
     60  */
     61 struct map_s {
     62 	caddr_t entry;
     63 	caddr_t base;
     64 	int pagesize;
     65 	int leafsize;
     66 	int nleaves;
     67 	caddr_t arg0;
     68 	caddr_t arg1;
     69 	caddr_t arg2;
     70 	caddr_t arg3;
     71 	caddr_t *leaf[32];
     72 };
     73 
     74 struct preference_s {
     75 	int setting_idx;
     76 	int fb_type;
     77 	int fb_width, fb_height, fb_linebytes;
     78 	long fb_addr;
     79 	unsigned long platid_cpu, platid_machine;
     80 	TCHAR setting_name[PATHBUFLEN];
     81 	TCHAR kernel_name[PATHBUFLEN];
     82 	TCHAR options[PATHBUFLEN];
     83 	BOOL check_last_chance;
     84 	BOOL load_debug_info;
     85 	BOOL serial_port;
     86 };
     87 
     88 /*
     89  * Machine dependent information
     90  */
     91 struct system_info {
     92 	unsigned int si_dramstart;
     93 	unsigned int si_drammaxsize;
     94 	DWORD si_pagesize;
     95 	unsigned char *si_asmcode;
     96 	int si_asmcodelen;
     97 	int (*si_boot) __P((caddr_t));
     98 	int si_intrvec;
     99 };
    100 extern struct system_info system_info;
    101 
    102 extern struct preference_s pref;
    103 extern TCHAR* where_pref_load_from;
    104 
    105 /*
    106  *  main.c
    107  */
    108 BOOL CheckCancel(int progress);
    109 extern HWND hWndMain;
    110 
    111 /*
    112  *  layout.c
    113  */
    114 int CreateMainWindow(HINSTANCE hInstance, HWND hWnd, LPCTSTR name, int cmdbar_height);
    115 
    116 /*
    117  *  vmem.c
    118  */
    119 int vmem_exec(caddr_t entry, int argc, char *argv[], struct bootinfo *bi);
    120 caddr_t vmem_get(caddr_t phys_addr, int *length);
    121 int vmem_init(caddr_t start, caddr_t end);
    122 void vmem_dump_map(void);
    123 caddr_t vtophysaddr(caddr_t page);
    124 void vmem_free(void);
    125 caddr_t vmem_alloc(void);
    126 
    127 /*
    128  *  elf.c
    129  */
    130 int getinfo(int fd, caddr_t *start, caddr_t *end);
    131 int loadfile(int fd, caddr_t *entry);
    132 
    133 /*
    134  *  mips.c
    135  */
    136 int mips_boot(caddr_t map);
    137 
    138 /*
    139  *  pbsdboot.c
    140  */
    141 int pbsdboot(TCHAR*, int argc, char *argv[], struct bootinfo *bi);
    142 
    143 /*
    144  *  print.c
    145  */
    146 int debug_printf(LPWSTR lpszFmt, ...);
    147 int msg_printf(UINT type, LPWSTR caption, LPWSTR lpszFmt, ...);
    148 
    149 #define	MSG_ERROR	(MB_OK | MB_ICONERROR)
    150 #define MSG_INFO	(MB_OK | MB_ICONINFORMATION)
    151 
    152 /*
    153  *  disptest.c
    154  */
    155 void hardware_test(void);
    156 
    157 
    158 /*
    159  *  preference.c
    160  */
    161 void pref_init(struct preference_s* pref);
    162 void pref_dump(struct preference_s* pref);
    163 int pref_read(TCHAR* filename, struct preference_s* pref);
    164 int pref_load(TCHAR* load_path[], int pathlen);
    165 int pref_write(TCHAR* filename, struct preference_s* buf);
    166 
    167 
    168 /*
    169  *  systeminfo.c
    170  */
    171 int set_system_info(platid_t* platid);
    172 
    173 
    174 /*
    175  *  vr41xx.c
    176  */
    177 void vr41xx_init(SYSTEM_INFO *info);
    178 
    179 
    180 /*
    181  *  tx39xx.c
    182  */
    183 void tx39xx_init(SYSTEM_INFO *info);
    184