[U-Boot] [PATCH] IDE: Don't assume there are always two devices per bus

Wolfgang Denk wd at denx.de
Mon Sep 6 10:18:06 CEST 2010


Dear Albert ARIBAUD,

In message <4C848E1A.1070003 at free.fr> you wrote:
> 
> >> Indeed; and additionally, who says you can only have two IDE busses? I
> >> am facing the case right now with the MV88SX6081, which is an 8-ports
> >> controller.
> >
> > But this is NOT an PATA controller, right?
> 
> Correct. It is a SATA controller with ATA, not PATA, compatibility.

OK. Then we must not talk about "IDE busses".

> For IDE as such, I agree. However:
> 
> 1) Some systems simply do not allow more that one IDE drive for 
> mechanical reasons. I suspect this is the reason behind the 
> CONFIG_SYS_IDE_MAXDEVICE option, which, as such, contradicts IDE since 
> it prevents cmd_ide to handle all 2*MAXBUS devices it could.

I don't understand what you want to tell me. As far as PATA is
concerned (and this is all what "*_IDE_*" config options refer to),
we can have zero, one or two devices per bus, and the code supports
this.

For systems, where only one device can be physically attached,
CONFIG_SYS_IDE_MAXDEVICE allows to save memory footprint because in
common/cmd_ide.c we allocate only as many device descriptors as we
need:

	block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];

This is just an implementation detail to avoid wasting memory; it has
nothing to do with restrictions in implementing the PATA specs.

> 2) More generally, the "cmd_ide.c" actually uses ATA to communicate with 
> the devices it manages; thus I feel cmd_ide.c is rightly used when on 
> non-IDE-but-ATA-compatible devices, and that the issue is of naming only.

Maybe. But if you are using it on such devices, please make sure not
to apply terms that make sense on IDE / PATA devices only.

> Besides, since cmd_ide's maximum bus feature is purely a design choice 
> not dictated by standards, I assume your rebuttal addresses maximum 

This "design choice" is merely the coinsequence of providing a static
allocation of data structures with minimal memory footprint. This is
OK for typical embedded systems where the configuration is inherently
static and known in advance.

> devices per bus but not maximum busses, right? Would you agree at least 
> to the minimal idea of having more than two ATA-compatible busses 
> managed by cmd_ide?

Yes, I agree. But this is not a new feature, but already supported out
of the box, isn't it?

> How about this: we could remove "IDE" altogether from config options 
> which are not actually IDE related. This includes CONFIG_SYS_IDE_MAXBUS 
> which is neither IDE- or ATA-related but system-defined

It may be "system-defined" (what exactly do you mean by that term?),
but it is ATA-related, isn't it?

> We would also remove ATA from non-ATA related symbols used in cmd_ide, 
> but so far the only one I see is CONFIG_SYS_IDE_MAXDEVICE, which is 
> purely a hack to accommodate system limitations; and in my proposal, it 

What makes you think this is a "hack"?

> would disappear from config files because it equals the sum of the "max 
> device" fields in the struct.

This would just waste memory for data structures which will never be
used.

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
Crash programs fail because they are based on the theory  that,  with
nine women pregnant, you can get a baby a month.  - Wernher von Braun


More information about the U-Boot mailing list