1/* $NetBSD: bugsyscalls.S,v 1.3 2011/01/19 09:03:15 he 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 * 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <machine/asm.h> 33 34#define BSYS(num) addi %r10,0,num ; sc 35 36 37/* 38 * char bugsys_inchr(void); 39 * 40 * Blocks until a character is received from the console. 41 * Returns character. 42 */ 43ENTRY(bugsys_inchr) 44 BSYS(0x0000) 45 blr 46 47/* 48 * void bugsys_outchr(char ch) 49 */ 50ENTRY(bugsys_outchr) 51 BSYS(0x0020) 52 blr 53 54/* 55 * int bugsys_instat(void); 56 * 57 * Returns zero if no characters are waiting to be read 58 * from the console. (i.e. bugsys_inchr() would block). 59 * Otherwise, it returns a non-zero value. 60 */ 61ENTRY(bugsys_instat) 62 BSYS(0x0002) 63 li %r4,0x8 64 and %r3,%r3,%r4 65 blr 66 67/* 68 * int bugsys_dskrd(struct bug_diskio *dcmd); 69 * 70 * Read data from disk according to the parameters specified 71 * in the `dcmd' data structure. 72 * 73 * Returns zero on success, non-zero on failure. 74 */ 75ENTRY(bugsys_dskrd) 76 BSYS(0x0010) 77 li %r4,0x8 78 and %r3,%r3,%r4 79 blr 80 81/* 82 * int bugsys_dskwr(struct bug_diskio *dcmd); 83 * 84 * Write data to disk according to the parameters specified 85 * in the `dcmd' data structure. 86 * 87 * Returns zero on success, non-zero on failure. 88 */ 89ENTRY(bugsys_dskwr) 90 BSYS(0x0011) 91 li %r4,0x8 92 and %r3,%r3,%r4 93 blr 94 95/* 96 * int bugsys_netio(struct bug_netcmd *ncmd); 97 * 98 * Performs an I/O operation to/from a network device as 99 * specified in the `ncmd' data structure. 100 * 101 * Returns zero on success, non-zero on failure. 102 */ 103ENTRY(bugsys_netio) 104 BSYS(0x001d) 105 li %r4,0x8 106 and %r3,%r3,%r4 107 blr 108 109/* 110 * void bugsys_delay(int ); 111 * 112 * Suspend processing for the specified number of milli-seconds 113 */ 114ENTRY(bugsys_delay) 115 BSYS(0x0043) 116 blr 117 118/* 119 * struct bug_boardid *bugsys_brdid(void); 120 * 121 * Returns a pointer to the board-id structure. 122 */ 123ENTRY(bugsys_brdid) 124 BSYS(0x0070) 125 blr 126 127/* 128 * struct bug_ioinquiry *bugsys_ioinq(void); 129 * 130 * Returns a pointer to the ioinq structure. 131 */ 132ENTRY(bugsys_ioinq) 133 BSYS(0x0120) 134 blr 135 136/* 137 * void bugsys_rtc_rd(struct bug_rtc_rd *); 138 * 139 * Reads the current time from the RTC chip. 140 */ 141ENTRY(bugsys_rtc_rd) 142 BSYS(0x0053) 143 blr 144