Home | History | Annotate | Line # | Download | only in isa
isa_io_asm.S revision 1.1
      1  1.1  thorpej /*	$NetBSD: isa_io_asm.S,v 1.1 2002/02/10 01:57:53 thorpej Exp $	*/
      2  1.1  thorpej 
      3  1.1  thorpej /*-
      4  1.1  thorpej  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  1.1  thorpej  * All rights reserved.
      6  1.1  thorpej  *
      7  1.1  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  thorpej  * by Mark Brinicombe.
      9  1.1  thorpej  *
     10  1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     11  1.1  thorpej  * modification, are permitted provided that the following conditions
     12  1.1  thorpej  * are met:
     13  1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     14  1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     15  1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     18  1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     19  1.1  thorpej  *    must display the following acknowledgement:
     20  1.1  thorpej  *	This product includes software developed by the NetBSD
     21  1.1  thorpej  *	Foundation, Inc. and its contributors.
     22  1.1  thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  thorpej  *    contributors may be used to endorse or promote products derived
     24  1.1  thorpej  *    from this software without specific prior written permission.
     25  1.1  thorpej  *
     26  1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  thorpej  */
     38  1.1  thorpej 
     39  1.1  thorpej /*
     40  1.1  thorpej  * Copyright 1997
     41  1.1  thorpej  * Digital Equipment Corporation. All rights reserved.
     42  1.1  thorpej  *
     43  1.1  thorpej  * This software is furnished under license and may be used and
     44  1.1  thorpej  * copied only in accordance with the following terms and conditions.
     45  1.1  thorpej  * Subject to these conditions, you may download, copy, install,
     46  1.1  thorpej  * use, modify and distribute this software in source and/or binary
     47  1.1  thorpej  * form. No title or ownership is transferred hereby.
     48  1.1  thorpej  *
     49  1.1  thorpej  * 1) Any source code used, modified or distributed must reproduce
     50  1.1  thorpej  *    and retain this copyright notice and list of conditions as
     51  1.1  thorpej  *    they appear in the source file.
     52  1.1  thorpej  *
     53  1.1  thorpej  * 2) No right is granted to use any trade name, trademark, or logo of
     54  1.1  thorpej  *    Digital Equipment Corporation. Neither the "Digital Equipment
     55  1.1  thorpej  *    Corporation" name nor any trademark or logo of Digital Equipment
     56  1.1  thorpej  *    Corporation may be used to endorse or promote products derived
     57  1.1  thorpej  *    from this software without the prior written permission of
     58  1.1  thorpej  *    Digital Equipment Corporation.
     59  1.1  thorpej  *
     60  1.1  thorpej  * 3) This software is provided "AS-IS" and any express or implied
     61  1.1  thorpej  *    warranties, including but not limited to, any implied warranties
     62  1.1  thorpej  *    of merchantability, fitness for a particular purpose, or
     63  1.1  thorpej  *    non-infringement are disclaimed. In no event shall DIGITAL be
     64  1.1  thorpej  *    liable for any damages whatsoever, and in particular, DIGITAL
     65  1.1  thorpej  *    shall not be liable for special, indirect, consequential, or
     66  1.1  thorpej  *    incidental damages or damages for lost profits, loss of
     67  1.1  thorpej  *    revenue or loss of use, whether such damages arise in contract,
     68  1.1  thorpej  *    negligence, tort, under statute, in equity, at law or otherwise,
     69  1.1  thorpej  *    even if advised of the possibility of such damage.
     70  1.1  thorpej  */
     71  1.1  thorpej 
     72  1.1  thorpej /*
     73  1.1  thorpej  * bus_space I/O functions for isa
     74  1.1  thorpej  */
     75  1.1  thorpej 
     76  1.1  thorpej #include <machine/asm.h>
     77  1.1  thorpej 
     78  1.1  thorpej #ifdef GPROF
     79  1.1  thorpej #define	PAUSE	nop ; nop ; nop ; nop ; nop
     80  1.1  thorpej #else
     81  1.1  thorpej #define	PAUSE
     82  1.1  thorpej #endif
     83  1.1  thorpej 
     84  1.1  thorpej /*
     85  1.1  thorpej  * Note these functions use ARM Architecture V4 instructions as
     86  1.1  thorpej  * all current systems with ISA will be using processors that support
     87  1.1  thorpej  * V4 or later architectures (SHARK & CATS)
     88  1.1  thorpej  */
     89  1.1  thorpej 
     90  1.1  thorpej /*
     91  1.1  thorpej  * read single
     92  1.1  thorpej  */
     93  1.1  thorpej 
     94  1.1  thorpej ENTRY(isa_bs_r_1)
     95  1.1  thorpej 	ldrb	r0, [r1, r2]
     96  1.1  thorpej 	PAUSE
     97  1.1  thorpej 	mov	pc, lr
     98  1.1  thorpej 
     99  1.1  thorpej ENTRY(isa_bs_r_2)
    100  1.1  thorpej 	ldrh	r0, [r1, r2]	/*.word	0xe19100b2*/
    101  1.1  thorpej 	PAUSE
    102  1.1  thorpej 	mov	pc, lr
    103  1.1  thorpej 
    104  1.1  thorpej ENTRY(isa_bs_r_4)
    105  1.1  thorpej 	ldr	r0, [r1, r2]
    106  1.1  thorpej 	PAUSE
    107  1.1  thorpej 	mov	pc, lr
    108  1.1  thorpej 
    109  1.1  thorpej /*
    110  1.1  thorpej  * read multiple.
    111  1.1  thorpej  */
    112  1.1  thorpej 
    113  1.1  thorpej ENTRY(isa_bs_rm_1)
    114  1.1  thorpej 	add	r0, r1, r2
    115  1.1  thorpej 	mov	r1, r3
    116  1.1  thorpej 	ldr	r2, [sp, #0]
    117  1.1  thorpej 	teq	r2, #0
    118  1.1  thorpej 	moveq	pc, lr
    119  1.1  thorpej 
    120  1.1  thorpej Lisa_rm_1_loop:
    121  1.1  thorpej 	ldrb	r3, [r0]
    122  1.1  thorpej 	strb	r3, [r1], #1
    123  1.1  thorpej 	subs	r2, r2, #1
    124  1.1  thorpej 	bne	Lisa_rm_1_loop
    125  1.1  thorpej 
    126  1.1  thorpej 	mov	pc, lr
    127  1.1  thorpej 
    128  1.1  thorpej ENTRY(isa_bs_rm_2)
    129  1.1  thorpej 	add	r0, r1, r2
    130  1.1  thorpej 	mov	r1, r3
    131  1.1  thorpej 	ldr	r2, [sp, #0]
    132  1.1  thorpej 	teq	r2, #0
    133  1.1  thorpej 	moveq	pc, lr
    134  1.1  thorpej 
    135  1.1  thorpej Lisa_rm_2_loop:
    136  1.1  thorpej 	ldrh	r3, [r0]	/*.word 0xe1d030b0*/
    137  1.1  thorpej 	strh	r3, [r1], #2	/*.word 0xe0c130b2*/
    138  1.1  thorpej 	subs	r2, r2, #1
    139  1.1  thorpej 	bne	Lisa_rm_2_loop
    140  1.1  thorpej 
    141  1.1  thorpej 	mov	pc, lr
    142  1.1  thorpej 
    143  1.1  thorpej ENTRY(isa_bs_rm_4)
    144  1.1  thorpej 	add	r0, r1, r2
    145  1.1  thorpej 	mov	r1, r3
    146  1.1  thorpej 	ldr	r2, [sp, #0]
    147  1.1  thorpej 	teq	r2, #0
    148  1.1  thorpej 	moveq	pc, lr
    149  1.1  thorpej 
    150  1.1  thorpej Lisa_rm_4_loop:
    151  1.1  thorpej 	ldr	r3, [r0]
    152  1.1  thorpej 	str	r3, [r1], #4
    153  1.1  thorpej 	subs	r2, r2, #1
    154  1.1  thorpej 	bne	Lisa_rm_4_loop
    155  1.1  thorpej 
    156  1.1  thorpej 	mov	pc, lr
    157  1.1  thorpej 
    158  1.1  thorpej /*
    159  1.1  thorpej  * read region.
    160  1.1  thorpej  */
    161  1.1  thorpej 
    162  1.1  thorpej ENTRY(isa_bs_rr_1)
    163  1.1  thorpej 	add	r0, r1, r2
    164  1.1  thorpej 	mov	r1, r3
    165  1.1  thorpej 	ldr	r2, [sp, #0]
    166  1.1  thorpej 	teq	r2, #0
    167  1.1  thorpej 	moveq	pc, lr
    168  1.1  thorpej 
    169  1.1  thorpej Lisa_rr_1_loop:
    170  1.1  thorpej 	ldrb	r3, [r0], #1
    171  1.1  thorpej 	strb	r3, [r1], #1
    172  1.1  thorpej 	subs	r2, r2, #1
    173  1.1  thorpej 	bne	Lisa_rr_1_loop
    174  1.1  thorpej 
    175  1.1  thorpej 	mov	pc, lr
    176  1.1  thorpej 
    177  1.1  thorpej ENTRY(isa_bs_rr_2)
    178  1.1  thorpej 	add	r0, r1, r2
    179  1.1  thorpej 	mov	r1, r3
    180  1.1  thorpej 	ldr	r2, [sp, #0]
    181  1.1  thorpej 	teq	r2, #0
    182  1.1  thorpej 	moveq	pc, lr
    183  1.1  thorpej 
    184  1.1  thorpej Lisa_rr_2_loop:
    185  1.1  thorpej 	ldrh	r3, [r0], #2
    186  1.1  thorpej 	strh	r3, [r1], #2	/*.word 0xe0c130b2*/
    187  1.1  thorpej 	subs	r2, r2, #1
    188  1.1  thorpej 	bne	Lisa_rr_2_loop
    189  1.1  thorpej 
    190  1.1  thorpej 	mov	pc, lr
    191  1.1  thorpej 
    192  1.1  thorpej ENTRY(isa_bs_rr_4)
    193  1.1  thorpej 	add	r0, r1, r2
    194  1.1  thorpej 	mov	r1, r3
    195  1.1  thorpej 	ldr	r2, [sp, #0]
    196  1.1  thorpej 	teq	r2, #0
    197  1.1  thorpej 	moveq	pc, lr
    198  1.1  thorpej 
    199  1.1  thorpej Lisa_rr_4_loop:
    200  1.1  thorpej 	ldr	r3, [r0], #4
    201  1.1  thorpej 	str	r3, [r1], #4
    202  1.1  thorpej 	subs	r2, r2, #1
    203  1.1  thorpej 	bne	Lisa_rr_4_loop
    204  1.1  thorpej 
    205  1.1  thorpej 	mov	pc, lr
    206  1.1  thorpej 
    207  1.1  thorpej /*
    208  1.1  thorpej  * write single
    209  1.1  thorpej  */
    210  1.1  thorpej 
    211  1.1  thorpej ENTRY(isa_bs_w_1)
    212  1.1  thorpej 	strb	r3, [r1, r2]
    213  1.1  thorpej 	PAUSE
    214  1.1  thorpej 	mov	pc, lr
    215  1.1  thorpej 
    216  1.1  thorpej ENTRY(isa_bs_w_2)
    217  1.1  thorpej 	strh	r3, [r1, r2]	/*.word 0xe18130b2*/
    218  1.1  thorpej 	PAUSE
    219  1.1  thorpej 	mov	pc, lr
    220  1.1  thorpej 
    221  1.1  thorpej ENTRY(isa_bs_w_4)
    222  1.1  thorpej 	str	r3, [r1, r2]
    223  1.1  thorpej 	PAUSE
    224  1.1  thorpej 	mov	pc, lr
    225  1.1  thorpej 
    226  1.1  thorpej /*
    227  1.1  thorpej  * write multiple
    228  1.1  thorpej  */
    229  1.1  thorpej 
    230  1.1  thorpej ENTRY(isa_bs_wm_1)
    231  1.1  thorpej 	add	r0, r1, r2
    232  1.1  thorpej 	mov	r1, r3
    233  1.1  thorpej 	ldr	r2, [sp, #0]
    234  1.1  thorpej 	teq	r2, #0
    235  1.1  thorpej 	moveq	pc, lr
    236  1.1  thorpej 
    237  1.1  thorpej Lisa_wm_1_loop:
    238  1.1  thorpej 	ldrb	r3, [r1], #1
    239  1.1  thorpej 	strb	r3, [r0]
    240  1.1  thorpej 	subs	r2, r2, #1
    241  1.1  thorpej 	bne	Lisa_wm_1_loop
    242  1.1  thorpej 
    243  1.1  thorpej 	mov	pc, lr
    244  1.1  thorpej 
    245  1.1  thorpej ENTRY(isa_bs_wm_2)
    246  1.1  thorpej 	add	r0, r1, r2
    247  1.1  thorpej 	mov	r1, r3
    248  1.1  thorpej 	ldr	r2, [sp, #0]
    249  1.1  thorpej 	teq	r2, #0
    250  1.1  thorpej 	moveq	pc, lr
    251  1.1  thorpej 
    252  1.1  thorpej Lisa_wm_2_loop:
    253  1.1  thorpej 	ldrh	r3, [r1], #2	/*.word 0xe0d130b2*/
    254  1.1  thorpej 	strh	r3, [r0]	/*.word 0xe1c030b0*/
    255  1.1  thorpej 	subs	r2, r2, #1
    256  1.1  thorpej 	bne	Lisa_wm_2_loop
    257  1.1  thorpej 
    258  1.1  thorpej 	mov	pc, lr
    259  1.1  thorpej 
    260  1.1  thorpej ENTRY(isa_bs_wm_4)
    261  1.1  thorpej 	add	r0, r1, r2
    262  1.1  thorpej 	mov	r1, r3
    263  1.1  thorpej 	ldr	r2, [sp, #0]
    264  1.1  thorpej 	teq	r2, #0
    265  1.1  thorpej 	moveq	pc, lr
    266  1.1  thorpej 
    267  1.1  thorpej Lisa_wm_4_loop:
    268  1.1  thorpej 	ldr	r3, [r1], #4
    269  1.1  thorpej 	str	r3, [r0]
    270  1.1  thorpej 	subs	r2, r2, #1
    271  1.1  thorpej 	bne	Lisa_wm_4_loop
    272  1.1  thorpej 
    273  1.1  thorpej 	mov	pc, lr
    274  1.1  thorpej 
    275  1.1  thorpej 
    276  1.1  thorpej /*
    277  1.1  thorpej  * write region.
    278  1.1  thorpej  */
    279  1.1  thorpej 
    280  1.1  thorpej ENTRY(isa_bs_wr_1)
    281  1.1  thorpej 	add	r0, r1, r2
    282  1.1  thorpej 	mov	r1, r3
    283  1.1  thorpej 	ldr	r2, [sp, #0]
    284  1.1  thorpej 	teq	r2, #0
    285  1.1  thorpej 	moveq	pc, lr
    286  1.1  thorpej 
    287  1.1  thorpej Lisa_wr_1_loop:
    288  1.1  thorpej 	ldrb	r3, [r1], #1
    289  1.1  thorpej 	strb	r3, [r0], #1
    290  1.1  thorpej 	subs	r2, r2, #1
    291  1.1  thorpej 	bne	Lisa_wr_1_loop
    292  1.1  thorpej 
    293  1.1  thorpej 	mov	pc, lr
    294  1.1  thorpej 
    295  1.1  thorpej ENTRY(isa_bs_wr_2)
    296  1.1  thorpej 	add	r0, r1, r2
    297  1.1  thorpej 	mov	r1, r3
    298  1.1  thorpej 	ldr	r2, [sp, #0]
    299  1.1  thorpej 	teq	r2, #0
    300  1.1  thorpej 	moveq	pc, lr
    301  1.1  thorpej 
    302  1.1  thorpej Lisa_wr_2_loop:
    303  1.1  thorpej 	ldrh	r3, [r1], #2	/*.word 0xe0d130b2*/
    304  1.1  thorpej 	strh	r3, [r0], #2
    305  1.1  thorpej 	subs	r2, r2, #1
    306  1.1  thorpej 	bne	Lisa_wr_2_loop
    307  1.1  thorpej 
    308  1.1  thorpej 	mov	pc, lr
    309  1.1  thorpej 
    310  1.1  thorpej ENTRY(isa_bs_wr_4)
    311  1.1  thorpej 	add	r0, r1, r2
    312  1.1  thorpej 	mov	r1, r3
    313  1.1  thorpej 	ldr	r2, [sp, #0]
    314  1.1  thorpej 	teq	r2, #0
    315  1.1  thorpej 	moveq	pc, lr
    316  1.1  thorpej 
    317  1.1  thorpej Lisa_wr_4_loop:
    318  1.1  thorpej 	ldr	r3, [r1], #4
    319  1.1  thorpej 	str	r3, [r0], #4
    320  1.1  thorpej 	subs	r2, r2, #1
    321  1.1  thorpej 	bne	Lisa_wr_4_loop
    322  1.1  thorpej 
    323  1.1  thorpej 	mov	pc, lr
    324  1.1  thorpej 
    325  1.1  thorpej /*
    326  1.1  thorpej  * Set region
    327  1.1  thorpej  */
    328  1.1  thorpej 
    329  1.1  thorpej ENTRY(isa_bs_sr_2)
    330  1.1  thorpej 	add	r0, r1, r2
    331  1.1  thorpej 	mov	r1, r3
    332  1.1  thorpej 	ldr	r2, [sp, #0]
    333  1.1  thorpej 	teq	r2, #0
    334  1.1  thorpej 	moveq	pc, lr
    335  1.1  thorpej 
    336  1.1  thorpej Lisa_bs_sr_2_loop:
    337  1.1  thorpej 	strh	r1, [r0], #2		/*.word e0c010b2*/
    338  1.1  thorpej 	subs	r2, r2, #1
    339  1.1  thorpej 	bne	Lisa_bs_sr_2_loop
    340  1.1  thorpej 
    341  1.1  thorpej 	mov	pc, lr
    342