Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Oct 2012 18:42:03 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r241256 - stable/9/sys/boot/i386/loader
Message-ID:  <201210061842.q96Ig3V4017319@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Sat Oct  6 18:42:02 2012
New Revision: 241256
URL: http://svn.freebsd.org/changeset/base/241256

Log:
  MFC r240341,240637: loader/i386: replace ugly inb/outb
  re-implementations with cpufunc.h

Modified:
  stable/9/sys/boot/i386/loader/main.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)

Modified: stable/9/sys/boot/i386/loader/main.c
==============================================================================
--- stable/9/sys/boot/i386/loader/main.c	Sat Oct  6 17:54:42 2012	(r241255)
+++ stable/9/sys/boot/i386/loader/main.c	Sat Oct  6 18:42:02 2012	(r241256)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include <stddef.h>
 #include <string.h>
 #include <machine/bootinfo.h>
+#include <machine/cpufunc.h>
 #include <machine/psl.h>
 #include <sys/reboot.h>
 
@@ -321,34 +322,19 @@ command_heap(int argc, char *argv[])
     return(CMD_OK);
 }
 
-/* ISA bus access functions for PnP, derived from <machine/cpufunc.h> */
-static int		
+/* ISA bus access functions for PnP. */
+static int
 isa_inb(int port)
 {
-    u_char	data;
-    
-    if (__builtin_constant_p(port) && 
-	(((port) & 0xffff) < 0x100) && 
-	((port) < 0x10000)) {
-	__asm __volatile("inb %1,%0" : "=a" (data) : "id" ((u_short)(port)));
-    } else {
-	__asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port));
-    }
-    return(data);
+
+    return (inb(port));
 }
 
 static void
 isa_outb(int port, int value)
 {
-    u_char	al = value;
-    
-    if (__builtin_constant_p(port) && 
-	(((port) & 0xffff) < 0x100) && 
-	((port) < 0x10000)) {
-	__asm __volatile("outb %0,%1" : : "a" (al), "id" ((u_short)(port)));
-    } else {
-        __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port));
-    }
+
+    outb(port, value);
 }
 
 #ifdef LOADER_ZFS_SUPPORT



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210061842.q96Ig3V4017319>