public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] x86: Add infrastructure to extract an e820 table from the coreboot tables
Date: Sat, 03 Dec 2011 08:14:18 +1100	[thread overview]
Message-ID: <4ED93FAA.3080903@gmail.com> (raw)
In-Reply-To: <1322633275-10542-5-git-send-email-gabeblack@chromium.org>

Hi Gabe,

On 30/11/11 17:07, Gabe Black wrote:
> Signed-off-by: Gabe Black <gabeblack@chromium.org>
> ---
>  arch/x86/cpu/coreboot/sdram.c |   32 ++++++++++++++++++++++++++------
>  arch/x86/include/asm/zimage.h |    5 +++++
>  arch/x86/lib/zimage.c         |   10 ++++++++++
>  3 files changed, 41 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c
> index b5b086b..ce73467 100644
> --- a/arch/x86/cpu/coreboot/sdram.c
> +++ b/arch/x86/cpu/coreboot/sdram.c
> @@ -23,6 +23,8 @@
>   */
>  
>  #include <common.h>
> +#include <malloc.h>
> +#include <asm/e820.h>
>  #include <asm/u-boot-x86.h>
>  #include <asm/global_data.h>
>  #include <asm/ic/coreboot/sysinfo.h>
> @@ -30,18 +32,36 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
> +{
> +	int i;
> +
> +	unsigned num_entries = min(lib_sysinfo.n_memranges, max_entries);
> +	if (num_entries < lib_sysinfo.n_memranges) {
> +		printf("Warning: Limiting e820 map to %d entries.\n",
> +			num_entries);
> +	}
> +	for (i = 0; i < num_entries; i++) {
> +		struct memrange *memrange = &lib_sysinfo.memrange[i];
> +
> +		entries[i].addr = memrange->base;
> +		entries[i].size = memrange->size;
> +		entries[i].type = memrange->type;
> +	}
> +	return num_entries;
> +}
> +
>  int dram_init_f(void)
>  {
>  	int i;
>  	phys_size_t ram_size = 0;
> +
>  	for (i = 0; i < lib_sysinfo.n_memranges; i++) {
> -		unsigned long long end = \
> -			lib_sysinfo.memrange[i].base +
> -			lib_sysinfo.memrange[i].size;
> -		if (lib_sysinfo.memrange[i].type == CB_MEM_RAM &&
> -			end > ram_size) {
> +		struct memrange *memrange = &lib_sysinfo.memrange[i];
> +		unsigned long long end = memrange->base + memrange->size;
> +
> +		if (memrange->type == CB_MEM_RAM && end > ram_size)
>  			ram_size = end;
> -		}
>  	}
>  	gd->ram_size = ram_size;
>  	if (ram_size == 0)

Please fold these changes to dram_init_f() into the second patch

> diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h
> index a02637f..b172048 100644
> --- a/arch/x86/include/asm/zimage.h
> +++ b/arch/x86/include/asm/zimage.h
> @@ -24,6 +24,8 @@
>  #ifndef _ASM_ZIMAGE_H_
>  #define _ASM_ZIMAGE_H_
>  
> +#include <asm/e820.h>
> +
>  /* linux i386 zImage/bzImage header. Offsets relative to
>   * the start of the image */
>  
> @@ -65,6 +67,9 @@
>  #define BZIMAGE_LOAD_ADDR  0x100000
>  #define ZIMAGE_LOAD_ADDR   0x10000
>  
> +/* Implementation defined function to install an e820 map. */
> +unsigned install_e820_map(unsigned max_entries, struct e820entry *);
> +
>  void *load_zimage(char *image, unsigned long kernel_size,
>  		  unsigned long initrd_addr, unsigned long initrd_size,
>  		  int auto_boot);
> diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
> index 6843ff6..1fde13f 100644
> --- a/arch/x86/lib/zimage.c
> +++ b/arch/x86/lib/zimage.c
> @@ -51,6 +51,16 @@
>  
>  #define COMMAND_LINE_SIZE	2048
>  
> +unsigned generic_install_e820_map(unsigned max_entries,
> +				  struct e820entry *entries)
> +{
> +	return 0;
> +}
> +
> +unsigned install_e820_map(unsigned max_entries,
> +			  struct e820entry *entries)
> +	__attribute__((weak, alias("generic_install_e820_map")));
> +
>  static void build_command_line(char *command_line, int auto_boot)
>  {
>  	char *env_command_line;

I think all of the e820 code can be moved into your 32-bit boot protocol
patch series

Regards,

Graeme

  reply	other threads:[~2011-12-02 21:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30  6:07 [U-Boot] [PATCH 0/4] Add code to read in the coreboot tables and fill in memory info Gabe Black
2011-11-30  6:07 ` [U-Boot] [PATCH 1/4] x86: Import code from coreboot's libpayload to parse the coreboot table Gabe Black
2011-12-02 12:06   ` Graeme Russ
2011-11-30  6:07 ` [U-Boot] [PATCH 2/4] x86: Determine the ram size using the coreboot tables Gabe Black
2011-11-30  6:07 ` [U-Boot] [PATCH 3/4] x86: Force the lib_sysinfo structure to be in the .data section Gabe Black
2011-12-02 21:10   ` Graeme Russ
2011-12-02 21:16     ` Gabe Black
2011-12-02 21:22       ` Graeme Russ
2011-12-02 21:27         ` Gabe Black
2012-01-08  5:19   ` Mike Frysinger
2011-11-30  6:07 ` [U-Boot] [PATCH 4/4] x86: Add infrastructure to extract an e820 table from the coreboot tables Gabe Black
2011-12-02 21:14   ` Graeme Russ [this message]
2011-12-02 21:24     ` Gabe Black
2011-12-02 21:36       ` Graeme Russ

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ED93FAA.3080903@gmail.com \
    --to=graeme.russ@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox