summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/siop.c70
-rw-r--r--sys/dev/ic/siop_common.c13
-rw-r--r--sys/dev/ic/siopvar_common.h34
-rw-r--r--sys/dev/microcode/siop/siop.out113
-rw-r--r--sys/dev/microcode/siop/siop.ss16
5 files changed, 67 insertions, 179 deletions
diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c
index 87379103d33..e801d8e1294 100644
--- a/sys/dev/ic/siop.c
+++ b/sys/dev/ic/siop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop.c,v 1.27 2003/06/28 22:16:55 krw Exp $ */
+/* $OpenBSD: siop.c,v 1.28 2003/07/01 17:15:06 krw Exp $ */
/* $NetBSD: siop.c,v 1.65 2002/11/08 22:04:41 bouyer Exp $ */
/*
@@ -490,6 +490,7 @@ siop_intr(v)
if ((sist & SIST0_MA) && need_reset == 0) {
if (siop_cmd) {
int scratcha0;
+ /* XXX Why read DSTAT again? */
dstat = bus_space_read_1(sc->sc_c.sc_rt,
sc->sc_c.sc_rh, SIOP_DSTAT);
/*
@@ -1082,26 +1083,19 @@ siop_scsicmd_end(siop_cmd)
BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_data);
}
- bus_dmamap_unload(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_cmd);
if (siop_cmd->cmd_c.status == CMDST_SENSE) {
/* issue a request sense for this target */
+ struct scsi_sense *cmd = (struct scsi_sense *)&siop_cmd->cmd_c.siop_tables->xscmd;
int error;
- siop_cmd->cmd_c.rs_cmd.opcode = REQUEST_SENSE;
- siop_cmd->cmd_c.rs_cmd.byte2 = xs->sc_link->lun << 5;
- siop_cmd->cmd_c.rs_cmd.unused[0] = siop_cmd->cmd_c.rs_cmd.unused[1] = 0;
- siop_cmd->cmd_c.rs_cmd.length = sizeof(struct scsi_sense_data);
- siop_cmd->cmd_c.rs_cmd.control = 0;
+ bzero(cmd, sizeof(*cmd));
+ siop_cmd->cmd_c.siop_tables->cmd.count =
+ htole32(sizeof(struct scsi_sense));
+ cmd->opcode = REQUEST_SENSE;
+ cmd->byte2 = xs->sc_link->lun << 5;
+ cmd->unused[0] = cmd->unused[1] = 0;
+ cmd->length = sizeof(struct scsi_sense_data);
+ cmd->control = 0;
siop_cmd->cmd_c.flags &= ~CMDFL_TAG;
- error = bus_dmamap_load(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_cmd,
- &siop_cmd->cmd_c.rs_cmd, sizeof(struct scsi_sense),
- NULL, BUS_DMA_NOWAIT);
- if (error) {
- printf("%s: unable to load cmd DMA map "
- "(for SENSE): %d\n",
- sc->sc_c.sc_dev.dv_xname, error);
- xs->error = XS_DRIVER_STUFFUP;
- goto out;
- }
error = bus_dmamap_load(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_data,
&xs->sense, sizeof(struct scsi_sense_data),
NULL, BUS_DMA_NOWAIT);
@@ -1110,15 +1104,11 @@ siop_scsicmd_end(siop_cmd)
"(for SENSE): %d\n",
sc->sc_c.sc_dev.dv_xname, error);
xs->error = XS_DRIVER_STUFFUP;
- bus_dmamap_unload(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_cmd);
goto out;
}
bus_dmamap_sync(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_data,
0, siop_cmd->cmd_c.dmamap_data->dm_mapsize,
BUS_DMASYNC_PREREAD);
- bus_dmamap_sync(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_cmd,
- 0, siop_cmd->cmd_c.dmamap_cmd->dm_mapsize,
- BUS_DMASYNC_PREWRITE);
siop_setuptables(&siop_cmd->cmd_c);
siop_table_sync(siop_cmd, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -1270,7 +1260,8 @@ siop_handle_reset(sc)
(siop_cmd->cmd_c.flags & CMDFL_TIMEOUT)
? XS_TIMEOUT : XS_RESET;
siop_cmd->cmd_c.xs->status = SCSI_SIOP_NOCHECK;
- printf("cmd %p (status %d) reset ",
+ sc_print_addr(siop_cmd->cmd_c.xs->sc_link);
+ printf("cmd %p (status %d) reset",
siop_cmd, siop_cmd->cmd_c.status);
if (siop_cmd->cmd_c.status == CMDST_SENSE ||
siop_cmd->cmd_c.status == CMDST_SENSE_ACTIVE)
@@ -1373,17 +1364,12 @@ siop_scsicmd(xs)
siop_cmd->cmd_c.flags = 0;
siop_cmd->cmd_c.status = CMDST_READY;
+ bzero(&siop_cmd->cmd_c.siop_tables->xscmd,
+ sizeof(siop_cmd->cmd_c.siop_tables->xscmd));
+ bcopy(xs->cmd, &siop_cmd->cmd_c.siop_tables->xscmd, xs->cmdlen);
+ siop_cmd->cmd_c.siop_tables->cmd.count = htole32(xs->cmdlen);
+
/* load the DMA maps */
- error = bus_dmamap_load(sc->sc_c.sc_dmat,
- siop_cmd->cmd_c.dmamap_cmd,
- xs->cmd, xs->cmdlen, NULL, BUS_DMA_NOWAIT);
- if (error) {
- printf("%s: unable to load cmd DMA map: %d\n",
- sc->sc_c.sc_dev.dv_xname, error);
- xs->error = XS_DRIVER_STUFFUP;
- splx(s);
- return(TRY_AGAIN_LATER);
- }
if (xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
error = bus_dmamap_load(sc->sc_c.sc_dmat,
siop_cmd->cmd_c.dmamap_data, xs->data, xs->datalen,
@@ -1391,11 +1377,9 @@ siop_scsicmd(xs)
((xs->flags & SCSI_DATA_IN) ?
BUS_DMA_READ : BUS_DMA_WRITE));
if (error) {
- printf("%s: unable to load cmd DMA map: %d\n",
+ printf("%s: unable to load data DMA map: %d\n",
sc->sc_c.sc_dev.dv_xname, error);
xs->error = XS_DRIVER_STUFFUP;
- bus_dmamap_unload(sc->sc_c.sc_dmat,
- siop_cmd->cmd_c.dmamap_cmd);
splx(s);
return(TRY_AGAIN_LATER);
}
@@ -1405,9 +1389,6 @@ siop_scsicmd(xs)
(xs->flags & SCSI_DATA_IN) ?
BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
}
- bus_dmamap_sync(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_cmd, 0,
- siop_cmd->cmd_c.dmamap_cmd->dm_mapsize,
- BUS_DMASYNC_PREWRITE);
siop_setuptables(&siop_cmd->cmd_c);
siop_table_sync(siop_cmd,
@@ -1785,16 +1766,6 @@ siop_morecbd(sc)
sc->sc_c.sc_dev.dv_xname, error);
goto bad0;
}
- error = bus_dmamap_create(sc->sc_c.sc_dmat,
- sizeof(struct scsi_generic), 1,
- sizeof(struct scsi_generic), 0,
- BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
- &newcbd->cmds[i].cmd_c.dmamap_cmd);
- if (error) {
- printf("%s: unable to create cmd DMA map for cbd %d\n",
- sc->sc_c.sc_dev.dv_xname, error);
- goto bad0;
- }
}
/* Use two loops since bailing out above releases allocated memory */
@@ -1821,6 +1792,9 @@ siop_morecbd(sc)
xfer->siop_tables.t_status.count= htole32(1);
xfer->siop_tables.t_status.addr = htole32(dsa +
offsetof(struct siop_common_xfer, status));
+ xfer->siop_tables.cmd.count= htole32(0);
+ xfer->siop_tables.cmd.addr = htole32(dsa +
+ offsetof(struct siop_common_xfer, xscmd));
/* The select/reselect script */
scr = &xfer->resel[0];
for (j = 0; j < sizeof(load_dsa) / sizeof(load_dsa[0]); j++)
diff --git a/sys/dev/ic/siop_common.c b/sys/dev/ic/siop_common.c
index c9b10ac5085..814a22a5e3c 100644
--- a/sys/dev/ic/siop_common.c
+++ b/sys/dev/ic/siop_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop_common.c,v 1.15 2002/10/09 23:43:11 krw Exp $ */
+/* $OpenBSD: siop_common.c,v 1.16 2003/07/01 17:15:06 krw Exp $ */
/* $NetBSD: siop_common.c,v 1.31 2002/09/27 15:37:18 provos Exp $ */
/*
@@ -312,10 +312,6 @@ siop_setuptables(siop_cmd)
siop_cmd->siop_tables->status =
htole32(SCSI_SIOP_NOSTATUS); /* set invalid status */
- siop_cmd->siop_tables->cmd.count =
- htole32(siop_cmd->dmamap_cmd->dm_segs[0].ds_len);
- siop_cmd->siop_tables->cmd.addr =
- htole32(siop_cmd->dmamap_cmd->dm_segs[0].ds_addr);
if ((xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) ||
siop_cmd->status == CMDST_SENSE) {
for (i = 0; i < siop_cmd->dmamap_data->dm_nsegs; i++) {
@@ -419,7 +415,7 @@ siop_ppr_neg(siop_cmd)
int i;
#ifdef DEBUG_NEG
- printf("%s: anserw on ppr negotiation:", sc->sc_dev.dv_xname);
+ printf("%s: answer on ppr negotiation:", sc->sc_dev.dv_xname);
for (i = 0; i < 8; i++)
printf(" 0x%x", tables->msg_in[i]);
printf("\n");
@@ -729,7 +725,7 @@ siop_sdp(siop_cmd)
table = &siop_cmd->siop_tables->data[offset];
#ifdef DEBUG_DR
printf("sdp: offset %d count=%d addr=0x%x ", offset,
- table->count, table->addr);
+ letoh32(table->count), letoh32(table->addr));
#endif
dbc = bus_space_read_4(sc->sc_rt, sc->sc_rh, SIOP_DBC) & 0x00ffffff;
if (siop_cmd->xs->flags & SCSI_DATA_OUT) {
@@ -771,7 +767,8 @@ siop_sdp(siop_cmd)
htole32(letoh32(table->addr) + letoh32(table->count) - dbc);
table->count = htole32(dbc);
#ifdef DEBUG_DR
- printf("now count=%d addr=0x%x\n", table->count, table->addr);
+ printf("now count=%d addr=0x%x\n",
+ letoh32(table->count), letoh32(table->addr));
#endif
}
diff --git a/sys/dev/ic/siopvar_common.h b/sys/dev/ic/siopvar_common.h
index a7dd7da789c..ce5741c15b4 100644
--- a/sys/dev/ic/siopvar_common.h
+++ b/sys/dev/ic/siopvar_common.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: siopvar_common.h,v 1.13 2003/02/11 19:20:27 mickey Exp $ */
+/* $OpenBSD: siopvar_common.h,v 1.14 2003/07/01 17:15:06 krw Exp $ */
/* $NetBSD: siopvar_common.h,v 1.22 2002/10/23 02:32:36 christos Exp $ */
/*
@@ -48,23 +48,23 @@ typedef struct scr_table {
/*
* This structure interfaces the SCRIPT with the driver; it describes a full
- * transfer.
- * If you change something here, don't forget to update offsets in {s,es}iop.ss
+ * transfer. If you change something here, don't forget to update offsets in
+ * {s,es}iop.ss
*/
struct siop_common_xfer {
- u_int8_t msg_out[16]; /* 0 */
- u_int8_t msg_in[16]; /* 16 */
- u_int32_t status; /* 32 */
- u_int32_t pad1; /* 36 */
- u_int32_t id; /* 40 */
- u_int32_t pad2; /* 44 */
- scr_table_t t_msgin; /* 48 */
- scr_table_t t_extmsgin; /* 56 */
- scr_table_t t_extmsgdata; /* 64 */
- scr_table_t t_msgout; /* 72 */
- scr_table_t cmd; /* 80 */
- scr_table_t t_status; /* 88 */
- scr_table_t data[SIOP_NSG]; /* 96 */
+ u_int8_t msg_out[16]; /* 0 */
+ u_int8_t msg_in[16]; /* 16 */
+ u_int32_t status; /* 32 */
+ u_int32_t pad1; /* 36 */
+ u_int32_t id; /* 40 */
+ struct scsi_generic xscmd; /* 44 */
+ scr_table_t t_msgin; /* 56 */
+ scr_table_t t_extmsgin; /* 64 */
+ scr_table_t t_extmsgdata; /* 72 */
+ scr_table_t t_msgout; /* 80 */
+ scr_table_t cmd; /* 88 */
+ scr_table_t t_status; /* 96 */
+ scr_table_t data[SIOP_NSG]; /* 104 */
} __attribute__((__packed__));
/* status can hold the SCSI_* status values, and 2 additionnal values: */
@@ -79,9 +79,7 @@ struct siop_common_cmd {
struct siop_common_target *siop_target; /* pointer to our target def */
struct scsi_xfer *xs; /* xfer from the upper level */
struct siop_common_xfer *siop_tables; /* tables for this cmd */
- struct scsi_sense rs_cmd; /* request sense command buffer */
bus_addr_t dsa; /* DSA value to load */
- bus_dmamap_t dmamap_cmd;
bus_dmamap_t dmamap_data;
int status;
int flags;
diff --git a/sys/dev/microcode/siop/siop.out b/sys/dev/microcode/siop/siop.out
index e64b8d9c951..09b22bbaade 100644
--- a/sys/dev/microcode/siop/siop.out
+++ b/sys/dev/microcode/siop/siop.out
@@ -1,7 +1,7 @@
/* $NetBSD: ncr53cxxx.c,v 1.10 2002/04/21 22:40:10 bouyer Exp $ */
/*
* DO NOT EDIT - this file is automatically generated.
- * created from siop.ss on Sun Sep 1 23:53:00 2002
+ * created from siop.ss on Sat Jun 28 19:18:24 2003
*/
const u_int32_t siop_script[] = {
0x78340000, 0x00000000, /* 000 - 0 */
@@ -106,7 +106,7 @@ const u_int32_t siop_script[] = {
0x60000040, 0x00000000, /* 318 - 792 */
0x7a340100, 0x00000000, /* 320 - 800 */
0x60000008, 0x00000000, /* 328 - 808 */
- 0x1f000030, 0x00000030, /* 330 - 816 */
+ 0x1f000038, 0x00000038, /* 330 - 816 */
0x808c0000, 0x00000218, /* 338 - 824 */
0x808c0002, 0xffffffd0, /* 340 - 832 */
0x808c0001, 0x00000218, /* 348 - 840 */
@@ -121,16 +121,16 @@ const u_int32_t siop_script[] = {
0x80880000, 0xfffffc88, /* 390 - 912 */
0x58000008, 0x00000000, /* 398 - 920 */
0x60000040, 0x00000000, /* 3a0 - 928 */
- 0x1e000048, 0x00000048, /* 3a8 - 936 */
+ 0x1e000050, 0x00000050, /* 3a8 - 936 */
0x60000008, 0x00000000, /* 3b0 - 944 */
0x80880000, 0xfffffc60, /* 3b8 - 952 */
- 0x1a000050, 0x00000050, /* 3c0 - 960 */
+ 0x1a000058, 0x00000058, /* 3c0 - 960 */
0x80880000, 0xfffffc50, /* 3c8 - 968 */
- 0x1b000058, 0x00000058, /* 3d0 - 976 */
+ 0x1b000060, 0x00000060, /* 3d0 - 976 */
0x80880000, 0xfffffc40, /* 3d8 - 984 */
0x88880000, 0x000000b8, /* 3e0 - 992 */
0x7a340200, 0x00000000, /* 3e8 - 1000 */
- 0x19000060, 0x00000060, /* 3f0 - 1008 */
+ 0x19000068, 0x00000068, /* 3f0 - 1008 */
0x7e350100, 0x00000000, /* 3f8 - 1016 */
0x7e100800, 0x00000000, /* 400 - 1024 */
0x7f110000, 0x00000000, /* 408 - 1032 */
@@ -142,7 +142,7 @@ const u_int32_t siop_script[] = {
0x80880000, 0xfffffbe0, /* 438 - 1080 */
0x88880000, 0x00000058, /* 440 - 1088 */
0x7a340200, 0x00000000, /* 448 - 1096 */
- 0x18000060, 0x00000060, /* 450 - 1104 */
+ 0x18000068, 0x00000068, /* 450 - 1104 */
0x7e350100, 0x00000000, /* 458 - 1112 */
0x7e100800, 0x00000000, /* 460 - 1120 */
0x7f110000, 0x00000000, /* 468 - 1128 */
@@ -178,10 +178,10 @@ const u_int32_t siop_script[] = {
0x88880000, 0xffffffd0, /* 558 - 1368 */
0x98080000, 0x0000ff00, /* 560 - 1376 */
0x60000040, 0x00000000, /* 568 - 1384 */
- 0x1f000038, 0x00000038, /* 570 - 1392 */
+ 0x1f000040, 0x00000040, /* 570 - 1392 */
0x98080000, 0x0000ff02, /* 578 - 1400 */
0x60000040, 0x00000000, /* 580 - 1408 */
- 0x1f000040, 0x00000040, /* 588 - 1416 */
+ 0x1f000048, 0x00000048, /* 588 - 1416 */
0x98080000, 0x0000ff03, /* 590 - 1424 */
0x80000000, 0x00000000, /* 598 - 1432 */
};
@@ -240,13 +240,13 @@ const u_int32_t siop_led_off[] = {
};
#define A_t_id 0x00000028
-#define A_t_msg_in 0x00000030
-#define A_t_ext_msg_in 0x00000038
-#define A_t_ext_msg_data 0x00000040
-#define A_t_msg_out 0x00000048
-#define A_t_cmd 0x00000050
-#define A_t_status 0x00000058
-#define A_t_data 0x00000060
+#define A_t_msg_in 0x00000038
+#define A_t_ext_msg_in 0x00000040
+#define A_t_ext_msg_data 0x00000048
+#define A_t_msg_out 0x00000050
+#define A_t_cmd 0x00000058
+#define A_t_status 0x00000060
+#define A_t_data 0x00000068
#define A_int_done 0x0000ff00
#define A_int_msgin 0x0000ff01
#define A_int_extmsgin 0x0000ff02
@@ -415,84 +415,3 @@ u_int32_t E_ldsa_abs_slot_Used[] = {
0x00000014,
};
-
-u_int32_t INSTRUCTIONS = 0x000000da;
-u_int32_t PATCHES = 0x0000004b;
-u_int32_t LABELPATCHES[] = {
- 0x00000029,
- 0x0000002b,
- 0x0000002d,
- 0x0000002f,
- 0x00000031,
- 0x00000033,
- 0x00000035,
- 0x00000037,
- 0x00000039,
- 0x0000003b,
- 0x0000003d,
- 0x0000003f,
- 0x00000041,
- 0x00000043,
- 0x00000045,
- 0x00000047,
- 0x00000049,
- 0x0000004b,
- 0x0000004d,
- 0x0000004f,
- 0x00000051,
- 0x00000053,
- 0x00000055,
- 0x00000057,
- 0x00000059,
- 0x0000005b,
- 0x0000005d,
- 0x0000005f,
- 0x00000061,
- 0x00000063,
- 0x00000065,
- 0x00000067,
- 0x00000069,
- 0x0000006b,
- 0x0000006d,
- 0x0000006f,
- 0x00000071,
- 0x00000073,
- 0x00000075,
- 0x00000077,
- 0x0000008f,
- 0x00000091,
- 0x00000093,
- 0x00000095,
- 0x00000097,
- 0x00000099,
- 0x0000009b,
- 0x0000009d,
- 0x0000009f,
- 0x000000a1,
- 0x000000a3,
- 0x000000a5,
- 0x000000a7,
- 0x000000a9,
- 0x000000ab,
- 0x00000005,
- 0x00000003,
- 0x00000005,
- 0x00000007,
- 0x00000009,
- 0x0000000b,
- 0x0000000d,
- 0x0000000f,
- 0x00000011,
- 0x00000013,
- 0x00000015,
- 0x00000017,
- 0x00000019,
- 0x0000001b,
- 0x0000001d,
- 0x0000001f,
- 0x00000021,
- 0x0000000d,
- 0x00000011,
- 0x00000016,
-};
-
diff --git a/sys/dev/microcode/siop/siop.ss b/sys/dev/microcode/siop/siop.ss
index ab66276eb17..fcc59776238 100644
--- a/sys/dev/microcode/siop/siop.ss
+++ b/sys/dev/microcode/siop/siop.ss
@@ -1,4 +1,4 @@
-; $OpenBSD: siop.ss,v 1.4 2002/09/16 00:53:12 krw Exp $
+; $OpenBSD: siop.ss,v 1.5 2003/07/01 17:15:06 krw Exp $
; $NetBSD: siop.ss,v 1.17 2002/07/26 14:11:34 wiz Exp $
;
@@ -33,13 +33,13 @@ ARCH 720
; offsets in siop_common_xfer
ABSOLUTE t_id = 40;
-ABSOLUTE t_msg_in = 48;
-ABSOLUTE t_ext_msg_in = 56;
-ABSOLUTE t_ext_msg_data = 64;
-ABSOLUTE t_msg_out = 72;
-ABSOLUTE t_cmd = 80;
-ABSOLUTE t_status = 88;
-ABSOLUTE t_data = 96;
+ABSOLUTE t_msg_in = 56;
+ABSOLUTE t_ext_msg_in = 64;
+ABSOLUTE t_ext_msg_data = 72;
+ABSOLUTE t_msg_out = 80;
+ABSOLUTE t_cmd = 88;
+ABSOLUTE t_status = 96;
+ABSOLUTE t_data = 104;
;; interrupt codes
; interrupts that need a valid DSA