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