From: Simon Glass Date: Thu, 1 Jan 2015 23:17:56 +0000 (-0700) Subject: x86: Correct ifdtool microcode calculation X-Git-Tag: v2015.04-rc1~195^2~31 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8a388085c70d0da306cbd0dc644606cf8be24486;p=u-boot x86: Correct ifdtool microcode calculation This currently assumes that U-Boot resides at the start of ROM. Update it to remove this assumption. Signed-off-by: Simon Glass Tested-by: Bin Meng --- diff --git a/tools/ifdtool.c b/tools/ifdtool.c index fe8366ba4f..590ccc914b 100644 --- a/tools/ifdtool.c +++ b/tools/ifdtool.c @@ -788,9 +788,9 @@ static int write_uboot(char *image, int size, struct input_file *uboot, fdt_strerror(data_size)); return -ENOENT; } - offset = ucode_ptr - uboot->addr; + offset = (uint32_t)(ucode_ptr + size); ptr = (void *)image + offset; - ptr[0] = uboot->addr + (data - image); + ptr[0] = (data - image) - size; ptr[1] = data_size; debug("Wrote microcode pointer at %x: addr=%x, size=%x\n", ucode_ptr, ptr[0], ptr[1]);