2 * Copyright (c) 1998 Doug Rabson
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * $Id: cpufunc.h,v 1.3 1998/08/17 08:21:31 dfr Exp $
29 #ifndef _MACHINE_CPUFUNC_H_
30 #define _MACHINE_CPUFUNC_H_
34 #include <sys/types.h>
35 #include <machine/chipset.h>
42 __asm __volatile("call_pal 0x81"); /* XXX bugchk */
47 #define inb(port) chipset.inb(port)
48 #define inw(port) chipset.inw(port)
49 #define inl(port) chipset.inl(port)
50 #define outb(port, data) chipset.outb(port, data)
51 #define outw(port, data) chipset.outw(port, data)
52 #define outl(port, data) chipset.outl(port, data)
54 #define readb(pa) chipset.readb(pa)
55 #define readw(pa) chipset.readw(pa)
56 #define readl(pa) chipset.readl(pa)
57 #define writeb(pa,v) chipset.writeb(pa,v)
58 #define writew(pa,v) chipset.writew(pa,v)
59 #define writel(pa,v) chipset.writel(pa,v)
62 * Bulk i/o (for IDE driver).
64 static __inline void insw(u_int32_t port, void *buffer, size_t count)
66 u_int16_t *p = (u_int16_t *) buffer;
71 static __inline void insl(u_int32_t port, void *buffer, size_t count)
73 u_int32_t *p = (u_int32_t *) buffer;
78 static __inline void outsw(u_int32_t port, const void *buffer, size_t count)
80 const u_int16_t *p = (const u_int16_t *) buffer;
85 static __inline void outsl(u_int32_t port, const void *buffer, size_t count)
87 const u_int32_t *p = (const u_int32_t *) buffer;
93 * String version of IO memory access ops:
95 extern void memcpy_fromio(void *, u_int32_t, size_t);
96 extern void memcpy_toio(u_int32_t, void *, size_t);
97 extern void memcpy_io(u_int32_t, u_int32_t, size_t);
98 extern void memset_io(u_int32_t, int, size_t);
99 extern void memsetw(void *, int, size_t);
100 extern void memsetw_io(u_int32_t, int, size_t);
105 #endif /* !_MACHINE_CPUFUNC_H_ */