Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67408
b: refs/heads/master
c: 27ff35d
h: refs/heads/master
v: v3
  • Loading branch information
Scott Wood authored and Paul Mackerras committed Oct 3, 2007
1 parent 20d1e27 commit 385b0cc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 51a505d73bfed863135861fdc0496a09766b69d5
refs/heads/master: 27ff35d9026b5d41d66ed95b65d7819db4cf5fb1
31 changes: 17 additions & 14 deletions trunk/arch/powerpc/boot/devtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,32 @@ void dt_fixup_clock(const char *path, u32 freq)
}
}

void dt_fixup_mac_address(u32 index, const u8 *addr)
{
void *devp = find_node_by_prop_value(NULL, "linux,network-index",
(void*)&index, sizeof(index));

if (devp) {
printf("ENET%d: local-mac-address <-"
" %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
addr[0], addr[1], addr[2],
addr[3], addr[4], addr[5]);

setprop(devp, "local-mac-address", addr, 6);
}
}

void __dt_fixup_mac_addresses(u32 startindex, ...)
{
va_list ap;
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));

if (devp) {
printf("ENET%d: local-mac-address <-"
" %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
addr[0], addr[1], addr[2],
addr[3], addr[4], addr[5]);
while ((addr = va_arg(ap, const u8 *)))
dt_fixup_mac_address(index++, addr);

setprop(devp, "local-mac-address", addr, 6);
}

index++;
}
va_end(ap);
}

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/powerpc/boot/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq);
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, ...);
#define dt_fixup_mac_addresses(...) \
__dt_fixup_mac_addresses(0, __VA_ARGS__, NULL)
Expand Down

0 comments on commit 385b0cc

Please sign in to comment.