]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/alpha/include/cpufunc.h
This commit was generated by cvs2svn to compensate for changes in r48907,
[FreeBSD/FreeBSD.git] / sys / alpha / include / cpufunc.h
1 /*-
2  * Copyright (c) 1998 Doug Rabson
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
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.
13  *
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
24  * SUCH DAMAGE.
25  *
26  *      $Id: cpufunc.h,v 1.3 1998/08/17 08:21:31 dfr Exp $
27  */
28
29 #ifndef _MACHINE_CPUFUNC_H_
30 #define _MACHINE_CPUFUNC_H_
31
32 #ifdef KERNEL
33
34 #include <sys/types.h>
35 #include <machine/chipset.h>
36
37 #ifdef __GNUC__
38
39 static __inline void
40 breakpoint(void)
41 {
42         __asm __volatile("call_pal 0x81"); /* XXX bugchk */
43 }
44
45 #endif
46
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)
53
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)
60
61 /*
62  * Bulk i/o (for IDE driver).
63  */
64 static __inline void insw(u_int32_t port, void *buffer, size_t count)
65 {
66         u_int16_t *p = (u_int16_t *) buffer;
67         while (count--)
68                 *p++ = inw(port);
69 }
70
71 static __inline void insl(u_int32_t port, void *buffer, size_t count)
72 {
73         u_int32_t *p = (u_int32_t *) buffer;
74         while (count--)
75                 *p++ = inl(port);
76 }
77
78 static __inline void outsw(u_int32_t port, const void *buffer, size_t count)
79 {
80         const u_int16_t *p = (const u_int16_t *) buffer;
81         while (count--)
82                 outw(port, *p++);
83 }
84
85 static __inline void outsl(u_int32_t port, const void *buffer, size_t count)
86 {
87         const u_int32_t *p = (const u_int32_t *) buffer;
88         while (count--)
89                 outl(port, *p++);
90 }
91
92 /*
93  * String version of IO memory access ops:
94  */
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);
101
102
103 #endif /* KERNEL */
104
105 #endif /* !_MACHINE_CPUFUNC_H_ */