cpufunc.h (74897) | cpufunc.h (83511) |
---|---|
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 unchanged lines hidden (view full) --- 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 * | 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 unchanged lines hidden (view full) --- 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 * $FreeBSD: head/sys/ia64/include/cpufunc.h 74897 2001-03-28 02:31:54Z jhb $ | 26 * $FreeBSD: head/sys/ia64/include/cpufunc.h 83511 2001-09-15 12:30:56Z dfr $ |
27 */ 28 29#ifndef _MACHINE_CPUFUNC_H_ 30#define _MACHINE_CPUFUNC_H_ 31 32#ifdef _KERNEL 33 34#include <sys/types.h> | 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/ia64_cpu.h> |
|
35 36#ifdef __GNUC__ 37 38static __inline void 39breakpoint(void) 40{ 41 __asm __volatile("break 0x80100"); /* XXX use linux value */ 42} 43 44#endif 45 | 36 37#ifdef __GNUC__ 38 39static __inline void 40breakpoint(void) 41{ 42 __asm __volatile("break 0x80100"); /* XXX use linux value */ 43} 44 45#endif 46 |
47extern u_int64_t ia64_port_base; 48 49static __inline volatile void * 50ia64_port_address(u_int port) 51{ 52 return (volatile void *)(ia64_port_base 53 | ((port >> 2) << 12) 54 | (port & ((1 << 12) - 1))); 55} 56 |
|
46static __inline u_int8_t 47inb(u_int port) 48{ | 57static __inline u_int8_t 58inb(u_int port) 59{ |
49 return 0; /* TODO: implement this */ | 60 volatile u_int8_t *p = ia64_port_address(port); 61 u_int8_t v = *p; 62 ia64_mf_a(); 63 ia64_mf(); 64 return v; |
50} 51 52static __inline u_int16_t 53inw(u_int port) 54{ | 65} 66 67static __inline u_int16_t 68inw(u_int port) 69{ |
55 return 0; /* TODO: implement this */ | 70 volatile u_int16_t *p = ia64_port_address(port); 71 u_int16_t v = *p; 72 ia64_mf_a(); 73 ia64_mf(); 74 return v; |
56} 57 58static __inline u_int32_t 59inl(u_int port) 60{ | 75} 76 77static __inline u_int32_t 78inl(u_int port) 79{ |
61 return 0; /* TODO: implement this */ | 80 volatile u_int32_t *p = ia64_port_address(port); 81 u_int32_t v = *p; 82 ia64_mf_a(); 83 ia64_mf(); 84 return v; |
62} 63 64static __inline void 65insb(u_int port, void *addr, size_t count) 66{ 67 u_int8_t *p = addr; 68 while (count--) 69 *p++ = inb(port); --- 13 unchanged lines hidden (view full) --- 83 u_int32_t *p = addr; 84 while (count--) 85 *p++ = inl(port); 86} 87 88static __inline void 89outb(u_int port, u_int8_t data) 90{ | 85} 86 87static __inline void 88insb(u_int port, void *addr, size_t count) 89{ 90 u_int8_t *p = addr; 91 while (count--) 92 *p++ = inb(port); --- 13 unchanged lines hidden (view full) --- 106 u_int32_t *p = addr; 107 while (count--) 108 *p++ = inl(port); 109} 110 111static __inline void 112outb(u_int port, u_int8_t data) 113{ |
91 return; /* TODO: implement this */ | 114 volatile u_int8_t *p = ia64_port_address(port); 115 *p = data; 116 ia64_mf_a(); 117 ia64_mf(); |
92} 93 94static __inline void 95outw(u_int port, u_int16_t data) 96{ | 118} 119 120static __inline void 121outw(u_int port, u_int16_t data) 122{ |
97 return; /* TODO: implement this */ | 123 volatile u_int16_t *p = ia64_port_address(port); 124 *p = data; 125 ia64_mf_a(); 126 ia64_mf(); |
98} 99 100static __inline void 101outl(u_int port, u_int32_t data) 102{ | 127} 128 129static __inline void 130outl(u_int port, u_int32_t data) 131{ |
103 return; /* TODO: implement this */ | 132 volatile u_int32_t *p = ia64_port_address(port); 133 *p = data; 134 ia64_mf_a(); 135 ia64_mf(); |
104} 105 106static __inline void 107outsb(u_int port, const void *addr, size_t count) 108{ 109 const u_int8_t *p = addr; 110 while (count--) 111 outb(port, *p++); --- 85 unchanged lines hidden --- | 136} 137 138static __inline void 139outsb(u_int port, const void *addr, size_t count) 140{ 141 const u_int8_t *p = addr; 142 while (count--) 143 outb(port, *p++); --- 85 unchanged lines hidden --- |