NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/39584: arcmsr(4) driver disk state values are incorrect (for ARC-1220)



The following reply was made to PR kern/39584; it has been noted by GNATS.

From: "Juan Romero Pardines" <xtraeme%gmail.com@localhost>
To: "NetBSD GNATS" <gnats-bugs%netbsd.org@localhost>
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;
 


Home | Main Index | Thread Index | Old Index