Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Oct 1998 10:12:23 -0800 (PST)
From:      parag@codegen.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/8486: doscmd port.c change to access real device ports
Message-ID:  <199810291812.KAA24349@pinhead.parag.codegen.com>

next in thread | raw e-mail | index | archive | help

>Number:         8486
>Category:       bin
>Synopsis:       doscmd port.c change to access real device ports
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 29 10:20:00 PST 1998
>Last-Modified:
>Originator:     Parag Patel
>Organization:
CodeGen, Inc.
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	Dual SMP Pentium-II/300, 256Mb RAM, 2 IBM 4Gb SCSI disks
	(not that it matters)

>Description:

	doscmd does not currently allow access to the physical device
	ports on the system.  The relevant code in port.c has not been
	ported to FreeBSD.  As I need it to access a Needhams EMP-10
	EPROM programmer, I added the relevant code.

>How-To-Repeat:

	This command allows access to the physical parallel port from
	doscmd using the patch below:

	rtprio 10 doscmd -x -b -i0x378:8 -o0x378:8

>Fix:

	I had posted a similar patch to current@freebsd.org that had a
	bug in it.  In the original patch, iounmap() did not set the
	ioperm back to zero.  This patch fixes that problem.
	

Index: port.c
===================================================================
RCS file: /src/freebsd/src/usr.bin/doscmd/port.c,v
retrieving revision 1.1
diff -c -r1.1 port.c
*** port.c	1997/08/09 01:42:54	1.1
--- port.c	1998/10/29 17:56:15
***************
*** 59,73 ****
  static void
  iomap(int port, int cnt)
  {
!     fatal("iomap not supported");
  }
  
  static void
  iounmap(int port, int cnt)
  {
!     fatal("iomap not supported");
  }
-     
  #else
  static void
  iomap(int port, int cnt)
--- 59,88 ----
  static void
  iomap(int port, int cnt)
  {
!     if (port + cnt >= MAXPORT) {
! 	errno = ERANGE;
! 	goto bad;
!     }
!     if (i386_set_ioperm(port, cnt, 1) < 0) {
!     bad:
! 	perror("iomap");
! 	quit(1);
!     }
  }
  
  static void
  iounmap(int port, int cnt)
  {
!     if (port + cnt >= MAXPORT) {
! 	errno = ERANGE;
! 	goto bad;
!     }
!     if (i386_set_ioperm(port, cnt, 0) < 0) {
!     bad:
! 	perror("iounmap");
! 	quit(1);
!     }
  }
  #else
  static void
  iomap(int port, int cnt)

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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