All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Gmeiner <christian.gmeiner@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 02/18] bootvx: x86: Prepare e820 related stuff from the given kernel memory base address
Date: Thu, 12 Apr 2018 09:25:26 +0200	[thread overview]
Message-ID: <CAH9NwWfPV23N=c04qj5txGJTjMbt0jLJdFCyxB_QDKcOaPcDwQ@mail.gmail.com> (raw)
In-Reply-To: <1523509343-18123-3-git-send-email-bmeng.cn@gmail.com>

2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
> At present two environment variables 'e820data'/'e820info' are required
> to boot a VxWorks x86 kernel, but this is superfluous. The offset of
> these two tables are actually at a fixed offset from the kernel memory
> base address and we can provide the kernel memory base address to U-Boot
> via only one variable 'vx_phys_mem_base'.
>
> Note as it name indicates, the physical address should be provided.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

> ---
>
> Changes in v2: None
>
>  cmd/elf.c          | 20 +++++++-------------
>  doc/README.vxworks | 18 +++++++-----------
>  include/vxworks.h  | 12 +++++++++---
>  3 files changed, 23 insertions(+), 27 deletions(-)
>
> diff --git a/cmd/elf.c b/cmd/elf.c
> index f874073..c83d4cd 100644
> --- a/cmd/elf.c
> +++ b/cmd/elf.c
> @@ -208,6 +208,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>         char build_buf[128]; /* Buffer for building the bootline */
>         int ptr = 0;
>  #ifdef CONFIG_X86
> +       ulong base;
>         struct e820info *info;
>         struct e820entry *data;
>  #endif
> @@ -334,25 +335,18 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>
>  #ifdef CONFIG_X86
>         /*
> -        * Since E820 information is critical to the kernel, if we don't
> -        * specify these in the environments, use a default one.
> +        * Get VxWorks's physical memory base address from environment,
> +        * if we don't specify it in the environment, use a default one.
>          */
> -       tmp = env_get("e820data");
> -       if (tmp)
> -               data = (struct e820entry *)simple_strtoul(tmp, NULL, 16);
> -       else
> -               data = (struct e820entry *)VXWORKS_E820_DATA_ADDR;
> -       tmp = env_get("e820info");
> -       if (tmp)
> -               info = (struct e820info *)simple_strtoul(tmp, NULL, 16);
> -       else
> -               info = (struct e820info *)VXWORKS_E820_INFO_ADDR;
> +       base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE);
> +       data = (struct e820entry *)(base + E820_DATA_OFFSET);
> +       info = (struct e820info *)(base + E820_INFO_OFFSET);
>
>         memset(info, 0, sizeof(struct e820info));
>         info->sign = E820_SIGNATURE;
>         info->entries = install_e820_map(E820MAX, data);
>         info->addr = (info->entries - 1) * sizeof(struct e820entry) +
> -                    VXWORKS_E820_DATA_ADDR;
> +                    E820_DATA_OFFSET;
>  #endif
>
>         /*
> diff --git a/doc/README.vxworks b/doc/README.vxworks
> index eb1f458..b95a516 100644
> --- a/doc/README.vxworks
> +++ b/doc/README.vxworks
> @@ -67,17 +67,13 @@ look like VxWorks hangs somewhere as nothing outputs on the serial console.
>
>  x86-specific information
>  ------------------------
> -Before loading an x86 kernel, two additional environment variables need to be
> -provided. They are "e820data" and "e820info", which represent the address of
> -E820 table and E820 information (defined by VxWorks) in system memory.
> -
> -Check VxWorks kernel configuration to look for BIOS_E820_DATA_START and
> -BIOS_E820_INFO_START, and assign their values to "e820data" and "e820info"
> -accordingly. If neither of these two are supplied, U-Boot assumes a default
> -location at 0x4000 for "e820data" and 0x4a00 for "e820info". Typical values
> -for "e820data" and "e820info" are 0x104000 and 0x104a00. But there is one
> -exception on Intel Galileo, where "e820data" and "e820info" should be left
> -unset, which assume the default location for VxWorks.
> +Before loading an x86 kernel, one additional environment variable need to be
> +provided. This is "vx_phys_mem_base", which represent the physical memory
> +base address of VxWorks.
> +
> +Check VxWorks kernel configuration to look for LOCAL_MEM_LOCAL_ADRS. For
> +VxWorks 7, this is normally a virtual address and you need find out its
> +corresponding physical address and assign its value to "vx_phys_mem_base".
>
>  For boards on which ACPI is not supported by U-Boot yet, VxWorks kernel must
>  be configured to use MP table and virtual wire interrupt mode. This requires
> diff --git a/include/vxworks.h b/include/vxworks.h
> index f69b008..f600dfa 100644
> --- a/include/vxworks.h
> +++ b/include/vxworks.h
> @@ -9,9 +9,15 @@
>  #define _VXWORKS_H_
>
>  /*
> + * Physical address of memory base for VxWorks x86
> + * This is LOCAL_MEM_LOCAL_ADRS in the VxWorks kernel configuration.
> + */
> +#define VXWORKS_PHYS_MEM_BASE  0x100000
> +
> +/*
>   * VxWorks x86 E820 related stuff
>   *
> - * VxWorks on x86 gets E820 information from pre-defined address @
> + * VxWorks on x86 gets E820 information from pre-defined offset @
>   * 0x4a00 and 0x4000. At 0x4a00 it's an information table defined
>   * by VxWorks and the actual E820 table entries starts from 0x4000.
>   * As defined by the BIOS E820 spec, the maximum number of E820 table
> @@ -20,8 +26,8 @@
>   * information that is retrieved from the BIOS E820 call and saved
>   * later for sanity test during the kernel boot-up.
>   */
> -#define VXWORKS_E820_DATA_ADDR 0x4000
> -#define VXWORKS_E820_INFO_ADDR 0x4a00
> +#define E820_DATA_OFFSET       0x4000
> +#define E820_INFO_OFFSET       0x4a00
>
>  /* E820 info signatiure "SMAP" - System MAP */
>  #define E820_SIGNATURE 0x534d4150
> --
> 2.7.4
>



-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info

  reply	other threads:[~2018-04-12  7:25 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12  5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 01/18] doc: vxworks: Minor update for clarity Bin Meng
2018-04-16  9:15   ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 02/18] bootvx: x86: Prepare e820 related stuff from the given kernel memory base address Bin Meng
2018-04-12  7:25   ` Christian Gmeiner [this message]
2018-04-16  9:15     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 03/18] bootvx: x86: Explicitly clear the bootloader image size Bin Meng
2018-04-12 16:41   ` Simon Glass
2018-04-16  9:15     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 04/18] vxworks: x86: Rename e820info to e820_info Bin Meng
2018-04-12  7:26   ` Christian Gmeiner
2018-04-16  9:15     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 05/18] x86: Use 'unsigned int' in install_e820_map() functions Bin Meng
2018-04-12  7:27   ` Christian Gmeiner
2018-04-16  9:15     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 06/18] x86: Rename e820entry to e820_entry Bin Meng
2018-04-12  7:28   ` Christian Gmeiner
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 07/18] elf: Clean up the ELF header file Bin Meng
2018-04-12  7:29   ` Christian Gmeiner
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 08/18] elf: Add ELF64 related structure defines Bin Meng
2018-04-12 16:41   ` Simon Glass
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 09/18] elf: Add a very simple ELF64 loader Bin Meng
2018-04-12 16:42   ` Simon Glass
2018-04-13  3:30     ` Bin Meng
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 10/18] bios: vesa: Guard setting vesa mode with CONFIG_FRAMEBUFFER_SET_VESA_MODE Bin Meng
2018-04-12 16:42   ` Simon Glass
2018-04-13  3:30     ` Bin Meng
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 11/18] video: vesa: Change default FRAMEBUFFER_VESA_MODE Bin Meng
2018-04-12 16:42   ` Simon Glass
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 12/18] x86: Change default FRAMEBUFFER_VESA_MODE of some boards Bin Meng
2018-04-12 16:42   ` Simon Glass
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 13/18] pci: video: Only print out when everything is OK Bin Meng
2018-04-12 16:42   ` Simon Glass
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 14/18] bootvx: x86: Make VxWorks EFI console driver happy Bin Meng
2018-04-12 16:42   ` Simon Glass
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 15/18] bootvx: Refactor the bootline copy codes a little bit Bin Meng
2018-04-12 16:42   ` Simon Glass
2018-04-16  9:16     ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 16/18] bootvx: Exit if bootline address is not specified Bin Meng
2018-04-16  9:17   ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 17/18] bootvx: x86: Assign bootaddr based on kernel memory base Bin Meng
2018-04-16  9:17   ` Bin Meng
2018-04-12  5:02 ` [U-Boot] [PATCH v2 18/18] doc: vxworks: Update x86 specific instructions Bin Meng
2018-04-16  9:17   ` Bin Meng

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='CAH9NwWfPV23N=c04qj5txGJTjMbt0jLJdFCyxB_QDKcOaPcDwQ@mail.gmail.com' \
    --to=christian.gmeiner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.