libi386.h revision 1.15.2.6 1 /* $NetBSD: libi386.h,v 1.15.2.6 2005/11/10 13:56:54 skrll 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(const void *, void *, size_t);
33 void pvbcopy(const void *, void *, size_t);
34 void pbzero(void *, size_t);
35 physaddr_t vtophys(void *);
36
37 ssize_t pread(int, void *, size_t);
38 void startprog(physaddr_t, int, unsigned long *, physaddr_t);
39
40 int exec_netbsd(const char *, physaddr_t, int);
41
42 void delay(int);
43 int getbasemem(void);
44 int getextmemx(void);
45 int getextmem1(void);
46 int biosvideomode(void);
47 #ifdef CONSERVATIVE_MEMDETECT
48 #define getextmem() getextmem1()
49 #else
50 #define getextmem() getextmemx()
51 #endif
52 void printmemlist(void);
53 void reboot(void);
54 void gateA20(void);
55
56 void initio(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(int);
68 char awaitkey(int, int);
69
70 /* this is in "user code"! */
71 int parsebootfile(const char *, char **, char **, int *, int *, const char **);
72
73 #ifdef XMS
74 physaddr_t ppbcopy(physaddr_t, physaddr_t, int);
75 int checkxms(void);
76 physaddr_t xmsalloc(int);
77 #endif
78
79 /* parseutils.c */
80 char *gettrailer(char *);
81 int parseopts(const char *, int *);
82 int parseboot(char *, char **, int *);
83
84 /* menuutils.c */
85 struct bootblk_command {
86 const char *c_name;
87 void (*c_fn)(char *);
88 };
89 void bootmenu(void);
90 void docommand(char *);
91
92 /* getsecs.c */
93 time_t getsecs(void);
94
95 /* in "user code": */
96 void command_help(char *);
97 extern const struct bootblk_command commands[];
98
99 /* asm bios/dos calls */
100 int biosdisk_extread(int, void *);
101 int biosdisk_read(int, int, int, int, int, void *);
102 int biosdisk_reset(int);
103
104 int biosgetrtc(u_long *);
105 int biosgetsystime(void);
106 int comgetc(int);
107 void cominit(int);
108 int computc(int, int);
109 int comstatus(int);
110 int congetc(void);
111 int conisshift(void);
112 int coniskey(void);
113 void conputc(int);
114
115 int getextmem2(int *);
116 int getextmemps2(void *);
117 int getmementry(int *, int *);
118
119 int biosdisk_int13ext(int);
120 int biosdisk_getinfo(int);
121 struct biosdisk_extinfo;
122 void biosdisk_getextinfo(int, struct biosdisk_extinfo *);
123 int get_harddrives(void);
124
125 int pcibios_cfgread(unsigned int, int, int *);
126 int pcibios_cfgwrite(unsigned int, int, int);
127 int pcibios_finddev(int, int, int, unsigned int *);
128 int pcibios_present(int *);
129
130 void dosclose(int);
131 int dosopen(char *);
132 int dosread(int, char *, int);
133 int dosseek(int, int, int);
134 extern int doserrno; /* in dos_file.S */
135