1/*	$NetBSD: bugsyscalls.S,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#include <machine/asm.h>
40
41#define	BSYS(num)	addi r10,0,num ; sc
42
43
44/*
45 * char bugsys_inchr(void);
46 *
47 * Blocks until a character is received from the console.
48 * Returns character.
49 */
50ENTRY(bugsys_inchr)
51	BSYS(0x0000)
52	blr
53
54/*
55 * void bugsys_outchr(char ch)
56 */
57ENTRY(bugsys_outchr)
58	BSYS(0x0020)
59	blr
60
61/*
62 * int bugsys_instat(void);
63 *
64 * Returns zero if no characters are waiting to be read
65 * from the console. (i.e. bugsys_inchr() would block).
66 * Otherwise, it returns a non-zero value.
67 */
68ENTRY(bugsys_instat)
69	BSYS(0x0002)
70	li	r4,0x8
71	and	r3,r3,r4
72	blr
73
74/*
75 * int bugsys_dskrd(struct bug_diskio *dcmd);
76 *
77 * Read data from disk according to the parameters specified
78 * in the `dcmd' data structure.
79 *
80 * Returns zero on success, non-zero on failure.
81 */
82ENTRY(bugsys_dskrd)
83	BSYS(0x0010)
84	li	r4,0x8
85	and	r3,r3,r4
86	blr
87
88/*
89 * int bugsys_dskwr(struct bug_diskio *dcmd);
90 *
91 * Write data to disk according to the parameters specified
92 * in the `dcmd' data structure.
93 *
94 * Returns zero on success, non-zero on failure.
95 */
96ENTRY(bugsys_dskwr)
97	BSYS(0x0011)
98	li	r4,0x8
99	and	r3,r3,r4
100	blr
101
102/*
103 * int bugsys_netio(struct bug_netcmd *ncmd);
104 *
105 * Performs an I/O operation to/from a network device as
106 * specified in the `ncmd' data structure.
107 *
108 * Returns zero on success, non-zero on failure.
109 */
110ENTRY(bugsys_netio)
111	BSYS(0x001d)
112	li	r4,0x8
113	and	r3,r3,r4
114	blr
115
116/*
117 * void bugsys_delay(int );
118 *
119 * Suspend processing for the specified number of milli-seconds
120 */
121ENTRY(bugsys_delay)
122	BSYS(0x0043)
123	blr
124
125/*
126 * struct bug_boardid *bugsys_brdid(void);
127 *
128 * Returns a pointer to the board-id structure.
129 */
130ENTRY(bugsys_brdid)
131	BSYS(0x0070)
132	blr
133
134/*
135 * struct bug_ioinquiry *bugsys_ioinq(void);
136 *
137 * Returns a pointer to the ioinq structure.
138 */
139ENTRY(bugsys_ioinq)
140	BSYS(0x0120)
141	blr
142
143/*
144 * void bugsys_rtc_rd(struct bug_rtc_rd *);
145 *
146 * Reads the current time from the RTC chip.
147 */
148ENTRY(bugsys_rtc_rd)
149	BSYS(0x0053)
150	blr
151