[eros-cvs] cvs commit: eros/src/base/sys/eros/i486 io.h

shap@eros.cs.jhu.edu shap@eros.cs.jhu.edu
Mon, 2 Jul 2001 12:56:21 -0400


shap        01/07/02 12:56:21

  Modified:    src/base/sys/arch/i486/boot cons_io.c main.cxx
               src/base/sys/eros/i486 io.h
  Log:
  Patchups to use inb/outb for Anshumal

Revision  Changes    Path
1.15      +2 -2      eros/src/base/sys/arch/i486/boot/cons_io.c

Index: cons_io.c
===================================================================
RCS file: /cvs/eros/src/base/sys/arch/i486/boot/cons_io.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- cons_io.c	2001/06/20 17:01:10	1.14
+++ cons_io.c	2001/07/02 16:56:21	1.15
@@ -54,9 +54,9 @@
 	while (inb(K_STATUS) & K_OBUF_FUL)
 		(void)inb(K_RDWR);
 
-	out8(KC_CMD_WOUT, K_CMD);
+	outb(KC_CMD_WOUT, K_CMD);
 	while (inb(K_STATUS) & K_IBUF_FUL);
-	out8(x_20, K_RDWR);
+	outb(x_20, K_RDWR);
 	while (inb(K_STATUS) & K_IBUF_FUL);
 #endif	/* IBM_L40 */
 }



1.28      +1 -1      eros/src/base/sys/arch/i486/boot/main.cxx

Index: main.cxx
===================================================================
RCS file: /cvs/eros/src/base/sys/arch/i486/boot/main.cxx,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- main.cxx	2001/06/10 19:41:47	1.27
+++ main.cxx	2001/07/02 16:56:21	1.28
@@ -93,7 +93,7 @@
    * down.  It would be better to do this with a BIOS call, but I
    * don't have my BIOS reference handy at the moment.
    */
-  out8(0x08, 0x3f2);
+  outb(0x08, 0x3f2);
 
 #if 0
   if (VolFlags & VolHdr::VF_DEBUG) {



1.2       +28 -57    eros/src/base/sys/eros/i486/io.h

Index: io.h
===================================================================
RCS file: /cvs/eros/src/base/sys/eros/i486/io.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- io.h	2001/06/05 14:30:58	1.1
+++ io.h	2001/07/02 16:56:21	1.2
@@ -27,9 +27,11 @@
  * states.
  */
 
-#ifdef GNU_INLINE_ASM
+/* If your compiler complains that GNU_INLINE_ASM is not defined, you
+ * will need to move these to a library somewhere. 
+ */
 static inline void
-out8(uint8_t value, uint16_t port)
+outb(uint8_t value, uint16_t port)
 {
   GNU_INLINE_ASM ("outb %b0,%w1"
 	      : /* no outputs */
@@ -39,17 +41,33 @@
   GNU_INLINE_ASM ("outb %al,$0x80");	 /* delay */
 #endif
 }
-#endif /* GNU_INLINE_ASM */
 
+#ifdef __KERNEL__
+
 static inline void
 old_outb(uint16_t port, uint8_t value)
 {
-  out8(value, port);
+  outb(value, port);
 }
 
-#ifdef GNU_INLINE_ASM
+#if 0
+static inline void
+outw(uint16_t value, uint16_t port)
+{
+  outw(value, port);
+}
+
+static inline void
+outl(uint32_t value, uint16_t port)
+{
+  outl(value, port);
+}
+#endif
+
+#endif
+
 static inline uint8_t
-in8(uint16_t port)
+inb(uint16_t port)
 {
   unsigned int _v;
   GNU_INLINE_ASM ("inb %w1,%b0"
@@ -60,17 +78,9 @@
 #endif
   return _v;
 }
-#endif /* GNU_INLINE_ASM */
-
-static inline uint8_t
-inb(uint16_t port)
-{
-  return in8(port);
-}
 
-#ifdef GNU_INLINE_ASM
 static inline void
-out16(uint16_t value, uint16_t port)
+outw(uint16_t value, uint16_t port)
 {
   GNU_INLINE_ASM ("outw %w0,%w1"
 			: /* no outputs */
@@ -80,17 +90,9 @@
   GNU_INLINE_ASM ("outb %al,$0x80");	 /* delay */
 #endif
 }
-#endif /* GNU_INLINE_ASM */
-
-static inline void
-old_outh(uint16_t port, uint16_t value)
-{
-  out16(value, port);
-}
 
-#ifdef GNU_INLINE_ASM
 static inline uint16_t
-in16(uint16_t port)
+inw(uint16_t port)
 {
   unsigned int _v;
 
@@ -102,17 +104,9 @@
 #endif
   return _v;
 }
-#endif /* GNU_INLINE_ASM */
-
-static inline uint16_t
-inh(uint16_t port)
-{
-  return in16(port);
-}
 
-#ifdef GNU_INLINE_ASM
 static inline void
-out32(uint32_t value, uint16_t port)
+outl(uint32_t value, uint16_t port)
 {
   GNU_INLINE_ASM ("outl %0,%w1"
 			: /* no outputs */
@@ -122,17 +116,9 @@
   GNU_INLINE_ASM ("outb %al,$0x80");	 /* delay */
 #endif
 }
-#endif /* GNU_INLINE_ASM */
 
-static inline void
-old_outw(uint16_t port, uint32_t value)
-{
-  out32(value, port);
-}
-
-#ifdef GNU_INLINE_ASM
 static inline uint32_t
-in32(uint16_t port)
+inl(uint16_t port)
 {
   unsigned int _v;
   GNU_INLINE_ASM ("inl %1,%w0"
@@ -143,15 +129,7 @@
 #endif
   return _v;
 }
-#endif /* GNU_INLINE_ASM */
 
-static inline uint32_t
-inw(uint16_t port)
-{
-  return in32(port);
-}
-
-#ifdef GNU_INLINE_ASM
 static inline void
 ins16(uint16_t port, void *addr, uint32_t count)
 {
@@ -159,7 +137,6 @@
 			: "=D" (addr), "=c" (count)
 			: "d" (port), "0" (addr), "1" (count));
 }
-#endif /* GNU_INLINE_ASM */
 
 #if 0
 #ifdef GNU_INLINE_ASM
@@ -188,7 +165,6 @@
 #endif /* GNU_INLINE_ASM */
 #endif
 
-#ifdef GNU_INLINE_ASM
 static inline void
 ins32(uint16_t port, void *addr, uint32_t count)
 {
@@ -196,9 +172,7 @@
 			: "=D" (addr), "=c" (count)
 			: "d" (port), "0" (addr), "1" (count));
 }
-#endif /* GNU_INLINE_ASM */
 
-#ifdef GNU_INLINE_ASM
 static inline void
 outs16(uint16_t port, void *addr, uint32_t count)
 {
@@ -206,9 +180,7 @@
 			: "=S" (addr), "=c" (count)
 			: "d" (port), "0" (addr), "1" (count));
 }
-#endif /* GNU_INLINE_ASM */
 
-#ifdef GNU_INLINE_ASM
 static inline void
 outs32(uint16_t port, void *addr, uint32_t count)
 {
@@ -216,6 +188,5 @@
 			: "=S" (addr), "=c" (count)
 			: "d" (port), "0" (addr), "1" (count));
 }
-#endif /* GNU_INLINE_ASM */
 
 #endif  /* __IO_H__ */