NetBSD Problem Report #43683

From khorben@defora.org  Thu Jul 29 12:55:30 2010
Return-Path: <khorben@defora.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 1024463BB29
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Jul 2010 12:55:30 +0000 (UTC)
Message-Id: <20100729125524.9C264DD@kwarx.defora.lan>
Date: Thu, 29 Jul 2010 14:55:24 +0200 (CEST)
From: Pierre Pronchery <khorben@defora.org>
To: gnats-bugs@gnats.NetBSD.org
Subject: puc(4) could be more useful
X-Send-Pr-Version: 3.95

>Number:         43683
>Category:       kern
>Synopsis:       puc(4)-based parallel ports' addresses are not printed
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 29 13:00:01 +0000 2010
>Closed-Date:    Wed Jul 31 15:03:11 +0000 2013
>Last-Modified:  Wed Jul 31 15:03:11 +0000 2013
>Originator:     Pierre Pronchery
>Release:        NetBSD 5.1_RC2
>Organization:
>Environment:
System: NetBSD kwarx.defora.lan 5.1_RC2 NetBSD 5.1_RC2 (GENERIC) #2: Fri Jun 11 21:15:51 CEST 2010 khorben@kwarx.defora.lan:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
puc(4) is a driver for PCI extension cards, providing extra serial and
parallel ports to the computer. Many existing programs interacting with
the parallel port, do so by means of the ioperm() or iopl() calls, and
then perform inb()/outb() requests.

However, these programs require an address to open the desired hardware
port; unfortunately, there is currently no way of knowing this address:
it is not printed at any time by the kernel.
>How-To-Repeat:
Connect a puc(4)-based PCI card to the computer. Boot and look for a way
to access it through the ioperm/iopl/inb/outb interfaces.
>Fix:
The patch below simply enables a call to printf(), already found in the
code, that does print the proper address (held in paa.a). It could
probably be modified to look more obvious to the user.

Index: sys/dev/pci/puc.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/puc.c,v
retrieving revision 1.31
diff -p -u -r1.31 puc.c
--- sys/dev/pci/puc.c	9 Jul 2008 14:46:15 -0000	1.31
+++ sys/dev/pci/puc.c	29 Jul 2010 12:50:22 -0000
@@ -288,7 +288,7 @@ puc_attach(device_t parent, device_t sel
 		}
 		paa.h = subregion_handle;

-#if 0
+#if 1
 		printf("%s: port %d: %s @ (index %d) 0x%x (0x%lx, 0x%lx)\n",
 		    device_xname(self), paa.port,
 		    puc_port_type_name(paa.type), barindex, (int)paa.a,

>Release-Note:

>Audit-Trail:
From: "Soren S. Jorvang" <soren@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/43683 CVS commit: src/sys/dev/pci
Date: Wed, 31 Jul 2013 14:31:01 +0000

 Module Name:	src
 Committed By:	soren
 Date:		Wed Jul 31 14:31:01 UTC 2013

 Modified Files:
 	src/sys/dev/pci: com_puc.c lpt_puc.c

 Log Message:
 On x86, print the I/O address of lpt_puc as for com_puc so that hacks
 using iopl/ioperm can be told where to find the parallel port.

 Closes PR kern/43683.


 To generate a diff of this commit:
 cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/com_puc.c
 cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/lpt_puc.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: soren@NetBSD.org
State-Changed-When: Wed, 31 Jul 2013 15:03:11 +0000
State-Changed-Why:


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.