2018-04-12 7:02 GMT+02:00 Bin Meng :
> 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
Reviewed-by: Christian Gmeiner
> ---
>
> 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 0x10
> +
> +/*
> * 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