xref: /netbsd-src/sys/arch/i386/stand/lib/libi386.h (revision 21e37cc72a480a47828990a439cde7ac9ffaf0c6)
1 /*	$NetBSD: libi386.h,v 1.16 2004/03/24 16:46:28 drochner Exp $	*/
2 
3 /*
4  * Copyright (c) 1996
5  *	Matthias Drochner.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 typedef unsigned long physaddr_t;
30 
31 /* this is in startup code */
32 void vpbcopy __P((const void *, void *, size_t));
33 void pvbcopy __P((const void *, void *, size_t));
34 void pbzero __P((void *, size_t));
35 physaddr_t vtophys __P((void*));
36 
37 ssize_t pread __P((int, void *, size_t));
38 void startprog __P((physaddr_t, int, unsigned long*, physaddr_t));
39 
40 int exec_netbsd __P((const char*, physaddr_t, int));
41 
42 void delay __P((int));
43 int getbasemem __P((void));
44 int getextmemx __P((void));
45 int getextmem1 __P((void));
46 int biosvideomode __P((void));
47 #ifdef CONSERVATIVE_MEMDETECT
48 #define getextmem() getextmem1()
49 #else
50 #define getextmem() getextmemx()
51 #endif
52 void printmemlist __P((void));
53 void reboot __P((void));
54 void gateA20 __P((void));
55 
56 void initio __P((int));
57 #define CONSDEV_PC 0
58 #define CONSDEV_COM0 1
59 #define CONSDEV_COM1 2
60 #define CONSDEV_COM2 3
61 #define CONSDEV_COM3 4
62 #define CONSDEV_COM0KBD 5
63 #define CONSDEV_COM1KBD 6
64 #define CONSDEV_COM2KBD 7
65 #define CONSDEV_COM3KBD 8
66 #define CONSDEV_AUTO (-1)
67 int iskey __P((void));
68 char awaitkey __P((int, int));
69 
70 /* this is in "user code"! */
71 int parsebootfile __P((const char *, char**, char**, unsigned int*,
72 		       unsigned int*, const char**));
73 
74 #ifdef XMS
75 physaddr_t ppbcopy __P((physaddr_t, physaddr_t, int));
76 int checkxms __P((void));
77 physaddr_t xmsalloc __P((int));
78 #endif
79 
80 /* parseutils.c */
81 char *gettrailer __P((char*));
82 int parseopts __P((const char*, int*));
83 int parseboot __P((char*, char**, int*));
84 
85 /* menuutils.c */
86 struct bootblk_command {
87 	const char *c_name;
88 	void (*c_fn) __P((char *));
89 };
90 void bootmenu __P((void));
91 void docommand __P((char*));
92 
93 /* getsecs.c */
94 time_t getsecs __P((void));
95 
96 /* in "user code": */
97 void command_help __P((char *));
98 extern const struct bootblk_command commands[];
99 
100 /* asm bios/dos calls */
101 extern int biosdiskreset(int);
102 extern int biosextread(int, void *);
103 extern int biosgetrtc(u_long *);
104 extern int biosgetsystime(void);
105 extern int biosread(int, int, int, int, int, void *);
106 extern int comgetc(int);
107 extern void cominit(int);
108 extern int computc(int, int);
109 extern int comstatus(int);
110 extern int congetc(void);
111 extern int coniskey(void);
112 extern void conputc(int);
113 
114 extern int get_diskinfo(int);
115 extern int getextmem2(int *);
116 extern int getextmemps2(void *);
117 extern int getmementry(int *, int *);
118 extern int int13_extension(int);
119 struct biosdisk_ext13info;
120 extern void int13_getextinfo(int, struct biosdisk_ext13info *);
121 extern int pcibios_cfgread(unsigned int, int, int *);
122 extern int pcibios_cfgwrite(unsigned int, int, int);
123 extern int pcibios_finddev(int, int, int, unsigned int *);
124 extern int pcibios_present(int *);
125 
126 extern void dosclose(int);
127 extern int doserrno;	/* in dos_file.S */
128 extern int dosopen(char *);
129 extern int dosread(int, char *, int);
130 extern int dosseek(int, int, int);
131