NetBSD Problem Report #39584

From www@NetBSD.org  Fri Sep 19 07:57:22 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id A1D9A63B877
	for <gnats-bugs@gnats.netbsd.org>; Fri, 19 Sep 2008 07:57:22 +0000 (UTC)
Message-Id: <20080919075722.3FA0563B842@narn.NetBSD.org>
Date: Fri, 19 Sep 2008 07:57:22 +0000 (UTC)
From: bradd@cat.co.za
Reply-To: bradd@cat.co.za
To: gnats-bugs@NetBSD.org
Subject: arcmsr(4) driver disk state values are incorrect (for ARC-1220)
X-Send-Pr-Version: www-1.0

>Number:         39584
>Category:       kern
>Synopsis:       arcmsr(4) driver disk state values are incorrect (for ARC-1220)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 19 08:00:01 +0000 2008
>Closed-Date:    Wed Sep 24 14:18:21 +0000 2008
>Last-Modified:  Wed Sep 24 17:30:11 +0000 2008
>Originator:     Brad du Plessis
>Release:        NetBSD 4.0_STABLE
>Organization:
Cathexis Technologies
>Environment:
NetBSD massstorage 4.0_STABLE NetBSD 4.0_STABLE (GENERIC.MP) #8: Thu Sep 18 16:46:11 SAST 2008  root@massstorage:/usr/src/sys/arch/i386/compile/GENERIC.MP i386

>Description:
I have an Areca ARC-1220:

arcmsr0 at pci2 dev 14 function 0: interrupting at ioapic0 pin 18 (irq 10)
arcmsr0: Areca ARC-1220 Host Adapter RAID controller
arcmsr0: 8 ports, 256MB SDRAM, firmware <V1.43 2007-4-17>

and when performing a show disks with bioctl(8) I get an 'Invalid' disk state when the disks are actually in the unused, pass through or hot spare state. The disk state values returned from the device don't match what the driver expects.
>How-To-Repeat:
As above.
>Fix:
This patch addresses the problem on the ARC-1220, not sure if these values are correct for other Areca devices:

Index: arcmsrvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/arcmsrvar.h,v
retrieving revision 1.8.4.3
diff -u -r1.8.4.3 arcmsrvar.h
--- arcmsrvar.h 29 Aug 2008 21:24:19 -0000      1.8.4.3
+++ arcmsrvar.h 19 Sep 2008 07:51:18 -0000
@@ -349,9 +349,9 @@
        uint8_t         device_state;
 #define ARC_FW_DISK_INITIALIZED        0x88    /* disk has been initialized */
 #define ARC_FW_DISK_RAIDMEMBER 0x89    /* disk is member of a raid set */
-#define ARC_FW_DISK_PASSTHRU   0x8b    /* pass through disk */
-#define ARC_FW_DISK_HOTSPARE   0xa9    /* hotspare disk */
-#define ARC_FW_DISK_UNUSED     0xc9    /* free/unused disk */
+#define ARC_FW_DISK_PASSTHRU   0x8a    /* pass through disk */
+#define ARC_FW_DISK_HOTSPARE   0xa8    /* hotspare disk */
+#define ARC_FW_DISK_UNUSED     0xc8    /* free/unused disk */
        uint8_t         pio_mode;
        uint8_t         current_udma_mode;
        uint8_t         udma_mode;

>Release-Note:

>Audit-Trail:
From: "Juan Romero Pardines" <xtraeme@gmail.com>
To: "NetBSD GNATS" <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: kern/39584: arcmsr(4) driver disk state values are incorrect (for ARC-1220)
Date: Mon, 22 Sep 2008 01:26:30 +0200

 Hi,

 what happens is that we don't have documentation about this bit.
 On my controller (ARC-1210) bit zero is set, ARECA's API package
 only mentions the following bits:

 #define  DEV_INITIALIZED        0x80  // Device initialized
 #define  DEV_AVAILABLE          0x40  // Device available for use
 #define  DEV_HOT_SPARE          0x20  // Device is reserved for HOT SPARE
 #define  DEV_FAILED             0x10  // Device failed
 #define  DEV_ATTACHED           0x08  // Device attached
 #define  DEV_PASSTHROUGH        0x02  // Pass through device

 Therefore I propose the following patch that should work for all us,
 plus this now detects failed state (I missed this a while ago):

 Index: arcmsr.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/arcmsr.c,v
 retrieving revision 1.21
 diff -b -u -p -r1.21 arcmsr.c
 --- arcmsr.c    24 Jun 2008 10:14:41 -0000      1.21
 +++ arcmsr.c    21 Sep 2008 23:25:00 -0000
 @@ -1378,12 +1378,17 @@ arc_bio_disk_filldata(struct arc_softc *
         char                    serial[41];
         char                    rev[17];

 +       /* Ignore bit zero for now, we don't know what it means */
 +       diskinfo->device_state &= ~0x1;
 +
         switch (diskinfo->device_state) {
 +       case ARC_FW_DISK_FAILED:
 +               bd->bd_status = BIOC_SDFAILED;
 +               break;
         case ARC_FW_DISK_PASSTHRU:
                 bd->bd_status = BIOC_SDPASSTHRU;
                 break;
 -       case ARC_FW_DISK_INITIALIZED:
 -       case ARC_FW_DISK_RAIDMEMBER:
 +       case ARC_FW_DISK_NORMAL:
                 bd->bd_status = BIOC_SDONLINE;
                 break;
         case ARC_FW_DISK_HOTSPARE:
 Index: arcmsrvar.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/arcmsrvar.h,v
 retrieving revision 1.12
 diff -b -u -p -r1.12 arcmsrvar.h
 --- arcmsrvar.h 3 Apr 2008 13:59:01 -0000       1.12
 +++ arcmsrvar.h 21 Sep 2008 23:25:00 -0000
 @@ -347,11 +347,11 @@ struct arc_fw_diskinfo {
         uint32_t        capacity;
         uint32_t        capacity2;
         uint8_t         device_state;
 -#define ARC_FW_DISK_INITIALIZED        0x88    /* disk has been initialized */
 -#define ARC_FW_DISK_RAIDMEMBER 0x89    /* disk is member of a raid set */
 -#define ARC_FW_DISK_PASSTHRU   0x8b    /* pass through disk */
 -#define ARC_FW_DISK_HOTSPARE   0xa9    /* hotspare disk */
 -#define ARC_FW_DISK_UNUSED     0xc9    /* free/unused disk */
 +#define ARC_FW_DISK_NORMAL     0x88    /* disk attached/initialized */
 +#define ARC_FW_DISK_PASSTHRU   0x8a    /* pass through disk in normal state */
 +#define ARC_FW_DISK_HOTSPARE   0xa8    /* hotspare disk in normal state */
 +#define ARC_FW_DISK_UNUSED     0xc8    /* free/unused disk in normal state */
 +#define ARC_FW_DISK_FAILED     0x10    /* disk in failed state */
         uint8_t         pio_mode;
         uint8_t         current_udma_mode;
         uint8_t         udma_mode;

From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39584 CVS commit: src/sys/dev/pci
Date: Tue, 23 Sep 2008 22:22:41 +0000 (UTC)

 Module Name:	src
 Committed By:	christos
 Date:		Tue Sep 23 22:22:41 UTC 2008

 Modified Files:
 	src/sys/dev/pci: arcmsr.c arcmsrvar.h

 Log Message:
 PR/39583: Brad du Plessis: acrmsr(4) driver doesn't report number of volumes correctly
 to bioctl(8)
 PR/39584: Juan RP: arcmsr(4) driver disk state values are incorrect (for ARC-1220)


 To generate a diff of this commit:
 cvs rdiff -r1.21 -r1.22 src/sys/dev/pci/arcmsr.c
 cvs rdiff -r1.12 -r1.13 src/sys/dev/pci/arcmsrvar.h

 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: christos@NetBSD.org
State-Changed-When: Wed, 24 Sep 2008 10:18:21 -0400
State-Changed-Why:
fixed, thanks


From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39584 CVS commit: [netbsd-4] src/sys/dev/pci
Date: Wed, 24 Sep 2008 17:25:23 +0000 (UTC)

 Module Name:	src
 Committed By:	bouyer
 Date:		Wed Sep 24 17:25:23 UTC 2008

 Modified Files:
 	src/sys/dev/pci [netbsd-4]: arcmsr.c arcmsrvar.h

 Log Message:
 Pull up following revision(s) (requested by christos in ticket #1205):
 	sys/dev/pci/arcmsrvar.h: revision 1.13
 	sys/dev/pci/arcmsr.c: revision 1.22
 PR/39583: Brad du Plessis: acrmsr(4) driver doesn't report number of
 volumes correctly
 to bioctl(8)
 PR/39584: Juan RP: arcmsr(4) driver disk state values are incorrect (for
 ARC-1220)


 To generate a diff of this commit:
 cvs rdiff -r1.9.4.3 -r1.9.4.4 src/sys/dev/pci/arcmsr.c
 cvs rdiff -r1.8.4.3 -r1.8.4.4 src/sys/dev/pci/arcmsrvar.h

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

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