All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity
@ 2018-04-10  2:31 Bin Meng
  2018-04-10  2:31 ` [U-Boot] [PATCH 2/3] bootvx: Prepare e820 related stuff from the given kernel memory base address Bin Meng
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bin Meng @ 2018-04-10  2:31 UTC (permalink / raw)
  To: u-boot

This corrects a typo and updates several places for clarity.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 doc/README.vxworks | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/README.vxworks b/doc/README.vxworks
index 3433e4f..eb1f458 100644
--- a/doc/README.vxworks
+++ b/doc/README.vxworks
@@ -30,11 +30,11 @@ the ePAPR standard, which is shown below (see ePAPR for more details):
 
     void (*kernel_entry)(fdt_addr, 0, 0, EPAPR_MAGIC, boot_IMA, 0, 0)
 
-For ARM, the calling convention is show below:
+For ARM, the calling convention is shown below:
 
     void (*kernel_entry)(void *fdt_addr)
 
-When booting new VxWorks kernel (uImage format), the parameters passed to bootm
+When booting a VxWorks 7 kernel (uImage format), the parameters passed to bootm
 is like below:
 
     bootm <kernel image address> - <device tree address>
@@ -46,7 +46,7 @@ board-specific address before loading VxWorks. U-Boot supplies its address
 via "bootaddr" environment variable. To check where the bootline should be
 for a specific board, go to the VxWorks BSP for that board, and look for a
 parameter called BOOT_LINE_ADRS. Assign its value to "bootaddr". A typical
-value for "bootaddr" is 0x101200.
+value for "bootaddr" on an x86 board is 0x101200.
 
 If a "bootargs" variable is defined, its content will be copied to the memory
 location pointed by "bootaddr" as the kernel bootline. If "bootargs" is not
@@ -79,7 +79,7 @@ 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.
 
-Note since currently U-Boot does not support ACPI yet, VxWorks kernel must
+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
 INCLUDE_MPTABLE_BOOT_OP and INCLUDE_VIRTUAL_WIRE_MODE to be included in a
 VxWorks kernel configuration.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/3] bootvx: Prepare e820 related stuff from the given kernel memory base address
  2018-04-10  2:31 [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity Bin Meng
@ 2018-04-10  2:31 ` Bin Meng
  2018-04-10  2:31 ` [U-Boot] [PATCH 3/3] bootvx: Explicitly clear the bootloader image size Bin Meng
  2018-04-10  9:55 ` [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity Christian Gmeiner
  2 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2018-04-10  2:31 UTC (permalink / raw)
  To: u-boot

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>
---

 cmd/elf.c          | 21 ++++++++-------------
 doc/README.vxworks | 18 +++++++-----------
 include/vxworks.h  | 12 +++++++++---
 3 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/cmd/elf.c b/cmd/elf.c
index f874073..eec9f14 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -333,26 +333,21 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	}
 
 #ifdef CONFIG_X86
+	ulong base;
+
 	/*
-	 * 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 3/3] bootvx: Explicitly clear the bootloader image size
  2018-04-10  2:31 [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity Bin Meng
  2018-04-10  2:31 ` [U-Boot] [PATCH 2/3] bootvx: Prepare e820 related stuff from the given kernel memory base address Bin Meng
@ 2018-04-10  2:31 ` Bin Meng
  2018-04-10  9:55 ` [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity Christian Gmeiner
  2 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2018-04-10  2:31 UTC (permalink / raw)
  To: u-boot

VxWorks bootloader stores its size at a pre-defined offset @ 0x5004.
Later when VxWorks kernel boots up and system memory information is
retrieved from the E820 table, the bootloader size will be subtracted
from the total system memory size to calculate the size of available
memory for the OS.

Explicitly clear the bootloader image size otherwise if memory
at this offset happens to contain some garbage data, the final
available memory size for the kernel is insane.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 cmd/elf.c         | 7 +++++++
 include/vxworks.h | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/cmd/elf.c b/cmd/elf.c
index eec9f14..501f935 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -348,6 +348,13 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	info->entries = install_e820_map(E820MAX, data);
 	info->addr = (info->entries - 1) * sizeof(struct e820entry) +
 		     E820_DATA_OFFSET;
+
+	/*
+	 * Explicitly clear the bootloader image size otherwise if memory
+	 * at this offset happens to contain some garbage data, the final
+	 * available memory size for the kernel is insane.
+	 */
+	*(u32 *)(base + BOOT_IMAGE_SIZE_OFFSET) = 0;
 #endif
 
 	/*
diff --git a/include/vxworks.h b/include/vxworks.h
index f600dfa..d912076 100644
--- a/include/vxworks.h
+++ b/include/vxworks.h
@@ -43,6 +43,15 @@ struct e820info {
 	u32 error;	/* must be zero */
 };
 
+/*
+ * VxWorks bootloader stores its size at a pre-defined offset @ 0x5004.
+ * Later when VxWorks kernel boots up and system memory information is
+ * retrieved from the E820 table, the bootloader size will be subtracted
+ * from the total system memory size to calculate the size of available
+ * memory for the OS.
+ */
+#define BOOT_IMAGE_SIZE_OFFSET	0x5004
+
 int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 void boot_prep_vxworks(bootm_headers_t *images);
 void boot_jump_vxworks(bootm_headers_t *images);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity
  2018-04-10  2:31 [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity Bin Meng
  2018-04-10  2:31 ` [U-Boot] [PATCH 2/3] bootvx: Prepare e820 related stuff from the given kernel memory base address Bin Meng
  2018-04-10  2:31 ` [U-Boot] [PATCH 3/3] bootvx: Explicitly clear the bootloader image size Bin Meng
@ 2018-04-10  9:55 ` Christian Gmeiner
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Gmeiner @ 2018-04-10  9:55 UTC (permalink / raw)
  To: u-boot

2018-04-10 4:31 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
> This corrects a typo and updates several places for clarity.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

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

> ---
>
>  doc/README.vxworks | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/doc/README.vxworks b/doc/README.vxworks
> index 3433e4f..eb1f458 100644
> --- a/doc/README.vxworks
> +++ b/doc/README.vxworks
> @@ -30,11 +30,11 @@ the ePAPR standard, which is shown below (see ePAPR for more details):
>
>      void (*kernel_entry)(fdt_addr, 0, 0, EPAPR_MAGIC, boot_IMA, 0, 0)
>
> -For ARM, the calling convention is show below:
> +For ARM, the calling convention is shown below:
>
>      void (*kernel_entry)(void *fdt_addr)
>
> -When booting new VxWorks kernel (uImage format), the parameters passed to bootm
> +When booting a VxWorks 7 kernel (uImage format), the parameters passed to bootm
>  is like below:
>
>      bootm <kernel image address> - <device tree address>
> @@ -46,7 +46,7 @@ board-specific address before loading VxWorks. U-Boot supplies its address
>  via "bootaddr" environment variable. To check where the bootline should be
>  for a specific board, go to the VxWorks BSP for that board, and look for a
>  parameter called BOOT_LINE_ADRS. Assign its value to "bootaddr". A typical
> -value for "bootaddr" is 0x101200.
> +value for "bootaddr" on an x86 board is 0x101200.
>
>  If a "bootargs" variable is defined, its content will be copied to the memory
>  location pointed by "bootaddr" as the kernel bootline. If "bootargs" is not
> @@ -79,7 +79,7 @@ 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.
>
> -Note since currently U-Boot does not support ACPI yet, VxWorks kernel must
> +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
>  INCLUDE_MPTABLE_BOOT_OP and INCLUDE_VIRTUAL_WIRE_MODE to be included in a
>  VxWorks kernel configuration.
> --
> 2.7.4
>



-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-10  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10  2:31 [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity Bin Meng
2018-04-10  2:31 ` [U-Boot] [PATCH 2/3] bootvx: Prepare e820 related stuff from the given kernel memory base address Bin Meng
2018-04-10  2:31 ` [U-Boot] [PATCH 3/3] bootvx: Explicitly clear the bootloader image size Bin Meng
2018-04-10  9:55 ` [U-Boot] [PATCH 1/3] doc: vxworks: Minor update for clarity Christian Gmeiner

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.