1/*	$NetBSD: romread.S,v 1.2 2017/05/22 17:00:19 ragge Exp $ */
2/*
3 * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Ludd by
7 * Bertram Barth.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in the
16 *    documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 /* All bugs are subject to removal without further notice */
31
32
33
34#include "../include/asm.h"
35
36/*
37 * read750 (int block, int *regs)
38 */
39ENTRY(read750, 0xFFE)
40	movl	8(%ap), %r8
41	movl	4(%r8), %r1
42	movl	8(%r8), %r2
43	movl	12(%r8), %r3
44	movl	24(%r8), %r6
45	clrl	%r5
46	movl	4(%ap), %r8
47	pushl	$0
48	movl	$0, 4(%sp)
49	movl    %fp, 0xf0000	# ragge ???
50	jsb	(%r6)
51	movl    0xf0000, %fp
52	ret
53
54/*
55 * romread_uvax (int lbn, int size, void *buf, struct rpb *rpb)
56 */
57ENTRY(romread_uvax, 0xFFE)
58	movl	16(%ap),%r11	# restore boot-contents of %r11 (rpb)
59	movl    52(%r11), %r7     # load iovec/bqo into %r7
60	addl3   (%r7), %r7, %r6	# load qio into %r6
61	pushl	%r11		# base of rpb
62	pushl	$0		# virtual-flag
63	pushl	$33		# read-logical-block
64	pushl	4(%ap)		# lbn to start reading
65	pushl	8(%ap)		# number of bytes to read
66	pushl	12(%ap)		# buffer-address
67	calls	$6, (%r6)	# call the qio-routine
68	ret			# %r0 holds the result
69
70/*
71 * romwrite_uvax (int lbn, int size, void *buf, struct rpb *rpb)
72 */
73ENTRY(romwrite_uvax, 0xFFE)
74	movl    16(%ap), %r11	# restore boot-contents of %r11 (rpb)
75	movl    52(%r11), %r7     # load iovec/bqo into %r7
76	addl3   (%r7), %r7, %r6    # load qio into %r6
77	pushl   %r11             # base of rpb
78	pushl   $0              # virtual-flag
79	pushl   $32             # write-logical-block
80	pushl   4(%ap)           # lbn to start reading
81	pushl   8(%ap)           # number of bytes to read
82	pushl   12(%ap)          # buffer-address
83	calls   $6, (%r6)        # call the qio-routine
84	ret                     # %r0 holds the result
85
86