Home | History | Annotate | Line # | Download | only in lib
libi386.h revision 1.28
      1 /*	$NetBSD: libi386.h,v 1.28 2008/12/13 23:30:54 christos 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 void multiboot(physaddr_t, physaddr_t, physaddr_t);
     40 
     41 int exec_netbsd(const char *, physaddr_t, int, int);
     42 int exec_multiboot(const char *, char *);
     43 
     44 void delay(int);
     45 int getbasemem(void);
     46 int getextmemx(void);
     47 int getextmem1(void);
     48 int biosvideomode(void);
     49 #ifdef CONSERVATIVE_MEMDETECT
     50 #define getextmem() getextmem1()
     51 #else
     52 #define getextmem() getextmemx()
     53 #endif
     54 void printmemlist(void);
     55 void reboot(void);
     56 void gateA20(void);
     57 
     58 void clear_pc_screen(void);
     59 void initio(int);
     60 #define CONSDEV_PC 0
     61 #define CONSDEV_COM0 1
     62 #define CONSDEV_COM1 2
     63 #define CONSDEV_COM2 3
     64 #define CONSDEV_COM3 4
     65 #define CONSDEV_COM0KBD 5
     66 #define CONSDEV_COM1KBD 6
     67 #define CONSDEV_COM2KBD 7
     68 #define CONSDEV_COM3KBD 8
     69 #define CONSDEV_AUTO (-1)
     70 int iskey(int);
     71 char awaitkey(int, int);
     72 
     73 /* this is in "user code"! */
     74 int parsebootfile(const char *, char **, char **, int *, int *, const char **);
     75 
     76 #ifdef XMS
     77 physaddr_t ppbcopy(physaddr_t, physaddr_t, int);
     78 int checkxms(void);
     79 physaddr_t xmsalloc(int);
     80 #endif
     81 
     82 /* parseutils.c */
     83 char *gettrailer(char *);
     84 int parseopts(const char *, int *);
     85 int parseboot(char *, char **, int *);
     86 
     87 /* menuutils.c */
     88 struct bootblk_command {
     89 	const char *c_name;
     90 	void (*c_fn)(char *);
     91 };
     92 void bootmenu(void);
     93 void docommand(char *);
     94 
     95 /* getsecs.c */
     96 time_t getsecs(void);
     97 
     98 /* in "user code": */
     99 void command_help(char *);
    100 extern const struct bootblk_command commands[];
    101 
    102 /* asm bios/dos calls */
    103 int biosdisk_extread(int, void *);
    104 int biosdisk_read(int, int, int, int, int, void *);
    105 int biosdisk_reset(int);
    106 
    107 int biosgetrtc(u_long *);
    108 int biosgetsystime(void);
    109 int comgetc(int);
    110 void cominit(int);
    111 int computc(int, int);
    112 int comstatus(int);
    113 int congetc(void);
    114 int conisshift(void);
    115 int coniskey(void);
    116 void conputc(int);
    117 void conclr(void);
    118 
    119 int getextmem2(int *);
    120 int getextmemps2(void *);
    121 int getmementry(int *, int *);
    122 
    123 int biosdisk_int13ext(int);
    124 int biosdisk_getinfo(int);
    125 struct biosdisk_extinfo;
    126 void biosdisk_getextinfo(int, struct biosdisk_extinfo *);
    127 int get_harddrives(void);
    128 
    129 int pcibios_cfgread(unsigned int, int, int *);
    130 int pcibios_cfgwrite(unsigned int, int, int);
    131 int pcibios_finddev(int, int, int, unsigned int *);
    132 int pcibios_present(int *);
    133 
    134 void dosclose(int);
    135 int dosopen(char *);
    136 int dosread(int, char *, int);
    137 int dosseek(int, int, int);
    138 extern int doserrno;	/* in dos_file.S */
    139 
    140 void module_add(char *);
    141