[U-Boot] [Patch v4] powerpc/eeprom: cleanup mac command
Wolfgang Denk
wd at denx.de
Sat Oct 15 11:39:13 CEST 2011
Dear York Sun,
In message <1318631500.7780.56.camel at oslab-l1> you wrote:
>
> > There are very few exceptions wher eU-Boot uses and expects decimal
> > numbers, and I strongly recommend not to add any new such
> > inconsistencies.
>
> Changing back to hex number is not a problem. But it brings a problem
> when trying to set mac address to ports 10-15. For example, for port 14,
> you may want to use
>
> mac e xxxxxxxx
>
> where 'e' is another defined command. In order to make this work, we
> need to use two bytes for cmd.
No, not really.
Instead you should fix the command decode. If there are potential
confusions with the "mac errata" command then it's obviously not
sufficient to compare just the first character of the sub-command
name.
Frankly, the whole implementation of this command is a mess.
It is IMO a major design bug that the command accepts sub-commands, but
then does not use a sub-command to program the MAC address for port n.
Instead of implementing your own (broken, as we see now) way to
implement sub-commands, you should use the standard way with a
sub-command table as used elsewhere (thenyou get correct decoding for
free) - of course, you need to get rid of the inconsistency in your
command interface first.
My recommendation is therefor: 1) introduce a "mac" subcommand for
programming the MAC (this solves the decode issue), and 2) convert the
code to proper sub-command decoding.
> Back to my current patch, it was from another nice feedback. To accept
> both hex and decimal. In order to use hex, you will have to prefix it
> with 0x.
Yes, that is what your patch would do. But the standard input bae in
U-Boot is 16, not 10. So your patch introduces inconsistent
behaviour, which is why I NAKed it.
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
No journaling file system can recover your data if the disk dies.
- Steve Rago in <D4Cw1p.L9E at plc.com>
More information about the U-Boot
mailing list