Subject: kern/17435: ieee1394 dc camera / bogus rom
To: None <gnats-bugs@gnats.netbsd.org>
From: Anthony Mallet <anthony.mallet@useless-ficus.net>
List: netbsd-bugs
Date: 06/30/2002 02:16:43
>Number: 17435
>Category: kern
>Synopsis: ieee1394 dc camera / bogus rom
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jun 29 17:17:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Anthony Mallet
>Release: NetBSD 1.5ZC
>Organization:
>Environment:
System: NetBSD ficus 1.5ZC NetBSD 1.5ZC (FICUS) #3: Sat May 4 20:51:04 CEST 2002 toto@ficus:/home/src/netbsd-current/sys/arch/i386/compile/FICUS i386
Architecture: i386
Machine: i386
>Description:
I'm trying to make a dc 1394 camera work and I'm fighting with a rom that
doesn't seem to implement the p1212 config rom specs correctly.
Here is the rom, as dumped by fwnode_dump_rom() :
/* Bus info */
0x04205b5e, 0x31333934, 0x20ff4000, 0x00d0f540,
0x00070285,
/* Root dir */
0x000446b3, 0x0300d0f5, 0x06070198 (*),
0x8d000002, 0xd1000004,
/* node unique leaf */
0x0002d192, 0x00d0f540,
0x00070285,
/* unit dir */
0x00034462, 0x1200a02d, 0x13000100,
0xd4000001,
/* unit dependant dir */
0x00031226, 0x403c0000 (**), 0x81000002,
0x82000008,
/* vendor name */
0x000642dd, 0x00000000, 0x00000000,
0x4f52414e, 0x4745204d, 0x4943524f, 0x00000000,
/* model name */
0x000448cb, 0x00000000, 0x00000000, 0x49424f54,
0x00000000
First, the quadlet marked with a (*) in the root dir begins with 0x06,
which translates into 'P1212_KEYVALUE_Module_Sw_Version' (this is
incorrect). The correct value (according to the iidc 1.20 specs) should
be 0x0C (P1212_KEYVALUE_Node_Capabilities).
(note that the CRC of the rom or the root dir is ok).
Second, the quadlet marked with (**) begins with 0x40, which translates
into P1212_KEYTYPE_Offset with a val of 0 ("Root-Directory"). This also
seems to be incorrect because p1212_validate_offset() doesn't accept it.
I attach a patch which will hopefully make things more clear.
This patch isn't intended to be a generic solution. It's just there to
show how I managed to make this camera probe ok...
(Note that the code in netbsd seems to be ok. I'm just complaining about
my rom which seems to be bogus, and I'm wondering how to make the probing
code more tolerant...)
>How-To-Repeat:
>Fix:
Index: ieee1212.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/std/ieee1212.c,v
retrieving revision 1.2
diff -u -r1.2 ieee1212.c
--- ieee1212.c 2002/04/02 10:10:54 1.2
+++ ieee1212.c 2002/06/30 00:11:01
@@ -406,7 +406,18 @@
desc = ntohl(t[i]);
type = P1212_DIRENT_GET_KEYTYPE(desc);
val = P1212_DIRENT_GET_KEYVALUE(desc);
-
+
+ DPRINTF(("ROM: type 0x%02hx val 0x%02hx\n",
+ type, val));
+
+ /*
+ * Some ROMs are bogus...
+ */
+ if (val == P1212_KEYVALUE_Module_Sw_Version &&
+ !node_capabilities_flag &&
+ dir->parent == NULL)
+ val = P1212_KEYVALUE_Node_Capabilities;
+
/*
* Sanity check for valid types/locations/etc.
*
@@ -1269,7 +1280,8 @@
static int
p1212_validate_offset(u_int16_t val, u_int32_t mask)
{
- if ((val == P1212_KEYVALUE_Node_Units_Extent) ||
+ if (/* xxx */val == 0 ||
+ (val == P1212_KEYVALUE_Node_Units_Extent) ||
(val == P1212_KEYVALUE_Node_Memory_Extent) ||
((mask & P1212_ALLOW_DEPENDENT_INFO_OFFSET_TYPE) &&
((val == P1212_KEYVALUE_Unit_Dependent_Info) ||
>Release-Note:
>Audit-Trail:
>Unformatted: