Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 2010 13:49:47 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 177177 for review
Message-ID:  <201004211349.o3LDnl1k021518@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@177177?ac=10

Change 177177 by mav@mav_mavtest on 2010/04/21 13:49:12

	Arm timeout for PIO commands.
	Fix crash on stray interrupt.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/dev/mvs/mvs.c#5 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/dev/mvs/mvs.c#5 (text+ko) ====

@@ -306,7 +306,7 @@
 mvs_setup_interrupt(device_t dev)
 {
 	struct mvs_controller *ctlr = device_get_softc(dev);
-	int msi = 0;
+	int msi = 1;
 
 	/* Process hints. */
 	resource_int_value(device_get_name(dev),
@@ -352,7 +352,7 @@
 	u_int32_t ic, aic;
 
 	ic = ATA_INL(ctlr->r_mem, CHIP_MIC);
-//device_printf(ctlr->dev, "irq MIC:%08x\n", ic);
+device_printf(ctlr->dev, "irq MIC:%08x\n", ic);
 	if (ic & IC_ALL_PORTS_COAL_DONE)
 		ATA_OUTL(ctlr->r_mem, CHIP_MIC, ~IC_ALL_PORTS_COAL_DONE);
 	for (p = 0; p < ctlr->channels; p++) {
@@ -1106,7 +1106,7 @@
 	struct mvs_slot *slot = &ch->slot[0]; /* PIO is always in slot 0. */
 	union ccb *ccb = slot->ccb;
 	enum mvs_err_type et = MVS_ERR_NONE;
-	int port = ccb->ccb_h.target_id & 0x0f;
+	int port;
 	u_int length;
 	uint8_t status, ireason;
 
@@ -1115,9 +1115,10 @@
 //	device_printf(dev, "Legacy intr status %02x\n",
 //	    status);
 	if (slot->state < MVS_SLOT_RUNNING) {
-//	    device_printf(dev, "Stray irq\n");
+	    device_printf(dev, "Stray irq\n");
 	    return;
 	}
+	port = ccb->ccb_h.target_id & 0x0f;
 	/* Wait a bit for late !BUSY status update. */
 	if (status & ATA_S_BUSY) {
 		DELAY(100);
@@ -1582,6 +1583,9 @@
 			ch->fake_busy = 1;
 		DELAY(10);
 	}
+	/* Start command execution timeout */
+	callout_reset(&slot->timeout, (int)ccb->ccb_h.timeout * hz / 1000,
+	    (timeout_t*)mvs_timeout, slot);
 }
 
 /* Locked by busdma engine. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004211349.o3LDnl1k021518>