* [U-Boot] why does fdt_fixup_ethernet() need to worry about an edited FDT?
@ 2016-05-24 12:55 Robert P. J. Day
2016-05-25 2:23 ` Bin Meng
0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2016-05-24 12:55 UTC (permalink / raw)
To: u-boot
looking at the code for fdt_fixup_ethernet() in fdt_support.c, and
i'm puzzled by the extra work being done ostensibly to take an
"edited" FDT into account:
void fdt_fixup_ethernet(void *fdt)
{
int i, j, prop;
char *tmp, *end;
char mac[16];
const char *path;
unsigned char mac_addr[6];
int offset;
if (fdt_path_offset(fdt, "/aliases") < 0)
return;
/* Cycle through all aliases */
for (prop = 0; ; prop++) {
const char *name;
int len = strlen("ethernet");
/* FDT might have been edited, recompute the offset */
offset = fdt_first_property_offset(fdt,
fdt_path_offset(fdt, "/aliases"));
/* Select property number 'prop' */
for (i = 0; i < prop; i++)
offset = fdt_next_property_offset(fdt, offset);
... snip ...
why is it that *this* routine has to worry about an edited FDT, but
nothing else i see in that entire source file has to? as a (hopefully)
relevant example:
#if defined(OF_STDOUT_PATH)
static int fdt_fixup_stdout(void *fdt, int chosenoff)
{
return fdt_setprop(fdt, chosenoff, "linux,stdout-path",
OF_STDOUT_PATH, strlen(OF_STDOUT_PATH) + 1);
}
that routine simply calls fdt_setprop() ... what is it about
fdt_fixup_ethernet() that needs to take extra care compared to every
other function in that file?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
* [U-Boot] why does fdt_fixup_ethernet() need to worry about an edited FDT?
2016-05-24 12:55 [U-Boot] why does fdt_fixup_ethernet() need to worry about an edited FDT? Robert P. J. Day
@ 2016-05-25 2:23 ` Bin Meng
0 siblings, 0 replies; 2+ messages in thread
From: Bin Meng @ 2016-05-25 2:23 UTC (permalink / raw)
To: u-boot
On Tue, May 24, 2016 at 8:55 PM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
>
> looking at the code for fdt_fixup_ethernet() in fdt_support.c, and
> i'm puzzled by the extra work being done ostensibly to take an
> "edited" FDT into account:
>
> void fdt_fixup_ethernet(void *fdt)
> {
> int i, j, prop;
> char *tmp, *end;
> char mac[16];
> const char *path;
> unsigned char mac_addr[6];
> int offset;
>
> if (fdt_path_offset(fdt, "/aliases") < 0)
> return;
>
> /* Cycle through all aliases */
> for (prop = 0; ; prop++) {
> const char *name;
> int len = strlen("ethernet");
>
> /* FDT might have been edited, recompute the offset */
> offset = fdt_first_property_offset(fdt,
> fdt_path_offset(fdt, "/aliases"));
> /* Select property number 'prop' */
> for (i = 0; i < prop; i++)
> offset = fdt_next_property_offset(fdt, offset);
> ... snip ...
>
> why is it that *this* routine has to worry about an edited FDT, but
> nothing else i see in that entire source file has to? as a (hopefully)
> relevant example:
>
> #if defined(OF_STDOUT_PATH)
> static int fdt_fixup_stdout(void *fdt, int chosenoff)
> {
> return fdt_setprop(fdt, chosenoff, "linux,stdout-path",
> OF_STDOUT_PATH, strlen(OF_STDOUT_PATH) + 1);
> }
>
> that routine simply calls fdt_setprop() ... what is it about
> fdt_fixup_ethernet() that needs to take extra care compared to every
> other function in that file?
>
Commit a434fd1d282fd32d81296c6d4c2e0911f6e488b3 explains this.
Regards,
Bin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-25 2:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-24 12:55 [U-Boot] why does fdt_fixup_ethernet() need to worry about an edited FDT? Robert P. J. Day
2016-05-25 2:23 ` Bin Meng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox