xref: /netbsd-src/sys/arch/luna68k/stand/boot/samachdep.h (revision bdeab44e3ff3720ebee1520574b30256193b6ac9)
1 /*	$NetBSD: samachdep.h,v 1.20 2015/02/14 05:03:09 tsutsui Exp $	*/
2 
3 /*
4  * Copyright (c) 1982, 1990, 1993
5  *	The Regents of the University of California.  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. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *	@(#)samachdep.h	8.1 (Berkeley) 6/10/93
32  */
33 
34 #include <sys/param.h>
35 #include <m68k/frame.h>
36 #include <lib/libsa/stand.h>
37 
38 #define	NSCSI		2
39 
40 #define MHZ_8		1
41 #define MHZ_16		2
42 #define MHZ_25		3
43 #define MHZ_33		4
44 #define MHZ_50		6
45 
46 struct consdev;
47 struct frame;
48 typedef struct label_t {
49 	int val[15];
50 } label_t;
51 
52 /* autoconf.c */
53 void find_devs(void);
54 extern const int dev2adpt[];
55 
56 /* awaitkey.c */
57 char awaitkey(const char *, int, bool);
58 
59 /* bmc.c */
60 void bmccnprobe(struct consdev *);
61 void bmccninit(struct consdev *);
62 int  bmccngetc(dev_t);
63 void bmccnputc(dev_t, int);
64 
65 /* bmd.c */
66 void bmdinit(void);
67 int bmdputc(int);
68 void bmdadjust(int16_t, int16_t);
69 void bmdclear(void);
70 
71 /* boot.c */
72 int boot(int, char **);
73 int bootnetbsd(char *, int);
74 
75 /* cons.c */
76 void cninit(void);
77 int cngetc(void);
78 void cnputc(int);
79 
80 /* devopen.c */
81 int make_device(const char *, int *, int *, int *, char **);
82 
83 /* disklabel.c */
84 extern uint8_t lbl_buff[];
85 int disklabel(int, char **);
86 
87 /* font.c */
88 extern const uint16_t bmdfont[][20];
89 
90 /* fsdump.c */
91 int fsdump(int, char **);
92 int fsrestore(int, char **);
93 
94 /* getline.c */
95 int getline(const char *, char *);
96 
97 /* if_le.c */
98 int leinit(int, void *);
99 
100 /* init_main.c */
101 extern int cpuspeed;
102 extern int hz;
103 extern int nplane;
104 extern int machtype;
105 extern char default_file[];
106 extern const char *default_bootdev;
107 extern int default_unit;
108 
109 /* kbd.c */
110 int kbd_decode(uint8_t);
111 
112 /* lance.c */
113 void *lance_attach(int, void *, void *, uint8_t *);
114 void *lance_cookie(int);
115 uint8_t *lance_eaddr(void *);
116 bool lance_init(void *);
117 int lance_get(void *, void *, size_t);
118 bool lance_put(void *, void *, size_t);
119 bool lance_end(void *);
120 int lance_intr(void);
121 
122 /* locore.S */
123 extern int dipsw1, dipsw2;
124 extern int cputype;
125 extern volatile uint32_t tick;
126 int setjmp(label_t *);
127 int splhigh(void);
128 void splx(int);
129 int getsfc(void);
130 int getdfc(void);
131 int spl0(void);
132 int spl1(void);
133 int spl2(void);
134 int spl3(void);
135 int spl4(void);
136 int spl5(void);
137 int spl6(void);
138 
139 /* ls.c */
140 int cmd_ls(int, char **);
141 
142 /* machdep.c */
143 void straytrap(int);
144 int badaddr(volatile void *);
145 void regdump(int *, int);
146 char *hexstr(int, int);
147 
148 /* prf.c */
149 int tgetchar(void);
150 
151 /* parse.c */
152 int check_args(int, char **);
153 int exit_program(int, char **);
154 int parse(int, char **);
155 int getargs(char *, char **, int);
156 
157 /* romcons.c */
158 void romcnprobe(struct consdev *);
159 void romcninit(struct consdev *);
160 int  romcngetc(dev_t);
161 void romcnputc(dev_t, int);
162 
163 /* sc.c */
164 int scinit(int, void *);
165 struct scsi_inquiry;
166 bool scident(uint, uint, uint, struct scsi_inquiry *, uint32_t *);
167 struct scsi_generic_cdb;
168 int scsi_immed_command(int, int, int, struct scsi_generic_cdb *, uint8_t *,
169     unsigned int);
170 int scsi_request_sense(int, int, int, uint8_t *, unsigned int);
171 int scsi_test_unit_rdy(int, int, int);
172 int scsi_format_unit(int, int, int);
173 int scintr(void);
174 
175 /* scsi.c */
176 int scsi(int, char **);
177 int scsi_read_raw(u_int, u_int, u_int, uint8_t *, u_int);
178 int scsi_read(u_int, uint8_t *, u_int);
179 int scsi_write(u_int, uint8_t *, u_int);
180 
181 /* screen.c */
182 int screen(int, char **);
183 
184 /* scsi.c */
185 int scsi(int, char **);
186 
187 /* sd.c */
188 int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
189 int sdopen(struct open_file *, ...);
190 int sdclose(struct open_file *);
191 
192 /* sio.c */
193 void _siointr(void);
194 void siocnprobe(struct consdev *);
195 void siocninit(struct consdev *);
196 int  siocngetc(dev_t);
197 void siocnputc(dev_t, int);
198 void sioinit(void);
199 
200 /* tape.c */
201 int tape(int, char **);
202 
203 /* trap.c */
204 void trap(int, unsigned int, unsigned int, struct frame);
205 
206 /* ufs_disklabel.c */
207 char *readdisklabel(int, int, struct disklabel *);
208 
209 
210 /* use following device unit number strategy to make parser easier */
211 #define	UNIT(ctlr, target)	((ctlr) * 10 + (target))
212 #define	CTLR(unit)		((unit) / 10)
213 #define	TARGET(unit)		((unit) % 10)
214 
215 #define DELAY(n)							\
216 do {									\
217 	register int __N = cpuspeed * (n);				\
218 	do {								\
219 		__asm("subql #1, %0" : "=r" (__N) : "0" (__N));		\
220 	} while (__N > 0);						\
221 } while (/* CONSTCOND */ 0)
222 
223 extern	struct fs_ops file_system_disk[];
224 extern	int nfsys_disk;
225 extern	struct fs_ops file_system_nfs[];
226 
227 extern	const char bootprog_name[], bootprog_rev[], bootprog_kernrev[];
228