[U-Boot] [PATCH v6 3/8] x86: slimbootloader: Add memory configuration

Andy Shevchenko andy.shevchenko at gmail.com
Fri Jul 26 10:30:15 UTC 2019


On Fri, Jul 26, 2019 at 10:00 AM Park, Aiden <aiden.park at intel.com> wrote:
>
> Slim Bootloader provides memory map info thru its HOB list pointer.
> Configure memory size and relocation memory from the HOB data, and
> provide e820 entries as well.
> - Get memory size from the memory map info HOB
> - Set available top memory lower than 4GB for U-Boot relocation
> - Provide e820 entries from the memory map info HOB


> +#define while_each_memory_map_entry_reversed(iter, entries) \
> +       (iter) = (entries)->count; \
> +       while ((iter)--) \
> +               if ((entries)->entry[(iter)].type != E820_RAM) \
> +                       continue; \
> +               else \

In case of macro it's better to go with for-loop.
Also, no need to have parenthesis around iterator (we expect it to be
plain variable.
continue can be replaced with {}.

See, for wxample,
https://elixir.bootlin.com/linux/latest/source/include/linux/pci.h#L634

> +
> +DECLARE_GLOBAL_DATA_PTR;
> +

And move the macro definition closer to its first use.

-- 
With Best Regards,
Andy Shevchenko


More information about the U-Boot mailing list