public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takao Indoh <indou.takao@soft.fujitsu.com>
To: linux-kernel@vger.kernel.org, lkdump-develop@lists.sourceforge.net
Subject: [ANNOUNCE 7/7] Diskdump 1.0 Release
Date: Mon, 29 Nov 2004 19:48:41 +0900	[thread overview]
Message-ID: <41C4D600FD8FDFindou.takao@soft.fujitsu.com> (raw)
In-Reply-To: <3AC4D5FF1413D5indou.takao@soft.fujitsu.com>

This is a patch for IBM Power Linux RAID driver.


diff -Nur linux-2.6.9.org/drivers/scsi/ipr.c linux-2.6.9/drivers/scsi/ipr.c
--- linux-2.6.9.org/drivers/scsi/ipr.c	2004-10-19 06:55:36.000000000 +0900
+++ linux-2.6.9/drivers/scsi/ipr.c	2004-11-24 19:20:56.889376282 +0900
@@ -71,6 +71,7 @@
 #include <linux/firmware.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
+#include <linux/diskdump.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/processor.h>
@@ -1264,7 +1265,13 @@
 		ipr_initiate_ioa_reset(ioa_cfg, shutdown_type);
 
 	spin_unlock_irq(ioa_cfg->host->host_lock);
-	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+	if (crashdump_mode()) {
+		while (ioa_cfg->in_reset_reload) {
+			diskdump_update();
+			diskdump_mdelay(1);
+		}
+	} else
+		wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
 	spin_lock_irq(ioa_cfg->host->host_lock);
 
 	/* If we got hit with a host reset while we were already resetting
@@ -3288,6 +3295,80 @@
 }
 
 /**
+ * ipr_poll - Check for command completion
+ * @sdev:	the SCSI device to which the command was queued
+ *
+ * This function is called after the diskdump subsystem has queued an
+ * I/O command to the indicated device.  Since interrupts are disabled,
+ * this function is called periodically to detect command completion.
+ * To report completion, ipr_cmd->done() sets a value that our caller
+ * can monitor.
+ **/
+static void ipr_poll(struct scsi_device *sdev)
+{
+	struct ipr_ioa_cfg *ioa_cfg =
+		(struct ipr_ioa_cfg *) sdev->host->hostdata;
+	u16 cmd_index;
+	struct ipr_cmnd *ipr_cmd;
+	unsigned long lock_flags = 0;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	while ((be32_to_cpu(*ioa_cfg->hrrq_curr) & IPR_HRRQ_TOGGLE_BIT) ==
+	       ioa_cfg->toggle_bit) {
+		cmd_index = (be32_to_cpu(*ioa_cfg->hrrq_curr) &
+			IPR_HRRQ_REQ_RESP_HANDLE_MASK) >> IPR_HRRQ_REQ_RESP_HANDLE_SHIFT;
+
+		if (unlikely(cmd_index >= IPR_NUM_CMD_BLKS)) {
+			/* FIXME: Need to abort the diskdump. */
+			panic("Command index %u out of range in %s\n",
+				cmd_index, __FUNCTION__);
+			/*NOTREACHED*/
+		}
+
+		ipr_cmd = ioa_cfg->ipr_cmnd_list[cmd_index];
+		list_del(&ipr_cmd->queue);
+		del_timer(&ipr_cmd->timer);
+		ipr_cmd->done(ipr_cmd);
+
+		if (ioa_cfg->hrrq_curr < ioa_cfg->hrrq_end) {
+			ioa_cfg->hrrq_curr++;
+		} else {
+			ioa_cfg->hrrq_curr = ioa_cfg->hrrq_start;
+			ioa_cfg->toggle_bit ^= 1u;
+		}
+	}
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+}
+
+/**
+ * ipr_sanity_check - Verify that SCSI device can receive dump
+ * @sdev:	the SCSI device
+ *
+ * Called by mid-layer diskdump sanity-check function to determine
+ * whether the indicated device is operational.  Caller has already
+ * verified that scsi_device_online(device) is true.
+ *
+ * Return value:
+ *	0 for a good device, < 0 for a bad one
+ */
+static int ipr_sanity_check(struct scsi_device *sdev)
+{
+	struct ipr_ioa_cfg *ioa_cfg;
+	if (!sdev->host) {
+		return -ENXIO;
+	}
+	ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata;
+	if (!ioa_cfg) {
+		return -ENXIO;
+	}
+	if (ioa_cfg->ioa_is_dead) {
+		return -EIO;
+	}
+	return 0;
+}
+
+/**
  * ipr_build_ioadl - Build a scatter/gather list and map the buffer
  * @ioa_cfg:	ioa config struct
  * @ipr_cmd:	ipr command struct
@@ -3967,7 +4048,9 @@
 	.use_clustering = ENABLE_CLUSTERING,
 	.shost_attrs = ipr_ioa_attrs,
 	.sdev_attrs = ipr_dev_attrs,
-	.proc_name = IPR_NAME
+	.proc_name = IPR_NAME,
+	.dump_sanity_check = ipr_sanity_check,
+	.dump_poll = ipr_poll
 };
 
 #ifdef CONFIG_PPC_PSERIES

  parent reply	other threads:[~2004-11-29 10:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-29 10:35 [ANNOUNCE 0/7] Diskdump 1.0 Release Takao Indoh
2004-11-29 10:37 ` [ANNOUNCE 1/7] " Takao Indoh
2004-11-30  3:23   ` Rusty Russell
2004-12-01  0:50     ` Takao Indoh
2004-11-29 10:39 ` [ANNOUNCE 2/7] " Takao Indoh
2004-11-29 10:41 ` [ANNOUNCE 3/7] " Takao Indoh
2004-11-30  3:24   ` Rusty Russell
2004-11-29 10:43 ` [ANNOUNCE 4/7] " Takao Indoh
2004-11-29 10:45 ` [ANNOUNCE 5/7] " Takao Indoh
2004-11-29 10:47 ` [ANNOUNCE 6/7] " Takao Indoh
2004-11-29 10:48 ` Takao Indoh [this message]
2004-11-29 11:19 ` [ANNOUNCE 0/7] " Arjan van de Ven
2004-11-29 12:34   ` [lkdump-develop] " Takao Indoh
2004-11-29 12:45     ` Arjan van de Ven
2004-11-30  1:15       ` Takao Indoh
2004-11-30 12:35         ` Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41C4D600FD8FDFindou.takao@soft.fujitsu.com \
    --to=indou.takao@soft.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkdump-develop@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox