summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-09-16 13:33:56 +0000
committerdg <dg@FreeBSD.org>1994-09-16 13:33:56 +0000
commitf40d319a8685d1524f17f2e46cffef6bf9763224 (patch)
tree54f2e11922d9e64f624a46a9dfeb32d8581fdeea /sys/amd64
parentcd1fdc31d4a5f75289c02b5a64cab1bbd4b53c0b (diff)
downloadFreeBSD-src-f40d319a8685d1524f17f2e46cffef6bf9763224.zip
FreeBSD-src-f40d319a8685d1524f17f2e46cffef6bf9763224.tar.gz
Removed inclusion of pio.h and cpufunc.h (cpufunc.h is included from
systm.h). Merged functionality of pio.h into cpufunc.h. Cleaned up some related code.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c3
-rw-r--r--sys/amd64/amd64/support.S29
-rw-r--r--sys/amd64/amd64/support.s29
-rw-r--r--sys/amd64/include/cpufunc.h52
-rw-r--r--sys/amd64/isa/icu.h10
5 files changed, 54 insertions, 69 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 6b94a63..61d5daa 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
- * $Id: pmap.c,v 1.34 1994/09/02 04:12:06 davidg Exp $
+ * $Id: pmap.c,v 1.35 1994/09/04 04:11:57 davidg Exp $
*/
/*
@@ -94,7 +94,6 @@
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
-#include <i386/include/cpufunc.h>
#include <i386/include/cputypes.h>
#include <i386/isa/isa.h>
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S
index 0f929f8..248c989 100644
--- a/sys/amd64/amd64/support.S
+++ b/sys/amd64/amd64/support.S
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: support.s,v 1.16 1994/09/04 10:24:22 davidg Exp $
+ * $Id: support.s,v 1.17 1994/09/12 11:38:09 davidg Exp $
*/
#include "assym.s" /* system definitions */
@@ -59,19 +59,6 @@ ENTRY(__divsi3)
/*
* I/O bus instructions via C
*/
-ENTRY(inb) /* val = inb(port) */
- movl 4(%esp),%edx
- subl %eax,%eax
- inb %dx,%al
- NOP
- ret
-
-ENTRY(inw) /* val = inw(port) */
- movl 4(%esp),%edx
- subl %eax,%eax
- inw %dx,%ax
- NOP
- ret
ENTRY(insb) /* insb(port, addr, cnt) */
pushl %edi
@@ -121,20 +108,6 @@ ENTRY(rtcin) /* rtcin(val) */
NOP
ret
-ENTRY(outb) /* outb(port, val) */
- movl 4(%esp),%edx
- movl 8(%esp),%eax
- outb %al,%dx
- NOP
- ret
-
-ENTRY(outw) /* outw(port, val) */
- movl 4(%esp),%edx
- movl 8(%esp),%eax
- outw %ax,%dx
- NOP
- ret
-
ENTRY(outsb) /* outsb(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
diff --git a/sys/amd64/amd64/support.s b/sys/amd64/amd64/support.s
index 0f929f8..248c989 100644
--- a/sys/amd64/amd64/support.s
+++ b/sys/amd64/amd64/support.s
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: support.s,v 1.16 1994/09/04 10:24:22 davidg Exp $
+ * $Id: support.s,v 1.17 1994/09/12 11:38:09 davidg Exp $
*/
#include "assym.s" /* system definitions */
@@ -59,19 +59,6 @@ ENTRY(__divsi3)
/*
* I/O bus instructions via C
*/
-ENTRY(inb) /* val = inb(port) */
- movl 4(%esp),%edx
- subl %eax,%eax
- inb %dx,%al
- NOP
- ret
-
-ENTRY(inw) /* val = inw(port) */
- movl 4(%esp),%edx
- subl %eax,%eax
- inw %dx,%ax
- NOP
- ret
ENTRY(insb) /* insb(port, addr, cnt) */
pushl %edi
@@ -121,20 +108,6 @@ ENTRY(rtcin) /* rtcin(val) */
NOP
ret
-ENTRY(outb) /* outb(port, val) */
- movl 4(%esp),%edx
- movl 8(%esp),%eax
- outb %al,%dx
- NOP
- ret
-
-ENTRY(outw) /* outw(port, val) */
- movl 4(%esp),%edx
- movl 8(%esp),%eax
- outw %ax,%dx
- NOP
- ret
-
ENTRY(outsb) /* outsb(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index 970c867..c299218 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: cpufunc.h,v 1.22 1994/09/15 17:55:47 paul Exp $
+ * $Id: cpufunc.h,v 1.23 1994/09/16 11:22:33 jkh Exp $
*/
/*
@@ -46,10 +46,53 @@
#include <machine/spl.h>
-#include <machine/pio.h>
-
#ifdef __GNUC__
+static inline u_char
+inb(u_short port)
+{
+ u_char data;
+
+ __asm __volatile("inb %1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+static inline u_short
+inw(u_short port)
+{
+ u_short data;
+
+ __asm __volatile("inw %1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+static inline u_long
+inl(u_short port)
+{
+ u_long data;
+
+ __asm __volatile("inl %1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+static inline void
+outb(u_short port, u_char val)
+{
+ __asm __volatile("outb %0,%1" : :"a" (val), "d" (port));
+}
+
+static inline void
+outw(u_short port, u_short val)
+{
+ __asm __volatile("outw %0,%1" : :"a" (val), "d" (port));
+}
+
+static inline void
+outl(u_short port, u_long val)
+{
+ __asm __volatile("outl %0,%1" : :"a" (val), "d" (port));
+}
+
static inline int bdb(void)
{
extern int bdb_exists;
@@ -145,9 +188,6 @@ extern void DELAY(int);
void setidt __P((int, void (*)(), int, int));
extern u_long kvtop(void *);
-#ifndef outw /* If not inline defined */
-extern void outw(int /*u_short*/, int /*u_short*/); /* XXX inline!*/
-#endif
extern void outsb(int /*u_short*/, void *, size_t);
extern void outsw(int /*u_short*/, void *, size_t);
extern void insw(int /*u_short*/, void *, size_t);
diff --git a/sys/amd64/isa/icu.h b/sys/amd64/isa/icu.h
index 13216b0..22c9066 100644
--- a/sys/amd64/isa/icu.h
+++ b/sys/amd64/isa/icu.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)icu.h 5.6 (Berkeley) 5/9/91
- * $Id: icu.h,v 1.2 1993/10/16 13:45:51 rgrimes Exp $
+ * $Id: icu.h,v 1.3 1994/04/02 07:00:40 davidg Exp $
*/
/*
@@ -52,17 +52,17 @@
*/
extern unsigned imen; /* interrupt mask enable */
-#define INTREN(s) (imen &= ~(s), SET_ICUS())
-#define INTRDIS(s) (imen |= (s), SET_ICUS())
+#define INTREN(s) {imen &= ~(s); SET_ICUS()}
+#define INTRDIS(s) {imen |= (s); SET_ICUS()}
#define INTRMASK(msk,s) (msk |= (s))
#if 0
-#define SET_ICUS() (outb(IO_ICU1 + 1, imen), outb(IU_ICU2 + 1, imen >> 8))
+#define SET_ICUS() {outb(IO_ICU1 + 1, imen); outb(IU_ICU2 + 1, imen >> 8);}
#else
/*
* XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to
* include isa.h, while too many things include icu.h.
*/
-#define SET_ICUS() (outb(0x21, imen), outb(0xa1, imen >> 8))
+#define SET_ICUS() {outb(0x21, imen); outb(0xa1, imen >> 8);}
#endif
#endif
OpenPOWER on IntegriCloud