From ecb1ab17614fdc090c1d9924dfcf7f49160bb17b Mon Sep 17 00:00:00 2001 From: Rafal Jaworowski Date: Wed, 12 Mar 2008 16:32:08 +0000 Subject: Obtain TSEC h/w address from the parent bus (OCP) and not rely blindly on what might be currently programmed into the registers. Underlying firmware (U-Boot) would typically program MAC address into the first unit only, and others are left uninitialized. It is now possible to retrieve and program MAC address for all units properly, provided they were passed on in the bootinfo metadata. Reviewed by: imp, marcel Approved by: cognet (mentor) --- sys/powerpc/mpc85xx/ocpbus.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sys/powerpc/mpc85xx') diff --git a/sys/powerpc/mpc85xx/ocpbus.c b/sys/powerpc/mpc85xx/ocpbus.c index a62e78b8bcaf..cf86eed0cce4 100644 --- a/sys/powerpc/mpc85xx/ocpbus.c +++ b/sys/powerpc/mpc85xx/ocpbus.c @@ -555,6 +555,8 @@ static int ocpbus_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { struct ocp_devinfo *dinfo; + struct bi_eth_addr *eth; + int unit; if (device_get_parent(child) != dev) return (EINVAL); @@ -571,6 +573,13 @@ ocpbus_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) case OCPBUS_IVAR_HWUNIT: *result = dinfo->ocp_unit; return (0); + case OCPBUS_IVAR_MACADDR: + unit = device_get_unit(child); + if (unit > bootinfo->bi_eth_addr_no - 1) + return (EINVAL); + eth = bootinfo_eth() + unit; + *result = (uintptr_t)eth; + return (0); } return (EINVAL); -- cgit v1.3