Skip to contentSkip to conversation

doc: vxworks: Minor update for clarity

PATCH Superseded Bin Meng 2 participants 4 messages Apr 10, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/3 doc: vxworks: Minor update for clarity

This corrects a typo and updates several places for clarity.

---

 doc/README.vxworks | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
doc/README.vxworks +4 -4
index 3433e4f..eb1f458 100644
@@ -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.
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/3 bootvx: Prepare e820 related stuff from the given kernel memory base address

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.

---

 cmd/elf.c          | 21 ++++++++-------------
 doc/README.vxworks | 18 +++++++-----------
 include/vxworks.h  | 12 +++++++++---
 3 files changed, 24 insertions(+), 27 deletions(-)
cmd/elf.c +8 -13
index f874073..eec9f14 100644
@@ -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
 
 	/*
doc/README.vxworks +7 -11
index eb1f458..b95a516 100644
@@ -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
include/vxworks.h +9 -3
index f69b008..f600dfa 100644
@@ -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
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH 3/3 bootvx: Explicitly clear the bootloader image size

In reply to Bin Meng

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.

---

 cmd/elf.c         | 7 +++++++
 include/vxworks.h | 9 +++++++++
 2 files changed, 16 insertions(+)
cmd/elf.c +7 -0
index eec9f14..501f935 100644
@@ -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
 
 	/*
include/vxworks.h +9 -0
index f600dfa..d912076 100644
@@ -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);
Signature · 1 line
2.7.4
#3 lore raw

PATCH 1/3 doc: vxworks: Minor update for clarity

In reply to Bin Meng

2018-04-10 4:31 GMT+02:00 Bin Meng <[email protected]>:

Quoted 3 lines

This corrects a typo and updates several places for clarity.

Quoted 44 lines

---

 doc/README.vxworks | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
doc/README.vxworks +4 -5
index 3433e4f..eb1f458 100644
@@ -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

Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info