Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ieee1394 - print expected crc when it does not match
details: https://anonhg.NetBSD.org/src/rev/d9359d75ef3b
branches: trunk
changeset: 757345:d9359d75ef3b
user: cegger <cegger%NetBSD.org@localhost>
date: Thu Aug 26 07:36:53 2010 +0000
description:
- print expected crc when it does not match
- add and print secondary text leaf. This prints the model name of my webcam.
- add csr keys that are printed as 'unknown' otherwise
diffstat:
sys/dev/ieee1394/fwcrom.c | 57 +++++++++++++++++++++++++++++++-------------
sys/dev/ieee1394/iec13213.h | 4 ++-
2 files changed, 43 insertions(+), 18 deletions(-)
diffs (143 lines):
diff -r c4153a7bac26 -r d9359d75ef3b sys/dev/ieee1394/fwcrom.c
--- a/sys/dev/ieee1394/fwcrom.c Thu Aug 26 07:04:04 2010 +0000
+++ b/sys/dev/ieee1394/fwcrom.c Thu Aug 26 07:36:53 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fwcrom.c,v 1.12 2010/04/24 21:34:29 cegger Exp $ */
+/* $NetBSD: fwcrom.c,v 1.13 2010/08/26 07:36:53 cegger Exp $ */
/*-
* Copyright (c) 2002-2003
* Hidetoshi Shimokawa. All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fwcrom.c,v 1.12 2010/04/24 21:34:29 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwcrom.c,v 1.13 2010/08/26 07:36:53 cegger Exp $");
#include <sys/param.h>
#ifdef _KERNEL
@@ -178,10 +178,16 @@
return;
reg = crom_get(cc);
- if (reg->key != CROM_TEXTLEAF ||
- (char *)(reg + reg->val) > CROM_END(cc)) {
- strncpy(buf, nullstr, len);
- return;
+ switch (reg->key) {
+ case CROM_TEXTLEAF:
+ case CROM_TEXTLEAF2:
+ break;
+ default:
+ if ((char *)(reg + reg->val) > CROM_END(cc)) {
+ strncpy(buf, nullstr, len);
+ return;
+ }
+ break;
}
textleaf = (struct csrtext *)(reg + reg->val);
@@ -288,7 +294,7 @@
switch (reg->key & CSRTYPE_MASK) {
case CSRTYPE_I:
#if 0
- len -= snprintf(buf, len, "%d", reg->val);
+ len -= snprintf(buf, len, "0x%x", reg->val);
buf += strlen(buf);
#else
*buf = '\0';
@@ -304,33 +310,43 @@
case CSRTYPE_D:
dir = (struct csrdirectory *) (reg + reg->val);
crc = crom_crc((uint32_t *)dir->entry, dir->crc_len);
- len -= snprintf(buf, len, "len=%d crc=0x%04x(%s) ",
- dir->crc_len, dir->crc, (crc == dir->crc) ? "OK" : "NG");
+ len -= snprintf(buf, len, "len=%d crc=0x%04x ",
+ dir->crc_len, crc);
+ buf += strlen(buf);
+
+ if (crc == dir->crc)
+ len -= snprintf(buf, len, "(OK) ");
+ else
+ len -= snprintf(buf, len, "(NG, 0x%x) ",
+ dir->crc);
buf += strlen(buf);
}
switch (reg->key) {
- case 0x03:
+ case CSRKEY_VENDOR: /* 0x03 */
desc = "module_vendor_ID";
break;
- case 0x04:
+ case CSRKEY_HW: /* 0x04 */
desc = "hardware_version";
break;
- case 0x0c:
+ case CSRKEY_NCAP: /* 0x0c */
desc = "node_capabilities";
break;
- case 0x12:
+ case CSRKEY_SPEC: /* 0x12 */
desc = "unit_spec_ID";
break;
- case 0x13:
+ case CSRKEY_VER: /* 0x13 */
desc = "unit_sw_version";
crom_desc_specver(0, reg->val, buf, len);
break;
- case 0x14:
+ case CSRKEY_DINFO: /* 0x14 */
desc = "logical_unit_number";
break;
- case 0x17:
+ case CSRKEY_MODEL: /* 0x17 */
desc = "model_ID";
break;
+ case CSRKEY_REV: /* 0x21 */
+ desc = "revision_ID";
+ break;
case 0x38:
desc = "command_set_spec_ID";
break;
@@ -349,13 +365,20 @@
case 0x3d:
desc = "reconnect_timeout";
break;
+ case 0x40:
+ desc = "command_regs_base";
+ break;
case 0x54:
desc = "management_agent";
break;
- case 0x81:
+ case CROM_TEXTLEAF: /* 0x81 */
+ case CROM_TEXTLEAF2: /* 0x82 */
desc = "text_leaf";
crom_parse_text(cc, buf + strlen(buf), len);
break;
+ case CROM_NODEID: /* 0x8d */
+ desc = "node_unique_ID";
+ break;
case 0xd1:
desc = "unit_directory";
break;
diff -r c4153a7bac26 -r d9359d75ef3b sys/dev/ieee1394/iec13213.h
--- a/sys/dev/ieee1394/iec13213.h Thu Aug 26 07:04:04 2010 +0000
+++ b/sys/dev/ieee1394/iec13213.h Thu Aug 26 07:36:53 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iec13213.h,v 1.4 2010/03/29 03:05:28 kiyohara Exp $ */
+/* $NetBSD: iec13213.h,v 1.5 2010/08/26 07:36:53 cegger Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -105,8 +105,10 @@
#define CROM_UDIR (CSRTYPE_D | CSRKEY_UNIT) /* 0x81 Unit directory */
#define CROM_TEXTLEAF (CSRTYPE_L | CSRKEY_DESC) /* 0x81 Text leaf */
+#define CROM_TEXTLEAF2 (CSRTYPE_L | CSRKEY_BDINFO)/* 0x82 Text leaf2 */
#define CROM_LUN (CSRTYPE_I | CSRKEY_DINFO) /* 0x14 Logical unit num. */
#define CROM_MGM (CSRTYPE_C | CSRKEY_DINFO) /* 0x54 Management agent */
+#define CROM_NODEID 0x8d /* only valid for IEEE 1394-1995 digital camera */
#define CSRVAL_VENDOR_PRIVATE 0xacde48
#define CSRVAL_1394TA 0x00a02d
Home |
Main Index |
Thread Index |
Old Index