bugsyscalls.h revision 1.1 1 1.1 scw /* $NetBSD: bugsyscalls.h,v 1.1 2002/02/27 21:02:27 scw Exp $ */
2 1.1 scw
3 1.1 scw /*-
4 1.1 scw * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 1.1 scw * All rights reserved.
6 1.1 scw *
7 1.1 scw * This code is derived from software contributed to The NetBSD Foundation
8 1.1 scw * by Steve C. Woodford.
9 1.1 scw *
10 1.1 scw * Redistribution and use in source and binary forms, with or without
11 1.1 scw * modification, are permitted provided that the following conditions
12 1.1 scw * are met:
13 1.1 scw * 1. Redistributions of source code must retain the above copyright
14 1.1 scw * notice, this list of conditions and the following disclaimer.
15 1.1 scw * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 scw * notice, this list of conditions and the following disclaimer in the
17 1.1 scw * documentation and/or other materials provided with the distribution.
18 1.1 scw * 3. All advertising materials mentioning features or use of this software
19 1.1 scw * must display the following acknowledgement:
20 1.1 scw * This product includes software developed by the NetBSD
21 1.1 scw * Foundation, Inc. and its contributors.
22 1.1 scw * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 scw * contributors may be used to endorse or promote products derived
24 1.1 scw * from this software without specific prior written permission.
25 1.1 scw *
26 1.1 scw * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 scw * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 scw * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 scw * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 scw * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 scw * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 scw * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 scw * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 scw * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 scw * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 scw * POSSIBILITY OF SUCH DAMAGE.
37 1.1 scw */
38 1.1 scw
39 1.1 scw #ifndef __BUGSYSCALLS_H
40 1.1 scw #define __BUGSYSCALLS_H
41 1.1 scw
42 1.1 scw /*
43 1.1 scw * Basic Console I/O system calls
44 1.1 scw */
45 1.1 scw extern char bugsys_inchr(void);
46 1.1 scw extern void bugsys_outchr(char);
47 1.1 scw extern int bugsys_instat(void);
48 1.1 scw
49 1.1 scw
50 1.1 scw /*
51 1.1 scw * Basic Disk I/O system calls
52 1.1 scw */
53 1.1 scw struct bug_diskio {
54 1.1 scw u_int8_t dc_clun; /* Controller LUN for operation */
55 1.1 scw u_int8_t dc_dlun; /* Device LUN for operation */
56 1.1 scw u_int16_t dc_status; /* Completion status written here */
57 1.1 scw void *dc_buffer; /* Pointer to dest/src buffer */
58 1.1 scw u_int32_t dc_block; /* Starting block/file-number */
59 1.1 scw u_int16_t dc_nblocks; /* Number of blocks to transfer */
60 1.1 scw u_int8_t dc_flag; /* Flag (see below) */
61 1.1 scw u_int8_t dc_am; /* VMEbus address modifier, or zero */
62 1.1 scw };
63 1.1 scw #define BUG_DISKCMD_FLAG_FILEMARK (1 << 7)
64 1.1 scw #define BUG_DISKCMD_FLAG_IFN (1 << 1)
65 1.1 scw #define BUG_DISKCMD_FLAG_EOF (1 << 0)
66 1.1 scw
67 1.1 scw extern int bugsys_dskrd(struct bug_diskio *);
68 1.1 scw extern int bugsys_dskwr(struct bug_diskio *);
69 1.1 scw
70 1.1 scw /*
71 1.1 scw * Basic Nework I/O system calls
72 1.1 scw */
73 1.1 scw struct bug_netio {
74 1.1 scw u_int8_t nc_clun; /* Controller LUN for operation */
75 1.1 scw u_int8_t nc_dlun; /* Device LUN for operation */
76 1.1 scw u_int16_t nc_status; /* Completion status written here */
77 1.1 scw u_int32_t nc_command; /* Command identifier */
78 1.1 scw void *nc_buffer; /* Pointer to dest/src data buffer */
79 1.1 scw u_int32_t nc_length; /* Number of bytes of data */
80 1.1 scw u_int32_t nc_csr; /* Status/Control flags */
81 1.1 scw };
82 1.1 scw #define BUG_NETIO_CMD_INIT 0x0 /* Initialise Device/Channel/Node */
83 1.1 scw #define BUG_NETIO_CMD_GET_MAC 0x1 /* Get ethernet MAC address */
84 1.1 scw #define BUG_NETIO_CMD_TRANSMIT 0x2 /* Transmit a packet of data */
85 1.1 scw #define BUG_NETIO_CMD_RECEIVE 0x3 /* Receive a packet of data */
86 1.1 scw #define BUG_NETIO_CMD_FLUSH 0x4 /* Flush receive buffers */
87 1.1 scw #define BUG_NETIO_CMD_RESET 0x5 /* Reset Device/Channel/Node */
88 1.1 scw
89 1.1 scw #define BUG_NETIO_CSR_RX_COMPLETE (1<<16)
90 1.1 scw
91 1.1 scw extern int bugsys_netio(struct bug_netio *);
92 1.1 scw
93 1.1 scw /*
94 1.1 scw * Miscellaneous system calls
95 1.1 scw */
96 1.1 scw extern void bugsys_delay(int);
97 1.1 scw
98 1.1 scw struct bug_boardid {
99 1.1 scw u_int32_t bi_eyecatcher; /* Eye catcher pattern */
100 1.1 scw u_int8_t bi_rev; /* PPCBug Revision, in BCD */
101 1.1 scw u_int8_t bi_month; /* PPCBug Month, in BCD */
102 1.1 scw u_int8_t bi_day; /* PPCBug Day, in BCD */
103 1.1 scw u_int8_t bi_year; /* PPCBug Year, in BCD */
104 1.1 scw u_int16_t bi_size; /* Size of this structure */
105 1.1 scw u_int16_t bi_resvd;
106 1.1 scw u_int16_t bi_bnumber; /* Board number, in BCD */
107 1.1 scw u_int16_t bi_bsuffix; /* Board suffix, in BCD */
108 1.1 scw u_int32_t bi_options; /* Board options. See below */
109 1.1 scw u_int16_t bi_clun; /* Boot device CLUN */
110 1.1 scw u_int16_t bi_dlun; /* Boot device DLUN */
111 1.1 scw u_int16_t bi_devtype; /* Boot device type. See below */
112 1.1 scw u_int16_t bi_devnumber; /* Boot device number */
113 1.1 scw u_int32_t bi_resvd2;
114 1.1 scw };
115 1.1 scw #define BUG_BOARDID_OPT_CPU_MASK 0x0f
116 1.1 scw #define BUG_BOARDID_OPT_CPU_SHIFT 0
117 1.1 scw #define BUG_BOARDID_OPT_CPU_MPC620 1
118 1.1 scw #define BUG_BOARDID_OPT_CPU_MPC601 1
119 1.1 scw #define BUG_BOARDID_OPT_CPU_MPC602 2
120 1.1 scw #define BUG_BOARDID_OPT_CPU_MPC603 3
121 1.1 scw #define BUG_BOARDID_OPT_CPU_MPC604 4
122 1.1 scw #define BUG_BOARDID_OPT_FAMILY_MASK 0x07
123 1.1 scw #define BUG_BOARDID_OPT_FAMILY_SHIFT 6
124 1.1 scw #define BUG_BOARDID_OPT_FAMILY_MPC600 2
125 1.1 scw #define BUG_BOARDID_OPT_FPC (1 << 7)
126 1.1 scw #define BUG_BOARDID_OPT_MMU (1 << 8)
127 1.1 scw #define BUG_BOARDID_OPT_MMB (1 << 9)
128 1.1 scw
129 1.1 scw #define BUG_BOARDID_DEVTYPE_DIRECT 0 /* Direct Access Device (disk) */
130 1.1 scw #define BUG_BOARDID_DEVTYPE_SEQ 1 /* Sequential Access Device (tape) */
131 1.1 scw #define BUG_BOARDID_DEVTYPE_PRINTER 2 /* Printer device */
132 1.1 scw #define BUG_BOARDID_DEVTYPE_PROCESSOR 3 /* Processor device */
133 1.1 scw #define BUG_BOARDID_DEVTYPE_WORM 4 /* WORM device */
134 1.1 scw #define BUG_BOARDID_DEVTYPE_CDROM 5 /* CD-ROM device */
135 1.1 scw #define BUG_BOARDID_DEVTYPE_SCANNER 6 /* Scanner device */
136 1.1 scw #define BUG_BOARDID_DEVTYPE_OPTICAL 7 /* Optical memory device */
137 1.1 scw #define BUG_BOARDID_DEVTYPE_CHANGER 8 /* Medium Changer device */
138 1.1 scw #define BUG_BOARDID_DEVTYPE_COMMS 9 /* Communications device */
139 1.1 scw
140 1.1 scw extern struct bug_boardid *bugsys_brdid(void);
141 1.1 scw
142 1.1 scw struct bug_ioinquiry {
143 1.1 scw u_int32_t ii_portnum; /* Port number */
144 1.1 scw char *ii_boardname; /* Board name pointer */
145 1.1 scw u_int32_t ii_channel; /* Channel number */
146 1.1 scw u_int32_t ii_devaddr; /* Device address */
147 1.1 scw u_int32_t ii_concurmode; /* Concurrent mode */
148 1.1 scw u_int32_t ii_modemid; /* Modem ID */
149 1.1 scw struct bug_ioctrl *ii_ioctrl; /* I/O control struction pointer */
150 1.1 scw u_int32_t ii_error; /* Error code */
151 1.1 scw u_int32_t ii_resvd[3];
152 1.1 scw };
153 1.1 scw #define BUG_IOINQ_PORT_CONSOLE 0xffffffff
154 1.1 scw
155 1.1 scw struct bug_ioctrl {
156 1.1 scw u_int32_t ic_ctrlbits;
157 1.1 scw u_int32_t ic_baud;
158 1.1 scw u_int32_t ic_protocol;
159 1.1 scw u_int32_t ic_sync1;
160 1.1 scw u_int32_t ic_sync2;
161 1.1 scw u_int32_t ic_xonchar;
162 1.1 scw u_int32_t ic_xoffchar;
163 1.1 scw };
164 1.1 scw #define IOCTRL_PARITY_ODD (1 << 0)
165 1.1 scw #define IOCTRL_PARITY_EVEN (1 << 1)
166 1.1 scw #define IOCTRL_BITS_8 (1 << 2)
167 1.1 scw #define IOCTRL_BITS_7 (1 << 3)
168 1.1 scw #define IOCTRL_BITS_6 (1 << 4)
169 1.1 scw #define IOCTRL_BITS_5 (1 << 5)
170 1.1 scw #define IOCTRL_STOP_2 (1 << 6)
171 1.1 scw #define IOCTRL_STOP_1 (1 << 7)
172 1.1 scw
173 1.1 scw extern struct bug_ioinquiry *bugsys_ioinq(struct bug_ioinquiry *);
174 1.1 scw
175 1.1 scw struct bug_rtc_rd {
176 1.1 scw u_int8_t rr_year;
177 1.1 scw u_int8_t rr_month;
178 1.1 scw u_int8_t rr_dayofmonth;
179 1.1 scw u_int8_t rr_dayofweek;
180 1.1 scw u_int8_t rr_hour;
181 1.1 scw u_int8_t rr_minute;
182 1.1 scw u_int8_t rr_second;
183 1.1 scw u_int8_t rr_calibration;
184 1.1 scw };
185 1.1 scw
186 1.1 scw extern void bugsys_rtc_rd(struct bug_rtc_rd *);
187 1.1 scw
188 1.1 scw /*
189 1.1 scw * Information passed from bug to the bootstrap program when in PReP mode.
190 1.1 scw *
191 1.1 scw * Note: This is the only option for booting from disk...
192 1.1 scw */
193 1.1 scw struct bug_prepinfo {
194 1.1 scw void *bpi_residual; /* PReP mode's "residual data" */
195 1.1 scw void *bpi_loadaddr; /* Load address of bootstrap code */
196 1.1 scw };
197 1.1 scw
198 1.1 scw /*
199 1.1 scw * Information passed when in traditional PPCBug mode
200 1.1 scw *
201 1.1 scw * Note: This appears to be the case for netboot only...
202 1.1 scw */
203 1.1 scw struct bug_buginfo {
204 1.1 scw int bbi_clun; /* Boot controller LUN */
205 1.1 scw int bbi_dlun; /* Boot device LUN */
206 1.1 scw u_int32_t bbi_devaddr; /* PCI config. addr. of boot device */
207 1.1 scw void *bbi_loadaddr; /* Load address of bootstrap code */
208 1.1 scw void *bbi_ipaddr; /* Pointer to IP address parameters */
209 1.1 scw const char *bbi_fnstart; /* Boot filename string start */
210 1.1 scw const char *bbi_fnend; /* Boot filename string end */
211 1.1 scw char *bbi_argstart; /* Boot argument string start */
212 1.1 scw char *bbi_argend; /* Boot argument string end */
213 1.1 scw };
214 1.1 scw
215 1.1 scw /*
216 1.1 scw * Structure passed into C code from srt0.S
217 1.1 scw */
218 1.1 scw struct bug_bootinfo {
219 1.1 scw int bbi_bugmode; /* Non-zero if traditional bug boot */
220 1.1 scw union {
221 1.1 scw struct bug_prepinfo bpi;
222 1.1 scw struct bug_buginfo bbi;
223 1.1 scw } bbi_bi;
224 1.1 scw };
225 1.1 scw
226 1.1 scw #endif /* __BUGSYSCALLS_H */
227