xref: /openbsd/sys/arch/i386/stand/libsa/machdep.c (revision 78b63d65)
1 /*	$OpenBSD: machdep.c,v 1.31 2001/08/18 15:34:17 mickey Exp $	*/
2 
3 /*
4  * Copyright (c) 1997-1999 Michael Shalayeff
5  * 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  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *      This product includes software developed by Michael Shalayeff.
18  * 4. The name of the author may not be used to endorse or promote products
19  *    derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
25  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #include "libsa.h"
35 #include <machine/apmvar.h>
36 #include <machine/biosvar.h>
37 #include "debug.h"
38 #include "ps2probe.h"
39 
40 struct BIOS_regs	BIOS_regs;
41 
42 #if defined(DEBUG) && !defined(_TEST)
43 #define CKPT(c)	(*(u_int16_t*)0xb8148 = 0x4700 + (c))
44 #else
45 #define CKPT(c) /* c */
46 #endif
47 
48 extern int debug;
49 int ps2model;
50 
51 void
52 machdep()
53 {
54 	/* here */	CKPT('0');
55 	printf("probing:");
56 #ifndef _TEST
57 	/* probe for a model number, gateA20() neds ps2model */
58 	ps2probe();	CKPT('1');
59 	gateA20(1);	CKPT('2');
60 	debug_init();	CKPT('3');
61 #endif
62 	/* call console init before doing any io */
63 	cninit();	CKPT('4');
64 #ifndef _TEST
65 	apmprobe();	CKPT('5');
66 	pciprobe();	CKPT('6');
67 /*	smpprobe();	CKPT('7'); */
68 	memprobe();	CKPT('8');
69 	printf("\n");
70 
71 	diskprobe();	CKPT('9');
72 #endif
73 			CKPT('Z');
74 }
75