Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Dec 2009 13:32:49 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r200294 - stable/8/sys/dev/siis
Message-ID:  <200912091332.nB9DWnuS026667@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Dec  9 13:32:49 2009
New Revision: 200294
URL: http://svn.freebsd.org/changeset/base/200294

Log:
  MFC r200223:
  Explicitly acknowledge MSI completion, as required by SiI3124 datasheet.
  It makes MSI working there. Later (and cheaper) PCIe chips (3132/3531)
  still randomly crashing system in few seconds of high MSI rates, generating
  something inaporopriate, like NMI or "Fatal trap 30".

Modified:
  stable/8/sys/dev/siis/siis.c
  stable/8/sys/dev/siis/siis.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/siis/siis.c
==============================================================================
--- stable/8/sys/dev/siis/siis.c	Wed Dec  9 13:30:11 2009	(r200293)
+++ stable/8/sys/dev/siis/siis.c	Wed Dec  9 13:32:49 2009	(r200294)
@@ -143,6 +143,7 @@ siis_attach(device_t dev)
 	if (!(ctlr->r_gmem = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
 	    &ctlr->r_grid, RF_ACTIVE)))
 		return (ENXIO);
+	ctlr->gctl = ATA_INL(ctlr->r_gmem, SIIS_GCTL);
 	/* Channels memory */
 	ctlr->r_rid = PCIR_BAR(2);
 	if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
@@ -221,7 +222,8 @@ siis_suspend(device_t dev)
 
 	bus_generic_suspend(dev);
 	/* Put controller into reset state. */
-	ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, SIIS_GCTL_GRESET);
+	ctlr->gctl |= SIIS_GCTL_GRESET;
+	ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl);
 	return 0;
 }
 
@@ -231,10 +233,13 @@ siis_resume(device_t dev)
 	struct siis_controller *ctlr = device_get_softc(dev);
 
 	/* Put controller into reset state. */
-	ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, SIIS_GCTL_GRESET);
+	ctlr->gctl |= SIIS_GCTL_GRESET;
+	ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl);
 	DELAY(10000);
 	/* Get controller out of reset state and enable port interrupts. */
-	ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, 0x0000000f);
+	ctlr->gctl &= ~(SIIS_GCTL_GRESET | SIIS_GCTL_I2C_IE);
+	ctlr->gctl |= 0x0000000f;
+	ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl);
 	return (bus_generic_resume(dev));
 }
 
@@ -288,6 +293,11 @@ siis_intr(void *data)
 			ctlr->interrupt[unit].function(arg);
 		}
 	}
+	/* Acknowledge interrupt, if MSI enabled. */
+	if (ctlr->irq.r_irq_rid) {
+		ATA_OUTL(ctlr->r_gmem, SIIS_GCTL,
+		    ctlr->gctl | SIIS_GCTL_MSIACK);
+	}
 }
 
 static struct resource *

Modified: stable/8/sys/dev/siis/siis.h
==============================================================================
--- stable/8/sys/dev/siis/siis.h	Wed Dec  9 13:30:11 2009	(r200293)
+++ stable/8/sys/dev/siis/siis.h	Wed Dec  9 13:32:49 2009	(r200294)
@@ -403,6 +403,7 @@ struct siis_controller {
 	} irq;
 	int			quirks;
 	int			channels;
+	uint32_t		gctl;
 	struct {
 		void			(*function)(void *);
 		void			*argument;



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