From iain@rice.research.canon.com.au  Tue Jan 16 19:44:55 2001
Return-Path: <iain@rice.research.canon.com.au>
Received: from kwanon.research.canon.com.au (kwanon.research.canon.com.au [203.12.172.254])
	by hub.freebsd.org (Postfix) with ESMTP id 42EE837B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 16 Jan 2001 19:44:55 -0800 (PST)
Received: from rice.research.canon.com.au (rice.research.canon.com.au [10.2.2.91])
	by kwanon.research.canon.com.au (Postfix) with ESMTP id 94CE28A8B2
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 17 Jan 2001 03:51:17 +0000 (UTC)
Received: (from iain@localhost)
	by rice.research.canon.com.au (8.11.0/8.11.1) id f0H3irq00407;
	Wed, 17 Jan 2001 14:44:53 +1100 (EST)
	(envelope-from iain)
Message-Id: <200101170344.f0H3irq00407@rice.research.canon.com.au>
Date: Wed, 17 Jan 2001 14:44:53 +1100 (EST)
From: iain@research.canon.com.au
Sender: iain@rice.research.canon.com.au
Reply-To: iain@research.canon.com.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: Unit number is not set in ahc driver.
X-Send-Pr-Version: 3.2

>Number:         24398
>Category:       kern
>Synopsis:       Unit number is not set in ahc driver.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gibbs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 16 19:50:00 PST 2001
>Closed-Date:    Sat Feb 24 12:07:56 PST 2001
>Last-Modified:  Sat Feb 24 12:09:16 PST 2001
>Originator:     Iain Templeton
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Canon Information Systems Research Australia
>Environment:

4.2-STABLE, current version of aic7xxx driver.

>Description:

The ahc->unit field is not being set in the softc structure. This effects
the test against AHC_TARGET_MODE since it uses that field. If it is not set
it is 0, and the test happens as if all the devices were ahc0.

I suspect it doesn't effect anything else (the field isn't used elsewhere).

>How-To-Repeat:

Use AHC_TARGET_MODE set to some value with bits other than bit 0 set. It
won't activate target mode on any units higher than 0.

>Fix:

Try this patch. It simply sets the unit number after allocating the 
ahc_softc structure.


*** ahc_eisa.c.old	Wed Jan 17 14:37:08 2001
--- ahc_eisa.c	Wed Jan 17 14:37:56 2001
***************
*** 126,131 ****
--- 126,134 ----
  	if (ahc == NULL)
  		return (ENOMEM);
  
+ 	/* Set the unit number of the ahc instance */
+ 	ahc_set_unit(ahc, device_get_unit(dev));
+ 
  	/* Allocate a dmatag for our SCB DMA maps */
  	/* XXX Should be a child of the PCI bus dma tag */
  	error = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1,
*** ahc_pci.c.old	Wed Jan 17 14:36:26 2001
--- ahc_pci.c	Wed Jan 17 14:36:09 2001
***************
*** 98,103 ****
--- 98,106 ----
  	if (ahc == NULL)
  		return (ENOMEM);
  
+ 	/* Set the unit number of the ahc instance */
+ 	ahc_set_unit(ahc, device_get_unit(dev));
+ 
  	/* Allocate a dmatag for our SCB DMA maps */
  	/* XXX Should be a child of the PCI bus dma tag */
  	error = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1,

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gibbs 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Wed Jan 17 01:56:22 PST 2001 
Responsible-Changed-Why:  
The ahc driver is Justin's. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24398 
State-Changed-From-To: open->closed 
State-Changed-By: gibbs 
State-Changed-When: Sat Feb 24 12:07:56 PST 2001 
State-Changed-Why:  
Fixed in rev 1.39 of ahc_pci.c and rev 1.19 of ahc_eisa.c 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24398 
>Unformatted:
