1164426Ssam/*	$NetBSD: ixp425_pci_asm.S,v 1.2 2005/12/11 12:16:51 christos Exp $	*/
2164426Ssam
3164426Ssam/*
4164426Ssam * Copyright (c) 2003 Wasabi Systems, Inc.
5164426Ssam * All rights reserved.
6164426Ssam *
7164426Ssam * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8164426Ssam *
9164426Ssam * Redistribution and use in source and binary forms, with or without
10164426Ssam * modification, are permitted provided that the following conditions
11164426Ssam * are met:
12164426Ssam * 1. Redistributions of source code must retain the above copyright
13164426Ssam *    notice, this list of conditions and the following disclaimer.
14164426Ssam * 2. Redistributions in binary form must reproduce the above copyright
15164426Ssam *    notice, this list of conditions and the following disclaimer in the
16164426Ssam *    documentation and/or other materials provided with the distribution.
17164426Ssam * 3. All advertising materials mentioning features or use of this software
18164426Ssam *    must display the following acknowledgement:
19164426Ssam *	This product includes software developed for the NetBSD Project by
20164426Ssam *	Wasabi Systems, Inc.
21164426Ssam * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22164426Ssam *    or promote products derived from this software without specific prior
23164426Ssam *    written permission.
24164426Ssam *
25164426Ssam * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26164426Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27164426Ssam * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28164426Ssam * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
29164426Ssam * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30164426Ssam * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31164426Ssam * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32164426Ssam * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33164426Ssam * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34164426Ssam * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35164426Ssam * POSSIBILITY OF SUCH DAMAGE.
36164426Ssam *
37164426Ssam * $FreeBSD$
38164426Ssam *
39164426Ssam */
40164426Ssam
41164426Ssam#include <machine/asm.h>
42164426Ssam
43164426Ssam/*
44164426Ssam * Bus space functions for IXP425 PCI space access.  We have to swizzle
45164426Ssam * the address for 1 and 2 byte accesses when in big-endian mode.
46164426Ssam */
47164426Ssam
48164426Ssam/*
49164426Ssam * read single
50164426Ssam */
51164426Ssam
52164426SsamENTRY(ixp425_pci_mem_bs_r_1)
53164426Ssam#ifdef __ARMEB__
54164426Ssam	add	r1, r1, r2
55164426Ssam	eor	r1, r1, #0x3
56164426Ssam	ldrb	r0, [r1]
57164426Ssam#else
58164426Ssam	ldrb	r0, [r1, r2]
59164426Ssam#endif /* __ARMEB__ */
60164426Ssam	mov	pc, lr
61164426Ssam
62164426SsamENTRY(ixp425_pci_mem_bs_r_2)
63164426Ssam#ifdef __ARMEB__
64164426Ssam	add	r1, r1, r2
65164426Ssam	eor	r1, r1, #0x2
66164426Ssam	ldrh	r0, [r1]
67164426Ssam#else
68164426Ssam	ldrh	r0, [r1, r2]
69164426Ssam#endif /* __ARMEB__ */
70164426Ssam	mov	pc, lr
71164426Ssam
72164426SsamENTRY(ixp425_pci_mem_bs_r_4)
73164426Ssam	ldr	r0, [r1, r2]
74164426Ssam	mov	pc, lr
75164426Ssam
76164426Ssam/*
77164426Ssam * write single
78164426Ssam */
79164426Ssam
80164426SsamENTRY(ixp425_pci_mem_bs_w_1)
81164426Ssam#ifdef __ARMEB__
82164426Ssam	add	r1, r1, r2
83164426Ssam	eor	r1, r1, #0x3
84164426Ssam	strb	r3, [r1]
85164426Ssam#else
86164426Ssam	strb	r3, [r1, r2]
87164426Ssam#endif /* __ARMEB__ */
88164426Ssam	mov	pc, lr
89164426Ssam
90164426SsamENTRY(ixp425_pci_mem_bs_w_2)
91164426Ssam#ifdef __ARMEB__
92164426Ssam	add	r1, r1, r2
93164426Ssam	eor	r1, r1, #0x2
94164426Ssam	strh	r3, [r1]
95164426Ssam#else
96164426Ssam	strh	r3, [r1, r2]
97164426Ssam#endif /* __ARMEB__ */
98164426Ssam	mov	pc, lr
99164426Ssam
100164426SsamENTRY(ixp425_pci_mem_bs_w_4)
101164426Ssam	str	r3, [r1, r2]
102164426Ssam	mov	pc, lr
103