Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Dec 2009 13:26:51 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 171490 for review
Message-ID:  <200912071326.nB7DQpTj013036@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=171490

Change 171490 by mav@mav_mavtest on 2009/12/07 13:25:55

	SiI3124 has no SNotification register. Handle Asynchronous
	Notifications there as good as possible without it.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#27 edit
.. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.h#11 edit

Differences ...

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

@@ -93,15 +93,17 @@
 	uint32_t	id;
 	const char	*name;
 	int		ports;
+	int		quirks;
+#define SIIS_Q_SNTF	1
 } siis_ids[] = {
-	{0x31241095,	"SiI3124",	4},
-	{0x31248086,	"SiI3124",	4},
-	{0x31321095,	"SiI3132",	2},
-	{0x02421095,	"SiI3132",	2},
-	{0x02441095,	"SiI3132",	2},
-	{0x31311095,	"SiI3131",	1},
-	{0x35311095,	"SiI3531",	1},
-	{0,		NULL,		0}
+	{0x31241095,	"SiI3124",	4,	0},
+	{0x31248086,	"SiI3124",	4,	0},
+	{0x31321095,	"SiI3132",	2,	SIIS_Q_SNTF},
+	{0x02421095,	"SiI3132",	2,	SIIS_Q_SNTF},
+	{0x02441095,	"SiI3132",	2,	SIIS_Q_SNTF},
+	{0x31311095,	"SiI3131",	1,	SIIS_Q_SNTF},
+	{0x35311095,	"SiI3531",	1,	SIIS_Q_SNTF},
+	{0,		NULL,		0,	0}
 };
 
 static int
@@ -113,7 +115,7 @@
 
 	for (i = 0; siis_ids[i].id != 0; i++) {
 		if (siis_ids[i].id == devid) {
-			snprintf(buf, sizeof(buf), "%s SATA2 controller",
+			snprintf(buf, sizeof(buf), "%s SATA controller",
 			    siis_ids[i].name);
 			device_set_desc_copy(dev, buf);
 			return (BUS_PROBE_VENDOR);
@@ -130,11 +132,12 @@
 	device_t child;
 	int	error, i, unit;
 
+	ctlr->dev = dev;
 	for (i = 0; siis_ids[i].id != 0; i++) {
 		if (siis_ids[i].id == devid)
 			break;
 	}
-	ctlr->dev = dev;
+	ctlr->quirks = siis_ids[i].quirks;
 	/* Global memory */
 	ctlr->r_grid = PCIR_BAR(0);
 	if (!(ctlr->r_gmem = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
@@ -413,12 +416,14 @@
 static int
 siis_ch_attach(device_t dev)
 {
+	struct siis_controller *ctlr = device_get_softc(device_get_parent(dev));
 	struct siis_channel *ch = device_get_softc(dev);
 	struct cam_devq *devq;
 	int rid, error, i, sata_rev = 0;
 
 	ch->dev = dev;
 	ch->unit = (intptr_t)device_get_ivars(dev);
+	ch->quirks = ctlr->quirks;
 	resource_int_value(device_get_name(dev),
 	    device_get_unit(dev), "pm_level", &ch->pm_level);
 	resource_int_value(device_get_name(dev),
@@ -680,8 +685,16 @@
 	u_int32_t status;
 	int i;
 
-	status = ATA_INL(ch->r_mem, SIIS_P_SNTF);
-	ATA_OUTL(ch->r_mem, SIIS_P_SNTF, status);
+	if (ch->quirks & SIIS_Q_SNTF) {
+		status = ATA_INL(ch->r_mem, SIIS_P_SNTF);
+		ATA_OUTL(ch->r_mem, SIIS_P_SNTF, status);
+	} else {
+		/*
+		 * Without SNTF we have no idea which device sent notification.
+		 * If PMP is connected, assume it, else - device.
+		 */
+		status = (ch->pm_present) ? 0x8000 : 0x0001;
+	}
 	if (bootverbose)
 		device_printf(dev, "SNTF 0x%04x\n", status);
 	for (i = 0; i < 16; i++) {

==== //depot/projects/scottl-camlock/src/sys/dev/siis/siis.h#11 (text+ko) ====

@@ -363,6 +363,7 @@
 	struct ata_dma		dma;            /* DMA data */
 	struct cam_sim		*sim;
 	struct cam_path		*path;
+	int			quirks;
 	int			pm_level;	/* power management level */
 
 	struct siis_slot	slot[SIIS_MAX_SLOTS];
@@ -400,6 +401,7 @@
 		void			*handle;
 		int			r_irq_rid;
 	} irq;
+	int			quirks;
 	int			channels;
 	struct {
 		void			(*function)(void *);



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