[U-Boot] [PATCH] cmd_ide: Fix detection problem with missing devices
Wolfgang Denk
wd at denx.de
Thu May 14 22:54:39 CEST 2009
Dear Stefan Roese,
In message <200905141714.34154.sr at denx.de> you wrote:
>
> > U-Boot 1.3.2-rc2-g02e4b4e3 (Feb 28 2008 - 16:46:26)
> ^^^^^^^^^^^^^
> That's very old.
Indeed. That's why I included this information as data point.
> From my understanding this worked at some point on the CPCI750 as well.
Ah! You didn't mention this before. That's bad.
> Perhaps you could give the TOT U-Boot version a try on your board used above.
> My guess is that this will fail as well.
Correct.
> I tried to locate a problem that was introduced at some time but couldn't
> locate it (no, I didn't use git bisect). But looking at the current code this
Well, I did bisect it, and found that it's an "interesting" issue, as
inbettween there obviously were some versions where it didn't work at
all; i. e.:
old:
IDE: Bus 0: ..OK
Device 0: Model: HITACHI_DK23DA-20 Firm: 00J2A0A1 Ser#: 12Y0MN
Type: Hard Disk
Capacity: 19077.1 MB = 18.6 GB (39070080 x 512)
Device 1: not available
then:
IDE: Bus 0: OK
Device 0: Model: HITACHI_DK23DA-20 Firm: 00J2A0A1 Ser#: 12Y0MN
Vendor: HITACHI_DK23DA-20 Prod.: 12Y0MN Rev: 00J2A0A1
Type: Hard Disk
Capacity: 19077.1 MB = 18.6 GB (39070080 x 512)
Device 1: not available
then:
IDE: Bus 0: OK
Device 0: not available
Device 1: not available
This was caused by:
574b319512b13e10800f0045e39b993f4ca25e42 is first bad commit
commit 574b319512b13e10800f0045e39b993f4ca25e42
Author: Detlev Zundel <dzu at denx.de>
Date: Mon May 5 16:11:21 2008 +0200
Fix disk type output in disk/part.c
Signed-off-by: Detlev Zundel <dzu at denx.de>
The bug is here:
- if (dev_desc->type==DEV_TYPE_UNKNOWN) {
- puts ("not available\n");
- return;
- }
- if (dev_desc->if_type==IF_TYPE_SCSI) {
- printf ("(%d:%d) ", dev_desc->target,dev_desc->lun);
- }
- if (dev_desc->if_type==IF_TYPE_IDE) {
- printf ("Model: %s Firm: %s Ser#: %s\n",
+ switch (dev_desc->type) {
+ case IF_TYPE_SCSI:
...
+ case DEV_TYPE_UNKNOWN:
+ default:
+ puts ("not available\n");
+ return;
The initial test was on "dev_desc->type", but this was
"optimized" into the switch - not noticing that the switch
tests for "dev_desc->if_type" which can only take "IF_*"
values, but no "DEV_*" values.
Later, the switch() was fixed into "switch (dev_desc->if_type)",
but then the DEV_TYPE_UNKNOWN was converted into IF_TYPE_UNKNOWN
which might have seemed logical at that time, but by that we
lost all trace of the original test; see
commit 8ec6e332eace0ee78c71ee5f645d12b06813b86f
Author: Tor Krill <tor at excito.com>
Date: Thu May 29 11:10:30 2008 +0200
Fix incorrect switch for IF_TYPE in part.c
and finally:
IDE: Bus 0: OK
Device 0: Model: HITACHI_DK23DA-20 Firm: 00J2A0A1 Ser#: 12Y0MN
Type: Hard Disk
Capacity: 19077.1 MB = 18.6 GB (39070080 x 512)
Device 1: Model: Firm: Ser#:
Type: # 1F #
Capacity: not available
Hey, that's fun, isn't it :-(
> just can't work as is for the 2nd drive. And I still think my fix is ok.
I don't think so. Could you please try the patch in the following
mail? Thanks in advance.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Democracy is mob rule, but with income taxes.
More information about the U-Boot
mailing list