Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Bump the space for SCSI messages from 8 to 16 octets...



details:   https://anonhg.NetBSD.org/src/rev/0be02c0c43ad
branches:  trunk
changeset: 526019:0be02c0c43ad
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Apr 23 12:55:26 2002 +0000

description:
Bump the space for SCSI messages from 8 to 16 octets, as 8 may not be
enouth for IDENTIFY + TAG + PPR.
Get rid of constants in C code by use of a offsetof macro.

diffstat:

 sys/dev/ic/esiop.c              |  19 ++++++++++++-------
 sys/dev/ic/siop.c               |  20 ++++++++++++--------
 sys/dev/ic/siopvar_common.h     |  30 ++++++++++++++++--------------
 sys/dev/microcode/siop/esiop.ss |  20 ++++++++++----------
 sys/dev/microcode/siop/siop.ss  |  20 ++++++++++----------
 5 files changed, 60 insertions(+), 49 deletions(-)

diffs (213 lines):

diff -r b0cfaf059460 -r 0be02c0c43ad sys/dev/ic/esiop.c
--- a/sys/dev/ic/esiop.c        Tue Apr 23 12:41:04 2002 +0000
+++ b/sys/dev/ic/esiop.c        Tue Apr 23 12:55:26 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: esiop.c,v 1.4 2002/04/23 10:38:37 bouyer Exp $ */
+/*     $NetBSD: esiop.c,v 1.5 2002/04/23 12:55:27 bouyer Exp $ */
 
 /*
  * Copyright (c) 2002 Manuel Bouyer.
@@ -33,7 +33,7 @@
 /* SYM53c7/8xx PCI-SCSI I/O Processors driver */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.4 2002/04/23 10:38:37 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.5 2002/04/23 12:55:27 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -930,7 +930,8 @@
                            esiop_cmd->cmd_tables->msg_in[2], 
                            esiop_cmd->cmd_tables->msg_in[1]);
 #endif
-                       if (esiop_cmd->cmd_tables->msg_in[1] > 6)
+                       if (esiop_cmd->cmd_tables->msg_in[1] >
+                           sizeof(esiop_cmd->cmd_tables->msg_in) - 2)
                                printf("%s: extended message too big (%d)\n",
                                    sc->sc_c.sc_dev.dv_xname,
                                    esiop_cmd->cmd_tables->msg_in[1]);
@@ -1812,12 +1813,16 @@
                xfer->siop_tables.t_msgout.count= htole32(1);
                xfer->siop_tables.t_msgout.addr = htole32(dsa);
                xfer->siop_tables.t_msgin.count= htole32(1);
-               xfer->siop_tables.t_msgin.addr = htole32(dsa + 8);
+               xfer->siop_tables.t_msgin.addr = htole32(dsa + 
+                       offsetof(struct siop_common_xfer, msg_in));
                xfer->siop_tables.t_extmsgin.count= htole32(2);
-               xfer->siop_tables.t_extmsgin.addr = htole32(dsa + 9);
-               xfer->siop_tables.t_extmsgdata.addr = htole32(dsa + 11);
+               xfer->siop_tables.t_extmsgin.addr = htole32(dsa +
+                       offsetof(struct siop_common_xfer, msg_in) + 1);
+               xfer->siop_tables.t_extmsgdata.addr = htole32(dsa +
+                       offsetof(struct siop_common_xfer, msg_in) + 3);
                xfer->siop_tables.t_status.count= htole32(1);
-               xfer->siop_tables.t_status.addr = htole32(dsa + 16);
+               xfer->siop_tables.t_status.addr = htole32(dsa +
+                       offsetof(struct siop_common_xfer, status));
 
                s = splbio();
                TAILQ_INSERT_TAIL(&sc->free_list, &newcbd->cmds[i], next);
diff -r b0cfaf059460 -r 0be02c0c43ad sys/dev/ic/siop.c
--- a/sys/dev/ic/siop.c Tue Apr 23 12:41:04 2002 +0000
+++ b/sys/dev/ic/siop.c Tue Apr 23 12:55:26 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop.c,v 1.56 2002/04/23 10:38:37 bouyer Exp $ */
+/*     $NetBSD: siop.c,v 1.57 2002/04/23 12:55:26 bouyer Exp $ */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -33,7 +33,7 @@
 /* SYM53c7/8xx PCI-SCSI I/O Processors driver */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.56 2002/04/23 10:38:37 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.57 2002/04/23 12:55:26 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -859,7 +859,8 @@
                            siop_cmd->cmd_tables->msg_in[2], 
                            siop_cmd->cmd_tables->msg_in[1]);
 #endif
-                       if (siop_cmd->cmd_tables->msg_in[1] > 6)
+                       if (siop_cmd->cmd_tables->msg_in[1] >
+                           sizeof(siop_cmd->cmd_tables->msg_in) - 2)
                                printf("%s: extended message too big (%d)\n",
                                    sc->sc_c.sc_dev.dv_xname,
                                    siop_cmd->cmd_tables->msg_in[1]);
@@ -1705,13 +1706,16 @@
                xfer->siop_tables.t_msgout.count= htole32(1);
                xfer->siop_tables.t_msgout.addr = htole32(dsa);
                xfer->siop_tables.t_msgin.count= htole32(1);
-               xfer->siop_tables.t_msgin.addr = htole32(dsa + 8);
+               xfer->siop_tables.t_msgin.addr = htole32(dsa +
+                               offsetof(struct siop_common_xfer, msg_in));
                xfer->siop_tables.t_extmsgin.count= htole32(2);
-               xfer->siop_tables.t_extmsgin.addr = htole32(dsa + 9);
-               xfer->siop_tables.t_extmsgdata.addr = htole32(dsa + 11);
+               xfer->siop_tables.t_extmsgin.addr = htole32(dsa +
+                               offsetof(struct siop_common_xfer, msg_in) + 1);
+               xfer->siop_tables.t_extmsgdata.addr = htole32(dsa +
+                               offsetof(struct siop_common_xfer, msg_in) + 3);
                xfer->siop_tables.t_status.count= htole32(1);
-               xfer->siop_tables.t_status.addr = htole32(dsa + 16);
-
+               xfer->siop_tables.t_status.addr = htole32(dsa +
+                               offsetof(struct siop_common_xfer, status));
                /* The select/reselect script */
                scr = &xfer->resel[0];
                for (j = 0; j < sizeof(load_dsa) / sizeof(load_dsa[0]); j++)
diff -r b0cfaf059460 -r 0be02c0c43ad sys/dev/ic/siopvar_common.h
--- a/sys/dev/ic/siopvar_common.h       Tue Apr 23 12:41:04 2002 +0000
+++ b/sys/dev/ic/siopvar_common.h       Tue Apr 23 12:55:26 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siopvar_common.h,v 1.16 2002/04/23 10:38:38 bouyer Exp $       */
+/*     $NetBSD: siopvar_common.h,v 1.17 2002/04/23 12:55:26 bouyer Exp $       */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -53,21 +53,23 @@
  * 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[8];    /* 0 */
-       u_int8_t msg_in[8];     /* 8 */
-       u_int32_t status;       /* 16 */
-       u_int32_t pad1;         /* 20 */
-       u_int32_t id;           /* 24 */
-       u_int32_t pad2;         /* 28 */
-       scr_table_t t_msgin;    /* 32 */
-       scr_table_t t_extmsgin; /* 40 */
-       scr_table_t t_extmsgdata; /* 48 */
-       scr_table_t t_msgout;   /* 56 */
-       scr_table_t cmd;        /* 64 */
-       scr_table_t t_status;   /* 72 */
-       scr_table_t data[SIOP_NSG]; /* 80 */
+       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 */
 } __attribute__((__packed__));
 
+#define offsetof(type, member)     ((size_t)(&((type *)0)->member))
+
 /* status can hold the SCSI_* status values, and 2 additionnal values: */
 #define SCSI_SIOP_NOCHECK      0xfe    /* don't check the scsi status */
 #define SCSI_SIOP_NOSTATUS     0xff    /* device didn't report status */
diff -r b0cfaf059460 -r 0be02c0c43ad sys/dev/microcode/siop/esiop.ss
--- a/sys/dev/microcode/siop/esiop.ss   Tue Apr 23 12:41:04 2002 +0000
+++ b/sys/dev/microcode/siop/esiop.ss   Tue Apr 23 12:55:26 2002 +0000
@@ -1,4 +1,4 @@
-;      $NetBSD: esiop.ss,v 1.4 2002/04/22 20:45:27 bouyer Exp $
+;      $NetBSD: esiop.ss,v 1.5 2002/04/23 12:55:28 bouyer Exp $
 
 ;
 ; Copyright (c) 2002 Manuel Bouyer.
@@ -34,15 +34,15 @@
 
 ARCH 825
 
-; offsets in sym_xfer
-ABSOLUTE t_id = 24;
-ABSOLUTE t_msg_in = 32;
-ABSOLUTE t_ext_msg_in = 40;
-ABSOLUTE t_ext_msg_data = 48;
-ABSOLUTE t_msg_out = 56;
-ABSOLUTE t_cmd = 64;
-ABSOLUTE t_status = 72;
-ABSOLUTE t_data = 80;
+; 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;
 
 ; offsets in the per-target lun table
 ABSOLUTE target_id = 0x0;
diff -r b0cfaf059460 -r 0be02c0c43ad sys/dev/microcode/siop/siop.ss
--- a/sys/dev/microcode/siop/siop.ss    Tue Apr 23 12:41:04 2002 +0000
+++ b/sys/dev/microcode/siop/siop.ss    Tue Apr 23 12:55:26 2002 +0000
@@ -1,4 +1,4 @@
-;      $NetBSD: siop.ss,v 1.13 2002/04/18 11:56:11 bouyer Exp $
+;      $NetBSD: siop.ss,v 1.14 2002/04/23 12:55:28 bouyer Exp $
 
 ;
 ;  Copyright (c) 2000 Manuel Bouyer.
@@ -30,15 +30,15 @@
 
 ARCH 720
 
-; offsets in sym_xfer
-ABSOLUTE t_id = 24;
-ABSOLUTE t_msg_in = 32;
-ABSOLUTE t_ext_msg_in = 40;
-ABSOLUTE t_ext_msg_data = 48;
-ABSOLUTE t_msg_out = 56;
-ABSOLUTE t_cmd = 64;
-ABSOLUTE t_status = 72;
-ABSOLUTE t_data = 80;
+; 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;
 
 ;; interrupt codes
 ; interrupts that need a valid DSA



Home | Main Index | Thread Index | Old Index