Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2o Parameter group changes:
details: https://anonhg.NetBSD.org/src/rev/6aecd309fd13
branches: trunk
changeset: 514091:6aecd309fd13
user: ad <ad%NetBSD.org@localhost>
date: Wed Aug 22 09:42:05 2001 +0000
description:
Parameter group changes:
- Do FIELD_SET correctly for scalar types.
- Add some basic table ops.
- Push error reporting back into iop.c.
- Add some field index and (yet more) LAN defs to i2o.h.
diffstat:
sys/dev/i2o/i2o.h | 90 ++++++++++++++++++++++++++-
sys/dev/i2o/iop.c | 170 +++++++++++++++++++++++++++++++++++++++++++++-----
sys/dev/i2o/iopsp.c | 34 +++------
sys/dev/i2o/iopvar.h | 12 ++-
sys/dev/i2o/ld_iop.c | 59 ++++++-----------
5 files changed, 281 insertions(+), 84 deletions(-)
diffs (truncated from 588 to 300 lines):
diff -r 2a95f880a4dc -r 6aecd309fd13 sys/dev/i2o/i2o.h
--- a/sys/dev/i2o/i2o.h Wed Aug 22 09:20:38 2001 +0000
+++ b/sys/dev/i2o/i2o.h Wed Aug 22 09:42:05 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i2o.h,v 1.7 2001/08/06 13:33:49 ad Exp $ */
+/* $NetBSD: i2o.h,v 1.8 2001/08/22 09:42:05 ad Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -873,6 +873,18 @@
u_int32_t atomicwritesize;
} __attribute__ ((__packed__));
+#define I2O_PARAM_RBS_OPERATION_autoreass 0
+#define I2O_PARAM_RBS_OPERATION_reasstolerance 1
+#define I2O_PARAM_RBS_OPERATION_numretries 2
+#define I2O_PARAM_RBS_OPERATION_reserved0 3
+#define I2O_PARAM_RBS_OPERATION_reasssize 4
+#define I2O_PARAM_RBS_OPERATION_expectedtimeout 5
+#define I2O_PARAM_RBS_OPERATION_rwvtimeout 6
+#define I2O_PARAM_RBS_OPERATION_rwvtimeoutbase 7
+#define I2O_PARAM_RBS_OPERATION_timeoutbase 8
+#define I2O_PARAM_RBS_OPERATION_orderedreqdepth 9
+#define I2O_PARAM_RBS_OPERATION_atomicwritesize 10
+
#define I2O_PARAM_RBS_CACHE_CONTROL 0x0003
struct i2o_param_rbs_cache_control {
u_int32_t totalcachesize;
@@ -1063,6 +1075,19 @@
u_int32_t bucketsleft;
} __attribute__ ((__packed__));
+#define I2O_LAN_RECEIVE_REPLY_PDB 0x80
+
+#define I2O_LAN_PDB_ERROR_NONE 0x00
+#define I2O_LAN_PDB_ERROR_BAD_CRC 0x01
+#define I2O_LAN_PDB_ERROR_ALIGNMENT 0x02
+#define I2O_LAN_PDB_ERROR_TOO_LONG 0x03
+#define I2O_LAN_PDB_ERROR_TOO_SHORT 0x04
+#define I2O_LAN_PDB_ERROR_RX_OVERRUN 0x05
+#define I2O_LAN_PDB_ERROR_L3_CKSUM_BAD 0x40
+#define I2O_LAN_PDB_ERROR_L4_CKSUM_BAD 0x80
+#define I2O_LAN_PDB_ERROR_CKSUM_MASK 0xc0
+#define I2O_LAN_PDB_ERROR_OTHER 0xff
+
#define I2O_LAN_RESET 0x35
struct i2o_lan_reset {
u_int32_t msgflags;
@@ -1132,13 +1157,31 @@
u_int8_t activeaddr[8];
u_int8_t localaddr[8];
u_int8_t addrmask[8];
- u_int8_t filtermask[4];
- u_int8_t hwfiltermask[4];
+ u_int32_t filtermask;
+ u_int32_t hwfiltercaps;
u_int32_t maxmcastaddr;
u_int32_t maxfilterperfect;
u_int32_t maxfilterimperfect;
} __attribute__ ((__packed__));
+#define I2O_PARAM_LAN_MAC_ADDRESS_activeaddr 0
+#define I2O_PARAM_LAN_MAC_ADDRESS_localaddr 1
+#define I2O_PARAM_LAN_MAC_ADDRESS_addrmask 2
+#define I2O_PARAM_LAN_MAC_ADDRESS_filtermask 3
+#define I2O_PARAM_LAN_MAC_ADDRESS_hwfiltercaps 4
+#define I2O_PARAM_LAN_MAC_ADDRESS_maxmcastaddr 5
+#define I2O_PARAM_LAN_MAC_ADDRESS_maxfilterperfect 6
+#define I2O_PARAM_LAN_MAC_ADDRESS_maxfilterimperfect 7
+
+#define I2O_LAN_FILTERMASK_UNICAST_DISABLE 0x0001
+#define I2O_LAN_FILTERMASK_PROMISC_ENABLE 0x0002
+#define I2O_LAN_FILTERMASK_PROMISC_MCAST_ENABLE 0x0004
+#define I2O_LAN_FILTERMASK_BROADCAST_DISABLE 0x0100
+#define I2O_LAN_FILTERMASK_MCAST_DISABLE 0x0200
+#define I2O_LAN_FILTERMASK_FUNCADDR_DISABLE 0x0400
+#define I2O_LAN_FILTERMASK_MACMODE_0 0x0800
+#define I2O_LAN_FILTERMASK_MACMODE_1 0x1000
+
#define I2O_PARAM_LAN_MCAST_MAC_ADDRESS 0x0002
/*
* This one's a table, not a scalar.
@@ -1157,6 +1200,16 @@
u_int32_t maxtxbatchcount; /* 2.0 only */
} __attribute__ ((__packed__));
+#define I2O_PARAM_LAN_BATCH_CONTROL_batchflags 0
+#define I2O_PARAM_LAN_BATCH_CONTROL_risingloaddly 1
+#define I2O_PARAM_LAN_BATCH_CONTROL_risingloadthresh 2
+#define I2O_PARAM_LAN_BATCH_CONTROL_fallingloaddly 3
+#define I2O_PARAM_LAN_BATCH_CONTROL_fallingloadthresh 4
+#define I2O_PARAM_LAN_BATCH_CONTROL_maxrxbatchcount 5
+#define I2O_PARAM_LAN_BATCH_CONTROL_maxrxbatchdelay 6
+#define I2O_PARAM_LAN_BATCH_CONTROL_maxtxbatchdelay 7
+#define I2O_PARAM_LAN_BATCH_CONTROL_maxtxbatchcount 8
+
#define I2O_PARAM_LAN_OPERATION 0x0004
struct i2o_param_lan_operation {
u_int32_t pktprepad;
@@ -1166,6 +1219,12 @@
u_int32_t rxmodesenable; /* 2.0 only */
} __attribute__ ((__packed__));
+#define I2O_PARAM_LAN_OPERATION_pktprepad 0
+#define I2O_PARAM_LAN_OPERATION_userflags 1
+#define I2O_PARAM_LAN_OPERATION_pktorphanlimit 2
+#define I2O_PARAM_LAN_OPERATION_txmodesenable 3
+#define I2O_PARAM_LAN_OPERATION_rxmodesenable 4
+
#define I2O_PARAM_LAN_MEDIA_OPERATION 0x0005
struct i2o_param_lan_media_operation {
u_int32_t connectortype;
@@ -1180,6 +1239,17 @@
u_int32_t connectiontarget; /* v2.0 only */
} __attribute__ ((__packed__));
+#define I2O_PARAM_LAN_MEDIA_OPERATION_connectortype 0
+#define I2O_PARAM_LAN_MEDIA_OPERATION_connectiontype 1
+#define I2O_PARAM_LAN_MEDIA_OPERATION_curtxbps 2
+#define I2O_PARAM_LAN_MEDIA_OPERATION_currxbps 3
+#define I2O_PARAM_LAN_MEDIA_OPERATION_fullduplex 4
+#define I2O_PARAM_LAN_MEDIA_OPERATION_linkstatus 5
+#define I2O_PARAM_LAN_MEDIA_OPERATION_badpkthandling 6
+#define I2O_PARAM_LAN_MEDIA_OPERATION_duplextarget 7
+#define I2O_PARAM_LAN_MEDIA_OPERATION_connectortarget 8
+#define I2O_PARAM_LAN_MEDIA_OPERATION_connectiontarget 9
+
#define I2O_LAN_CONNECTOR_OTHER 0x00
#define I2O_LAN_CONNECTOR_UNKNOWN 0x01
#define I2O_LAN_CONNECTOR_AUI 0x02
@@ -1284,4 +1354,18 @@
u_int64_t excessivedeferrals;
} __attribute__ ((__packed__));
+#define I2O_PARAM_LAN_FDDI_STATS 0x0400
+struct i2o_param_lan_fddi_stats {
+ u_int64_t configstate;
+ u_int64_t upstreamnode;
+ u_int64_t downstreamnode;
+ u_int64_t frameerrors;
+ u_int64_t frameslost;
+ u_int64_t ringmgmtstate;
+ u_int64_t lctfailures;
+ u_int64_t lemrejects;
+ u_int64_t lemcount;
+ u_int64_t lconnectionstate;
+} __attribute__ ((__packed__));
+
#endif /* !defined _I2O_I2O_H_ */
diff -r 2a95f880a4dc -r 6aecd309fd13 sys/dev/i2o/iop.c
--- a/sys/dev/i2o/iop.c Wed Aug 22 09:20:38 2001 +0000
+++ b/sys/dev/i2o/iop.c Wed Aug 22 09:42:05 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iop.c,v 1.15 2001/08/04 16:54:18 ad Exp $ */
+/* $NetBSD: iop.c,v 1.16 2001/08/22 09:42:05 ad Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -1188,13 +1188,13 @@
* pointer to the parameter group op in the wrapper's `im_dvcontext' field.
*/
int
-iop_param_op(struct iop_softc *sc, int tid, struct iop_initiator *ii,
- int write, int group, void *buf, int size)
+iop_field_get_all(struct iop_softc *sc, int tid, int group, void *buf,
+ int size, struct iop_initiator *ii)
{
struct iop_msg *im;
struct i2o_util_params_op *mf;
struct i2o_reply *rf;
- int rv, func, op;
+ int rv;
struct iop_pgop *pgop;
u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];
@@ -1211,24 +1211,16 @@
im->im_dvcontext = pgop;
im->im_rb = rf;
- if (write) {
- func = I2O_UTIL_PARAMS_SET;
- op = I2O_PARAMS_OP_FIELD_SET;
- } else {
- func = I2O_UTIL_PARAMS_GET;
- op = I2O_PARAMS_OP_FIELD_GET;
- }
-
mf = (struct i2o_util_params_op *)mb;
mf->msgflags = I2O_MSGFLAGS(i2o_util_params_op);
- mf->msgfunc = I2O_MSGFUNC(tid, func);
+ mf->msgfunc = I2O_MSGFUNC(tid, I2O_UTIL_PARAMS_GET);
mf->msgictx = IOP_ICTX;
mf->msgtctx = im->im_tctx;
mf->flags = 0;
pgop->olh.count = htole16(1);
pgop->olh.reserved = htole16(0);
- pgop->oat.operation = htole16(op);
+ pgop->oat.operation = htole16(I2O_PARAMS_OP_FIELD_GET);
pgop->oat.fieldcount = htole16(0xffff);
pgop->oat.group = htole16(group);
@@ -1237,7 +1229,7 @@
memset(buf, 0, size);
iop_msg_map(sc, im, mb, pgop, sizeof(*pgop), 1, NULL);
- iop_msg_map(sc, im, mb, buf, size, write, NULL);
+ iop_msg_map(sc, im, mb, buf, size, 0, NULL);
rv = iop_msg_post(sc, im, mb, (ii == NULL ? 30000 : 0));
if (ii == NULL)
@@ -1250,6 +1242,10 @@
rv = 0;
else
rv = (rf->reqstatus != 0 ? EIO : 0);
+
+ if (rv != 0)
+ printf("%s: FIELD_GET failed for tid %d group %d\n",
+ sc->sc_dv.dv_xname, tid, group);
}
if (ii == NULL || rv != 0) {
@@ -1263,6 +1259,146 @@
}
/*
+ * Set a single field in a scalar parameter group.
+ */
+int
+iop_field_set(struct iop_softc *sc, int tid, int group, void *buf,
+ int size, int field)
+{
+ struct iop_msg *im;
+ struct i2o_util_params_op *mf;
+ struct iop_pgop *pgop;
+ int rv, totsize;
+ u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];
+
+ totsize = sizeof(*pgop) + size;
+
+ im = iop_msg_alloc(sc, IM_WAIT);
+ if ((pgop = malloc(totsize, M_DEVBUF, M_WAITOK)) == NULL) {
+ iop_msg_free(sc, im);
+ return (ENOMEM);
+ }
+
+ mf = (struct i2o_util_params_op *)mb;
+ mf->msgflags = I2O_MSGFLAGS(i2o_util_params_op);
+ mf->msgfunc = I2O_MSGFUNC(tid, I2O_UTIL_PARAMS_SET);
+ mf->msgictx = IOP_ICTX;
+ mf->msgtctx = im->im_tctx;
+ mf->flags = 0;
+
+ pgop->olh.count = htole16(1);
+ pgop->olh.reserved = htole16(0);
+ pgop->oat.operation = htole16(I2O_PARAMS_OP_FIELD_SET);
+ pgop->oat.fieldcount = htole16(1);
+ pgop->oat.group = htole16(group);
+ pgop->oat.fields[0] = htole16(field);
+ memcpy(pgop + 1, buf, size);
+
+ iop_msg_map(sc, im, mb, pgop, totsize, 1, NULL);
+ rv = iop_msg_post(sc, im, mb, 30000);
+ if (rv != 0)
+ printf("%s: FIELD_SET failed for tid %d group %d\n",
+ sc->sc_dv.dv_xname, tid, group);
+
+ iop_msg_unmap(sc, im);
+ iop_msg_free(sc, im);
+ free(pgop, M_DEVBUF);
+ return (rv);
+}
+
+/*
+ * Delete all rows in a tablular parameter group.
+ */
+int
+iop_table_clear(struct iop_softc *sc, int tid, int group)
+{
+ struct iop_msg *im;
+ struct i2o_util_params_op *mf;
+ struct iop_pgop pgop;
+ u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];
+ int rv;
+
+ im = iop_msg_alloc(sc, IM_WAIT);
+
+ mf = (struct i2o_util_params_op *)mb;
+ mf->msgflags = I2O_MSGFLAGS(i2o_util_params_op);
+ mf->msgfunc = I2O_MSGFUNC(tid, I2O_UTIL_PARAMS_SET);
+ mf->msgictx = IOP_ICTX;
+ mf->msgtctx = im->im_tctx;
+ mf->flags = 0;
+
+ pgop.olh.count = htole16(1);
+ pgop.olh.reserved = htole16(0);
+ pgop.oat.operation = htole16(I2O_PARAMS_OP_TABLE_CLEAR);
+ pgop.oat.fieldcount = htole16(0);
+ pgop.oat.group = htole16(group);
+ pgop.oat.fields[0] = htole16(0);
Home |
Main Index |
Thread Index |
Old Index