[U-Boot] [PATCH 29/82] x86: ivybridge: Add more debugging for failures

Bin Meng bmeng.cn at gmail.com
Tue Oct 11 05:16:40 CEST 2016


Hi Simon,

On Mon, Sep 26, 2016 at 11:33 AM, Simon Glass <sjg at chromium.org> wrote:
> Add various debug() messages in places where errors occur. This aids with
> debugging.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>  arch/x86/cpu/ivybridge/cpu.c   |  4 +++-
>  arch/x86/cpu/ivybridge/sdram.c | 36 +++++++++++++++++++++++++++---------
>  2 files changed, 30 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c
> index 85e361a..9d7c21d 100644
> --- a/arch/x86/cpu/ivybridge/cpu.c
> +++ b/arch/x86/cpu/ivybridge/cpu.c
> @@ -169,8 +169,10 @@ int print_cpuinfo(void)
>
>         /* Enable SPD ROMs and DDR-III DRAM */
>         ret = uclass_first_device_err(UCLASS_I2C, &dev);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: Failed to get I2C\n", __func__);
>                 return ret;
> +       }
>
>         /* Prepare USB controller early in S3 resume */
>         if (boot_mode == PEI_BOOT_RESUME) {
> diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
> index e0b06b5..eef6d78 100644
> --- a/arch/x86/cpu/ivybridge/sdram.c
> +++ b/arch/x86/cpu/ivybridge/sdram.c
> @@ -207,8 +207,10 @@ static int copy_spd(struct udevice *dev, struct pei_data *peid)
>         int ret;
>
>         ret = mrc_locate_spd(dev, sizeof(peid->spd_data[0]), &data);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: Could not locate SPD\n", __func__);
>                 return ret;
> +       }
>
>         memcpy(peid->spd_data[0], data, sizeof(peid->spd_data[0]));
>
> @@ -460,18 +462,26 @@ int dram_init(void)
>
>         /* We need the pinctrl set up early */
>         ret = syscon_get_by_driver_data(X86_SYSCON_PINCONF, &dev);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: Could not get pinconf\n", __func__);
>                 return ret;
> +       }
>
>         ret = uclass_first_device_err(UCLASS_NORTHBRIDGE, &dev);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: Could not get northbridge\n", __func__);
>                 return ret;
> +       }
>         ret = syscon_get_by_driver_data(X86_SYSCON_ME, &me_dev);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: Could not get ME\n", __func__);
>                 return ret;
> +       }
>         ret = copy_spd(dev, pei_data);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: Could not get SPD\n", __func__);
>                 return ret;
> +       }
>         pei_data->boot_mode = gd->arch.pei_boot_mode;
>         debug("Boot mode %d\n", gd->arch.pei_boot_mode);
>         debug("mrc_input %p\n", pei_data->mrc_input);
> @@ -498,19 +508,27 @@ int dram_init(void)
>
>         /* Wait for ME to be ready */
>         ret = intel_early_me_init(me_dev);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: Could not init ME\n", __func__);
>                 return ret;
> +       }
>         ret = intel_early_me_uma_size(me_dev);
> -       if (ret < 0)
> +       if (ret < 0) {
> +               debug("%s: Could not get UMA size\n", __func__);
>                 return ret;
> +       }
>
>         ret = mrc_common_init(dev, pei_data, false);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: mrc_common_init() failed\n", __func__);
>                 return ret;
> +       }
>
>         ret = sdram_find(dev);
> -       if (ret)
> +       if (ret) {
> +               debug("%s: sdram_find() failed\n", __func__);
>                 return ret;
> +       }
>         gd->ram_size = gd->arch.meminfo.total_32bit_memory;
>
>         debug("MRC output data length %#x at %p\n", pei_data->mrc_output_len,
> --

How about output the return value as well?

Regards,
Bin


More information about the U-Boot mailing list