aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/devtree.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-09-24 16:09:11 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-02 21:48:43 -0400
commit27ff35d9026b5d41d66ed95b65d7819db4cf5fb1 (patch)
tree5f19e6fa083770e4540ae507099cf463e34342da /arch/powerpc/boot/devtree.c
parent51a505d73bfed863135861fdc0496a09766b69d5 (diff)
[POWERPC] bootwrapper: Factor out dt_set_mac_address()
This allows callers to set addresses one at a time when that would be more convenient. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/devtree.c')
-rw-r--r--arch/powerpc/boot/devtree.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index 549463bf5eec..e5dfe4497313 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -88,29 +88,32 @@ void dt_fixup_clock(const char *path, u32 freq)
88 } 88 }
89} 89}
90 90
91void dt_fixup_mac_address(u32 index, const u8 *addr)
92{
93 void *devp = find_node_by_prop_value(NULL, "linux,network-index",
94 (void*)&index, sizeof(index));
95
96 if (devp) {
97 printf("ENET%d: local-mac-address <-"
98 " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
99 addr[0], addr[1], addr[2],
100 addr[3], addr[4], addr[5]);
101
102 setprop(devp, "local-mac-address", addr, 6);
103 }
104}
105
91void __dt_fixup_mac_addresses(u32 startindex, ...) 106void __dt_fixup_mac_addresses(u32 startindex, ...)
92{ 107{
93 va_list ap; 108 va_list ap;
94 u32 index = startindex; 109 u32 index = startindex;
95 void *devp;
96 const u8 *addr; 110 const u8 *addr;
97 111
98 va_start(ap, startindex); 112 va_start(ap, startindex);
99 while ((addr = va_arg(ap, const u8 *))) {
100 devp = find_node_by_prop_value(NULL, "linux,network-index",
101 (void*)&index, sizeof(index));
102 113
103 if (devp) { 114 while ((addr = va_arg(ap, const u8 *)))
104 printf("ENET%d: local-mac-address <-" 115 dt_fixup_mac_address(index++, addr);
105 " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
106 addr[0], addr[1], addr[2],
107 addr[3], addr[4], addr[5]);
108 116
109 setprop(devp, "local-mac-address", addr, 6);
110 }
111
112 index++;
113 }
114 va_end(ap); 117 va_end(ap);
115} 118}
116 119