xref: /netbsd-src/sys/arch/vax/boot/common/romread.S (revision 6a6027692662ba623e7bf5274322989a7b5d1440)
1*6a602769Sragge/*	$NetBSD: romread.S,v 1.2 2017/05/22 17:00:19 ragge Exp $ */
228b1aa2bSmatt/*
328b1aa2bSmatt * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
428b1aa2bSmatt * All rights reserved.
528b1aa2bSmatt *
628b1aa2bSmatt * This code is derived from software contributed to Ludd by
728b1aa2bSmatt * Bertram Barth.
828b1aa2bSmatt *
928b1aa2bSmatt * Redistribution and use in source and binary forms, with or without
1028b1aa2bSmatt * modification, are permitted provided that the following conditions
1128b1aa2bSmatt * are met:
1228b1aa2bSmatt * 1. Redistributions of source code must retain the above copyright
1328b1aa2bSmatt *    notice, this list of conditions and the following disclaimer.
1428b1aa2bSmatt * 2. Redistributions in binary form must reproduce the above copyright
1528b1aa2bSmatt *    notice, this list of conditions and the following disclaimer in the
1628b1aa2bSmatt *    documentation and/or other materials provided with the distribution.
1728b1aa2bSmatt *
1828b1aa2bSmatt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1928b1aa2bSmatt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2028b1aa2bSmatt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2128b1aa2bSmatt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2228b1aa2bSmatt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2328b1aa2bSmatt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2428b1aa2bSmatt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2528b1aa2bSmatt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2628b1aa2bSmatt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2728b1aa2bSmatt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828b1aa2bSmatt */
2928b1aa2bSmatt
3028b1aa2bSmatt /* All bugs are subject to removal without further notice */
3128b1aa2bSmatt
3228b1aa2bSmatt
3328b1aa2bSmatt
3428b1aa2bSmatt#include "../include/asm.h"
3528b1aa2bSmatt
3628b1aa2bSmatt/*
3728b1aa2bSmatt * read750 (int block, int *regs)
3828b1aa2bSmatt */
3928b1aa2bSmattENTRY(read750, 0xFFE)
4028b1aa2bSmatt	movl	8(%ap), %r8
4128b1aa2bSmatt	movl	4(%r8), %r1
4228b1aa2bSmatt	movl	8(%r8), %r2
4328b1aa2bSmatt	movl	12(%r8), %r3
4428b1aa2bSmatt	movl	24(%r8), %r6
4528b1aa2bSmatt	clrl	%r5
4628b1aa2bSmatt	movl	4(%ap), %r8
4728b1aa2bSmatt	pushl	$0
4828b1aa2bSmatt	movl	$0, 4(%sp)
4928b1aa2bSmatt	movl    %fp, 0xf0000	# ragge ???
5028b1aa2bSmatt	jsb	(%r6)
5128b1aa2bSmatt	movl    0xf0000, %fp
5228b1aa2bSmatt	ret
5328b1aa2bSmatt
5428b1aa2bSmatt/*
5528b1aa2bSmatt * romread_uvax (int lbn, int size, void *buf, struct rpb *rpb)
5628b1aa2bSmatt */
5728b1aa2bSmattENTRY(romread_uvax, 0xFFE)
5828b1aa2bSmatt	movl	16(%ap),%r11	# restore boot-contents of %r11 (rpb)
5928b1aa2bSmatt	movl    52(%r11), %r7     # load iovec/bqo into %r7
6028b1aa2bSmatt	addl3   (%r7), %r7, %r6	# load qio into %r6
6128b1aa2bSmatt	pushl	%r11		# base of rpb
6228b1aa2bSmatt	pushl	$0		# virtual-flag
6328b1aa2bSmatt	pushl	$33		# read-logical-block
6428b1aa2bSmatt	pushl	4(%ap)		# lbn to start reading
6528b1aa2bSmatt	pushl	8(%ap)		# number of bytes to read
6628b1aa2bSmatt	pushl	12(%ap)		# buffer-address
6728b1aa2bSmatt	calls	$6, (%r6)	# call the qio-routine
6828b1aa2bSmatt	ret			# %r0 holds the result
6928b1aa2bSmatt
7028b1aa2bSmatt/*
7128b1aa2bSmatt * romwrite_uvax (int lbn, int size, void *buf, struct rpb *rpb)
7228b1aa2bSmatt */
7328b1aa2bSmattENTRY(romwrite_uvax, 0xFFE)
7428b1aa2bSmatt	movl    16(%ap), %r11	# restore boot-contents of %r11 (rpb)
7528b1aa2bSmatt	movl    52(%r11), %r7     # load iovec/bqo into %r7
7628b1aa2bSmatt	addl3   (%r7), %r7, %r6    # load qio into %r6
7728b1aa2bSmatt	pushl   %r11             # base of rpb
7828b1aa2bSmatt	pushl   $0              # virtual-flag
7928b1aa2bSmatt	pushl   $32             # write-logical-block
8028b1aa2bSmatt	pushl   4(%ap)           # lbn to start reading
8128b1aa2bSmatt	pushl   8(%ap)           # number of bytes to read
8228b1aa2bSmatt	pushl   12(%ap)          # buffer-address
8328b1aa2bSmatt	calls   $6, (%r6)        # call the qio-routine
8428b1aa2bSmatt	ret                     # %r0 holds the result
8528b1aa2bSmatt
86