Module Name:    src
Committed By:   jakllsch
Date:           Sat Jul  4 20:57:15 UTC 2009

Modified Files:
        src/sys/dev/ata: satafis_subr.c satafisvar.h
        src/sys/dev/ic: siisata.c siisatareg.h

Log Message:
Further corrections for siisata.

Reset ch_status and ch_error at the beginning of any operation.

The chip only writes the RDH FIS to the SRAM when the error bit is
set in a RDH FIS (per the datasheet).  Thus, satafis_sdb_parse() is
replaced with satafis_rhd_parse().  A valid FIS type field seems to
not be written to the SRAM, so don't bother checking it for the
correct magic.

Additionally, append 2009 to copyright year set, and remove
obsolete CVS Id lines from when this was in my repository.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ata/satafis_subr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ata/satafisvar.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/siisata.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/siisatareg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ata/satafis_subr.c
diff -u src/sys/dev/ata/satafis_subr.c:1.2 src/sys/dev/ata/satafis_subr.c:1.3
--- src/sys/dev/ata/satafis_subr.c:1.2	Wed Jun 17 03:55:04 2009
+++ src/sys/dev/ata/satafis_subr.c	Sat Jul  4 20:57:15 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: satafis_subr.c,v 1.2 2009/06/17 03:55:04 jakllsch Exp $ */
+/* $NetBSD: satafis_subr.c,v 1.3 2009/07/04 20:57:15 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2009 Jonathan A. Kollasch.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: satafis_subr.c,v 1.2 2009/06/17 03:55:04 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: satafis_subr.c,v 1.3 2009/07/04 20:57:15 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -148,11 +148,14 @@
 #endif /* NATAPIBUS */
 
 void
-satafis_sdb_parse(struct ata_channel *chp, uint8_t *fis)
+satafis_rdh_parse(struct ata_channel *chp, uint8_t *fis)
 {
-	KASSERT(fis[fis_type] != SDB_FISTYPE);
-	chp->ch_status = fis[sdb_status];
-	chp->ch_error = fis[sdb_error];
+#if 0
+	/* siisata doesn't do enough for this to work */
+	KASSERT(fis[fis_type] == RDH_FISTYPE);
+#endif
+	chp->ch_status = fis[rdh_status];
+	chp->ch_error = fis[rdh_error];
 
 	return;
 }

Index: src/sys/dev/ata/satafisvar.h
diff -u src/sys/dev/ata/satafisvar.h:1.1 src/sys/dev/ata/satafisvar.h:1.2
--- src/sys/dev/ata/satafisvar.h:1.1	Wed Jun 17 03:07:51 2009
+++ src/sys/dev/ata/satafisvar.h	Sat Jul  4 20:57:15 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: satafisvar.h,v 1.1 2009/06/17 03:07:51 jakllsch Exp $ */
+/* $NetBSD: satafisvar.h,v 1.2 2009/07/04 20:57:15 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2009 Jonathan A. Kollasch.
@@ -33,6 +33,6 @@
 void satafis_rhd_construct_cmd(struct ata_command *, uint8_t *);
 void satafis_rhd_construct_bio(struct ata_xfer *, uint8_t *);
 void satafis_rhd_construct_atapi(struct ata_xfer *, uint8_t *);
-void satafis_sdb_parse(struct ata_channel *, uint8_t *);
+void satafis_rdh_parse(struct ata_channel *, uint8_t *);
 
 #endif /* _DEV_ATA_FISVAR_H_ */

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.6 src/sys/dev/ic/siisata.c:1.7
--- src/sys/dev/ic/siisata.c:1.6	Sat Jun 27 21:04:47 2009
+++ src/sys/dev/ic/siisata.c	Sat Jul  4 20:57:15 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.6 2009/06/27 21:04:47 jakllsch Exp $ */
+/* $NetBSD: siisata.c,v 1.7 2009/07/04 20:57:15 jakllsch Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -64,7 +64,7 @@
  */
 
 /*-
- * Copyright (c) 2007, 2008 Jonathan A. Kollasch.
+ * Copyright (c) 2007, 2008, 2009 Jonathan A. Kollasch.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -479,13 +479,13 @@
 
 		ec = PRREAD(sc, PRX(chp->ch_channel, PRO_PCE));
 		if (ec <= PR_PCE_DATAFISERROR) {
-			if (ec != PR_PCE_DATAFISERROR) {
+			if (ec == PR_PCE_DEVICEERROR) {
 				/* read in specific information about error */
 				prbfis = bus_space_read_stream_4(
 				    sc->sc_prt, sc->sc_prh,
 		    		    PRSX(chp->ch_channel, slot, PRSO_FIS));
 				/* set ch_status and ch_error */
-				satafis_sdb_parse(chp, (uint8_t *)&prbfis);
+				satafis_rdh_parse(chp, (uint8_t *)&prbfis);
 			}
 			siisata_reinit_port(chp);
 		} else {
@@ -774,6 +774,9 @@
 	SIISATA_DEBUG_PRINT(("%s: %s port %d, slot %d\n",
 	    SIISATANAME(sc), __func__, chp->ch_channel, slot), DEBUG_FUNCS);
 
+	chp->ch_status = 0;
+	chp->ch_error = 0;
+
 	prb = schp->sch_prb[slot];
 	memset(prb, 0, sizeof(struct siisata_prb));
 
@@ -978,6 +981,9 @@
 	    SIISATANAME(sc), __func__, chp->ch_channel, slot),
 	    DEBUG_FUNCS);
 
+	chp->ch_status = 0;
+	chp->ch_error = 0;
+
 	prb = schp->sch_prb[slot];
 	memset(prb, 0, sizeof(struct siisata_prb));
 
@@ -1515,6 +1521,9 @@
 	    chp->ch_drive[xfer->c_drive].drive, sc_xfer->xs_control),
 	    DEBUG_XFERS);
 
+	chp->ch_status = 0;
+	chp->ch_error = 0;
+
 	prbp = schp->sch_prb[slot];
 	memset(prbp, 0, sizeof(struct siisata_prb));
 

Index: src/sys/dev/ic/siisatareg.h
diff -u src/sys/dev/ic/siisatareg.h:1.3 src/sys/dev/ic/siisatareg.h:1.4
--- src/sys/dev/ic/siisatareg.h:1.3	Wed Jun 17 04:37:57 2009
+++ src/sys/dev/ic/siisatareg.h	Sat Jul  4 20:57:15 2009
@@ -1,8 +1,7 @@
-/* $NetBSD: siisatareg.h,v 1.3 2009/06/17 04:37:57 jakllsch Exp $ */
-/* Id: siisatareg.h,v 1.10 2008/05/21 15:51:36 jakllsch Exp  */
+/* $NetBSD: siisatareg.h,v 1.4 2009/07/04 20:57:15 jakllsch Exp $ */
 
 /*-
- * Copyright (c) 2007, 2008 Jonathan A. Kollasch.
+ * Copyright (c) 2007, 2008, 2009 Jonathan A. Kollasch.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Reply via email to