xref: /netbsd/sys/arch/mipsco/stand/common/prom.S (revision bf9ec67e)
1/*	$NetBSD: prom.S,v 1.2 2000/09/26 09:32:25 wdk Exp $	*/
2
3/*
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Wayne Knowles
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 <mips/asm.h>
40#include <mips/cpuregs.h>
41#include <machine/prom.h>
42
43
44LEAF(prom_restart)
45	li	v0, MIPS_PROM_RESTART
46	j	v0
47	move	a0, zero
48END(prom_restart)
49
50NESTED(prom_open, CALLFRAME_SIZ, ra)
51	.mask	0x80000000, -4
52	subu	sp, sp, CALLFRAME_SIZ
53	sw	ra, CALLFRAME_RA(sp)
54	li	v0, MIPS_PROM_OPEN
55	jal	v0
56	nop
57	/*
58	 * On return t0 contains our _iob structure
59	 * v0 contains the file descriptor number
60	 */
61	la	t4, saiob
62	sll	t5, v0, 2
63	add	t4, t4, t5
64	lw	ra, CALLFRAME_RA(sp)
65	addu	sp, sp, CALLFRAME_SIZ
66	sw	t0, 0(t4)
67	j	ra
68	nop
69END(prom_open)
70
71#ifndef LIBSA_NO_DEV_CLOSE
72LEAF(prom_close)
73	li	v0, MIPS_PROM_CLOSE
74	j	v0
75	nop
76END(prom_close)
77#endif
78
79LEAF(prom_read)
80	li	v0, MIPS_PROM_READ
81	j	v0
82	nop
83END(prom_read)
84
85#ifndef LIBSA_NO_FS_WRITE
86LEAF(prom_write)
87	li	v0, MIPS_PROM_WRITE
88	j	v0
89	nop
90END(prom_write)
91#endif
92
93LEAF(printf)
94	li	v0, MIPS_PROM_PRINTF
95	j	v0
96	nop
97END(printf)
98
99#ifndef NO_GETCHAR
100LEAF(getchar)
101	li	v0, MIPS_PROM_GETCHAR
102	j	v0
103	nop
104END(getchar)
105
106LEAF(putchar)
107	li	v0, MIPS_PROM_PUTCHAR
108	j	v0
109	nop
110END(putchar)
111#endif
112
113	.sdata
114
115	.global	saiob
116saiob:	.space	8*4
117
118