summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2004-08-13 23:38:55 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2004-08-13 23:38:55 +0000
commit6230a02147b92e9f7ccc878a8af3016910aea345 (patch)
treee563464f15ccdf2f59cad8eddcba83451bbeedfc
parentf3936768351d58355a1a0f35a1a36ea9d6b7d04b (diff)
Fix issue with auto request sense handling for both ahc and ahd.
Restore hppa functionality, add sgi functionality for ahc. ok deraadt@, plus marco@, mickey@, pefo@ for various bits.
-rw-r--r--sys/dev/ic/aic79xx_openbsd.c3
-rw-r--r--sys/dev/ic/aic7xxx.c45
-rw-r--r--sys/dev/ic/aic7xxx_openbsd.c3
-rw-r--r--sys/dev/pci/ahc_pci.c19
4 files changed, 58 insertions, 12 deletions
diff --git a/sys/dev/ic/aic79xx_openbsd.c b/sys/dev/ic/aic79xx_openbsd.c
index cff4c967f9f..c527b5916a7 100644
--- a/sys/dev/ic/aic79xx_openbsd.c
+++ b/sys/dev/ic/aic79xx_openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic79xx_openbsd.c,v 1.6 2004/08/06 01:29:19 marco Exp $ */
+/* $OpenBSD: aic79xx_openbsd.c,v 1.7 2004/08/13 23:38:54 krw Exp $ */
/*
* Bus independent OpenBSD shim for the aic79xx based Adaptec SCSI controllers
*
@@ -195,6 +195,7 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
/* Translate the CAM status code to a SCSI error code. */
switch (xs->error) {
+ case CAM_SCSI_STATUS_ERROR:
case CAM_REQ_INPROG:
case CAM_REQ_CMP:
switch (xs->status) {
diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c
index 11e5fc0b325..52496ee1724 100644
--- a/sys/dev/ic/aic7xxx.c
+++ b/sys/dev/ic/aic7xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx.c,v 1.58 2004/08/01 01:36:23 krw Exp $ */
+/* $OpenBSD: aic7xxx.c,v 1.59 2004/08/13 23:38:54 krw Exp $ */
/* $NetBSD: aic7xxx.c,v 1.108 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -40,7 +40,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aic7xxx.c,v 1.58 2004/08/01 01:36:23 krw Exp $
+ * $Id: aic7xxx.c,v 1.59 2004/08/13 23:38:54 krw Exp $
*/
/*
* Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003
@@ -332,6 +332,33 @@ ahc_run_qoutfifo(struct ahc_softc *ahc)
while (ahc->qoutfifo[ahc->qoutfifonext] != SCB_LIST_NULL) {
scb_index = ahc->qoutfifo[ahc->qoutfifonext];
+#ifdef __sgi__
+ if ((ahc->qoutfifonext & 0x1f) == 0x1f) {
+ u_int modnext;
+ u_int32_t *nextp;
+
+ /*
+ * Clear 32 bytes of QOUTFIFO at a time
+ * so that we don't clobber an incoming
+ * byte DMA to the array on architectures
+ * non coherent caches.
+ */
+ modnext = ahc->qoutfifonext & ~0x1f;
+ nextp = (uint32_t *)(&ahc->qoutfifo[modnext]);
+ *nextp++ = 0xFFFFFFFFUL;
+ *nextp++ = 0xFFFFFFFFUL;
+ *nextp++ = 0xFFFFFFFFUL;
+ *nextp++ = 0xFFFFFFFFUL;
+ *nextp++ = 0xFFFFFFFFUL;
+ *nextp++ = 0xFFFFFFFFUL;
+ *nextp++ = 0xFFFFFFFFUL;
+ *nextp++ = 0xFFFFFFFFUL;
+ ahc_dmamap_sync(ahc, ahc->parent_dmat /*shared_data_dmat*/,
+ ahc->shared_data_dmamap,
+ /*offset*/modnext, /*len*/32,
+ BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+ }
+#else
if ((ahc->qoutfifonext & 0x03) == 0x03) {
u_int modnext;
@@ -349,6 +376,7 @@ ahc_run_qoutfifo(struct ahc_softc *ahc)
/*offset*/modnext, /*len*/4,
BUS_DMASYNC_PREREAD);
}
+#endif
ahc->qoutfifonext++;
scb = ahc_lookup_scb(ahc, scb_index);
@@ -4538,8 +4566,11 @@ ahc_chip_init(struct ahc_softc *ahc)
/* All of our queues are empty */
for (i = 0; i < 256; i++)
ahc->qoutfifo[i] = SCB_LIST_NULL;
+#ifdef __sgi__
+ ahc_sync_qoutfifo(ahc, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+#else
ahc_sync_qoutfifo(ahc, BUS_DMASYNC_PREREAD);
-
+#endif
for (i = 0; i < 256; i++)
ahc->qinfifo[i] = SCB_LIST_NULL;
@@ -4752,7 +4783,11 @@ ahc_init(struct ahc_softc *ahc)
/* All target command blocks start out invalid. */
for (i = 0; i < AHC_TMODE_CMDS; i++)
ahc->targetcmds[i].cmd_valid = 0;
+#ifdef __sgi__
+ ahc_sync_tqinfifo(ahc, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+#else
ahc_sync_tqinfifo(ahc, BUS_DMASYNC_PREREAD);
+#endif
ahc->qoutfifo = (uint8_t *)&ahc->targetcmds[256];
}
ahc->qinfifo = &ahc->qoutfifo[256];
@@ -7206,7 +7241,11 @@ ahc_run_tqinfifo(struct ahc_softc *ahc, int paused)
ahc->shared_data_dmamap,
ahc_targetcmd_offset(ahc, ahc->tqinfifonext),
sizeof(struct target_cmd),
+#ifdef __sgi__
+ BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+#else
BUS_DMASYNC_PREREAD);
+#endif
ahc->tqinfifonext++;
/*
diff --git a/sys/dev/ic/aic7xxx_openbsd.c b/sys/dev/ic/aic7xxx_openbsd.c
index 1e18c4c3fe4..08d48fd875d 100644
--- a/sys/dev/ic/aic7xxx_openbsd.c
+++ b/sys/dev/ic/aic7xxx_openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx_openbsd.c,v 1.22 2004/08/01 01:36:23 krw Exp $ */
+/* $OpenBSD: aic7xxx_openbsd.c,v 1.23 2004/08/13 23:38:54 krw Exp $ */
/* $NetBSD: aic7xxx_osm.c,v 1.14 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -235,6 +235,7 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)
/* Translate the CAM status code to a SCSI error code. */
switch (xs->error) {
+ case CAM_SCSI_STATUS_ERROR:
case CAM_REQ_INPROG:
case CAM_REQ_CMP:
switch (xs->status) {
diff --git a/sys/dev/pci/ahc_pci.c b/sys/dev/pci/ahc_pci.c
index b6aec4bdb9f..28d20bd9e14 100644
--- a/sys/dev/pci/ahc_pci.c
+++ b/sys/dev/pci/ahc_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahc_pci.c,v 1.44 2004/08/01 01:36:24 krw Exp $ */
+/* $OpenBSD: ahc_pci.c,v 1.45 2004/08/13 23:38:54 krw Exp $ */
/*
* Product specific probe and attach routines for:
* 3940, 2940, aic7895, aic7890, aic7880,
@@ -40,7 +40,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: ahc_pci.c,v 1.44 2004/08/01 01:36:24 krw Exp $
+ * $Id: ahc_pci.c,v 1.45 2004/08/13 23:38:54 krw Exp $
*
* //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $
*
@@ -75,6 +75,9 @@
#include <dev/ic/smc93cx6var.h>
+#ifdef __hppa__
+#define AHC_ALLOW_MEMIO
+#endif
static __inline uint64_t
ahc_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
@@ -713,10 +716,11 @@ ahc_pci_attach(parent, self, aux)
uint32_t devconfig;
int error;
pcireg_t subid;
- int ioh_valid, memh_valid;
+ int ioh_valid;
bus_space_tag_t st, iot;
bus_space_handle_t sh, ioh;
#ifdef AHC_ALLOW_MEMIO
+ int memh_valid;
bus_space_tag_t memt;
bus_space_handle_t memh;
pcireg_t memtype;
@@ -767,9 +771,10 @@ ahc_pci_attach(parent, self, aux)
if (error != 0)
return;
- ioh_valid = memh_valid = 0;
+ ioh_valid = 0;
#ifdef AHC_ALLOW_MEMIO
+ memh_valid = 0;
memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, AHC_PCI_MEMADDR);
switch (memtype) {
case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT:
@@ -780,10 +785,10 @@ ahc_pci_attach(parent, self, aux)
default:
memh_valid = 0;
}
+ if (memh_valid == 0)
#endif
- ioh_valid = (pci_mapreg_map(pa, AHC_PCI_IOADDR,
- PCI_MAPREG_TYPE_IO, 0, &iot,
- &ioh, NULL, NULL, 0) == 0);
+ ioh_valid = (pci_mapreg_map(pa, AHC_PCI_IOADDR,
+ PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, NULL, NULL, 0) == 0);
#if 0
printf("%s: mem mapping: memt 0x%x, memh 0x%x, iot 0x%x, ioh 0x%lx\n",
ahc_name(ahc), memt, (u_int32_t)memh, (u_int32_t)iot, ioh);