Commit 27ff35d9 authored by Scott Wood's avatar Scott Wood Committed by Paul Mackerras

[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: default avatarScott Wood <scottwood@freescale.com>
Acked-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 51a505d7
...@@ -88,16 +88,9 @@ void dt_fixup_clock(const char *path, u32 freq) ...@@ -88,16 +88,9 @@ void dt_fixup_clock(const char *path, u32 freq)
} }
} }
void __dt_fixup_mac_addresses(u32 startindex, ...) void dt_fixup_mac_address(u32 index, const u8 *addr)
{ {
va_list ap; void *devp = find_node_by_prop_value(NULL, "linux,network-index",
u32 index = startindex;
void *devp;
const u8 *addr;
va_start(ap, startindex);
while ((addr = va_arg(ap, const u8 *))) {
devp = find_node_by_prop_value(NULL, "linux,network-index",
(void*)&index, sizeof(index)); (void*)&index, sizeof(index));
if (devp) { if (devp) {
...@@ -108,9 +101,19 @@ void __dt_fixup_mac_addresses(u32 startindex, ...) ...@@ -108,9 +101,19 @@ void __dt_fixup_mac_addresses(u32 startindex, ...)
setprop(devp, "local-mac-address", addr, 6); setprop(devp, "local-mac-address", addr, 6);
} }
}
void __dt_fixup_mac_addresses(u32 startindex, ...)
{
va_list ap;
u32 index = startindex;
const u8 *addr;
va_start(ap, startindex);
while ((addr = va_arg(ap, const u8 *)))
dt_fixup_mac_address(index++, addr);
index++;
}
va_end(ap); va_end(ap);
} }
......
...@@ -161,6 +161,7 @@ static inline void *find_node_by_devtype(const void *prev, ...@@ -161,6 +161,7 @@ static inline void *find_node_by_devtype(const void *prev,
void dt_fixup_memory(u64 start, u64 size); void dt_fixup_memory(u64 start, u64 size);
void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq); void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq);
void dt_fixup_clock(const char *path, u32 freq); void dt_fixup_clock(const char *path, u32 freq);
void dt_fixup_mac_address(u32 index, const u8 *addr);
void __dt_fixup_mac_addresses(u32 startindex, ...); void __dt_fixup_mac_addresses(u32 startindex, ...);
#define dt_fixup_mac_addresses(...) \ #define dt_fixup_mac_addresses(...) \
__dt_fixup_mac_addresses(0, __VA_ARGS__, NULL) __dt_fixup_mac_addresses(0, __VA_ARGS__, NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment