samachdep.h revision 1.16 1 /* $NetBSD: samachdep.h,v 1.16 2014/01/11 08:08:23 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 #define NSD 8
40 #define DK_NDRIVE 8
41
42 #define MHZ_8 1
43 #define MHZ_16 2
44 #define MHZ_25 3
45 #define MHZ_33 4
46 #define MHZ_50 6
47
48 struct consdev;
49 struct frame;
50 typedef struct label_t {
51 int val[15];
52 } label_t;
53
54 /* autoconf.c */
55 void configure(void);
56 void find_devs(void);
57 extern const int dev2adpt[];
58
59 /* awaitkey.c */
60 char awaitkey(const char *, int, bool);
61
62 /* bmc.c */
63 void bmccnprobe(struct consdev *);
64 void bmccninit(struct consdev *);
65 int bmccngetc(dev_t);
66 void bmccnputc(dev_t, int);
67
68 /* bmd.c */
69 void bmdinit(void);
70 int bmdputc(int);
71 void bmdadjust(short, short);
72 void bmdclear(void);
73
74 /* boot.c */
75 int boot(int, char **);
76 int bootnetbsd(char *, int);
77
78 /* clock.c */
79 /* not yet */
80
81 /* cons.c */
82 void cninit(void);
83 int cngetc(void);
84 void cnputc(int);
85
86 /* devopen.c */
87 int make_device(const char *, int *, int *, int *, char **);
88
89 /* disklabel.c */
90 extern u_char lbl_buff[];
91 int disklabel(int, char **);
92
93 /* exec.c */
94 void exec_hp300(char *, u_long, int);
95
96 /* font.c */
97 extern const uint16_t bmdfont[][20];
98
99 /* fsdump.c */
100 int fsdump(int, char **);
101 int fsrestore(int, char **);
102
103 /* getline.c */
104 int getline(const char *, char *);
105
106 /* if_le.c */
107 int leinit(int, void *);
108
109 /* init_main.c */
110 extern int cpuspeed;
111 extern int hz;
112 extern int nplane;
113 extern int machtype;
114 extern char default_file[];
115
116 /* kbd.c */
117 int kbd_decode(u_char);
118
119 /* lance.c */
120 void *lance_attach(int, void *, void *, uint8_t *);
121 void *lance_cookie(int);
122 uint8_t *lance_eaddr(void *);
123 bool lance_init(void *);
124 int lance_get(void *, void *, size_t);
125 bool lance_put(void *, void *, size_t);
126 bool lance_end(void *);
127 int lance_intr(void);
128
129 /* locore.S */
130 extern u_int bootdev;
131 extern int dipsw1, dipsw2;
132 extern int cputype;
133 extern volatile uint32_t tick;
134 int setjmp(label_t *);
135 int splhigh(void);
136 void splx(int);
137 int getsfc(void);
138 int getdfc(void);
139 int spl0(void);
140 int spl1(void);
141 int spl2(void);
142 int spl3(void);
143 int spl4(void);
144 int spl5(void);
145 int spl6(void);
146
147 /* ls.c */
148 int cmd_ls(int, char **);
149
150 /* machdep.c */
151 void straytrap(int);
152 int badaddr(volatile void *);
153 void regdump(int *, int);
154 char *hexstr(int, int);
155
156 /* prf.c */
157 int tgetchar(void);
158
159 /* parse.c */
160 int check_args(int, char **);
161 int exit_program(int, char **);
162 int parse(int, char **);
163 int getargs(char *, char **, int);
164
165 /* romcons.c */
166 void romcnprobe(struct consdev *);
167 void romcninit(struct consdev *);
168 int romcngetc(dev_t);
169 void romcnputc(dev_t, int);
170
171 /* sc.c */
172 int scinit(int, void *);
173 struct scsi_inquiry;
174 bool scident(uint, uint, uint, struct scsi_inquiry *, uint32_t *);
175 struct scsi_generic_cdb;
176 int scsi_immed_command(int, int, int, struct scsi_generic_cdb *, u_char *,
177 unsigned int);
178 int scsi_request_sense(int, int, int, u_char *, unsigned int);
179 int scsi_test_unit_rdy(int, int, int);
180 int scsi_format_unit(int, int, int);
181 int scintr(void);
182
183 /* scsi.c */
184 int scsi(int, char **);
185 int scsi_read_raw(u_int, u_int, u_int, u_char *, u_int);
186 int scsi_read(u_int, u_char *, u_int);
187 int scsi_write(u_int, u_char *, u_int);
188
189 /* screen.c */
190 int screen(int, char **);
191
192 /* scsi.c */
193 int scsi(int, char **);
194
195 /* sd.c */
196 int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
197 int sdopen(struct open_file *, ...);
198 int sdclose(struct open_file *);
199
200 /* sio.c */
201 void _siointr(void);
202 void siocnprobe(struct consdev *);
203 void siocninit(struct consdev *);
204 int siocngetc(dev_t);
205 void siocnputc(dev_t, int);
206 void sioinit(void);
207
208 /* tape.c */
209 int tape(int, char **);
210
211 /* trap.c */
212 void trap(int, unsigned int, unsigned int, struct frame);
213
214 /* ufs_disklabel.c */
215 char *readdisklabel(int, int, struct disklabel *);
216
217
218 /* use following device unit number strategy to make parser easier */
219 #define UNIT(ctlr, target) ((ctlr) * 10 + (target))
220 #define CTLR(unit) ((unit) / 10)
221 #define TARGET(unit) ((unit) % 10)
222
223 #define DELAY(n) \
224 do { \
225 register int __N = cpuspeed * (n); \
226 do { \
227 __asm("subql #1, %0" : "=r" (__N) : "0" (__N)); \
228 } while (__N > 0); \
229 } while (/* CONSTCOND */ 0)
230
231 extern struct fs_ops file_system_disk[];
232 extern int nfsys_disk;
233 extern struct fs_ops file_system_nfs[];
234
235 extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[];
236