Example #1
0
void
fdt_fixup_ethernet(const char *str, char *ethstr, int len)
{
	uint8_t tmp_addr[6];

	/* Convert macaddr string into a vector of uints */
	fdt_strtovectx(str, &tmp_addr, 6, sizeof(uint8_t));
	/* Set actual property to a value from vect */
	fdt_setprop(fdtp, fdt_path_offset(fdtp, ethstr),
	    "local-mac-address", &tmp_addr, 6 * sizeof(uint8_t));
}
Example #2
0
void
fixup_ethernet(const char *env, char *ethstr, int *eth_no, int len)
{
	char *end, *str;
	uint8_t tmp_addr[6];
	int i, n;

	/* Extract interface number */
	i = strtol(env + 3, &end, 10);
	if (end == (env + 3))
		/* 'ethaddr' means interface 0 address */
		n = 0;
	else
		n = i;

	if (n > TMP_MAX_ETH)
		return;

	str = ub_env_get(env);

	/* Convert macaddr string into a vector of uints */
	fdt_strtovectx(str, &tmp_addr, 6, sizeof(uint8_t));
	if (n != 0) {
		i = strlen(env) - 7;
		strncpy(ethstr + 8, env + 3, i);
	}
	/* Set actual property to a value from vect */
	fdt_setprop(fdtp, fdt_path_offset(fdtp, ethstr),
	    "local-mac-address", &tmp_addr, 6 * sizeof(uint8_t));

	/* Clear ethernet..XXXX.. string */
	bzero(ethstr + 8, len - 8);

	if (n + 1 > *eth_no)
		*eth_no = n + 1;
}