From 9f5ac6b847e666c1e92af13158f6b45862eeee8e Mon Sep 17 00:00:00 2001 From: xtraeme Date: Thu, 3 Apr 2008 13:59:00 +0000 Subject: [PATCH] Add ARC_FW_DISK_INITIALIZED flag for device_state and do not treat it as unknown; in this state the disk is correctly working so set it as online. Also remove some bogus htole32() for diskinfo->device_state. This should fix PR kern/38299 by Hiroyuki Bessho. --- sys/dev/pci/arcmsr.c | 9 +++++---- sys/dev/pci/arcmsrvar.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/pci/arcmsr.c b/sys/dev/pci/arcmsr.c index 3f249bb8510c..ec17dad0a301 100644 --- a/sys/dev/pci/arcmsr.c +++ b/sys/dev/pci/arcmsr.c @@ -1,4 +1,4 @@ -/* $NetBSD: arcmsr.c,v 1.19 2008/03/05 15:03:36 xtraeme Exp $ */ +/* $NetBSD: arcmsr.c,v 1.20 2008/04/03 13:59:00 xtraeme Exp $ */ /* $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */ /* @@ -21,7 +21,7 @@ #include "bio.h" #include -__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.19 2008/03/05 15:03:36 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.20 2008/04/03 13:59:00 xtraeme Exp $"); #include #include @@ -1378,10 +1378,11 @@ arc_bio_disk_filldata(struct arc_softc *sc, struct bioc_disk *bd, char serial[41]; char rev[17]; - switch (htole32(diskinfo->device_state)) { + switch (diskinfo->device_state) { case ARC_FW_DISK_PASSTHRU: bd->bd_status = BIOC_SDPASSTHRU; break; + case ARC_FW_DISK_INITIALIZED: case ARC_FW_DISK_RAIDMEMBER: bd->bd_status = BIOC_SDONLINE; break; @@ -1401,7 +1402,7 @@ arc_bio_disk_filldata(struct arc_softc *sc, struct bioc_disk *bd, break; default: printf("%s: unknown disk device_state: 0x%x\n", __func__, - htole32(diskinfo->device_state)); + diskinfo->device_state); bd->bd_status = BIOC_SDINVALID; return; } diff --git a/sys/dev/pci/arcmsrvar.h b/sys/dev/pci/arcmsrvar.h index 7a18d0fab305..8f2dae45f410 100644 --- a/sys/dev/pci/arcmsrvar.h +++ b/sys/dev/pci/arcmsrvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: arcmsrvar.h,v 1.11 2008/03/05 15:03:36 xtraeme Exp $ */ +/* $NetBSD: arcmsrvar.h,v 1.12 2008/04/03 13:59:01 xtraeme Exp $ */ /* Derived from $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */ /* @@ -347,6 +347,7 @@ 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 */