NetBSD Problem Report #42375

From Wolfgang.Stukenbrock@nagler-company.com  Wed Nov 25 10:50:23 2009
Return-Path: <Wolfgang.Stukenbrock@nagler-company.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id CA91263B8B4
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 25 Nov 2009 10:50:23 +0000 (UTC)
Message-Id: <20091125105019.976B61E80B3@test-s0.nagler-company.com>
Date: Wed, 25 Nov 2009 11:50:19 +0100 (CET)
From: Wolfgang.Stukenbrock@nagler-company.com
Reply-To: Wolfgang.Stukenbrock@nagler-company.com
To: gnats-bugs@gnats.NetBSD.org
Subject: ahd driver uses wrong mask if CND-queuing failed
X-Send-Pr-Version: 3.95

>Number:         42375
>Category:       kern
>Synopsis:       ahd driver uses wrong mask if CND-queuing failed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 25 10:55:00 +0000 2009
>Originator:     W. Stukenbrock
>Release:        NetBSD 4.0
>Organization:
Dr. Nagler & Company GmbH

>Environment:


System: NetBSD test-s0 4.0 NetBSD 4.0 (NSW-WS) #2: Fri Nov 6 11:14:49 CET 2009 wgstuken@s012:/export/NetBSD-4.0/N+C-build/.OBJDIR_amd64/export/NetBSD-4.0/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
	If a device rejects comamnd-queing as requested by the host,
	the fallback switching code in the ahd driver is broken.
	It checks the control byte with the simple-queue mask (this is not
	100% OK, but it would work ...) and than tries to check the tag_type
	if it it is simple queuing or something more sofisticated.
	If it was only simple it will turn of cmd-queuing for that device,
	otherwiese the driver next tries simple queuing mode.
	Here is the bug: while masking the relevant bits, some bits are
	lost.
>How-To-Repeat:
	Found by a look into the source.
	It would happen if someone setup a device to use an advanced queing
	mode, but that device does not support it.
>Fix:
	The problem is located in /usr/src/sys/dev/ic/aic79xx.c.
	The following patch will fix this problem:

--- aic79xx.c   2008/09/26 11:28:03     1.2
+++ aic79xx.c   2009/11/25 10:10:13
@@ -4672,11 +4672,16 @@
                       "Using asynchronous transfers\n",
                       ahd_name(ahd), devinfo->channel,
                       devinfo->target, devinfo->lun);
-       } else if ((scb->hscb->control & MSG_SIMPLE_TASK) != 0) {
+       } else if ((scb->hscb->control & 0x23) != 0) {
+/* remark: cannot use MSG_SIMPLE_TASK here - other bits are also needed
+ *         the mask 0x23 is used below - so use it here too
+ *
+ * W. Stukenbrock 25.11.2009
+ */
                int tag_type;
                int mask;

-               tag_type = (scb->hscb->control & MSG_SIMPLE_TASK);
+               tag_type = (scb->hscb->control & 0x23);

                if (tag_type == MSG_SIMPLE_TASK) {
                        printf("(%s:%c:%d:%d): refuses tagged commands.  "

>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.