1/*	$NetBSD: samachdep.h,v 1.19 2014/04/21 11:06:55 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
46struct consdev;
47struct frame;
48typedef struct label_t {
49	int val[15];
50} label_t;
51
52/* autoconf.c */
53void find_devs(void);
54extern const int dev2adpt[];
55
56/* awaitkey.c */
57char awaitkey(const char *, int, bool);
58
59/* bmc.c */
60void bmccnprobe(struct consdev *);
61void bmccninit(struct consdev *);
62int  bmccngetc(dev_t);
63void bmccnputc(dev_t, int);
64
65/* bmd.c */
66void bmdinit(void);
67int bmdputc(int);
68void bmdadjust(int16_t, int16_t);
69void bmdclear(void);
70
71/* boot.c */
72int boot(int, char **);
73int bootnetbsd(char *, int);
74
75/* cons.c */
76void cninit(void);
77int cngetc(void);
78void cnputc(int);
79
80/* devopen.c */
81int make_device(const char *, int *, int *, int *, char **);
82
83/* disklabel.c */
84extern uint8_t lbl_buff[];
85int disklabel(int, char **);
86
87/* font.c */
88extern const uint16_t bmdfont[][20];
89
90/* fsdump.c */
91int fsdump(int, char **);
92int fsrestore(int, char **);
93
94/* getline.c */
95int getline(const char *, char *);
96
97/* if_le.c */
98int leinit(int, void *);
99
100/* init_main.c */
101extern int cpuspeed;
102extern int hz;
103extern int nplane;
104extern int machtype;
105extern char default_file[];
106extern const char *default_bootdev;
107extern int default_unit;
108
109/* kbd.c */
110int kbd_decode(uint8_t);
111
112/* lance.c */
113void *lance_attach(int, void *, void *, uint8_t *);
114void *lance_cookie(int);
115uint8_t *lance_eaddr(void *);
116bool lance_init(void *);
117int lance_get(void *, void *, size_t);
118bool lance_put(void *, void *, size_t);
119bool lance_end(void *);
120int lance_intr(void);
121
122/* locore.S */
123extern int dipsw1, dipsw2;
124extern int cputype;
125extern volatile uint32_t tick;
126int setjmp(label_t *);
127int splhigh(void);
128void splx(int);
129int getsfc(void);
130int getdfc(void);
131int spl0(void);
132int spl1(void);
133int spl2(void);
134int spl3(void);
135int spl4(void);
136int spl5(void);
137int spl6(void);
138
139/* ls.c */
140int cmd_ls(int, char **);
141
142/* machdep.c */
143void straytrap(int);
144int badaddr(volatile void *);
145void regdump(int *, int);
146char *hexstr(int, int);
147
148/* prf.c */
149int tgetchar(void);
150
151/* parse.c */
152int check_args(int, char **);
153int exit_program(int, char **);
154int parse(int, char **);
155int getargs(char *, char **, int);
156
157/* romcons.c */
158void romcnprobe(struct consdev *);
159void romcninit(struct consdev *);
160int  romcngetc(dev_t);
161void romcnputc(dev_t, int);
162
163/* sc.c */
164int scinit(int, void *);
165struct scsi_inquiry;
166bool scident(uint, uint, uint, struct scsi_inquiry *, uint32_t *);
167struct scsi_generic_cdb;
168int scsi_immed_command(int, int, int, struct scsi_generic_cdb *, uint8_t *,
169    unsigned int);
170int scsi_request_sense(int, int, int, uint8_t *, unsigned int);
171int scsi_test_unit_rdy(int, int, int);
172int scsi_format_unit(int, int, int);
173int scintr(void);
174
175/* scsi.c */
176int scsi(int, char **);
177int scsi_read_raw(u_int, u_int, u_int, uint8_t *, u_int);
178int scsi_read(u_int, uint8_t *, u_int);
179int scsi_write(u_int, uint8_t *, u_int);
180
181/* screen.c */
182int screen(int, char **);
183
184/* scsi.c */
185int scsi(int, char **);
186
187/* sd.c */
188int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
189int sdopen(struct open_file *, ...);
190int sdclose(struct open_file *);
191
192/* sio.c */
193void _siointr(void);
194void siocnprobe(struct consdev *);
195void siocninit(struct consdev *);
196int  siocngetc(dev_t);
197void siocnputc(dev_t, int);
198void sioinit(void);
199
200/* tape.c */
201int tape(int, char **);
202
203/* trap.c */
204void trap(int, unsigned int, unsigned int, struct frame);
205
206/* ufs_disklabel.c */
207char *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)							\
216do {									\
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
223extern	struct fs_ops file_system_disk[];
224extern	int nfsys_disk;
225extern	struct fs_ops file_system_nfs[];
226
227extern	const char bootprog_name[], bootprog_rev[], bootprog_kernrev[];
228