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