Commit 2902be86c1496244800ee15a148a4907bf9a3492
1 parent
2ad3d088d2
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
bootvx: x86: 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. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Showing 3 changed files with 23 additions and 27 deletions Side-by-side Diff
cmd/elf.c
... | ... | @@ -209,6 +209,7 @@ |
209 | 209 | char build_buf[128]; /* Buffer for building the bootline */ |
210 | 210 | int ptr = 0; |
211 | 211 | #ifdef CONFIG_X86 |
212 | + ulong base; | |
212 | 213 | struct e820info *info; |
213 | 214 | struct e820entry *data; |
214 | 215 | #endif |
215 | 216 | |
216 | 217 | |
... | ... | @@ -335,25 +336,18 @@ |
335 | 336 | |
336 | 337 | #ifdef CONFIG_X86 |
337 | 338 | /* |
338 | - * Since E820 information is critical to the kernel, if we don't | |
339 | - * specify these in the environments, use a default one. | |
339 | + * Get VxWorks's physical memory base address from environment, | |
340 | + * if we don't specify it in the environment, use a default one. | |
340 | 341 | */ |
341 | - tmp = env_get("e820data"); | |
342 | - if (tmp) | |
343 | - data = (struct e820entry *)simple_strtoul(tmp, NULL, 16); | |
344 | - else | |
345 | - data = (struct e820entry *)VXWORKS_E820_DATA_ADDR; | |
346 | - tmp = env_get("e820info"); | |
347 | - if (tmp) | |
348 | - info = (struct e820info *)simple_strtoul(tmp, NULL, 16); | |
349 | - else | |
350 | - info = (struct e820info *)VXWORKS_E820_INFO_ADDR; | |
342 | + base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE); | |
343 | + data = (struct e820entry *)(base + E820_DATA_OFFSET); | |
344 | + info = (struct e820info *)(base + E820_INFO_OFFSET); | |
351 | 345 | |
352 | 346 | memset(info, 0, sizeof(struct e820info)); |
353 | 347 | info->sign = E820_SIGNATURE; |
354 | 348 | info->entries = install_e820_map(E820MAX, data); |
355 | 349 | info->addr = (info->entries - 1) * sizeof(struct e820entry) + |
356 | - VXWORKS_E820_DATA_ADDR; | |
350 | + E820_DATA_OFFSET; | |
357 | 351 | #endif |
358 | 352 | |
359 | 353 | /* |
doc/README.vxworks
... | ... | @@ -67,17 +67,13 @@ |
67 | 67 | |
68 | 68 | x86-specific information |
69 | 69 | ------------------------ |
70 | -Before loading an x86 kernel, two additional environment variables need to be | |
71 | -provided. They are "e820data" and "e820info", which represent the address of | |
72 | -E820 table and E820 information (defined by VxWorks) in system memory. | |
70 | +Before loading an x86 kernel, one additional environment variable need to be | |
71 | +provided. This is "vx_phys_mem_base", which represent the physical memory | |
72 | +base address of VxWorks. | |
73 | 73 | |
74 | -Check VxWorks kernel configuration to look for BIOS_E820_DATA_START and | |
75 | -BIOS_E820_INFO_START, and assign their values to "e820data" and "e820info" | |
76 | -accordingly. If neither of these two are supplied, U-Boot assumes a default | |
77 | -location at 0x4000 for "e820data" and 0x4a00 for "e820info". Typical values | |
78 | -for "e820data" and "e820info" are 0x104000 and 0x104a00. But there is one | |
79 | -exception on Intel Galileo, where "e820data" and "e820info" should be left | |
80 | -unset, which assume the default location for VxWorks. | |
74 | +Check VxWorks kernel configuration to look for LOCAL_MEM_LOCAL_ADRS. For | |
75 | +VxWorks 7, this is normally a virtual address and you need find out its | |
76 | +corresponding physical address and assign its value to "vx_phys_mem_base". | |
81 | 77 | |
82 | 78 | For boards on which ACPI is not supported by U-Boot yet, VxWorks kernel must |
83 | 79 | be configured to use MP table and virtual wire interrupt mode. This requires |
include/vxworks.h
... | ... | @@ -9,9 +9,15 @@ |
9 | 9 | #define _VXWORKS_H_ |
10 | 10 | |
11 | 11 | /* |
12 | + * Physical address of memory base for VxWorks x86 | |
13 | + * This is LOCAL_MEM_LOCAL_ADRS in the VxWorks kernel configuration. | |
14 | + */ | |
15 | +#define VXWORKS_PHYS_MEM_BASE 0x100000 | |
16 | + | |
17 | +/* | |
12 | 18 | * VxWorks x86 E820 related stuff |
13 | 19 | * |
14 | - * VxWorks on x86 gets E820 information from pre-defined address @ | |
20 | + * VxWorks on x86 gets E820 information from pre-defined offset @ | |
15 | 21 | * 0x4a00 and 0x4000. At 0x4a00 it's an information table defined |
16 | 22 | * by VxWorks and the actual E820 table entries starts from 0x4000. |
17 | 23 | * As defined by the BIOS E820 spec, the maximum number of E820 table |
... | ... | @@ -20,8 +26,8 @@ |
20 | 26 | * information that is retrieved from the BIOS E820 call and saved |
21 | 27 | * later for sanity test during the kernel boot-up. |
22 | 28 | */ |
23 | -#define VXWORKS_E820_DATA_ADDR 0x4000 | |
24 | -#define VXWORKS_E820_INFO_ADDR 0x4a00 | |
29 | +#define E820_DATA_OFFSET 0x4000 | |
30 | +#define E820_INFO_OFFSET 0x4a00 | |
25 | 31 | |
26 | 32 | /* E820 info signatiure "SMAP" - System MAP */ |
27 | 33 | #define E820_SIGNATURE 0x534d4150 |