From nnd@infoteka.nsk.ru Fri Oct 15 02:06:12 1999
Return-Path: <nnd@infoteka.nsk.ru>
Received: from infoteka.nsk.ru (infoteka.nsk.ru [212.20.32.40])
	by hub.freebsd.org (Postfix) with SMTP id 8643314DAA
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 15 Oct 1999 02:05:54 -0700 (PDT)
	(envelope-from nnd@infoteka.nsk.ru)
Received: (qmail 29194 invoked by uid 0); 15 Oct 1999 09:05:45 -0000
Message-Id: <19991015090545.29193.qmail@infoteka.nsk.ru>
Date: 15 Oct 1999 09:05:45 -0000
From: nnd@mail.nsk.ru
Sender: nnd@infoteka.nsk.ru
Reply-To: nnd@mail.nsk.ru
To: FreeBSD-gnats-submit@freebsd.org
Subject: Version 1.27 of the 'src/sys/dev/ata/ata-all.c' prevents HPT366 matching
X-Send-Pr-Version: 3.2

>Number:         14345
>Category:       kern
>Synopsis:       Version 1.27 of the 'src/sys/dev/ata/ata-all.c' prevents HPT366 matching
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    sos
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 15 02:10:00 PDT 1999
>Closed-Date:    Sat Oct 16 05:25:19 PDT 1999
>Last-Modified:  Sat Oct 16 05:26:16 PDT 1999
>Originator:     Nickolay N. Dudorov
>Release:        FreeBSD-current i386
>Organization:
STE Infoteka
>Environment:

	FreeBSD-current after 1999/10/13 11:56:50 PDT

>Description:

	Doug Rabson's commit to the file in question with the
  Log:
  Don't match non-IDE devices in probe.

prevents at least HighPoint HPT366 IDE controller from matching.
Kernel with version 1.26 file successfully recognizes and works
with the disk on this controller on the Abit's BP6 motherboard.
The reason for this is that motherbord (or PCI-BIOS ?) reports
this controller class as 'class=01-80-00' i.e. class=PCIC_STORGE
ans subclass=PCIS_OTHER. This does'nt prevent 'ata_pciattach'
from attaching HPT366 controller.

	Loking at the diff between -r1.26 and -r1.27 I dont
understand the purpose of the patch at all. Additional test
at the beginning of the 'ata_pcimatch' function can only return
NULL where previous version return non-NULL for one of the
"supported chipsets" or "unsupported but known chipsets".
But if there is such a chipset - is'nt it better to change
it's 'case' instead of the general (pre)condition ?

>How-To-Repeat:

	Take an FreeBSD-current system with HPT366 controller
and kernels with the -r1.26 and -r1.27 of the 'src/sys/dev/ata/ata_all.c'.
Then the first one will work with this controller and the second
not recognized it at all.


>Fix:
	
	Revert this file to the -r1.26


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Fri Oct 15 02:19:55 PDT 1999 
Responsible-Changed-Why:  
Over to the driver's maintainer. 

From: Doug Rabson <dfr@nlsystems.com>
To: nnd@mail.nsk.ru
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/14345: Version 1.27 of the 'src/sys/dev/ata/ata-all.c'
 prevents HPT366 matching
Date: Fri, 15 Oct 1999 22:18:39 +0100 (BST)

 On 15 Oct 1999 nnd@mail.nsk.ru wrote:
 
 > 
 > >Number:         14345
 > >Category:       kern
 > >Synopsis:       Version 1.27 of the 'src/sys/dev/ata/ata-all.c' prevents HPT366 matching
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       high
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Fri Oct 15 02:10:00 PDT 1999
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Nickolay N. Dudorov
 > >Release:        FreeBSD-current i386
 > >Organization:
 > STE Infoteka
 > >Environment:
 > 
 > 	FreeBSD-current after 1999/10/13 11:56:50 PDT
 > 
 > >Description:
 > 
 > 	Doug Rabson's commit to the file in question with the
 >   Log:
 >   Don't match non-IDE devices in probe.
 > 
 > prevents at least HighPoint HPT366 IDE controller from matching.
 > Kernel with version 1.26 file successfully recognizes and works
 > with the disk on this controller on the Abit's BP6 motherboard.
 > The reason for this is that motherbord (or PCI-BIOS ?) reports
 > this controller class as 'class=01-80-00' i.e. class=PCIC_STORGE
 > ans subclass=PCIS_OTHER. This does'nt prevent 'ata_pciattach'
 > from attaching HPT366 controller.
 > 
 > 	Loking at the diff between -r1.26 and -r1.27 I dont
 > understand the purpose of the patch at all. Additional test
 > at the beginning of the 'ata_pcimatch' function can only return
 > NULL where previous version return non-NULL for one of the
 > "supported chipsets" or "unsupported but known chipsets".
 > But if there is such a chipset - is'nt it better to change
 > it's 'case' instead of the general (pre)condition ?
 
 The reason I needed this is because at least one supported chipset
 (Cypress 82c693) has several functions including pci-isa bridge, usb
 bridge and ata. The broken part for this particular chipset is that the
 same deviceid/vendorid is reported for all functions and the drivers need
 to check the device class to avoid matching for the wrong function.
 
 Probably the correct workaround is to just check for PCIC_STORAGE. This
 patch should work for both broken chipsets:
 
 Index: ata-all.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
 retrieving revision 1.27
 diff -u -r1.27 ata-all.c
 --- ata-all.c	1999/10/13 18:56:49	1.27
 +++ ata-all.c	1999/10/15 21:17:57
 @@ -181,8 +181,7 @@
  static const char *
  ata_pcimatch(device_t dev)
  {
 -    if (pci_get_class(dev) != PCIC_STORAGE ||
 -	(pci_get_subclass(dev) != PCIS_STORAGE_IDE))
 +    if (pci_get_class(dev) != PCIC_STORAGE)
  	return NULL;
  
      switch (pci_get_devid(dev)) {
 
 
 --
 Doug Rabson				Mail:  dfr@nlsystems.com
 Nonlinear Systems Ltd.			Phone: +44 181 442 9037
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: dfr 
State-Changed-When: Sat Oct 16 05:25:19 PDT 1999 
State-Changed-Why:  
Fixed in version 1.28 of ata-all.c 
>Unformatted:
