scsi: megaraid_{mm,mbox}: init fix for kdump
Subsystems (3)
PATCH 1/1 scsi: megaraid_{mm,mbox}: init fix for kdump
- Changes in Initialization to fix kdump failure. Without this fix, megaraid driver either panics or fails to initialize the adapter during the kdump's 2nd kernel boot if there are pending commands or interrupts from other devices sharing the same IRQ.
Fix:Send SYNC command on loading.
This command clears the pending commands in the adapter and re-initialize its internal RAID structure.
Signed-Off By: Sumant Patro <[email protected]>
Documentation/scsi/ChangeLog.megaraid 2006-12-29 06:57:44.000000000 -0800 renamed from Documentation/scsi/ChangeLog.megaraid 2006-12-28 10:10:31.000000000 -0800 +13 -0
@@ -1,3 +1,16 @@ +Release Date : Thu Nov 16 15:32:35 EST 2006 - Sumant Patro <[email protected]> +Current Version : 2.20.5.1 (scsi module), 2.20.2.6 (cmm module) +Older Version : 2.20.4.9 (scsi module), 2.20.2.6 (cmm module) + +1. Changes in Initialization to fix kdump failure. +Without this fix, megaraid driver either panics or fails to +initialize the adapter during the kdump's 2nd kernel boot +if there are pending commands or interrupts from other devices +sharing the same IRQ. + - Send SYNC command on loading. + This command clears the pending commands in the adapter + and re-initialize its internal RAID structure. + Release Date : Fri May 19 09:31:45 EST 2006 - Seokmann Ju <[email protected]> Current Version : 2.20.4.9 (scsi module), 2.20.2.6 (cmm module) Older Version : 2.20.4.8 (scsi module), 2.20.2.6 (cmm module)
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +108 -20
185 lines not on this page · raw message
drivers/scsi/megaraid/megaraid_mbox.h renamed from drivers/scsi/megaraid/megaraid_mbox.h 2006-12-28 09:56:04.000000000 -0800 +2 -2
@@ -21,8 +21,8 @@#include "megaraid_ioctl.h" -#define MEGARAID_VERSION "2.20.4.9" -#define MEGARAID_EXT_VERSION "(Release Date: Sun Jul 16 12:27:22 EST 2006)" +#define MEGARAID_VERSION "2.20.5.1" +#define MEGARAID_EXT_VERSION "(Release Date: Thu Nov 16 15:32:35 EST 2006)"/*
Documentation/scsi/ChangeLog.megaraid +13 -0
@@ -1,3 +1,16 @@ +Release Date : Thu Nov 16 15:32:35 EST 2006 - Sumant Patro <[email protected]> +Current Version : 2.20.5.1 (scsi module), 2.20.2.6 (cmm module) +Older Version : 2.20.4.9 (scsi module), 2.20.2.6 (cmm module) + +1. Changes in Initialization to fix kdump failure. +Without this fix, megaraid driver either panics or fails to +initialize the adapter during the kdump's 2nd kernel boot +if there are pending commands or interrupts from other devices +sharing the same IRQ. + - Send SYNC command on loading. + This command clears the pending commands in the adapter + and re-initialize its internal RAID structure. + Release Date : Fri May 19 09:31:45 EST 2006 - Seokmann Ju <[email protected]> Current Version : 2.20.4.9 (scsi module), 2.20.2.6 (cmm module) Older Version : 2.20.4.8 (scsi module), 2.20.2.6 (cmm module)
drivers/scsi/megaraid/megaraid_mbox.c +108 -20
185 lines not on this page · raw message
drivers/scsi/megaraid/megaraid_mbox.h +2 -2
@@ -21,8 +21,8 @@#include "megaraid_ioctl.h" -#define MEGARAID_VERSION "2.20.4.9" -#define MEGARAID_EXT_VERSION "(Release Date: Sun Jul 16 12:27:22 EST 2006)" +#define MEGARAID_VERSION "2.20.5.1" +#define MEGARAID_EXT_VERSION "(Release Date: Thu Nov 16 15:32:35 EST 2006)"/*
On Fri, 29 Dec 2006 08:02:17 -0800 Sumant Patro wrote:
See Documentation/SubmittingPatches:
Please include output of "diffstat -p1 -w70" so that we can easily see the scope of the changes.
and see Documentation/CodingStyle for comments below:
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 megaraid_init_mbox(adapter_t *adapter) · line 784
Quoted 9 lines
diff -uprN
linux-2.6.orig/drivers/scsi/megaraid/megaraid_mbox.clinux-2.6.new/drivers/scsi/megaraid/megaraid_mbox.cdrivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +2
-0@@ -779,6 +780,22 @@ megaraid_init_mbox(adapter_t *adapter) goto out_release_regions; } + // initialize the mutual exclusion lock for the mailbox + spin_lock_init(&raid_dev->mailbox_lock);
Linux uses /*...*/ C89-style comments, not // C99 comments.
Quoted 8 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +8
-0+ // allocate memory required for commands + if (megaraid_alloc_cmd_packets(adapter) != 0) { + goto out_iounmap; + } + + /* + * Issue SYNC cmd to flush the pending cmds in the adapter + * and initialize its internal state
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 megaraid_init_mbox(adapter_t *adapter)
Quoted 10 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +6
-1+ */ + + if (megaraid_mbox_fire_sync_cmd(adapter)) + con_log(CL_ANN, ("megaraid: sync cmd failed\n")); + // Product info if (megaraid_mbox_product_info(adapter) != 0) { - goto out_alloc_cmds; + goto out_free_irq;
Don't uses {} braces around 1-statement "blocks".
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 megaraid_init_mbox(adapter_t *adapter) · line 886
Quoted 6 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +1
-1@@ -875,7 +883,7 @@ megaraid_init_mbox(adapter_t *adapter) * accessed */ if (megaraid_sysfs_alloc_resources(adapter) != 0) { - goto out_alloc_cmds; + goto out_free_irq;
Ditto.
Quoted 48 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +41
-0} // Set the DMA mask to 64-bit. All supported controllers as capable of@@ -3380,6 +3388,86 @@ megaraid_mbox_flush_cache(adapter_t *ada /** + * megaraid_mbox_fire_sync_cmd - fire the sync cmd + * @param adapter : soft state for the controller + */ +static int +megaraid_mbox_fire_sync_cmd(adapter_t *adapter) +{ + mbox_t *mbox; + uint8_t raw_mbox[sizeof(mbox_t)]; + mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter); + mbox64_t *mbox64; + uint8_t status = 0; + int i; + uint32_t dword; + + mbox = (mbox_t *)raw_mbox; + + memset((caddr_t)raw_mbox, 0, sizeof(mbox_t)); + + raw_mbox[0] = 0xFF; + + mbox64 = raid_dev->mbox64; + mbox = raid_dev->mbox; + + /* + * Wait until mailbox is free + */ + if (megaraid_busywait_mbox(raid_dev) != 0) { + status = 1; + goto blocked_mailbox; + } + + /* + * Copy mailbox data into host structure + */ + memcpy((caddr_t)mbox, (caddr_t)raw_mbox, 16); + mbox->cmdid = 0xFE; + mbox->busy = 1; + mbox->poll = 0; + mbox->ack = 0; + mbox->numstatus = 0; + mbox->status = 0;
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 megaraid_mbox_flush_cache(adapter_t *ada · line 3441
Quoted 10 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +10
-0+ + wmb(); + WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1); + + // wait for maximum 1 min for status to post. + // If the Firmware SUPPORTS the ABOVE COMMAND, + // mbox->cmd will be set to 0 + // else + // the firmware will reject the command with + // mbox->numstatus set to 1
Don't use // comment style. Also, for multi-line comments in Linux, please use this preferred style:
/*
* This is the preferred style for multi-line
* comments in the Linux kernel source code.
* Please use it consistently.
*
* Description: A column of asterisks on the left side,
* with beginning and ending almost-blank lines. */
Thanks.
---
~Randy
Quoted 16 lines · Randy Dunlap
On Fri, 29 Dec 2006 08:02:17 -0800 Sumant Patro wrote:
See
Documentation/SubmittingPatches:
Please include output of "diffstat -p1 -w70" so that we can easily see the scope of the changes.and see
Documentation/CodingStylefor comments below:Quoted 7 lines
diff -uprN
linux-2.6.orig/drivers/scsi/megaraid/megaraid_mbox.clinux-2.6.new/drivers/scsi/megaraid/megaraid_mbox.cdrivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +0
-0@@ -779,6 +780,22 @@ megaraid_init_mbox(adapter_t *adapter) goto out_release_regions; }
Quoted 4 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 megaraid_init_mbox(adapter_t *adapter) · line 784
Quoted 2 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +2
-0+ // initialize the mutual exclusion lock for the mailbox + spin_lock_init(&raid_dev->mailbox_lock);Linux uses /*...*/ C89-style comments, not // C99 comments.
Randy
It is about time this absurd stipulation was dropped. Are there any C compilers that can compile the linux kernel and that don't accept both _standard_ comment styles?
Doug Gilbert
Quoted 22 lines · On Sat, 30 Dec 2006 09:31:38 -0500 Douglas Gilbert wrote:
Quoted 16 lines · Randy Dunlap
On Fri, 29 Dec 2006 08:02:17 -0800 Sumant Patro wrote:
See
Documentation/SubmittingPatches:
Please include output of "diffstat -p1 -w70" so that we can easily see the scope of the changes.and see
Documentation/CodingStylefor comments below:Quoted 7 lines
diff -uprN
linux-2.6.orig/drivers/scsi/megaraid/megaraid_mbox.clinux-2.6.new/drivers/scsi/megaraid/megaraid_mbox.cdrivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +0
-0@@ -779,6 +780,22 @@ megaraid_init_mbox(adapter_t *adapter) goto out_release_regions; }Quoted 4 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 megaraid_init_mbox(adapter_t *adapter) · line 784
Quoted 2 lines
drivers/scsi/megaraid/megaraid_mbox.c 2006-12-29 05:31:48.000000000 -0800 renamed from drivers/scsi/megaraid/megaraid_mbox.c 2006-12-28 09:56:04.000000000 -0800 +2
-0+ // initialize the mutual exclusion lock for the mailbox + spin_lock_init(&raid_dev->mailbox_lock);Linux uses /*...*/ C89-style comments, not // C99 comments.
Quoted 4 lines
Randy
It is about time this absurd stipulation was dropped. Are there any C compilers that can compile the linux kernel and that don't accept both _standard_ comment styles?
It's not a technical issue, it's just a style point.
---
~Randy