diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c --- a/sys/dev/smartpqi/smartpqi_cam.c +++ b/sys/dev/smartpqi/smartpqi_cam.c @@ -261,15 +261,12 @@ } strncpy(inq->vendor, device->vendor, - SID_VENDOR_SIZE-1); - inq->vendor[sizeof(inq->vendor)-1] = '\0'; + SID_VENDOR_SIZE); strncpy(inq->product, pqisrc_raidlevel_to_string(device->raid_level), - SID_PRODUCT_SIZE-1); - inq->product[sizeof(inq->product)-1] = '\0'; + SID_PRODUCT_SIZE); strncpy(inq->revision, device->volume_offline?"OFF":"OK", - SID_REVISION_SIZE-1); - inq->revision[sizeof(inq->revision)-1] = '\0'; + SID_REVISION_SIZE); } DBG_FUNC("OUT\n"); diff --git a/sys/dev/smartpqi/smartpqi_defines.h b/sys/dev/smartpqi/smartpqi_defines.h --- a/sys/dev/smartpqi/smartpqi_defines.h +++ b/sys/dev/smartpqi/smartpqi_defines.h @@ -879,6 +879,7 @@ #define LEGACY_SIS_IQN_H 0xd4 /* inbound queue native mode (high)*/ #define LEGACY_SIS_MAILBOX 0x7fc60 /* mailbox (20 bytes) */ #define LEGACY_SIS_SRCV_MAILBOX 0x1000 /* mailbox (20 bytes) */ +#define LEGACY_SIS_SRCV_OFFSET_MAILBOX_7 0x101C /* mailbox 7 register offset */ #define LEGACY_SIS_ODR_SHIFT 12 /* outbound doorbell shift */ #define LEGACY_SIS_IDR_SHIFT 9 /* inbound doorbell shift */ diff --git a/sys/dev/smartpqi/smartpqi_helper.c b/sys/dev/smartpqi/smartpqi_helper.c --- a/sys/dev/smartpqi/smartpqi_helper.c +++ b/sys/dev/smartpqi/smartpqi_helper.c @@ -146,7 +146,17 @@ DBG_FUNC("IN\n"); softs->ctrl_online = false; - pqisrc_trigger_nmi_sis(softs); + + int lockupcode = 0; + + if (SIS_IS_KERNEL_PANIC(softs)) { + lockupcode = PCI_MEM_GET32(softs, &softs->ioa_reg->mb[7], LEGACY_SIS_SRCV_OFFSET_MAILBOX_7); + DBG_ERR("Controller FW is not runnning, Lockup code = %x\n", lockupcode); + } + else { + pqisrc_trigger_nmi_sis(softs); + } + os_complete_outstanding_cmds_nodevice(softs); pqisrc_wait_for_rescan_complete(softs); pqisrc_take_devices_offline(softs); @@ -176,8 +186,8 @@ take_ctrl_offline: if (take_offline){ DBG_ERR("controller is offline\n"); - pqisrc_take_ctrl_offline(softs); os_stop_heartbeat_timer(softs); + pqisrc_take_ctrl_offline(softs); } DBG_FUNC("OUT\n"); }