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