[PATCH 07/10] bootwrapper: Add PlanetCore firmware support.

David Gibson david at gibson.dropbear.id.au
Fri Sep 7 11:03:04 EST 2007


On Wed, Sep 05, 2007 at 02:21:15PM -0500, Scott Wood wrote:
> This is a library that board code can use to extract information from the
> PlanetCore configuration keys.  PlanetCore is used on various boards from
> Embedded Planet.
> 
> Signed-off-by: Scott Wood <scottwood at freescale.com>

[snip]
> +void planetcore_set_mac_addrs(const char *table)
> +{
> +	char addr[4][6];
> +	u64 int_addr;
> +	int i, j;
> +
> +	if (!planetcore_get_hex(table, PLANETCORE_KEY_MAC_ADDR, &int_addr))
> +		return;
> +
> +	for (i = 0; i < 4; i++) {
> +		u64 this_dev_addr = int_addr | mac_table[i];
> +
> +		for (j = 5; j >= 0; j--) {
> +			addr[i][j] = this_dev_addr & 0xff;
> +			this_dev_addr >>= 8;
> +		}
> +	}
> +
> +	dt_fixup_mac_addresses(addr[0], addr[1], addr[2], addr[3]);
> +}

It seems a bit silly to loop generating the MAC addresses, then loop
again assigning them to the device nodes.  Better, I think, to extract
the loop innards from dt_fixup_mac_addresses(), taking the
network-index as a parameter, then call that from within your loop
here.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson



More information about the Linuxppc-dev mailing list