libi386.h revision 1.42.14.1 1 /* $NetBSD: libi386.h,v 1.42.14.1 2020/04/13 08:03:54 martin 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 #ifndef __I386_STAND_LIBI386_H__
30 #define __I386_STAND_LIBI386_H__
31
32 typedef unsigned long physaddr_t;
33
34 /* this is in startup code */
35 void vpbcopy(const void *, void *, size_t);
36 void pvbcopy(const void *, void *, size_t);
37 void pbzero(void *, size_t);
38 physaddr_t vtophys(void *);
39
40 ssize_t pread(int, void *, size_t);
41 void startprog(physaddr_t, uint32_t, uint32_t *, physaddr_t);
42 void multiboot(physaddr_t, physaddr_t, physaddr_t, uint32_t);
43
44 int exec_netbsd(const char *, physaddr_t, int, int, void (*)(void));
45 int exec_multiboot(const char *, char *);
46
47 void delay(int);
48 int getbasemem(void);
49 int getextmemx(void);
50 int getextmem1(void);
51 int biosvideomode(void);
52 #ifdef CONSERVATIVE_MEMDETECT
53 #define getextmem() getextmem1()
54 #else
55 #define getextmem() getextmemx()
56 #endif
57 void printmemlist(void);
58 void reboot(void);
59 void gateA20(void);
60
61 void clear_pc_screen(void);
62 void initio(int);
63 #define CONSDEV_PC 0
64 #define CONSDEV_COM0 1
65 #define CONSDEV_COM1 2
66 #define CONSDEV_COM2 3
67 #define CONSDEV_COM3 4
68 #define CONSDEV_COM0KBD 5
69 #define CONSDEV_COM1KBD 6
70 #define CONSDEV_COM2KBD 7
71 #define CONSDEV_COM3KBD 8
72 #define CONSDEV_AUTO (-1)
73 int iskey(int);
74 char awaitkey(int, int);
75 void wait_sec(int);
76
77 /* multiboot */
78 struct multiboot_package;
79 struct multiboot_package_priv;
80
81 struct multiboot_package {
82 int mbp_version;
83 struct multiboot_header *mbp_header;
84 const char *mbp_file;
85 char *mbp_args;
86 u_long mbp_basemem;
87 u_long mbp_extmem;
88 u_long mbp_loadaddr;
89 u_long *mbp_marks;
90 struct multiboot_package_priv*mbp_priv;
91 struct multiboot_package*(*mbp_probe)(const char *);
92 int (*mbp_exec)(struct multiboot_package *);
93 void (*mbp_cleanup)(struct multiboot_package *);
94 };
95
96 struct multiboot_package *probe_multiboot1(const char *);
97 struct multiboot_package *probe_multiboot2(const char *);
98
99 /* this is in "user code"! */
100 int parsebootfile(const char *, char **, char **, int *, int *, const char **);
101
102 #ifdef XMS
103 physaddr_t ppbcopy(physaddr_t, physaddr_t, int);
104 int checkxms(void);
105 physaddr_t xmsalloc(int);
106 #endif
107
108 /* parseutils.c */
109 char *gettrailer(char *);
110 int parseopts(const char *, int *);
111 int parseboot(char *, char **, int *);
112
113 /* menuutils.c */
114 struct bootblk_command {
115 const char *c_name;
116 void (*c_fn)(char *);
117 };
118 void bootmenu(void);
119 void docommand(char *);
120
121 /* in "user code": */
122 void command_help(char *);
123 extern const struct bootblk_command commands[];
124
125 /* asm bios/dos calls */
126 __compactcall int biosdisk_extread(int, void *);
127 int biosdisk_read(int, int, int, int, int, void *);
128 __compactcall int biosdisk_reset(int);
129
130 __compactcall int biosgetrtc(u_long *);
131 int biosgetsystime(void);
132 int comgetc(int);
133 void cominit(int);
134 __compactcall int computc(int, int);
135 int comstatus(int);
136 int congetc(void);
137 int conisshift(void);
138 int coniskey(void);
139 __compactcall void conputc(int);
140 void conclr(void);
141
142 int getextmem2(int *);
143 __compactcall int getextmemps2(void *);
144 int getmementry(int *, int *);
145
146 __compactcall int biosdisk_int13ext(int);
147 __compactcall int biosdisk_getinfo(int);
148 struct biosdisk_extinfo;
149 __compactcall int biosdisk_getextinfo(int, struct biosdisk_extinfo *);
150 int get_harddrives(void);
151 void biosdisk_probe(void);
152
153 int pcibios_cfgread(unsigned int, int, int *);
154 int pcibios_cfgwrite(unsigned int, int, int);
155 int pcibios_finddev(int, int, int, unsigned int *);
156 int pcibios_present(int *);
157
158 void dosclose(int);
159 int dosopen(char *);
160 int dosread(int, char *, int);
161 int dosseek(int, int, int);
162 extern int doserrno; /* in dos_file.S */
163
164 void module_add(char *);
165 void splash_add(char *);
166 void rnd_add(char *);
167 void fs_add(char *);
168 void userconf_add(char *);
169 void module_add_split(const char *, uint8_t);
170
171 struct btinfo_framebuffer;
172 void framebuffer_configure(struct btinfo_framebuffer *);
173
174 void ksyms_addr_set(void *, void *, void *);
175
176 #endif /* __I386_STAND_LIBI386_H__ */
177