1 /* $NetBSD: samachdep.h,v 1.17 2014/01/11 17:00:37 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(short, short); 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 u_char 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 107 /* kbd.c */ 108 int kbd_decode(u_char); 109 110 /* lance.c */ 111 void *lance_attach(int, void *, void *, uint8_t *); 112 void *lance_cookie(int); 113 uint8_t *lance_eaddr(void *); 114 bool lance_init(void *); 115 int lance_get(void *, void *, size_t); 116 bool lance_put(void *, void *, size_t); 117 bool lance_end(void *); 118 int lance_intr(void); 119 120 /* locore.S */ 121 extern int dipsw1, dipsw2; 122 extern int cputype; 123 extern volatile uint32_t tick; 124 int setjmp(label_t *); 125 int splhigh(void); 126 void splx(int); 127 int getsfc(void); 128 int getdfc(void); 129 int spl0(void); 130 int spl1(void); 131 int spl2(void); 132 int spl3(void); 133 int spl4(void); 134 int spl5(void); 135 int spl6(void); 136 137 /* ls.c */ 138 int cmd_ls(int, char **); 139 140 /* machdep.c */ 141 void straytrap(int); 142 int badaddr(volatile void *); 143 void regdump(int *, int); 144 char *hexstr(int, int); 145 146 /* prf.c */ 147 int tgetchar(void); 148 149 /* parse.c */ 150 int check_args(int, char **); 151 int exit_program(int, char **); 152 int parse(int, char **); 153 int getargs(char *, char **, int); 154 155 /* romcons.c */ 156 void romcnprobe(struct consdev *); 157 void romcninit(struct consdev *); 158 int romcngetc(dev_t); 159 void romcnputc(dev_t, int); 160 161 /* sc.c */ 162 int scinit(int, void *); 163 struct scsi_inquiry; 164 bool scident(uint, uint, uint, struct scsi_inquiry *, uint32_t *); 165 struct scsi_generic_cdb; 166 int scsi_immed_command(int, int, int, struct scsi_generic_cdb *, u_char *, 167 unsigned int); 168 int scsi_request_sense(int, int, int, u_char *, unsigned int); 169 int scsi_test_unit_rdy(int, int, int); 170 int scsi_format_unit(int, int, int); 171 int scintr(void); 172 173 /* scsi.c */ 174 int scsi(int, char **); 175 int scsi_read_raw(u_int, u_int, u_int, u_char *, u_int); 176 int scsi_read(u_int, u_char *, u_int); 177 int scsi_write(u_int, u_char *, u_int); 178 179 /* screen.c */ 180 int screen(int, char **); 181 182 /* scsi.c */ 183 int scsi(int, char **); 184 185 /* sd.c */ 186 int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *); 187 int sdopen(struct open_file *, ...); 188 int sdclose(struct open_file *); 189 190 /* sio.c */ 191 void _siointr(void); 192 void siocnprobe(struct consdev *); 193 void siocninit(struct consdev *); 194 int siocngetc(dev_t); 195 void siocnputc(dev_t, int); 196 void sioinit(void); 197 198 /* tape.c */ 199 int tape(int, char **); 200 201 /* trap.c */ 202 void trap(int, unsigned int, unsigned int, struct frame); 203 204 /* ufs_disklabel.c */ 205 char *readdisklabel(int, int, struct disklabel *); 206 207 208 /* use following device unit number strategy to make parser easier */ 209 #define UNIT(ctlr, target) ((ctlr) * 10 + (target)) 210 #define CTLR(unit) ((unit) / 10) 211 #define TARGET(unit) ((unit) % 10) 212 213 #define DELAY(n) \ 214 do { \ 215 register int __N = cpuspeed * (n); \ 216 do { \ 217 __asm("subql #1, %0" : "=r" (__N) : "0" (__N)); \ 218 } while (__N > 0); \ 219 } while (/* CONSTCOND */ 0) 220 221 extern struct fs_ops file_system_disk[]; 222 extern int nfsys_disk; 223 extern struct fs_ops file_system_nfs[]; 224 225 extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[]; 226