Home | History | Annotate | Line # | Download | only in lib
libi386.h revision 1.44
      1 /*	$NetBSD: libi386.h,v 1.44 2019/07/26 12:09:48 nonaka 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);
     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 /* this is in "user code"! */
     78 int parsebootfile(const char *, char **, char **, int *, int *, const char **);
     79 
     80 #ifdef XMS
     81 physaddr_t ppbcopy(physaddr_t, physaddr_t, int);
     82 int checkxms(void);
     83 physaddr_t xmsalloc(int);
     84 #endif
     85 
     86 /* parseutils.c */
     87 char *gettrailer(char *);
     88 int parseopts(const char *, int *);
     89 int parseboot(char *, char **, int *);
     90 
     91 /* menuutils.c */
     92 struct bootblk_command {
     93 	const char *c_name;
     94 	void (*c_fn)(char *);
     95 };
     96 void bootmenu(void);
     97 void docommand(char *);
     98 
     99 /* in "user code": */
    100 void command_help(char *);
    101 extern const struct bootblk_command commands[];
    102 
    103 /* asm bios/dos calls */
    104 __compactcall int biosdisk_extread(int, void *);
    105 int biosdisk_read(int, int, int, int, int, void *);
    106 __compactcall int biosdisk_reset(int);
    107 
    108 __compactcall int biosgetrtc(u_long *);
    109 int biosgetsystime(void);
    110 int comgetc(int);
    111 void cominit(int);
    112 __compactcall int computc(int, int);
    113 int comstatus(int);
    114 int congetc(void);
    115 int conisshift(void);
    116 int coniskey(void);
    117 __compactcall void conputc(int);
    118 void conclr(void);
    119 
    120 int getextmem2(int *);
    121 __compactcall int getextmemps2(void *);
    122 int getmementry(int *, int *);
    123 
    124 __compactcall int biosdisk_int13ext(int);
    125 __compactcall int biosdisk_getinfo(int);
    126 struct biosdisk_extinfo;
    127 __compactcall int biosdisk_getextinfo(int, struct biosdisk_extinfo *);
    128 int get_harddrives(void);
    129 void biosdisk_probe(void);
    130 
    131 int pcibios_cfgread(unsigned int, int, int *);
    132 int pcibios_cfgwrite(unsigned int, int, int);
    133 int pcibios_finddev(int, int, int, unsigned int *);
    134 int pcibios_present(int *);
    135 
    136 void dosclose(int);
    137 int dosopen(char *);
    138 int dosread(int, char *, int);
    139 int dosseek(int, int, int);
    140 extern int doserrno;	/* in dos_file.S */
    141 
    142 void module_add(char *);
    143 void splash_add(char *);
    144 void rnd_add(char *);
    145 void fs_add(char *);
    146 void userconf_add(char *);
    147 void module_add_split(const char *, uint8_t);
    148 
    149 struct btinfo_framebuffer;
    150 void framebuffer_configure(struct btinfo_framebuffer *);
    151 
    152 #endif	/* __I386_STAND_LIBI386_H__ */
    153