* [U-Boot] [PATCH v2 01/18] doc: vxworks: Minor update for clarity
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 ` 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
` (16 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 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>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
Changes in v2: None
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] 53+ messages in thread
* [U-Boot] [PATCH v2 02/18] bootvx: x86: Prepare e820 related stuff from the given kernel memory base address
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-12 5:02 ` Bin Meng
2018-04-12 7:25 ` Christian Gmeiner
2018-04-12 5:02 ` [U-Boot] [PATCH v2 03/18] bootvx: x86: Explicitly clear the bootloader image size Bin Meng
` (15 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 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>
---
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
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 02/18] bootvx: x86: Prepare e820 related stuff from the given kernel memory base address
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
2018-04-16 9:15 ` Bin Meng
0 siblings, 1 reply; 53+ messages in thread
From: Christian Gmeiner @ 2018-04-12 7:25 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 02/18] bootvx: x86: Prepare e820 related stuff from the given kernel memory base address
2018-04-12 7:25 ` Christian Gmeiner
@ 2018-04-16 9:15 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:15 UTC (permalink / raw)
To: u-boot
On Thu, Apr 12, 2018 at 3:25 PM, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
> 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(-)
>>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 03/18] bootvx: x86: Explicitly clear the bootloader image size
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-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 5:02 ` Bin Meng
2018-04-12 16:41 ` Simon Glass
2018-04-12 5:02 ` [U-Boot] [PATCH v2 04/18] vxworks: x86: Rename e820info to e820_info Bin Meng
` (14 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 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>
---
Changes in v2: None
cmd/elf.c | 7 +++++++
include/vxworks.h | 9 +++++++++
2 files changed, 16 insertions(+)
diff --git a/cmd/elf.c b/cmd/elf.c
index c83d4cd..4638d79 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -347,6 +347,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] 53+ messages in thread
* [U-Boot] [PATCH v2 03/18] bootvx: x86: Explicitly clear the bootloader image size
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
0 siblings, 1 reply; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:41 UTC (permalink / raw)
To: u-boot
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> 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>
> ---
>
> Changes in v2: None
>
> cmd/elf.c | 7 +++++++
> include/vxworks.h | 9 +++++++++
> 2 files changed, 16 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 03/18] bootvx: x86: Explicitly clear the bootloader image size
2018-04-12 16:41 ` Simon Glass
@ 2018-04-16 9:15 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:15 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:41 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> 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>
>> ---
>>
>> Changes in v2: None
>>
>> cmd/elf.c | 7 +++++++
>> include/vxworks.h | 9 +++++++++
>> 2 files changed, 16 insertions(+)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 04/18] vxworks: x86: Rename e820info to e820_info
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (2 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 03/18] bootvx: x86: Explicitly clear the bootloader image size Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-12 7:26 ` Christian Gmeiner
2018-04-12 5:02 ` [U-Boot] [PATCH v2 05/18] x86: Use 'unsigned int' in install_e820_map() functions Bin Meng
` (13 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
This changes 'struct e820info' to 'struct e820_info' to conform
with the coding style.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
cmd/elf.c | 6 +++---
include/vxworks.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cmd/elf.c b/cmd/elf.c
index 4638d79..0717feb 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -209,7 +209,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int ptr = 0;
#ifdef CONFIG_X86
ulong base;
- struct e820info *info;
+ struct e820_info *info;
struct e820entry *data;
#endif
@@ -340,9 +340,9 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
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);
+ info = (struct e820_info *)(base + E820_INFO_OFFSET);
- memset(info, 0, sizeof(struct e820info));
+ memset(info, 0, sizeof(struct e820_info));
info->sign = E820_SIGNATURE;
info->entries = install_e820_map(E820MAX, data);
info->addr = (info->entries - 1) * sizeof(struct e820entry) +
diff --git a/include/vxworks.h b/include/vxworks.h
index d912076..4a83a34 100644
--- a/include/vxworks.h
+++ b/include/vxworks.h
@@ -32,7 +32,7 @@
/* E820 info signatiure "SMAP" - System MAP */
#define E820_SIGNATURE 0x534d4150
-struct e820info {
+struct e820_info {
u32 sign; /* "SMAP" signature */
u32 x0; /* don't care, used by VxWorks */
u32 x1; /* don't care, used by VxWorks */
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 04/18] vxworks: x86: Rename e820info to e820_info
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
0 siblings, 1 reply; 53+ messages in thread
From: Christian Gmeiner @ 2018-04-12 7:26 UTC (permalink / raw)
To: u-boot
2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
> This changes 'struct e820info' to 'struct e820_info' to conform
> with the coding style.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>
> Changes in v2: None
>
> cmd/elf.c | 6 +++---
> include/vxworks.h | 2 +-
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/cmd/elf.c b/cmd/elf.c
> index 4638d79..0717feb 100644
> --- a/cmd/elf.c
> +++ b/cmd/elf.c
> @@ -209,7 +209,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> int ptr = 0;
> #ifdef CONFIG_X86
> ulong base;
> - struct e820info *info;
> + struct e820_info *info;
> struct e820entry *data;
> #endif
>
> @@ -340,9 +340,9 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> */
> 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);
> + info = (struct e820_info *)(base + E820_INFO_OFFSET);
>
> - memset(info, 0, sizeof(struct e820info));
> + memset(info, 0, sizeof(struct e820_info));
> info->sign = E820_SIGNATURE;
> info->entries = install_e820_map(E820MAX, data);
> info->addr = (info->entries - 1) * sizeof(struct e820entry) +
> diff --git a/include/vxworks.h b/include/vxworks.h
> index d912076..4a83a34 100644
> --- a/include/vxworks.h
> +++ b/include/vxworks.h
> @@ -32,7 +32,7 @@
> /* E820 info signatiure "SMAP" - System MAP */
> #define E820_SIGNATURE 0x534d4150
>
> -struct e820info {
> +struct e820_info {
> u32 sign; /* "SMAP" signature */
> u32 x0; /* don't care, used by VxWorks */
> u32 x1; /* don't care, used by VxWorks */
> --
> 2.7.4
>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 04/18] vxworks: x86: Rename e820info to e820_info
2018-04-12 7:26 ` Christian Gmeiner
@ 2018-04-16 9:15 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:15 UTC (permalink / raw)
To: u-boot
On Thu, Apr 12, 2018 at 3:26 PM, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
> 2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
>> This changes 'struct e820info' to 'struct e820_info' to conform
>> with the coding style.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 05/18] x86: Use 'unsigned int' in install_e820_map() functions
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (3 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 04/18] vxworks: x86: Rename e820info to e820_info Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-12 7:27 ` Christian Gmeiner
2018-04-12 5:02 ` [U-Boot] [PATCH v2 06/18] x86: Rename e820entry to e820_entry Bin Meng
` (12 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
This fixes the following checkpatch warning:
warning: Prefer 'unsigned int' to bare use of 'unsigned'
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
arch/x86/cpu/coreboot/sdram.c | 7 ++++---
arch/x86/cpu/qemu/e820.c | 3 ++-
arch/x86/cpu/tangier/sdram.c | 6 ++++--
arch/x86/include/asm/e820.h | 3 ++-
arch/x86/lib/e820.c | 4 ++--
arch/x86/lib/fsp/fsp_dram.c | 5 +++--
6 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c
index 82407af..05918bc 100644
--- a/arch/x86/cpu/coreboot/sdram.c
+++ b/arch/x86/cpu/coreboot/sdram.c
@@ -12,12 +12,13 @@
DECLARE_GLOBAL_DATA_PTR;
-unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
+unsigned int install_e820_map(unsigned int max_entries,
+ struct e820entry *entries)
{
- unsigned num_entries;
+ unsigned int num_entries;
int i;
- num_entries = min((unsigned)lib_sysinfo.n_memranges, max_entries);
+ num_entries = min((unsigned int)lib_sysinfo.n_memranges, max_entries);
if (num_entries < lib_sysinfo.n_memranges) {
printf("Warning: Limiting e820 map to %d entries.\n",
num_entries);
diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c
index c1c9b89..11409dd 100644
--- a/arch/x86/cpu/qemu/e820.c
+++ b/arch/x86/cpu/qemu/e820.c
@@ -9,7 +9,8 @@
DECLARE_GLOBAL_DATA_PTR;
-unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
+unsigned int install_e820_map(unsigned int max_entries,
+ struct e820entry *entries)
{
entries[0].addr = 0;
entries[0].size = ISA_START_ADDRESS;
diff --git a/arch/x86/cpu/tangier/sdram.c b/arch/x86/cpu/tangier/sdram.c
index eae8d78..daa9909 100644
--- a/arch/x86/cpu/tangier/sdram.c
+++ b/arch/x86/cpu/tangier/sdram.c
@@ -99,7 +99,8 @@ static struct sfi_table_simple *sfi_search_mmap(void)
i < SFI_GET_NUM_ENTRIES(sb, struct sfi_mem_entry); \
i++, mentry++) \
-static unsigned sfi_setup_e820(unsigned max_entries, struct e820entry *entries)
+static unsigned int sfi_setup_e820(unsigned int max_entries,
+ struct e820entry *entries)
{
struct sfi_table_simple *sb;
struct sfi_mem_entry *mentry;
@@ -188,7 +189,8 @@ static phys_size_t sfi_get_ram_size(void)
return ram;
}
-unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
+unsigned int install_e820_map(unsigned int max_entries,
+ struct e820entry *entries)
{
return sfi_setup_e820(max_entries, entries);
}
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index 351f021..8355c34 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -24,6 +24,7 @@ struct e820entry {
#endif /* __ASSEMBLY__ */
/* Implementation defined function to install an e820 map */
-unsigned install_e820_map(unsigned max_entries, struct e820entry *);
+unsigned int install_e820_map(unsigned int max_entries,
+ struct e820entry *);
#endif /* _ASM_X86_E820_H */
diff --git a/arch/x86/lib/e820.c b/arch/x86/lib/e820.c
index 5babfde..c2595b1 100644
--- a/arch/x86/lib/e820.c
+++ b/arch/x86/lib/e820.c
@@ -17,8 +17,8 @@ DECLARE_GLOBAL_DATA_PTR;
* 0x100000-gd->ram_size Useable RAM
* CONFIG_PCIE_ECAM_BASE PCIe ECAM
*/
-__weak unsigned install_e820_map(unsigned max_entries,
- struct e820entry *entries)
+__weak unsigned int install_e820_map(unsigned int max_entries,
+ struct e820entry *entries)
{
entries[0].addr = 0;
entries[0].size = ISA_START_ADDRESS;
diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
index 1a7af57..c1c6c54 100644
--- a/arch/x86/lib/fsp/fsp_dram.c
+++ b/arch/x86/lib/fsp/fsp_dram.c
@@ -62,9 +62,10 @@ ulong board_get_usable_ram_top(ulong total_size)
return fsp_get_usable_lowmem_top(gd->arch.hob_list);
}
-unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
+unsigned int install_e820_map(unsigned int max_entries,
+ struct e820entry *entries)
{
- unsigned num_entries = 0;
+ unsigned int num_entries = 0;
const struct hob_header *hdr;
struct hob_res_desc *res_desc;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 05/18] x86: Use 'unsigned int' in install_e820_map() functions
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
0 siblings, 1 reply; 53+ messages in thread
From: Christian Gmeiner @ 2018-04-12 7:27 UTC (permalink / raw)
To: u-boot
2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
> This fixes the following checkpatch warning:
>
> warning: Prefer 'unsigned int' to bare use of 'unsigned'
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>
> Changes in v2: None
>
> arch/x86/cpu/coreboot/sdram.c | 7 ++++---
> arch/x86/cpu/qemu/e820.c | 3 ++-
> arch/x86/cpu/tangier/sdram.c | 6 ++++--
> arch/x86/include/asm/e820.h | 3 ++-
> arch/x86/lib/e820.c | 4 ++--
> arch/x86/lib/fsp/fsp_dram.c | 5 +++--
> 6 files changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c
> index 82407af..05918bc 100644
> --- a/arch/x86/cpu/coreboot/sdram.c
> +++ b/arch/x86/cpu/coreboot/sdram.c
> @@ -12,12 +12,13 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> -unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
> +unsigned int install_e820_map(unsigned int max_entries,
> + struct e820entry *entries)
> {
> - unsigned num_entries;
> + unsigned int num_entries;
> int i;
>
> - num_entries = min((unsigned)lib_sysinfo.n_memranges, max_entries);
> + num_entries = min((unsigned int)lib_sysinfo.n_memranges, max_entries);
> if (num_entries < lib_sysinfo.n_memranges) {
> printf("Warning: Limiting e820 map to %d entries.\n",
> num_entries);
> diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c
> index c1c9b89..11409dd 100644
> --- a/arch/x86/cpu/qemu/e820.c
> +++ b/arch/x86/cpu/qemu/e820.c
> @@ -9,7 +9,8 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> -unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
> +unsigned int install_e820_map(unsigned int max_entries,
> + struct e820entry *entries)
> {
> entries[0].addr = 0;
> entries[0].size = ISA_START_ADDRESS;
> diff --git a/arch/x86/cpu/tangier/sdram.c b/arch/x86/cpu/tangier/sdram.c
> index eae8d78..daa9909 100644
> --- a/arch/x86/cpu/tangier/sdram.c
> +++ b/arch/x86/cpu/tangier/sdram.c
> @@ -99,7 +99,8 @@ static struct sfi_table_simple *sfi_search_mmap(void)
> i < SFI_GET_NUM_ENTRIES(sb, struct sfi_mem_entry); \
> i++, mentry++) \
>
> -static unsigned sfi_setup_e820(unsigned max_entries, struct e820entry *entries)
> +static unsigned int sfi_setup_e820(unsigned int max_entries,
> + struct e820entry *entries)
> {
> struct sfi_table_simple *sb;
> struct sfi_mem_entry *mentry;
> @@ -188,7 +189,8 @@ static phys_size_t sfi_get_ram_size(void)
> return ram;
> }
>
> -unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
> +unsigned int install_e820_map(unsigned int max_entries,
> + struct e820entry *entries)
> {
> return sfi_setup_e820(max_entries, entries);
> }
> diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
> index 351f021..8355c34 100644
> --- a/arch/x86/include/asm/e820.h
> +++ b/arch/x86/include/asm/e820.h
> @@ -24,6 +24,7 @@ struct e820entry {
> #endif /* __ASSEMBLY__ */
>
> /* Implementation defined function to install an e820 map */
> -unsigned install_e820_map(unsigned max_entries, struct e820entry *);
> +unsigned int install_e820_map(unsigned int max_entries,
> + struct e820entry *);
>
> #endif /* _ASM_X86_E820_H */
> diff --git a/arch/x86/lib/e820.c b/arch/x86/lib/e820.c
> index 5babfde..c2595b1 100644
> --- a/arch/x86/lib/e820.c
> +++ b/arch/x86/lib/e820.c
> @@ -17,8 +17,8 @@ DECLARE_GLOBAL_DATA_PTR;
> * 0x100000-gd->ram_size Useable RAM
> * CONFIG_PCIE_ECAM_BASE PCIe ECAM
> */
> -__weak unsigned install_e820_map(unsigned max_entries,
> - struct e820entry *entries)
> +__weak unsigned int install_e820_map(unsigned int max_entries,
> + struct e820entry *entries)
> {
> entries[0].addr = 0;
> entries[0].size = ISA_START_ADDRESS;
> diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
> index 1a7af57..c1c6c54 100644
> --- a/arch/x86/lib/fsp/fsp_dram.c
> +++ b/arch/x86/lib/fsp/fsp_dram.c
> @@ -62,9 +62,10 @@ ulong board_get_usable_ram_top(ulong total_size)
> return fsp_get_usable_lowmem_top(gd->arch.hob_list);
> }
>
> -unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
> +unsigned int install_e820_map(unsigned int max_entries,
> + struct e820entry *entries)
> {
> - unsigned num_entries = 0;
> + unsigned int num_entries = 0;
> const struct hob_header *hdr;
> struct hob_res_desc *res_desc;
>
> --
> 2.7.4
>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 05/18] x86: Use 'unsigned int' in install_e820_map() functions
2018-04-12 7:27 ` Christian Gmeiner
@ 2018-04-16 9:15 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:15 UTC (permalink / raw)
To: u-boot
On Thu, Apr 12, 2018 at 3:27 PM, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
> 2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
>> This fixes the following checkpatch warning:
>>
>> warning: Prefer 'unsigned int' to bare use of 'unsigned'
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>
>> ---
>>
>> Changes in v2: None
>>
>> arch/x86/cpu/coreboot/sdram.c | 7 ++++---
>> arch/x86/cpu/qemu/e820.c | 3 ++-
>> arch/x86/cpu/tangier/sdram.c | 6 ++++--
>> arch/x86/include/asm/e820.h | 3 ++-
>> arch/x86/lib/e820.c | 4 ++--
>> arch/x86/lib/fsp/fsp_dram.c | 5 +++--
>> 6 files changed, 17 insertions(+), 11 deletions(-)
>>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 06/18] x86: Rename e820entry to e820_entry
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (4 preceding siblings ...)
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 5:02 ` Bin Meng
2018-04-12 7:28 ` Christian Gmeiner
2018-04-12 5:02 ` [U-Boot] [PATCH v2 07/18] elf: Clean up the ELF header file Bin Meng
` (11 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
This changes 'struct e820entry' to 'struct e820_entry' to conform
with the coding style.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
arch/x86/cpu/coreboot/sdram.c | 2 +-
arch/x86/cpu/qemu/e820.c | 2 +-
arch/x86/cpu/tangier/sdram.c | 4 ++--
arch/x86/include/asm/bootparam.h | 2 +-
arch/x86/include/asm/e820.h | 4 ++--
arch/x86/lib/coreboot_table.c | 2 +-
arch/x86/lib/e820.c | 2 +-
arch/x86/lib/fsp/fsp_dram.c | 2 +-
cmd/elf.c | 6 +++---
9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c
index 05918bc..885fc6f 100644
--- a/arch/x86/cpu/coreboot/sdram.c
+++ b/arch/x86/cpu/coreboot/sdram.c
@@ -13,7 +13,7 @@
DECLARE_GLOBAL_DATA_PTR;
unsigned int install_e820_map(unsigned int max_entries,
- struct e820entry *entries)
+ struct e820_entry *entries)
{
unsigned int num_entries;
int i;
diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c
index 11409dd..ec733cb 100644
--- a/arch/x86/cpu/qemu/e820.c
+++ b/arch/x86/cpu/qemu/e820.c
@@ -10,7 +10,7 @@
DECLARE_GLOBAL_DATA_PTR;
unsigned int install_e820_map(unsigned int max_entries,
- struct e820entry *entries)
+ struct e820_entry *entries)
{
entries[0].addr = 0;
entries[0].size = ISA_START_ADDRESS;
diff --git a/arch/x86/cpu/tangier/sdram.c b/arch/x86/cpu/tangier/sdram.c
index daa9909..f5f412a 100644
--- a/arch/x86/cpu/tangier/sdram.c
+++ b/arch/x86/cpu/tangier/sdram.c
@@ -100,7 +100,7 @@ static struct sfi_table_simple *sfi_search_mmap(void)
i++, mentry++) \
static unsigned int sfi_setup_e820(unsigned int max_entries,
- struct e820entry *entries)
+ struct e820_entry *entries)
{
struct sfi_table_simple *sb;
struct sfi_mem_entry *mentry;
@@ -190,7 +190,7 @@ static phys_size_t sfi_get_ram_size(void)
}
unsigned int install_e820_map(unsigned int max_entries,
- struct e820entry *entries)
+ struct e820_entry *entries)
{
return sfi_setup_e820(max_entries, entries);
}
diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
index 6aba614..0386cbe 100644
--- a/arch/x86/include/asm/bootparam.h
+++ b/arch/x86/include/asm/bootparam.h
@@ -111,7 +111,7 @@ struct boot_params {
struct setup_header hdr; /* setup header */ /* 0x1f1 */
__u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
__u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
- struct e820entry e820_map[E820MAX]; /* 0x2d0 */
+ struct e820_entry e820_map[E820MAX]; /* 0x2d0 */
__u8 _pad8[48]; /* 0xcd0 */
struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
__u8 _pad9[276]; /* 0xeec */
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index 8355c34..9d29f82 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -12,7 +12,7 @@
#ifndef __ASSEMBLY__
#include <linux/types.h>
-struct e820entry {
+struct e820_entry {
__u64 addr; /* start of memory segment */
__u64 size; /* size of memory segment */
__u32 type; /* type of memory segment */
@@ -25,6 +25,6 @@ struct e820entry {
/* Implementation defined function to install an e820 map */
unsigned int install_e820_map(unsigned int max_entries,
- struct e820entry *);
+ struct e820_entry *);
#endif /* _ASM_X86_E820_H */
diff --git a/arch/x86/lib/coreboot_table.c b/arch/x86/lib/coreboot_table.c
index b1b4cd9..5e0edd3 100644
--- a/arch/x86/lib/coreboot_table.c
+++ b/arch/x86/lib/coreboot_table.c
@@ -100,7 +100,7 @@ void write_coreboot_table(u32 addr, struct memory_area *cfg_tables)
struct cb_record *cbr;
struct cb_memory *mem;
struct cb_memory_range *map;
- struct e820entry e820[32];
+ struct e820_entry e820[32];
struct cb_framebuffer *fb;
struct vesa_mode_info *vesa;
int i, num;
diff --git a/arch/x86/lib/e820.c b/arch/x86/lib/e820.c
index c2595b1..84c8fab 100644
--- a/arch/x86/lib/e820.c
+++ b/arch/x86/lib/e820.c
@@ -18,7 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
* CONFIG_PCIE_ECAM_BASE PCIe ECAM
*/
__weak unsigned int install_e820_map(unsigned int max_entries,
- struct e820entry *entries)
+ struct e820_entry *entries)
{
entries[0].addr = 0;
entries[0].size = ISA_START_ADDRESS;
diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
index c1c6c54..662d4ac 100644
--- a/arch/x86/lib/fsp/fsp_dram.c
+++ b/arch/x86/lib/fsp/fsp_dram.c
@@ -63,7 +63,7 @@ ulong board_get_usable_ram_top(ulong total_size)
}
unsigned int install_e820_map(unsigned int max_entries,
- struct e820entry *entries)
+ struct e820_entry *entries)
{
unsigned int num_entries = 0;
const struct hob_header *hdr;
diff --git a/cmd/elf.c b/cmd/elf.c
index 0717feb..824f88e 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -210,7 +210,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#ifdef CONFIG_X86
ulong base;
struct e820_info *info;
- struct e820entry *data;
+ struct e820_entry *data;
#endif
/*
@@ -339,13 +339,13 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* if we don't specify it in the environment, use a default one.
*/
base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE);
- data = (struct e820entry *)(base + E820_DATA_OFFSET);
+ data = (struct e820_entry *)(base + E820_DATA_OFFSET);
info = (struct e820_info *)(base + E820_INFO_OFFSET);
memset(info, 0, sizeof(struct e820_info));
info->sign = E820_SIGNATURE;
info->entries = install_e820_map(E820MAX, data);
- info->addr = (info->entries - 1) * sizeof(struct e820entry) +
+ info->addr = (info->entries - 1) * sizeof(struct e820_entry) +
E820_DATA_OFFSET;
/*
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 06/18] x86: Rename e820entry to e820_entry
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
0 siblings, 1 reply; 53+ messages in thread
From: Christian Gmeiner @ 2018-04-12 7:28 UTC (permalink / raw)
To: u-boot
2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
> This changes 'struct e820entry' to 'struct e820_entry' to conform
> with the coding style.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>
> Changes in v2: None
>
> arch/x86/cpu/coreboot/sdram.c | 2 +-
> arch/x86/cpu/qemu/e820.c | 2 +-
> arch/x86/cpu/tangier/sdram.c | 4 ++--
> arch/x86/include/asm/bootparam.h | 2 +-
> arch/x86/include/asm/e820.h | 4 ++--
> arch/x86/lib/coreboot_table.c | 2 +-
> arch/x86/lib/e820.c | 2 +-
> arch/x86/lib/fsp/fsp_dram.c | 2 +-
> cmd/elf.c | 6 +++---
> 9 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c
> index 05918bc..885fc6f 100644
> --- a/arch/x86/cpu/coreboot/sdram.c
> +++ b/arch/x86/cpu/coreboot/sdram.c
> @@ -13,7 +13,7 @@
> DECLARE_GLOBAL_DATA_PTR;
>
> unsigned int install_e820_map(unsigned int max_entries,
> - struct e820entry *entries)
> + struct e820_entry *entries)
> {
> unsigned int num_entries;
> int i;
> diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c
> index 11409dd..ec733cb 100644
> --- a/arch/x86/cpu/qemu/e820.c
> +++ b/arch/x86/cpu/qemu/e820.c
> @@ -10,7 +10,7 @@
> DECLARE_GLOBAL_DATA_PTR;
>
> unsigned int install_e820_map(unsigned int max_entries,
> - struct e820entry *entries)
> + struct e820_entry *entries)
> {
> entries[0].addr = 0;
> entries[0].size = ISA_START_ADDRESS;
> diff --git a/arch/x86/cpu/tangier/sdram.c b/arch/x86/cpu/tangier/sdram.c
> index daa9909..f5f412a 100644
> --- a/arch/x86/cpu/tangier/sdram.c
> +++ b/arch/x86/cpu/tangier/sdram.c
> @@ -100,7 +100,7 @@ static struct sfi_table_simple *sfi_search_mmap(void)
> i++, mentry++) \
>
> static unsigned int sfi_setup_e820(unsigned int max_entries,
> - struct e820entry *entries)
> + struct e820_entry *entries)
> {
> struct sfi_table_simple *sb;
> struct sfi_mem_entry *mentry;
> @@ -190,7 +190,7 @@ static phys_size_t sfi_get_ram_size(void)
> }
>
> unsigned int install_e820_map(unsigned int max_entries,
> - struct e820entry *entries)
> + struct e820_entry *entries)
> {
> return sfi_setup_e820(max_entries, entries);
> }
> diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
> index 6aba614..0386cbe 100644
> --- a/arch/x86/include/asm/bootparam.h
> +++ b/arch/x86/include/asm/bootparam.h
> @@ -111,7 +111,7 @@ struct boot_params {
> struct setup_header hdr; /* setup header */ /* 0x1f1 */
> __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
> __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
> - struct e820entry e820_map[E820MAX]; /* 0x2d0 */
> + struct e820_entry e820_map[E820MAX]; /* 0x2d0 */
> __u8 _pad8[48]; /* 0xcd0 */
> struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
> __u8 _pad9[276]; /* 0xeec */
> diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
> index 8355c34..9d29f82 100644
> --- a/arch/x86/include/asm/e820.h
> +++ b/arch/x86/include/asm/e820.h
> @@ -12,7 +12,7 @@
> #ifndef __ASSEMBLY__
> #include <linux/types.h>
>
> -struct e820entry {
> +struct e820_entry {
> __u64 addr; /* start of memory segment */
> __u64 size; /* size of memory segment */
> __u32 type; /* type of memory segment */
> @@ -25,6 +25,6 @@ struct e820entry {
>
> /* Implementation defined function to install an e820 map */
> unsigned int install_e820_map(unsigned int max_entries,
> - struct e820entry *);
> + struct e820_entry *);
>
> #endif /* _ASM_X86_E820_H */
> diff --git a/arch/x86/lib/coreboot_table.c b/arch/x86/lib/coreboot_table.c
> index b1b4cd9..5e0edd3 100644
> --- a/arch/x86/lib/coreboot_table.c
> +++ b/arch/x86/lib/coreboot_table.c
> @@ -100,7 +100,7 @@ void write_coreboot_table(u32 addr, struct memory_area *cfg_tables)
> struct cb_record *cbr;
> struct cb_memory *mem;
> struct cb_memory_range *map;
> - struct e820entry e820[32];
> + struct e820_entry e820[32];
> struct cb_framebuffer *fb;
> struct vesa_mode_info *vesa;
> int i, num;
> diff --git a/arch/x86/lib/e820.c b/arch/x86/lib/e820.c
> index c2595b1..84c8fab 100644
> --- a/arch/x86/lib/e820.c
> +++ b/arch/x86/lib/e820.c
> @@ -18,7 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
> * CONFIG_PCIE_ECAM_BASE PCIe ECAM
> */
> __weak unsigned int install_e820_map(unsigned int max_entries,
> - struct e820entry *entries)
> + struct e820_entry *entries)
> {
> entries[0].addr = 0;
> entries[0].size = ISA_START_ADDRESS;
> diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
> index c1c6c54..662d4ac 100644
> --- a/arch/x86/lib/fsp/fsp_dram.c
> +++ b/arch/x86/lib/fsp/fsp_dram.c
> @@ -63,7 +63,7 @@ ulong board_get_usable_ram_top(ulong total_size)
> }
>
> unsigned int install_e820_map(unsigned int max_entries,
> - struct e820entry *entries)
> + struct e820_entry *entries)
> {
> unsigned int num_entries = 0;
> const struct hob_header *hdr;
> diff --git a/cmd/elf.c b/cmd/elf.c
> index 0717feb..824f88e 100644
> --- a/cmd/elf.c
> +++ b/cmd/elf.c
> @@ -210,7 +210,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> #ifdef CONFIG_X86
> ulong base;
> struct e820_info *info;
> - struct e820entry *data;
> + struct e820_entry *data;
> #endif
>
> /*
> @@ -339,13 +339,13 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> * if we don't specify it in the environment, use a default one.
> */
> base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE);
> - data = (struct e820entry *)(base + E820_DATA_OFFSET);
> + data = (struct e820_entry *)(base + E820_DATA_OFFSET);
> info = (struct e820_info *)(base + E820_INFO_OFFSET);
>
> memset(info, 0, sizeof(struct e820_info));
> info->sign = E820_SIGNATURE;
> info->entries = install_e820_map(E820MAX, data);
> - info->addr = (info->entries - 1) * sizeof(struct e820entry) +
> + info->addr = (info->entries - 1) * sizeof(struct e820_entry) +
> E820_DATA_OFFSET;
>
> /*
> --
> 2.7.4
>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 06/18] x86: Rename e820entry to e820_entry
2018-04-12 7:28 ` Christian Gmeiner
@ 2018-04-16 9:16 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Thu, Apr 12, 2018 at 3:28 PM, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
> 2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
>> This changes 'struct e820entry' to 'struct e820_entry' to conform
>> with the coding style.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>
>> ---
>>
>> Changes in v2: None
>>
>> arch/x86/cpu/coreboot/sdram.c | 2 +-
>> arch/x86/cpu/qemu/e820.c | 2 +-
>> arch/x86/cpu/tangier/sdram.c | 4 ++--
>> arch/x86/include/asm/bootparam.h | 2 +-
>> arch/x86/include/asm/e820.h | 4 ++--
>> arch/x86/lib/coreboot_table.c | 2 +-
>> arch/x86/lib/e820.c | 2 +-
>> arch/x86/lib/fsp/fsp_dram.c | 2 +-
>> cmd/elf.c | 6 +++---
>> 9 files changed, 13 insertions(+), 13 deletions(-)
>>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 07/18] elf: Clean up the ELF header file
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (5 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 06/18] x86: Rename e820entry to e820_entry Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-12 7:29 ` Christian Gmeiner
2018-04-12 5:02 ` [U-Boot] [PATCH v2 08/18] elf: Add ELF64 related structure defines Bin Meng
` (10 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
Fix various style violations in elf.h
- use correct comment format if the comment fits in just one line
- remove the ending period for the one-line comment
- use tab for the indention instead of space
- put the opening brace at the same line of a typedef/union
- remove <name> in a 'typedef struct' for consistency
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
include/elf.h | 284 ++++++++++++++++++++++++++++------------------------------
1 file changed, 138 insertions(+), 146 deletions(-)
diff --git a/include/elf.h b/include/elf.h
index fe2128f..4742597 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -5,10 +5,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-/*
- * This is the ELF ABI header file
- * formerly known as "elf_abi.h".
- */
+/* This is the ELF ABI header file formerly known as "elf_abi.h" */
#ifndef _ELF_H
#define _ELF_H
@@ -16,20 +13,16 @@
#ifndef __ASSEMBLER__
#include "compiler.h"
-/*
- * This version doesn't work for 64-bit ABIs - Erik.
- */
+/* This version doesn't work for 64-bit ABIs - Erik */
-/*
- * These typedefs need to be handled better.
- */
+/* These typedefs need to be handled better */
typedef uint32_t Elf32_Addr; /* Unsigned program address */
typedef uint32_t Elf32_Off; /* Unsigned file offset */
typedef int32_t Elf32_Sword; /* Signed large integer */
typedef uint32_t Elf32_Word; /* Unsigned large integer */
typedef uint16_t Elf32_Half; /* Unsigned medium integer */
-/* 64-bit ELF base types. */
+/* 64-bit ELF base types */
typedef uint64_t Elf64_Addr;
typedef uint16_t Elf64_Half;
typedef int16_t Elf64_SHalf;
@@ -96,7 +89,7 @@ typedef int64_t Elf64_Sxword;
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
/* ELF Header */
-typedef struct elfhdr{
+typedef struct {
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
Elf32_Half e_type; /* object file type */
Elf32_Half e_machine; /* machine */
@@ -122,9 +115,9 @@ typedef struct elfhdr{
#define ET_CORE 4 /* core file */
#define ET_NUM 5 /* number of types */
#define ET_LOOS 0xfe00 /* reserved range for operating */
-#define ET_HIOS 0xfeff /* system specific e_type */
+#define ET_HIOS 0xfeff /* system specific e_type */
#define ET_LOPROC 0xff00 /* reserved range for processor */
-#define ET_HIPROC 0xffff /* specific e_type */
+#define ET_HIPROC 0xffff /* specific e_type */
/* e_machine */
#define EM_NONE 0 /* No Machine */
@@ -235,9 +228,9 @@ typedef struct {
#define SHN_UNDEF 0 /* undefined */
#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
#define SHN_LOPROC 0xff00 /* reserved range for processor */
-#define SHN_HIPROC 0xff1f /* specific section indexes */
+#define SHN_HIPROC 0xff1f /* specific section indexes */
#define SHN_LOOS 0xff20 /* reserved range for operating */
-#define SHN_HIOS 0xff3f /* specific semantics */
+#define SHN_HIOS 0xff3f /* specific semantics */
#define SHN_ABS 0xfff1 /* absolute value */
#define SHN_COMMON 0xfff2 /* common symbol */
#define SHN_XINDEX 0xffff /* Index is an extra table */
@@ -265,46 +258,46 @@ typedef struct {
#define SHT_LOOS 0x60000000 /* Start OS-specific */
#define SHT_HIOS 0x6fffffff /* End OS-specific */
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
-#define SHT_HIPROC 0x7fffffff /* specific section header types */
+#define SHT_HIPROC 0x7fffffff /* specific section header types */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
-#define SHT_HIUSER 0xffffffff /* specific indexes */
+#define SHT_HIUSER 0xffffffff /* specific indexes */
/* Section names */
-#define ELF_BSS ".bss" /* uninitialized data */
+#define ELF_BSS ".bss" /* uninitialized data */
#define ELF_COMMENT ".comment" /* version control information */
-#define ELF_DATA ".data" /* initialized data */
-#define ELF_DATA1 ".data1" /* initialized data */
-#define ELF_DEBUG ".debug" /* debug */
-#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
-#define ELF_DYNSTR ".dynstr" /* dynamic string table */
-#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
-#define ELF_FINI ".fini" /* termination code */
+#define ELF_DATA ".data" /* initialized data */
+#define ELF_DATA1 ".data1" /* initialized data */
+#define ELF_DEBUG ".debug" /* debug */
+#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
+#define ELF_DYNSTR ".dynstr" /* dynamic string table */
+#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
+#define ELF_FINI ".fini" /* termination code */
#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */
-#define ELF_GOT ".got" /* global offset table */
-#define ELF_HASH ".hash" /* symbol hash table */
-#define ELF_INIT ".init" /* initialization code */
+#define ELF_GOT ".got" /* global offset table */
+#define ELF_HASH ".hash" /* symbol hash table */
+#define ELF_INIT ".init" /* initialization code */
#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */
#define ELF_INTERP ".interp" /* Pathname of program interpreter */
#define ELF_LINE ".line" /* Symbolic line numnber information */
#define ELF_NOTE ".note" /* Contains note section */
#define ELF_PLT ".plt" /* Procedure linkage table */
#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */
-#define ELF_REL_DATA ".rel.data" /* relocation data */
-#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
-#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
-#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
-#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
-#define ELF_REL_TEXT ".rel.text" /* relocation code */
-#define ELF_RODATA ".rodata" /* read-only data */
-#define ELF_RODATA1 ".rodata1" /* read-only data */
-#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
-#define ELF_STRTAB ".strtab" /* string table */
-#define ELF_SYMTAB ".symtab" /* symbol table */
+#define ELF_REL_DATA ".rel.data" /* relocation data */
+#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
+#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
+#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
+#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
+#define ELF_REL_TEXT ".rel.text" /* relocation code */
+#define ELF_RODATA ".rodata" /* read-only data */
+#define ELF_RODATA1 ".rodata1" /* read-only data */
+#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
+#define ELF_STRTAB ".strtab" /* string table */
+#define ELF_SYMTAB ".symtab" /* symbol table */
#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */
#define ELF_TBSS ".tbss" /* thread local uninit data */
#define ELF_TDATA ".tdata" /* thread local init data */
#define ELF_TDATA1 ".tdata1" /* thread local init data */
-#define ELF_TEXT ".text" /* code */
+#define ELF_TEXT ".text" /* code */
/* Section Attribute Flags - sh_flags */
#define SHF_WRITE 0x1 /* Writable */
@@ -319,7 +312,7 @@ typedef struct {
#define SHF_TLS 0x400 /* Thread local storage */
#define SHF_MASKOS 0x0ff00000 /* OS specific */
#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
- /* specific section attributes */
+ /* specific section attributes */
/* Section Group Flags */
#define GRP_COMDAT 0x1 /* COMDAT group */
@@ -327,7 +320,7 @@ typedef struct {
#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */
/* Symbol Table Entry */
-typedef struct elf32_sym {
+typedef struct {
Elf32_Word st_name; /* name - index into string table */
Elf32_Addr st_value; /* symbol value */
Elf32_Word st_size; /* symbol size */
@@ -351,9 +344,9 @@ typedef struct elf32_sym {
#define STB_WEAK 2 /* like global - lower precedence */
#define STB_NUM 3 /* number of symbol bindings */
#define STB_LOOS 10 /* reserved range for operating */
-#define STB_HIOS 12 /* system specific symbol bindings */
+#define STB_HIOS 12 /* system specific symbol bindings */
#define STB_LOPROC 13 /* reserved range for processor */
-#define STB_HIPROC 15 /* specific symbol bindings */
+#define STB_HIPROC 15 /* specific symbol bindings */
/* Symbol type - ELF32_ST_TYPE - st_info */
#define STT_NOTYPE 0 /* not specified */
@@ -364,9 +357,9 @@ typedef struct elf32_sym {
#define STT_NUM 5 /* number of symbol types */
#define STT_TLS 6 /* Thread local storage symbol */
#define STT_LOOS 10 /* reserved range for operating */
-#define STT_HIOS 12 /* system specific symbol types */
+#define STT_HIOS 12 /* system specific symbol types */
#define STT_LOPROC 13 /* reserved range for processor */
-#define STT_HIPROC 15 /* specific symbol types */
+#define STT_HIPROC 15 /* specific symbol types */
/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */
#define STV_DEFAULT 0 /* Normal visibility rules */
@@ -374,17 +367,14 @@ typedef struct elf32_sym {
#define STV_HIDDEN 2 /* Symbol unavailable in other mods */
#define STV_PROTECTED 3 /* Not preemptible, not exported */
-
/* Relocation entry with implicit addend */
-typedef struct
-{
+typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
} Elf32_Rel;
/* Relocation entry with explicit addend */
-typedef struct
-{
+typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
Elf32_Sword r_addend;
@@ -396,9 +386,9 @@ typedef struct {
} Elf64_Rel;
typedef struct {
- Elf64_Addr r_offset; /* Location at which to apply the action */
- Elf64_Xword r_info; /* index and type of relocation */
- Elf64_Sxword r_addend; /* Constant addend used to compute value */
+ Elf64_Addr r_offset; /* Location at which to apply the action */
+ Elf64_Xword r_info; /* index and type of relocation */
+ Elf64_Sxword r_addend; /* Constant addend used to compute value */
} Elf64_Rela;
/* Extract relocation info - r_info */
@@ -411,9 +401,9 @@ typedef struct {
Elf32_Word p_type; /* segment type */
Elf32_Off p_offset; /* segment offset */
Elf32_Addr p_vaddr; /* virtual address of segment */
- Elf32_Addr p_paddr; /* physical address - ignored? */
- Elf32_Word p_filesz; /* number of bytes in file for seg. */
- Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
+ Elf32_Addr p_paddr; /* physical address of segment */
+ Elf32_Word p_filesz; /* number of bytes in file for seg */
+ Elf32_Word p_memsz; /* number of bytes in mem. for seg */
Elf32_Word p_flags; /* flags */
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
@@ -429,9 +419,9 @@ typedef struct {
#define PT_TLS 7 /* Thread local storage template */
#define PT_NUM 8 /* Number of segment types */
#define PT_LOOS 0x60000000 /* reserved range for operating */
-#define PT_HIOS 0x6fffffff /* system specific segment types */
+#define PT_HIOS 0x6fffffff /* system specific segment types */
#define PT_LOPROC 0x70000000 /* reserved range for processor */
-#define PT_HIPROC 0x7fffffff /* specific segment types */
+#define PT_HIPROC 0x7fffffff /* specific segment types */
/* Segment flags - p_flags */
#define PF_X 0x1 /* Executable */
@@ -439,13 +429,11 @@ typedef struct {
#define PF_R 0x4 /* Readable */
#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
- /* specific segment flags */
+ /* specific segment flags */
/* Dynamic structure */
-typedef struct
-{
+typedef struct {
Elf32_Sword d_tag; /* controls meaning of d_val */
- union
- {
+ union {
Elf32_Word d_val; /* Multiple meanings - see d_tag */
Elf32_Addr d_ptr; /* program virtual address */
} d_un;
@@ -477,12 +465,12 @@ typedef struct {
#define DT_RELAENT 9 /* size of relocation entry */
#define DT_STRSZ 10 /* size of string table */
#define DT_SYMENT 11 /* size of symbol table entry */
-#define DT_INIT 12 /* address of initialization func. */
+#define DT_INIT 12 /* address of initialization func */
#define DT_FINI 13 /* address of termination function */
#define DT_SONAME 14 /* string table offset of shared obj */
#define DT_RPATH 15 /* string table offset of library
search path */
-#define DT_SYMBOLIC 16 /* start sym search in shared obj. */
+#define DT_SYMBOLIC 16 /* start sym search in shared obj */
#define DT_REL 17 /* address of rel. tbl. w addends */
#define DT_RELSZ 18 /* size of DT_REL relocation table */
#define DT_RELENT 19 /* size of DT_REL relocation entry */
@@ -500,11 +488,11 @@ typedef struct {
#define DT_ENCODING 32 /* Start of encoded range */
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
-#define DT_NUM 34 /* Number used. */
+#define DT_NUM 34 /* Number used */
#define DT_LOOS 0x60000000 /* reserved range for OS */
-#define DT_HIOS 0x6fffffff /* specific dynamic array tags */
+#define DT_HIOS 0x6fffffff /* specific dynamic array tags */
#define DT_LOPROC 0x70000000 /* reserved range for processor */
-#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
+#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
/* Dynamic Tag Flags - d_un.d_val */
#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */
@@ -525,93 +513,97 @@ unsigned long elf_hash(const unsigned char *name);
* but we'll put them in for simplicity.
*/
-/* Values for Elf32/64_Ehdr.e_flags. */
-#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
+/* Values for Elf32/64_Ehdr.e_flags */
+#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
/* Cygnus local bits below */
-#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
-#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
+#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
+#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
flag */
/* PowerPC relocations defined by the ABIs */
-#define R_PPC_NONE 0
-#define R_PPC_ADDR32 1 /* 32bit absolute address */
-#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
-#define R_PPC_ADDR16 3 /* 16bit absolute address */
-#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
-#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
-#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
-#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
-#define R_PPC_ADDR14_BRTAKEN 8
-#define R_PPC_ADDR14_BRNTAKEN 9
-#define R_PPC_REL24 10 /* PC relative 26 bit */
-#define R_PPC_REL14 11 /* PC relative 16 bit */
-#define R_PPC_REL14_BRTAKEN 12
-#define R_PPC_REL14_BRNTAKEN 13
-#define R_PPC_GOT16 14
-#define R_PPC_GOT16_LO 15
-#define R_PPC_GOT16_HI 16
-#define R_PPC_GOT16_HA 17
-#define R_PPC_PLTREL24 18
-#define R_PPC_COPY 19
-#define R_PPC_GLOB_DAT 20
-#define R_PPC_JMP_SLOT 21
-#define R_PPC_RELATIVE 22
-#define R_PPC_LOCAL24PC 23
-#define R_PPC_UADDR32 24
-#define R_PPC_UADDR16 25
-#define R_PPC_REL32 26
-#define R_PPC_PLT32 27
-#define R_PPC_PLTREL32 28
-#define R_PPC_PLT16_LO 29
-#define R_PPC_PLT16_HI 30
-#define R_PPC_PLT16_HA 31
-#define R_PPC_SDAREL16 32
-#define R_PPC_SECTOFF 33
-#define R_PPC_SECTOFF_LO 34
-#define R_PPC_SECTOFF_HI 35
-#define R_PPC_SECTOFF_HA 36
-/* Keep this the last entry. */
-#define R_PPC_NUM 37
-
-/* The remaining relocs are from the Embedded ELF ABI, and are not
- in the SVR4 ELF ABI. */
-#define R_PPC_EMB_NADDR32 101
-#define R_PPC_EMB_NADDR16 102
-#define R_PPC_EMB_NADDR16_LO 103
-#define R_PPC_EMB_NADDR16_HI 104
-#define R_PPC_EMB_NADDR16_HA 105
-#define R_PPC_EMB_SDAI16 106
-#define R_PPC_EMB_SDA2I16 107
-#define R_PPC_EMB_SDA2REL 108
-#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
-#define R_PPC_EMB_MRKREF 110
-#define R_PPC_EMB_RELSEC16 111
-#define R_PPC_EMB_RELST_LO 112
-#define R_PPC_EMB_RELST_HI 113
-#define R_PPC_EMB_RELST_HA 114
-#define R_PPC_EMB_BIT_FLD 115
-#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
-
-/* Diab tool relocations. */
-#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
-#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
-#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
-#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
-#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
-#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
-
-/* This is a phony reloc to handle any old fashioned TOC16 references
- that may still be in object files. */
-#define R_PPC_TOC16 255
+#define R_PPC_NONE 0
+#define R_PPC_ADDR32 1 /* 32bit absolute address */
+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored */
+#define R_PPC_ADDR16 3 /* 16bit absolute address */
+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
+#define R_PPC_ADDR14_BRTAKEN 8
+#define R_PPC_ADDR14_BRNTAKEN 9
+#define R_PPC_REL24 10 /* PC relative 26 bit */
+#define R_PPC_REL14 11 /* PC relative 16 bit */
+#define R_PPC_REL14_BRTAKEN 12
+#define R_PPC_REL14_BRNTAKEN 13
+#define R_PPC_GOT16 14
+#define R_PPC_GOT16_LO 15
+#define R_PPC_GOT16_HI 16
+#define R_PPC_GOT16_HA 17
+#define R_PPC_PLTREL24 18
+#define R_PPC_COPY 19
+#define R_PPC_GLOB_DAT 20
+#define R_PPC_JMP_SLOT 21
+#define R_PPC_RELATIVE 22
+#define R_PPC_LOCAL24PC 23
+#define R_PPC_UADDR32 24
+#define R_PPC_UADDR16 25
+#define R_PPC_REL32 26
+#define R_PPC_PLT32 27
+#define R_PPC_PLTREL32 28
+#define R_PPC_PLT16_LO 29
+#define R_PPC_PLT16_HI 30
+#define R_PPC_PLT16_HA 31
+#define R_PPC_SDAREL16 32
+#define R_PPC_SECTOFF 33
+#define R_PPC_SECTOFF_LO 34
+#define R_PPC_SECTOFF_HI 35
+#define R_PPC_SECTOFF_HA 36
+/* Keep this the last entry */
+#define R_PPC_NUM 37
+
+/*
+ * The remaining relocs are from the Embedded ELF ABI, and are not
+ * in the SVR4 ELF ABI.
+ */
+#define R_PPC_EMB_NADDR32 101
+#define R_PPC_EMB_NADDR16 102
+#define R_PPC_EMB_NADDR16_LO 103
+#define R_PPC_EMB_NADDR16_HI 104
+#define R_PPC_EMB_NADDR16_HA 105
+#define R_PPC_EMB_SDAI16 106
+#define R_PPC_EMB_SDA2I16 107
+#define R_PPC_EMB_SDA2REL 108
+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
+#define R_PPC_EMB_MRKREF 110
+#define R_PPC_EMB_RELSEC16 111
+#define R_PPC_EMB_RELST_LO 112
+#define R_PPC_EMB_RELST_HI 113
+#define R_PPC_EMB_RELST_HA 114
+#define R_PPC_EMB_BIT_FLD 115
+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
+
+/* Diab tool relocations */
+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
+
+/*
+ * This is a phony reloc to handle any old fashioned TOC16 references
+ * that may still be in object files.
+ */
+#define R_PPC_TOC16 255
/* ARM relocs */
#define R_ARM_NONE 0 /* No reloc */
#define R_ARM_RELATIVE 23 /* Adjust by program base */
/* AArch64 relocs */
-#define R_AARCH64_NONE 0 /* No relocation. */
-#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
+#define R_AARCH64_NONE 0 /* No relocation */
+#define R_AARCH64_RELATIVE 1027 /* Adjust by program base */
/* RISC-V relocations */
#define R_RISCV_32 1
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 07/18] elf: Clean up the ELF header file
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
0 siblings, 1 reply; 53+ messages in thread
From: Christian Gmeiner @ 2018-04-12 7:29 UTC (permalink / raw)
To: u-boot
2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
> Fix various style violations in elf.h
> - use correct comment format if the comment fits in just one line
> - remove the ending period for the one-line comment
> - use tab for the indention instead of space
> - put the opening brace at the same line of a typedef/union
> - remove <name> in a 'typedef struct' for consistency
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>
> Changes in v2: None
>
> include/elf.h | 284 ++++++++++++++++++++++++++++------------------------------
> 1 file changed, 138 insertions(+), 146 deletions(-)
>
> diff --git a/include/elf.h b/include/elf.h
> index fe2128f..4742597 100644
> --- a/include/elf.h
> +++ b/include/elf.h
> @@ -5,10 +5,7 @@
> * SPDX-License-Identifier: BSD-3-Clause
> */
>
> -/*
> - * This is the ELF ABI header file
> - * formerly known as "elf_abi.h".
> - */
> +/* This is the ELF ABI header file formerly known as "elf_abi.h" */
>
> #ifndef _ELF_H
> #define _ELF_H
> @@ -16,20 +13,16 @@
> #ifndef __ASSEMBLER__
> #include "compiler.h"
>
> -/*
> - * This version doesn't work for 64-bit ABIs - Erik.
> - */
> +/* This version doesn't work for 64-bit ABIs - Erik */
>
> -/*
> - * These typedefs need to be handled better.
> - */
> +/* These typedefs need to be handled better */
> typedef uint32_t Elf32_Addr; /* Unsigned program address */
> typedef uint32_t Elf32_Off; /* Unsigned file offset */
> typedef int32_t Elf32_Sword; /* Signed large integer */
> typedef uint32_t Elf32_Word; /* Unsigned large integer */
> typedef uint16_t Elf32_Half; /* Unsigned medium integer */
>
> -/* 64-bit ELF base types. */
> +/* 64-bit ELF base types */
> typedef uint64_t Elf64_Addr;
> typedef uint16_t Elf64_Half;
> typedef int16_t Elf64_SHalf;
> @@ -96,7 +89,7 @@ typedef int64_t Elf64_Sxword;
> (ehdr).e_ident[EI_MAG3] == ELFMAG3)
>
> /* ELF Header */
> -typedef struct elfhdr{
> +typedef struct {
> unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
> Elf32_Half e_type; /* object file type */
> Elf32_Half e_machine; /* machine */
> @@ -122,9 +115,9 @@ typedef struct elfhdr{
> #define ET_CORE 4 /* core file */
> #define ET_NUM 5 /* number of types */
> #define ET_LOOS 0xfe00 /* reserved range for operating */
> -#define ET_HIOS 0xfeff /* system specific e_type */
> +#define ET_HIOS 0xfeff /* system specific e_type */
> #define ET_LOPROC 0xff00 /* reserved range for processor */
> -#define ET_HIPROC 0xffff /* specific e_type */
> +#define ET_HIPROC 0xffff /* specific e_type */
>
> /* e_machine */
> #define EM_NONE 0 /* No Machine */
> @@ -235,9 +228,9 @@ typedef struct {
> #define SHN_UNDEF 0 /* undefined */
> #define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
> #define SHN_LOPROC 0xff00 /* reserved range for processor */
> -#define SHN_HIPROC 0xff1f /* specific section indexes */
> +#define SHN_HIPROC 0xff1f /* specific section indexes */
> #define SHN_LOOS 0xff20 /* reserved range for operating */
> -#define SHN_HIOS 0xff3f /* specific semantics */
> +#define SHN_HIOS 0xff3f /* specific semantics */
> #define SHN_ABS 0xfff1 /* absolute value */
> #define SHN_COMMON 0xfff2 /* common symbol */
> #define SHN_XINDEX 0xffff /* Index is an extra table */
> @@ -265,46 +258,46 @@ typedef struct {
> #define SHT_LOOS 0x60000000 /* Start OS-specific */
> #define SHT_HIOS 0x6fffffff /* End OS-specific */
> #define SHT_LOPROC 0x70000000 /* reserved range for processor */
> -#define SHT_HIPROC 0x7fffffff /* specific section header types */
> +#define SHT_HIPROC 0x7fffffff /* specific section header types */
> #define SHT_LOUSER 0x80000000 /* reserved range for application */
> -#define SHT_HIUSER 0xffffffff /* specific indexes */
> +#define SHT_HIUSER 0xffffffff /* specific indexes */
>
> /* Section names */
> -#define ELF_BSS ".bss" /* uninitialized data */
> +#define ELF_BSS ".bss" /* uninitialized data */
> #define ELF_COMMENT ".comment" /* version control information */
> -#define ELF_DATA ".data" /* initialized data */
> -#define ELF_DATA1 ".data1" /* initialized data */
> -#define ELF_DEBUG ".debug" /* debug */
> -#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
> -#define ELF_DYNSTR ".dynstr" /* dynamic string table */
> -#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
> -#define ELF_FINI ".fini" /* termination code */
> +#define ELF_DATA ".data" /* initialized data */
> +#define ELF_DATA1 ".data1" /* initialized data */
> +#define ELF_DEBUG ".debug" /* debug */
> +#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
> +#define ELF_DYNSTR ".dynstr" /* dynamic string table */
> +#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
> +#define ELF_FINI ".fini" /* termination code */
> #define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */
> -#define ELF_GOT ".got" /* global offset table */
> -#define ELF_HASH ".hash" /* symbol hash table */
> -#define ELF_INIT ".init" /* initialization code */
> +#define ELF_GOT ".got" /* global offset table */
> +#define ELF_HASH ".hash" /* symbol hash table */
> +#define ELF_INIT ".init" /* initialization code */
> #define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */
> #define ELF_INTERP ".interp" /* Pathname of program interpreter */
> #define ELF_LINE ".line" /* Symbolic line numnber information */
> #define ELF_NOTE ".note" /* Contains note section */
> #define ELF_PLT ".plt" /* Procedure linkage table */
> #define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */
> -#define ELF_REL_DATA ".rel.data" /* relocation data */
> -#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
> -#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
> -#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
> -#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
> -#define ELF_REL_TEXT ".rel.text" /* relocation code */
> -#define ELF_RODATA ".rodata" /* read-only data */
> -#define ELF_RODATA1 ".rodata1" /* read-only data */
> -#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
> -#define ELF_STRTAB ".strtab" /* string table */
> -#define ELF_SYMTAB ".symtab" /* symbol table */
> +#define ELF_REL_DATA ".rel.data" /* relocation data */
> +#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
> +#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
> +#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
> +#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
> +#define ELF_REL_TEXT ".rel.text" /* relocation code */
> +#define ELF_RODATA ".rodata" /* read-only data */
> +#define ELF_RODATA1 ".rodata1" /* read-only data */
> +#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
> +#define ELF_STRTAB ".strtab" /* string table */
> +#define ELF_SYMTAB ".symtab" /* symbol table */
> #define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */
> #define ELF_TBSS ".tbss" /* thread local uninit data */
> #define ELF_TDATA ".tdata" /* thread local init data */
> #define ELF_TDATA1 ".tdata1" /* thread local init data */
> -#define ELF_TEXT ".text" /* code */
> +#define ELF_TEXT ".text" /* code */
>
> /* Section Attribute Flags - sh_flags */
> #define SHF_WRITE 0x1 /* Writable */
> @@ -319,7 +312,7 @@ typedef struct {
> #define SHF_TLS 0x400 /* Thread local storage */
> #define SHF_MASKOS 0x0ff00000 /* OS specific */
> #define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
> - /* specific section attributes */
> + /* specific section attributes */
>
> /* Section Group Flags */
> #define GRP_COMDAT 0x1 /* COMDAT group */
> @@ -327,7 +320,7 @@ typedef struct {
> #define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */
>
> /* Symbol Table Entry */
> -typedef struct elf32_sym {
> +typedef struct {
> Elf32_Word st_name; /* name - index into string table */
> Elf32_Addr st_value; /* symbol value */
> Elf32_Word st_size; /* symbol size */
> @@ -351,9 +344,9 @@ typedef struct elf32_sym {
> #define STB_WEAK 2 /* like global - lower precedence */
> #define STB_NUM 3 /* number of symbol bindings */
> #define STB_LOOS 10 /* reserved range for operating */
> -#define STB_HIOS 12 /* system specific symbol bindings */
> +#define STB_HIOS 12 /* system specific symbol bindings */
> #define STB_LOPROC 13 /* reserved range for processor */
> -#define STB_HIPROC 15 /* specific symbol bindings */
> +#define STB_HIPROC 15 /* specific symbol bindings */
>
> /* Symbol type - ELF32_ST_TYPE - st_info */
> #define STT_NOTYPE 0 /* not specified */
> @@ -364,9 +357,9 @@ typedef struct elf32_sym {
> #define STT_NUM 5 /* number of symbol types */
> #define STT_TLS 6 /* Thread local storage symbol */
> #define STT_LOOS 10 /* reserved range for operating */
> -#define STT_HIOS 12 /* system specific symbol types */
> +#define STT_HIOS 12 /* system specific symbol types */
> #define STT_LOPROC 13 /* reserved range for processor */
> -#define STT_HIPROC 15 /* specific symbol types */
> +#define STT_HIPROC 15 /* specific symbol types */
>
> /* Symbol visibility - ELF32_ST_VISIBILITY - st_other */
> #define STV_DEFAULT 0 /* Normal visibility rules */
> @@ -374,17 +367,14 @@ typedef struct elf32_sym {
> #define STV_HIDDEN 2 /* Symbol unavailable in other mods */
> #define STV_PROTECTED 3 /* Not preemptible, not exported */
>
> -
> /* Relocation entry with implicit addend */
> -typedef struct
> -{
> +typedef struct {
> Elf32_Addr r_offset; /* offset of relocation */
> Elf32_Word r_info; /* symbol table index and type */
> } Elf32_Rel;
>
> /* Relocation entry with explicit addend */
> -typedef struct
> -{
> +typedef struct {
> Elf32_Addr r_offset; /* offset of relocation */
> Elf32_Word r_info; /* symbol table index and type */
> Elf32_Sword r_addend;
> @@ -396,9 +386,9 @@ typedef struct {
> } Elf64_Rel;
>
> typedef struct {
> - Elf64_Addr r_offset; /* Location at which to apply the action */
> - Elf64_Xword r_info; /* index and type of relocation */
> - Elf64_Sxword r_addend; /* Constant addend used to compute value */
> + Elf64_Addr r_offset; /* Location at which to apply the action */
> + Elf64_Xword r_info; /* index and type of relocation */
> + Elf64_Sxword r_addend; /* Constant addend used to compute value */
> } Elf64_Rela;
>
> /* Extract relocation info - r_info */
> @@ -411,9 +401,9 @@ typedef struct {
> Elf32_Word p_type; /* segment type */
> Elf32_Off p_offset; /* segment offset */
> Elf32_Addr p_vaddr; /* virtual address of segment */
> - Elf32_Addr p_paddr; /* physical address - ignored? */
> - Elf32_Word p_filesz; /* number of bytes in file for seg. */
> - Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
> + Elf32_Addr p_paddr; /* physical address of segment */
> + Elf32_Word p_filesz; /* number of bytes in file for seg */
> + Elf32_Word p_memsz; /* number of bytes in mem. for seg */
> Elf32_Word p_flags; /* flags */
> Elf32_Word p_align; /* memory alignment */
> } Elf32_Phdr;
> @@ -429,9 +419,9 @@ typedef struct {
> #define PT_TLS 7 /* Thread local storage template */
> #define PT_NUM 8 /* Number of segment types */
> #define PT_LOOS 0x60000000 /* reserved range for operating */
> -#define PT_HIOS 0x6fffffff /* system specific segment types */
> +#define PT_HIOS 0x6fffffff /* system specific segment types */
> #define PT_LOPROC 0x70000000 /* reserved range for processor */
> -#define PT_HIPROC 0x7fffffff /* specific segment types */
> +#define PT_HIPROC 0x7fffffff /* specific segment types */
>
> /* Segment flags - p_flags */
> #define PF_X 0x1 /* Executable */
> @@ -439,13 +429,11 @@ typedef struct {
> #define PF_R 0x4 /* Readable */
> #define PF_MASKOS 0x0ff00000 /* OS specific segment flags */
> #define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
> - /* specific segment flags */
> + /* specific segment flags */
> /* Dynamic structure */
> -typedef struct
> -{
> +typedef struct {
> Elf32_Sword d_tag; /* controls meaning of d_val */
> - union
> - {
> + union {
> Elf32_Word d_val; /* Multiple meanings - see d_tag */
> Elf32_Addr d_ptr; /* program virtual address */
> } d_un;
> @@ -477,12 +465,12 @@ typedef struct {
> #define DT_RELAENT 9 /* size of relocation entry */
> #define DT_STRSZ 10 /* size of string table */
> #define DT_SYMENT 11 /* size of symbol table entry */
> -#define DT_INIT 12 /* address of initialization func. */
> +#define DT_INIT 12 /* address of initialization func */
> #define DT_FINI 13 /* address of termination function */
> #define DT_SONAME 14 /* string table offset of shared obj */
> #define DT_RPATH 15 /* string table offset of library
> search path */
> -#define DT_SYMBOLIC 16 /* start sym search in shared obj. */
> +#define DT_SYMBOLIC 16 /* start sym search in shared obj */
> #define DT_REL 17 /* address of rel. tbl. w addends */
> #define DT_RELSZ 18 /* size of DT_REL relocation table */
> #define DT_RELENT 19 /* size of DT_REL relocation entry */
> @@ -500,11 +488,11 @@ typedef struct {
> #define DT_ENCODING 32 /* Start of encoded range */
> #define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
> #define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
> -#define DT_NUM 34 /* Number used. */
> +#define DT_NUM 34 /* Number used */
> #define DT_LOOS 0x60000000 /* reserved range for OS */
> -#define DT_HIOS 0x6fffffff /* specific dynamic array tags */
> +#define DT_HIOS 0x6fffffff /* specific dynamic array tags */
> #define DT_LOPROC 0x70000000 /* reserved range for processor */
> -#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
> +#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
>
> /* Dynamic Tag Flags - d_un.d_val */
> #define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */
> @@ -525,93 +513,97 @@ unsigned long elf_hash(const unsigned char *name);
> * but we'll put them in for simplicity.
> */
>
> -/* Values for Elf32/64_Ehdr.e_flags. */
> -#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
> +/* Values for Elf32/64_Ehdr.e_flags */
> +#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
>
> /* Cygnus local bits below */
> -#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
> -#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
> +#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
> +#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
> flag */
>
> /* PowerPC relocations defined by the ABIs */
> -#define R_PPC_NONE 0
> -#define R_PPC_ADDR32 1 /* 32bit absolute address */
> -#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
> -#define R_PPC_ADDR16 3 /* 16bit absolute address */
> -#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
> -#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
> -#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
> -#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
> -#define R_PPC_ADDR14_BRTAKEN 8
> -#define R_PPC_ADDR14_BRNTAKEN 9
> -#define R_PPC_REL24 10 /* PC relative 26 bit */
> -#define R_PPC_REL14 11 /* PC relative 16 bit */
> -#define R_PPC_REL14_BRTAKEN 12
> -#define R_PPC_REL14_BRNTAKEN 13
> -#define R_PPC_GOT16 14
> -#define R_PPC_GOT16_LO 15
> -#define R_PPC_GOT16_HI 16
> -#define R_PPC_GOT16_HA 17
> -#define R_PPC_PLTREL24 18
> -#define R_PPC_COPY 19
> -#define R_PPC_GLOB_DAT 20
> -#define R_PPC_JMP_SLOT 21
> -#define R_PPC_RELATIVE 22
> -#define R_PPC_LOCAL24PC 23
> -#define R_PPC_UADDR32 24
> -#define R_PPC_UADDR16 25
> -#define R_PPC_REL32 26
> -#define R_PPC_PLT32 27
> -#define R_PPC_PLTREL32 28
> -#define R_PPC_PLT16_LO 29
> -#define R_PPC_PLT16_HI 30
> -#define R_PPC_PLT16_HA 31
> -#define R_PPC_SDAREL16 32
> -#define R_PPC_SECTOFF 33
> -#define R_PPC_SECTOFF_LO 34
> -#define R_PPC_SECTOFF_HI 35
> -#define R_PPC_SECTOFF_HA 36
> -/* Keep this the last entry. */
> -#define R_PPC_NUM 37
> -
> -/* The remaining relocs are from the Embedded ELF ABI, and are not
> - in the SVR4 ELF ABI. */
> -#define R_PPC_EMB_NADDR32 101
> -#define R_PPC_EMB_NADDR16 102
> -#define R_PPC_EMB_NADDR16_LO 103
> -#define R_PPC_EMB_NADDR16_HI 104
> -#define R_PPC_EMB_NADDR16_HA 105
> -#define R_PPC_EMB_SDAI16 106
> -#define R_PPC_EMB_SDA2I16 107
> -#define R_PPC_EMB_SDA2REL 108
> -#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
> -#define R_PPC_EMB_MRKREF 110
> -#define R_PPC_EMB_RELSEC16 111
> -#define R_PPC_EMB_RELST_LO 112
> -#define R_PPC_EMB_RELST_HI 113
> -#define R_PPC_EMB_RELST_HA 114
> -#define R_PPC_EMB_BIT_FLD 115
> -#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
> -
> -/* Diab tool relocations. */
> -#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
> -#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
> -#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
> -#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
> -#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
> -#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
> -
> -/* This is a phony reloc to handle any old fashioned TOC16 references
> - that may still be in object files. */
> -#define R_PPC_TOC16 255
> +#define R_PPC_NONE 0
> +#define R_PPC_ADDR32 1 /* 32bit absolute address */
> +#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored */
> +#define R_PPC_ADDR16 3 /* 16bit absolute address */
> +#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
> +#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
> +#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
> +#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
> +#define R_PPC_ADDR14_BRTAKEN 8
> +#define R_PPC_ADDR14_BRNTAKEN 9
> +#define R_PPC_REL24 10 /* PC relative 26 bit */
> +#define R_PPC_REL14 11 /* PC relative 16 bit */
> +#define R_PPC_REL14_BRTAKEN 12
> +#define R_PPC_REL14_BRNTAKEN 13
> +#define R_PPC_GOT16 14
> +#define R_PPC_GOT16_LO 15
> +#define R_PPC_GOT16_HI 16
> +#define R_PPC_GOT16_HA 17
> +#define R_PPC_PLTREL24 18
> +#define R_PPC_COPY 19
> +#define R_PPC_GLOB_DAT 20
> +#define R_PPC_JMP_SLOT 21
> +#define R_PPC_RELATIVE 22
> +#define R_PPC_LOCAL24PC 23
> +#define R_PPC_UADDR32 24
> +#define R_PPC_UADDR16 25
> +#define R_PPC_REL32 26
> +#define R_PPC_PLT32 27
> +#define R_PPC_PLTREL32 28
> +#define R_PPC_PLT16_LO 29
> +#define R_PPC_PLT16_HI 30
> +#define R_PPC_PLT16_HA 31
> +#define R_PPC_SDAREL16 32
> +#define R_PPC_SECTOFF 33
> +#define R_PPC_SECTOFF_LO 34
> +#define R_PPC_SECTOFF_HI 35
> +#define R_PPC_SECTOFF_HA 36
> +/* Keep this the last entry */
> +#define R_PPC_NUM 37
> +
> +/*
> + * The remaining relocs are from the Embedded ELF ABI, and are not
> + * in the SVR4 ELF ABI.
> + */
> +#define R_PPC_EMB_NADDR32 101
> +#define R_PPC_EMB_NADDR16 102
> +#define R_PPC_EMB_NADDR16_LO 103
> +#define R_PPC_EMB_NADDR16_HI 104
> +#define R_PPC_EMB_NADDR16_HA 105
> +#define R_PPC_EMB_SDAI16 106
> +#define R_PPC_EMB_SDA2I16 107
> +#define R_PPC_EMB_SDA2REL 108
> +#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
> +#define R_PPC_EMB_MRKREF 110
> +#define R_PPC_EMB_RELSEC16 111
> +#define R_PPC_EMB_RELST_LO 112
> +#define R_PPC_EMB_RELST_HI 113
> +#define R_PPC_EMB_RELST_HA 114
> +#define R_PPC_EMB_BIT_FLD 115
> +#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
> +
> +/* Diab tool relocations */
> +#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
> +#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
> +#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
> +#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
> +#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
> +#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
> +
> +/*
> + * This is a phony reloc to handle any old fashioned TOC16 references
> + * that may still be in object files.
> + */
> +#define R_PPC_TOC16 255
>
> /* ARM relocs */
> #define R_ARM_NONE 0 /* No reloc */
> #define R_ARM_RELATIVE 23 /* Adjust by program base */
>
> /* AArch64 relocs */
> -#define R_AARCH64_NONE 0 /* No relocation. */
> -#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
> +#define R_AARCH64_NONE 0 /* No relocation */
> +#define R_AARCH64_RELATIVE 1027 /* Adjust by program base */
>
> /* RISC-V relocations */
> #define R_RISCV_32 1
> --
> 2.7.4
>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 07/18] elf: Clean up the ELF header file
2018-04-12 7:29 ` Christian Gmeiner
@ 2018-04-16 9:16 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Thu, Apr 12, 2018 at 3:29 PM, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
> 2018-04-12 7:02 GMT+02:00 Bin Meng <bmeng.cn@gmail.com>:
>> Fix various style violations in elf.h
>> - use correct comment format if the comment fits in just one line
>> - remove the ending period for the one-line comment
>> - use tab for the indention instead of space
>> - put the opening brace at the same line of a typedef/union
>> - remove <name> in a 'typedef struct' for consistency
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>
>> ---
>>
>> Changes in v2: None
>>
>> include/elf.h | 284 ++++++++++++++++++++++++++++------------------------------
>> 1 file changed, 138 insertions(+), 146 deletions(-)
>>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 08/18] elf: Add ELF64 related structure defines
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (6 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 07/18] elf: Clean up the ELF header file Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-12 16:41 ` Simon Glass
2018-04-12 5:02 ` [U-Boot] [PATCH v2 09/18] elf: Add a very simple ELF64 loader Bin Meng
` (9 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
This adds ELF header, program header and section header structure
defines for the 64-bit ELF image.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
include/elf.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/include/elf.h b/include/elf.h
index 4742597..248ba59 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -107,6 +107,24 @@ typedef struct {
header string table" entry offset */
} Elf32_Ehdr;
+typedef struct {
+ unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
+ Elf64_Half e_type; /* object file type */
+ Elf64_Half e_machine; /* machine */
+ Elf64_Word e_version; /* object file version */
+ Elf64_Addr e_entry; /* virtual entry point */
+ Elf64_Off e_phoff; /* program header table offset */
+ Elf64_Off e_shoff; /* section header table offset */
+ Elf64_Word e_flags; /* processor-specific flags */
+ Elf64_Half e_ehsize; /* ELF header size */
+ Elf64_Half e_phentsize; /* program header entry size */
+ Elf64_Half e_phnum; /* number of program header entries */
+ Elf64_Half e_shentsize; /* section header entry size */
+ Elf64_Half e_shnum; /* number of section header entries */
+ Elf64_Half e_shstrndx; /* section header table's "section
+ header string table" entry offset */
+} Elf64_Ehdr;
+
/* e_type */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* relocatable file */
@@ -224,6 +242,20 @@ typedef struct {
Elf32_Word sh_entsize; /* section entry size */
} Elf32_Shdr;
+typedef struct {
+ Elf64_Word sh_name; /* name - index into section header
+ string table section */
+ Elf64_Word sh_type; /* type */
+ Elf64_Xword sh_flags; /* flags */
+ Elf64_Addr sh_addr; /* address */
+ Elf64_Off sh_offset; /* file offset */
+ Elf64_Xword sh_size; /* section size */
+ Elf64_Word sh_link; /* section header table index link */
+ Elf64_Word sh_info; /* extra information */
+ Elf64_Xword sh_addralign; /* address alignment */
+ Elf64_Xword sh_entsize; /* section entry size */
+} Elf64_Shdr;
+
/* Special Section Indexes */
#define SHN_UNDEF 0 /* undefined */
#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
@@ -408,6 +440,17 @@ typedef struct {
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
+typedef struct {
+ Elf64_Word p_type; /* segment type */
+ Elf64_Word p_flags; /* flags */
+ Elf64_Off p_offset; /* segment offset */
+ Elf64_Addr p_vaddr; /* virtual address of segment */
+ Elf64_Addr p_paddr; /* physical address of segment */
+ Elf64_Xword p_filesz; /* number of bytes in file for seg */
+ Elf64_Xword p_memsz; /* number of bytes in mem. for seg */
+ Elf64_Xword p_align; /* memory alignment */
+} Elf64_Phdr;
+
/* Segment types - p_type */
#define PT_NULL 0 /* unused */
#define PT_LOAD 1 /* loadable segment */
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 08/18] elf: Add ELF64 related structure defines
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
0 siblings, 1 reply; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:41 UTC (permalink / raw)
To: u-boot
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> This adds ELF header, program header and section header structure
> defines for the 64-bit ELF image.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
> include/elf.h | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 08/18] elf: Add ELF64 related structure defines
2018-04-12 16:41 ` Simon Glass
@ 2018-04-16 9:16 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:41 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> This adds ELF header, program header and section header structure
>> defines for the 64-bit ELF image.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>> include/elf.h | 43 +++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 43 insertions(+)
>>
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 09/18] elf: Add a very simple ELF64 loader
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (7 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 08/18] elf: Add ELF64 related structure defines Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-12 16:42 ` Simon Glass
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
` (8 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
This adds a very simple ELF64 loader via program headers, similar
to load_elf_image_phdr() that we already have.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2:
- update the ELF32 and ELF64 loader comments
cmd/elf.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/cmd/elf.c b/cmd/elf.c
index 824f88e..8a0e7d9 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -24,8 +24,46 @@
#endif
/*
- * A very simple elf loader, assumes the image is valid, returns the
+ * A very simple ELF64 loader, assumes the image is valid, returns the
* entry point address.
+ *
+ * Note if U-Boot is 32-bit, the loader assumes the to segment's
+ * physical address and size is within the lower 32-bit address space.
+ */
+static unsigned long load_elf64_image_phdr(unsigned long addr)
+{
+ Elf64_Ehdr *ehdr; /* Elf header structure pointer */
+ Elf64_Phdr *phdr; /* Program header structure pointer */
+ int i;
+
+ ehdr = (Elf64_Ehdr *)addr;
+ phdr = (Elf64_Phdr *)(addr + (ulong)ehdr->e_phoff);
+
+ /* Load each program header */
+ for (i = 0; i < ehdr->e_phnum; ++i) {
+ void *dst = (void *)(ulong)phdr->p_paddr;
+ void *src = (void *)addr + phdr->p_offset;
+
+ debug("Loading phdr %i to 0x%p (%lu bytes)\n",
+ i, dst, (ulong)phdr->p_filesz);
+ if (phdr->p_filesz)
+ memcpy(dst, src, phdr->p_filesz);
+ if (phdr->p_filesz != phdr->p_memsz)
+ memset(dst + phdr->p_filesz, 0x00,
+ phdr->p_memsz - phdr->p_filesz);
+ flush_cache((unsigned long)dst, phdr->p_filesz);
+ ++phdr;
+ }
+
+ return ehdr->e_entry;
+}
+
+/*
+ * A very simple ELF loader, assumes the image is valid, returns the
+ * entry point address.
+ *
+ * The loader firstly reads the EFI class to see if it's a 64-bit image.
+ * If yes, call the ELF64 loader. Otherwise continue with the ELF32 loader.
*/
static unsigned long load_elf_image_phdr(unsigned long addr)
{
@@ -34,12 +72,16 @@ static unsigned long load_elf_image_phdr(unsigned long addr)
int i;
ehdr = (Elf32_Ehdr *)addr;
+ if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
+ return load_elf64_image_phdr(addr);
+
phdr = (Elf32_Phdr *)(addr + ehdr->e_phoff);
/* Load each program header */
for (i = 0; i < ehdr->e_phnum; ++i) {
void *dst = (void *)(uintptr_t)phdr->p_paddr;
void *src = (void *)addr + phdr->p_offset;
+
debug("Loading phdr %i to 0x%p (%i bytes)\n",
i, dst, phdr->p_filesz);
if (phdr->p_filesz)
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 09/18] elf: Add a very simple ELF64 loader
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
0 siblings, 2 replies; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:42 UTC (permalink / raw)
To: u-boot
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> This adds a very simple ELF64 loader via program headers, similar
> to load_elf_image_phdr() that we already have.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> Changes in v2:
> - update the ELF32 and ELF64 loader comments
>
> cmd/elf.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 43 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
I wonder if this should be used within the x86 relocate code?
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 09/18] elf: Add a very simple ELF64 loader
2018-04-12 16:42 ` Simon Glass
@ 2018-04-13 3:30 ` Bin Meng
2018-04-16 9:16 ` Bin Meng
1 sibling, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-13 3:30 UTC (permalink / raw)
To: u-boot
Hi Simon,
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> This adds a very simple ELF64 loader via program headers, similar
>> to load_elf_image_phdr() that we already have.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>> Changes in v2:
>> - update the ELF32 and ELF64 loader comments
>>
>> cmd/elf.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 43 insertions(+), 1 deletion(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> I wonder if this should be used within the x86 relocate code?
No, I don't think so.
Regards,
Bin
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 09/18] elf: Add a very simple ELF64 loader
2018-04-12 16:42 ` Simon Glass
2018-04-13 3:30 ` Bin Meng
@ 2018-04-16 9:16 ` Bin Meng
1 sibling, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> This adds a very simple ELF64 loader via program headers, similar
>> to load_elf_image_phdr() that we already have.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>> Changes in v2:
>> - update the ELF32 and ELF64 loader comments
>>
>> cmd/elf.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 43 insertions(+), 1 deletion(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 10/18] bios: vesa: Guard setting vesa mode with CONFIG_FRAMEBUFFER_SET_VESA_MODE
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (8 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 09/18] elf: Add a very simple ELF64 loader Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-12 16:42 ` Simon Glass
2018-04-12 5:02 ` [U-Boot] [PATCH v2 11/18] video: vesa: Change default FRAMEBUFFER_VESA_MODE Bin Meng
` (7 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
If CONFIG_FRAMEBUFFER_SET_VESA_MODE is not set, don't switch
graphics card to VESA mode. This applies to both native mode
and emulator mode of running the VGA BIOS.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
arch/x86/lib/bios.c | 4 ++++
drivers/bios_emulator/atibios.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arch/x86/lib/bios.c b/arch/x86/lib/bios.c
index 66d7629..f9092fd 100644
--- a/arch/x86/lib/bios.c
+++ b/arch/x86/lib/bios.c
@@ -185,6 +185,7 @@ static void setup_realmode_idt(void)
write_idt_stub((void *)0xffe6e, 0x1a);
}
+#ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
static u8 vbe_get_mode_info(struct vbe_mode_info *mi)
{
u16 buffer_seg;
@@ -241,6 +242,7 @@ static void vbe_set_graphics(int vesa_mode, struct vbe_mode_info *mode_info)
mode_info->video_mode &= 0x3ff;
vbe_set_mode(mode_info);
}
+#endif /* CONFIG_FRAMEBUFFER_SET_VESA_MODE */
void bios_run_on_x86(struct udevice *dev, unsigned long addr, int vesa_mode,
struct vbe_mode_info *mode_info)
@@ -273,8 +275,10 @@ void bios_run_on_x86(struct udevice *dev, unsigned long addr, int vesa_mode,
0x0);
debug("done\n");
+#ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
if (vesa_mode != -1)
vbe_set_graphics(vesa_mode, mode_info);
+#endif
}
asmlinkage int interrupt_handler(u32 intnumber, u32 gsfs, u32 dses,
diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c
index 2d5b5dc..07e45f2 100644
--- a/drivers/bios_emulator/atibios.c
+++ b/drivers/bios_emulator/atibios.c
@@ -78,6 +78,7 @@ static const void *bios_ptr(const void *buf, BE_VGAInfo *vga_info,
return buf + (flat - vbe_offset);
}
+#ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
static int atibios_debug_mode(BE_VGAInfo *vga_info, RMREGS *regs,
int vesa_mode, struct vbe_mode_info *mode_info)
{
@@ -215,6 +216,7 @@ static int atibios_set_vesa_mode(RMREGS *regs, int vesa_mode,
return 0;
}
+#endif /* CONFIG_FRAMEBUFFER_SET_VESA_MODE */
/****************************************************************************
PARAMETERS:
@@ -263,11 +265,13 @@ static void PCI_doBIOSPOST(pci_dev_t pcidev, BE_VGAInfo *vga_info,
/*Cleanup and exit*/
BE_getVGA(vga_info);
+#ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
/* Useful for debugging */
if (0)
atibios_debug_mode(vga_info, ®s, vesa_mode, mode_info);
if (vesa_mode != -1)
atibios_set_vesa_mode(®s, vesa_mode, mode_info);
+#endif
}
/****************************************************************************
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 10/18] bios: vesa: Guard setting vesa mode with CONFIG_FRAMEBUFFER_SET_VESA_MODE
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
0 siblings, 2 replies; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:42 UTC (permalink / raw)
To: u-boot
Hi Bin,
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> If CONFIG_FRAMEBUFFER_SET_VESA_MODE is not set, don't switch
> graphics card to VESA mode. This applies to both native mode
> and emulator mode of running the VGA BIOS.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
> arch/x86/lib/bios.c | 4 ++++
> drivers/bios_emulator/atibios.c | 4 ++++
> 2 files changed, 8 insertions(+)
Could this use if() instead of #ifdef ?
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 10/18] bios: vesa: Guard setting vesa mode with CONFIG_FRAMEBUFFER_SET_VESA_MODE
2018-04-12 16:42 ` Simon Glass
@ 2018-04-13 3:30 ` Bin Meng
2018-04-16 9:16 ` Bin Meng
1 sibling, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-13 3:30 UTC (permalink / raw)
To: u-boot
Hi Simon,
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Bin,
>
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> If CONFIG_FRAMEBUFFER_SET_VESA_MODE is not set, don't switch
>> graphics card to VESA mode. This applies to both native mode
>> and emulator mode of running the VGA BIOS.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>> arch/x86/lib/bios.c | 4 ++++
>> drivers/bios_emulator/atibios.c | 4 ++++
>> 2 files changed, 8 insertions(+)
>
> Could this use if() instead of #ifdef ?
>
Not all of the changes can, so I chose use #ifdef
> Reviewed-by: Simon Glass <sjg@chromium.org>
Regards,
Bin
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 10/18] bios: vesa: Guard setting vesa mode with CONFIG_FRAMEBUFFER_SET_VESA_MODE
2018-04-12 16:42 ` Simon Glass
2018-04-13 3:30 ` Bin Meng
@ 2018-04-16 9:16 ` Bin Meng
1 sibling, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Bin,
>
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> If CONFIG_FRAMEBUFFER_SET_VESA_MODE is not set, don't switch
>> graphics card to VESA mode. This applies to both native mode
>> and emulator mode of running the VGA BIOS.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>> arch/x86/lib/bios.c | 4 ++++
>> drivers/bios_emulator/atibios.c | 4 ++++
>> 2 files changed, 8 insertions(+)
>
> Could this use if() instead of #ifdef ?
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 11/18] video: vesa: Change default FRAMEBUFFER_VESA_MODE
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (9 preceding siblings ...)
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 5:02 ` Bin Meng
2018-04-12 16:42 ` Simon Glass
2018-04-12 5:02 ` [U-Boot] [PATCH v2 12/18] x86: Change default FRAMEBUFFER_VESA_MODE of some boards Bin Meng
` (6 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
This changes the default FRAMEBUFFER_VESA_MODE to use 32-bit pixel
format for better VxWorks compatibility.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
drivers/video/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 45a105d..4c4d286 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -174,7 +174,7 @@ config FRAMEBUFFER_SET_VESA_MODE
choice
prompt "framebuffer graphics resolution"
- default FRAMEBUFFER_VESA_MODE_117
+ default FRAMEBUFFER_VESA_MODE_118
depends on FRAMEBUFFER_SET_VESA_MODE
help
This option sets the resolution used for the U-Boot framebuffer (and
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 11/18] video: vesa: Change default FRAMEBUFFER_VESA_MODE
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
0 siblings, 1 reply; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:42 UTC (permalink / raw)
To: u-boot
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> This changes the default FRAMEBUFFER_VESA_MODE to use 32-bit pixel
> format for better VxWorks compatibility.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
> drivers/video/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 11/18] video: vesa: Change default FRAMEBUFFER_VESA_MODE
2018-04-12 16:42 ` Simon Glass
@ 2018-04-16 9:16 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> This changes the default FRAMEBUFFER_VESA_MODE to use 32-bit pixel
>> format for better VxWorks compatibility.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>> drivers/video/Kconfig | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 12/18] x86: Change default FRAMEBUFFER_VESA_MODE of some boards
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (10 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 11/18] video: vesa: Change default FRAMEBUFFER_VESA_MODE Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-12 16:42 ` Simon Glass
2018-04-12 5:02 ` [U-Boot] [PATCH v2 13/18] pci: video: Only print out when everything is OK Bin Meng
` (5 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
This changes some boards' default FRAMEBUFFER_VESA_MODE to use 32-bit
pixel format for better VxWorks compatibility.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
configs/bayleybay_defconfig | 2 +-
configs/minnowmax_defconfig | 2 +-
configs/qemu-x86_64_defconfig | 2 +-
configs/qemu-x86_defconfig | 2 +-
configs/qemu-x86_efi_payload32_defconfig | 2 +-
configs/qemu-x86_efi_payload64_defconfig | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/configs/bayleybay_defconfig b/configs/bayleybay_defconfig
index 5f7a09d..c78a70d 100644
--- a/configs/bayleybay_defconfig
+++ b/configs/bayleybay_defconfig
@@ -52,5 +52,5 @@ CONFIG_E1000=y
CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
-CONFIG_FRAMEBUFFER_VESA_MODE_11A=y
+CONFIG_FRAMEBUFFER_VESA_MODE_11B=y
CONFIG_CONSOLE_SCROLL_LINES=5
diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig
index 3547713..627f1d8 100644
--- a/configs/minnowmax_defconfig
+++ b/configs/minnowmax_defconfig
@@ -57,5 +57,5 @@ CONFIG_DEBUG_UART_CLOCK=1843200
CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
-CONFIG_FRAMEBUFFER_VESA_MODE_11A=y
+CONFIG_FRAMEBUFFER_VESA_MODE_11B=y
CONFIG_CONSOLE_SCROLL_LINES=5
diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
index 10bbc76..3aae96f 100644
--- a/configs/qemu-x86_64_defconfig
+++ b/configs/qemu-x86_64_defconfig
@@ -69,5 +69,5 @@ CONFIG_SPL_TIMER=y
CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
-CONFIG_FRAMEBUFFER_VESA_MODE_111=y
+CONFIG_FRAMEBUFFER_VESA_MODE_112=y
CONFIG_CONSOLE_SCROLL_LINES=5
diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
index 311fae3..28ee4aa 100644
--- a/configs/qemu-x86_defconfig
+++ b/configs/qemu-x86_defconfig
@@ -49,5 +49,5 @@ CONFIG_NVME=y
CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
-CONFIG_FRAMEBUFFER_VESA_MODE_111=y
+CONFIG_FRAMEBUFFER_VESA_MODE_112=y
CONFIG_CONSOLE_SCROLL_LINES=5
diff --git a/configs/qemu-x86_efi_payload32_defconfig b/configs/qemu-x86_efi_payload32_defconfig
index d2fc546..b847609 100644
--- a/configs/qemu-x86_efi_payload32_defconfig
+++ b/configs/qemu-x86_efi_payload32_defconfig
@@ -43,7 +43,7 @@ CONFIG_CPU=y
CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
-CONFIG_FRAMEBUFFER_VESA_MODE_111=y
+CONFIG_FRAMEBUFFER_VESA_MODE_112=y
CONFIG_CONSOLE_SCROLL_LINES=5
CONFIG_EFI=y
CONFIG_EFI_STUB=y
diff --git a/configs/qemu-x86_efi_payload64_defconfig b/configs/qemu-x86_efi_payload64_defconfig
index 9fd563e..59ff2a0 100644
--- a/configs/qemu-x86_efi_payload64_defconfig
+++ b/configs/qemu-x86_efi_payload64_defconfig
@@ -43,7 +43,7 @@ CONFIG_CPU=y
CONFIG_USB_STORAGE=y
CONFIG_USB_KEYBOARD=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
-CONFIG_FRAMEBUFFER_VESA_MODE_111=y
+CONFIG_FRAMEBUFFER_VESA_MODE_112=y
CONFIG_CONSOLE_SCROLL_LINES=5
CONFIG_EFI=y
CONFIG_EFI_STUB=y
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 12/18] x86: Change default FRAMEBUFFER_VESA_MODE of some boards
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
0 siblings, 1 reply; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:42 UTC (permalink / raw)
To: u-boot
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> This changes some boards' default FRAMEBUFFER_VESA_MODE to use 32-bit
> pixel format for better VxWorks compatibility.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
> configs/bayleybay_defconfig | 2 +-
> configs/minnowmax_defconfig | 2 +-
> configs/qemu-x86_64_defconfig | 2 +-
> configs/qemu-x86_defconfig | 2 +-
> configs/qemu-x86_efi_payload32_defconfig | 2 +-
> configs/qemu-x86_efi_payload64_defconfig | 2 +-
> 6 files changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 12/18] x86: Change default FRAMEBUFFER_VESA_MODE of some boards
2018-04-12 16:42 ` Simon Glass
@ 2018-04-16 9:16 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> This changes some boards' default FRAMEBUFFER_VESA_MODE to use 32-bit
>> pixel format for better VxWorks compatibility.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>> configs/bayleybay_defconfig | 2 +-
>> configs/minnowmax_defconfig | 2 +-
>> configs/qemu-x86_64_defconfig | 2 +-
>> configs/qemu-x86_defconfig | 2 +-
>> configs/qemu-x86_efi_payload32_defconfig | 2 +-
>> configs/qemu-x86_efi_payload64_defconfig | 2 +-
>> 6 files changed, 6 insertions(+), 6 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 13/18] pci: video: Only print out when everything is OK
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (11 preceding siblings ...)
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 5:02 ` Bin Meng
2018-04-12 16:42 ` Simon Glass
2018-04-12 5:02 ` [U-Boot] [PATCH v2 14/18] bootvx: x86: Make VxWorks EFI console driver happy Bin Meng
` (4 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
If video initialization fails, the "Video:" output message will be
mixed with the next console log. Change to print out such message
only when everything is OK, which improves the boot log readability.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
drivers/pci/pci_rom.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c
index 46fe5e6..7f46194 100644
--- a/drivers/pci/pci_rom.c
+++ b/drivers/pci/pci_rom.c
@@ -355,8 +355,6 @@ int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void))
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
int ret;
- printf("Video: ");
-
/* If we are running from EFI or coreboot, this can't work */
if (!ll_boot_init()) {
printf("Not available (previous bootloader prevents it)\n");
@@ -377,7 +375,7 @@ int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void))
return ret;
}
- printf("%dx%dx%d\n", uc_priv->xsize, uc_priv->ysize,
+ printf("Video: %dx%dx%d\n", uc_priv->xsize, uc_priv->ysize,
mode_info.vesa.bits_per_pixel);
return 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 13/18] pci: video: Only print out when everything is OK
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
0 siblings, 1 reply; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:42 UTC (permalink / raw)
To: u-boot
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> If video initialization fails, the "Video:" output message will be
> mixed with the next console log. Change to print out such message
> only when everything is OK, which improves the boot log readability.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
> drivers/pci/pci_rom.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 13/18] pci: video: Only print out when everything is OK
2018-04-12 16:42 ` Simon Glass
@ 2018-04-16 9:16 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> If video initialization fails, the "Video:" output message will be
>> mixed with the next console log. Change to print out such message
>> only when everything is OK, which improves the boot log readability.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>> drivers/pci/pci_rom.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 14/18] bootvx: x86: Make VxWorks EFI console driver happy
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (12 preceding siblings ...)
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 5:02 ` Bin Meng
2018-04-12 16:42 ` Simon Glass
2018-04-12 5:02 ` [U-Boot] [PATCH v2 15/18] bootvx: Refactor the bootline copy codes a little bit Bin Meng
` (3 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
When booting from EFI BIOS, VxWorks bootloader stores the EFI GOP
framebuffer info at a pre-defined offset @ 0x6100. When VxWorks
kernel boots up, its EFI console driver tries to find such a block
and if the signature matches, the framebuffer information will be
used to initialize the driver.
However it is not necessary to prepare an EFI environment for
VxWorks's EFI console driver to function (eg: EFI loader in
U-Boot). If U-Boot has already initialized the graphics card and
set it to a VESA mode that is compatible with EFI GOP, we can
simply prepare such a block for VxWorks.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
cmd/elf.c | 19 +++++++++++++++++++
include/vxworks.h | 26 ++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/cmd/elf.c b/cmd/elf.c
index 8a0e7d9..cd98392 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -19,6 +19,7 @@
#include <net.h>
#include <vxworks.h>
#ifdef CONFIG_X86
+#include <vbe.h>
#include <asm/e820.h>
#include <linux/linkage.h>
#endif
@@ -253,6 +254,8 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ulong base;
struct e820_info *info;
struct e820_entry *data;
+ struct efi_gop_info *gop;
+ struct vesa_mode_info *vesa = &mode_info.vesa;
#endif
/*
@@ -396,6 +399,22 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* available memory size for the kernel is insane.
*/
*(u32 *)(base + BOOT_IMAGE_SIZE_OFFSET) = 0;
+
+ /*
+ * Prepare compatible framebuffer information block.
+ * The VESA mode has to be 32-bit RGBA.
+ */
+ if (vesa->x_resolution && vesa->y_resolution) {
+ gop = (struct efi_gop_info *)(base + EFI_GOP_INFO_OFFSET);
+ gop->magic = EFI_GOP_INFO_MAGIC;
+ gop->info.version = 0;
+ gop->info.width = vesa->x_resolution;
+ gop->info.height = vesa->y_resolution;
+ gop->info.pixel_format = EFI_GOT_RGBA8;
+ gop->info.pixels_per_scanline = vesa->bytes_per_scanline / 4;
+ gop->fb_base = vesa->phys_base_ptr;
+ gop->fb_size = vesa->bytes_per_scanline * vesa->y_resolution;
+ }
#endif
/*
diff --git a/include/vxworks.h b/include/vxworks.h
index 4a83a34..b1b5096 100644
--- a/include/vxworks.h
+++ b/include/vxworks.h
@@ -8,6 +8,8 @@
#ifndef _VXWORKS_H_
#define _VXWORKS_H_
+#include <efi_api.h>
+
/*
* Physical address of memory base for VxWorks x86
* This is LOCAL_MEM_LOCAL_ADRS in the VxWorks kernel configuration.
@@ -52,6 +54,30 @@ struct e820_info {
*/
#define BOOT_IMAGE_SIZE_OFFSET 0x5004
+/*
+ * When booting from EFI BIOS, VxWorks bootloader stores the EFI GOP
+ * framebuffer info at a pre-defined offset @ 0x6100. When VxWorks kernel
+ * boots up, its EFI console driver tries to find such a block and if
+ * the signature matches, the framebuffer information will be used to
+ * initialize the driver.
+ *
+ * However it is not necessary to prepare an EFI environment for VxWorks's
+ * EFI console driver to function (eg: EFI loader in U-Boot). If U-Boot has
+ * already initialized the graphics card and set it to a VESA mode that is
+ * compatible with EFI GOP, we can simply prepare such a block for VxWorks.
+ */
+#define EFI_GOP_INFO_OFFSET 0x6100
+
+/* EFI GOP info signatiure */
+#define EFI_GOP_INFO_MAGIC 0xfeedface
+
+struct efi_gop_info {
+ u32 magic; /* signature */
+ struct efi_gop_mode_info info; /* EFI GOP mode info structure */
+ phys_addr_t fb_base; /* framebuffer base address */
+ u32 fb_size; /* framebuffer size */
+};
+
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] 53+ messages in thread
* [U-Boot] [PATCH v2 14/18] bootvx: x86: Make VxWorks EFI console driver happy
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
0 siblings, 1 reply; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:42 UTC (permalink / raw)
To: u-boot
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> When booting from EFI BIOS, VxWorks bootloader stores the EFI GOP
> framebuffer info at a pre-defined offset @ 0x6100. When VxWorks
> kernel boots up, its EFI console driver tries to find such a block
> and if the signature matches, the framebuffer information will be
> used to initialize the driver.
>
> However it is not necessary to prepare an EFI environment for
> VxWorks's EFI console driver to function (eg: EFI loader in
> U-Boot). If U-Boot has already initialized the graphics card and
> set it to a VESA mode that is compatible with EFI GOP, we can
> simply prepare such a block for VxWorks.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
> cmd/elf.c | 19 +++++++++++++++++++
> include/vxworks.h | 26 ++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 14/18] bootvx: x86: Make VxWorks EFI console driver happy
2018-04-12 16:42 ` Simon Glass
@ 2018-04-16 9:16 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> When booting from EFI BIOS, VxWorks bootloader stores the EFI GOP
>> framebuffer info at a pre-defined offset @ 0x6100. When VxWorks
>> kernel boots up, its EFI console driver tries to find such a block
>> and if the signature matches, the framebuffer information will be
>> used to initialize the driver.
>>
>> However it is not necessary to prepare an EFI environment for
>> VxWorks's EFI console driver to function (eg: EFI loader in
>> U-Boot). If U-Boot has already initialized the graphics card and
>> set it to a VESA mode that is compatible with EFI GOP, we can
>> simply prepare such a block for VxWorks.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>> cmd/elf.c | 19 +++++++++++++++++++
>> include/vxworks.h | 26 ++++++++++++++++++++++++++
>> 2 files changed, 45 insertions(+)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 15/18] bootvx: Refactor the bootline copy codes a little bit
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (13 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 14/18] bootvx: x86: Make VxWorks EFI console driver happy Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-12 16:42 ` Simon Glass
2018-04-12 5:02 ` [U-Boot] [PATCH v2 16/18] bootvx: Exit if bootline address is not specified Bin Meng
` (2 subsequent siblings)
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
There is a small duplication in do_bootvx() that does the bootline
copy. Refactor this a little bit to make it simpler.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
cmd/elf.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/cmd/elf.c b/cmd/elf.c
index cd98392..22ff254 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -312,12 +312,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* construct the info.
*/
bootline = env_get("bootargs");
- if (bootline) {
- memcpy((void *)bootaddr, bootline,
- max(strlen(bootline), (size_t)255));
- flush_cache(bootaddr, max(strlen(bootline),
- (size_t)255));
- } else {
+ if (!bootline) {
tmp = env_get("bootdev");
if (tmp) {
strcpy(build_buf, tmp);
@@ -368,12 +363,12 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ptr += strlen(tmp);
}
- memcpy((void *)bootaddr, build_buf,
- max(strlen(build_buf), (size_t)255));
- flush_cache(bootaddr, max(strlen(build_buf),
- (size_t)255));
+ bootline = build_buf;
}
+ memcpy((void *)bootaddr, bootline,
+ max(strlen(bootline), (size_t)255));
+ flush_cache(bootaddr, max(strlen(bootline), (size_t)255));
printf("## Using bootline (@ 0x%lx): %s\n", bootaddr,
(char *)bootaddr);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 15/18] bootvx: Refactor the bootline copy codes a little bit
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
0 siblings, 1 reply; 53+ messages in thread
From: Simon Glass @ 2018-04-12 16:42 UTC (permalink / raw)
To: u-boot
On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
> There is a small duplication in do_bootvx() that does the bootline
> copy. Refactor this a little bit to make it simpler.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
> cmd/elf.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 15/18] bootvx: Refactor the bootline copy codes a little bit
2018-04-12 16:42 ` Simon Glass
@ 2018-04-16 9:16 ` Bin Meng
0 siblings, 0 replies; 53+ messages in thread
From: Bin Meng @ 2018-04-16 9:16 UTC (permalink / raw)
To: u-boot
On Fri, Apr 13, 2018 at 12:42 AM, Simon Glass <sjg@chromium.org> wrote:
> On 11 April 2018 at 23:02, Bin Meng <bmeng.cn@gmail.com> wrote:
>> There is a small duplication in do_bootvx() that does the bootline
>> copy. Refactor this a little bit to make it simpler.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>> cmd/elf.c | 15 +++++----------
>> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 16/18] bootvx: Exit if bootline address is not specified
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (14 preceding siblings ...)
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 5:02 ` 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-12 5:02 ` [U-Boot] [PATCH v2 18/18] doc: vxworks: Update x86 specific instructions Bin Meng
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
Exit the 'bootvx' command if bootline address is not specified.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
cmd/elf.c | 109 ++++++++++++++++++++++++++++++--------------------------------
1 file changed, 53 insertions(+), 56 deletions(-)
diff --git a/cmd/elf.c b/cmd/elf.c
index 22ff254..0c84664 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -303,76 +303,73 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
tmp = env_get("bootaddr");
if (!tmp) {
printf("## VxWorks bootline address not specified\n");
- } else {
- bootaddr = simple_strtoul(tmp, NULL, 16);
+ return 1;
+ }
+
+ bootaddr = simple_strtoul(tmp, NULL, 16);
+
+ /*
+ * Check to see if the bootline is defined in the 'bootargs' parameter.
+ * If it is not defined, we may be able to construct the info.
+ */
+ bootline = env_get("bootargs");
+ if (!bootline) {
+ tmp = env_get("bootdev");
+ if (tmp) {
+ strcpy(build_buf, tmp);
+ ptr = strlen(tmp);
+ } else {
+ printf("## VxWorks boot device not specified\n");
+ }
+
+ tmp = env_get("bootfile");
+ if (tmp)
+ ptr += sprintf(build_buf + ptr, "host:%s ", tmp);
+ else
+ ptr += sprintf(build_buf + ptr, "host:vxWorks ");
/*
- * Check to see if the bootline is defined in the 'bootargs'
- * parameter. If it is not defined, we may be able to
- * construct the info.
+ * The following parameters are only needed if 'bootdev'
+ * is an ethernet device, otherwise they are optional.
*/
- bootline = env_get("bootargs");
- if (!bootline) {
- tmp = env_get("bootdev");
+ tmp = env_get("ipaddr");
+ if (tmp) {
+ ptr += sprintf(build_buf + ptr, "e=%s", tmp);
+ tmp = env_get("netmask");
if (tmp) {
- strcpy(build_buf, tmp);
- ptr = strlen(tmp);
- } else
- printf("## VxWorks boot device not specified\n");
-
- tmp = env_get("bootfile");
- if (tmp)
- ptr += sprintf(build_buf + ptr,
- "host:%s ", tmp);
- else
+ u32 mask = env_get_ip("netmask").s_addr;
ptr += sprintf(build_buf + ptr,
- "host:vxWorks ");
-
- /*
- * The following parameters are only needed if 'bootdev'
- * is an ethernet device, otherwise they are optional.
- */
- tmp = env_get("ipaddr");
- if (tmp) {
- ptr += sprintf(build_buf + ptr, "e=%s", tmp);
- tmp = env_get("netmask");
- if (tmp) {
- u32 mask = env_get_ip("netmask").s_addr;
- ptr += sprintf(build_buf + ptr,
- ":%08x ", ntohl(mask));
- } else {
- ptr += sprintf(build_buf + ptr, " ");
- }
+ ":%08x ", ntohl(mask));
+ } else {
+ ptr += sprintf(build_buf + ptr, " ");
}
+ }
- tmp = env_get("serverip");
- if (tmp)
- ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
-
- tmp = env_get("gatewayip");
- if (tmp)
- ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
+ tmp = env_get("serverip");
+ if (tmp)
+ ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
- tmp = env_get("hostname");
- if (tmp)
- ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
+ tmp = env_get("gatewayip");
+ if (tmp)
+ ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
- tmp = env_get("othbootargs");
- if (tmp) {
- strcpy(build_buf + ptr, tmp);
- ptr += strlen(tmp);
- }
+ tmp = env_get("hostname");
+ if (tmp)
+ ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
- bootline = build_buf;
+ tmp = env_get("othbootargs");
+ if (tmp) {
+ strcpy(build_buf + ptr, tmp);
+ ptr += strlen(tmp);
}
- memcpy((void *)bootaddr, bootline,
- max(strlen(bootline), (size_t)255));
- flush_cache(bootaddr, max(strlen(bootline), (size_t)255));
- printf("## Using bootline (@ 0x%lx): %s\n", bootaddr,
- (char *)bootaddr);
+ bootline = build_buf;
}
+ memcpy((void *)bootaddr, bootline, max(strlen(bootline), (size_t)255));
+ flush_cache(bootaddr, max(strlen(bootline), (size_t)255));
+ printf("## Using bootline (@ 0x%lx): %s\n", bootaddr, (char *)bootaddr);
+
#ifdef CONFIG_X86
/*
* Get VxWorks's physical memory base address from environment,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 17/18] bootvx: x86: Assign bootaddr based on kernel memory base
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (15 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 16/18] bootvx: Exit if bootline address is not specified Bin Meng
@ 2018-04-12 5:02 ` 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
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
On VxWorks x86 its bootline address is at a pre-defined offset @
0x1200. If 'bootaddr' is not passed via environment variable, we
assign its value based on the kernel memory base address.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2: None
cmd/elf.c | 91 +++++++++++++++++++++++++++++--------------------------
include/vxworks.h | 3 ++
2 files changed, 51 insertions(+), 43 deletions(-)
diff --git a/cmd/elf.c b/cmd/elf.c
index 0c84664..91e866b 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -245,7 +245,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
unsigned long addr; /* Address of image */
- unsigned long bootaddr; /* Address to put the bootline */
+ unsigned long bootaddr = 0; /* Address to put the bootline */
char *bootline; /* Text of the bootline */
char *tmp; /* Temporary char pointer */
char build_buf[128]; /* Buffer for building the bootline */
@@ -294,6 +294,45 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
puts("## Ethernet MAC address not copied to NV RAM\n");
#endif
+#ifdef CONFIG_X86
+ /*
+ * Get VxWorks's physical memory base address from environment,
+ * if we don't specify it in the environment, use a default one.
+ */
+ base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE);
+ data = (struct e820_entry *)(base + E820_DATA_OFFSET);
+ info = (struct e820_info *)(base + E820_INFO_OFFSET);
+
+ memset(info, 0, sizeof(struct e820_info));
+ info->sign = E820_SIGNATURE;
+ info->entries = install_e820_map(E820MAX, data);
+ info->addr = (info->entries - 1) * sizeof(struct e820_entry) +
+ 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;
+
+ /*
+ * Prepare compatible framebuffer information block.
+ * The VESA mode has to be 32-bit RGBA.
+ */
+ if (vesa->x_resolution && vesa->y_resolution) {
+ gop = (struct efi_gop_info *)(base + EFI_GOP_INFO_OFFSET);
+ gop->magic = EFI_GOP_INFO_MAGIC;
+ gop->info.version = 0;
+ gop->info.width = vesa->x_resolution;
+ gop->info.height = vesa->y_resolution;
+ gop->info.pixel_format = EFI_GOT_RGBA8;
+ gop->info.pixels_per_scanline = vesa->bytes_per_scanline / 4;
+ gop->fb_base = vesa->phys_base_ptr;
+ gop->fb_size = vesa->bytes_per_scanline * vesa->y_resolution;
+ }
+#endif
+
/*
* Use bootaddr to find the location in memory that VxWorks
* will look for the bootline string. The default value is
@@ -302,11 +341,16 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
tmp = env_get("bootaddr");
if (!tmp) {
- printf("## VxWorks bootline address not specified\n");
- return 1;
+ if (CONFIG_IS_ENABLED(X86)) {
+ bootaddr = base + X86_BOOT_LINE_OFFSET;
+ } else {
+ printf("## VxWorks bootline address not specified\n");
+ return 1;
+ }
}
- bootaddr = simple_strtoul(tmp, NULL, 16);
+ if (!bootaddr)
+ bootaddr = simple_strtoul(tmp, NULL, 16);
/*
* Check to see if the bootline is defined in the 'bootargs' parameter.
@@ -370,45 +414,6 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
flush_cache(bootaddr, max(strlen(bootline), (size_t)255));
printf("## Using bootline (@ 0x%lx): %s\n", bootaddr, (char *)bootaddr);
-#ifdef CONFIG_X86
- /*
- * Get VxWorks's physical memory base address from environment,
- * if we don't specify it in the environment, use a default one.
- */
- base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE);
- data = (struct e820_entry *)(base + E820_DATA_OFFSET);
- info = (struct e820_info *)(base + E820_INFO_OFFSET);
-
- memset(info, 0, sizeof(struct e820_info));
- info->sign = E820_SIGNATURE;
- info->entries = install_e820_map(E820MAX, data);
- info->addr = (info->entries - 1) * sizeof(struct e820_entry) +
- 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;
-
- /*
- * Prepare compatible framebuffer information block.
- * The VESA mode has to be 32-bit RGBA.
- */
- if (vesa->x_resolution && vesa->y_resolution) {
- gop = (struct efi_gop_info *)(base + EFI_GOP_INFO_OFFSET);
- gop->magic = EFI_GOP_INFO_MAGIC;
- gop->info.version = 0;
- gop->info.width = vesa->x_resolution;
- gop->info.height = vesa->y_resolution;
- gop->info.pixel_format = EFI_GOT_RGBA8;
- gop->info.pixels_per_scanline = vesa->bytes_per_scanline / 4;
- gop->fb_base = vesa->phys_base_ptr;
- gop->fb_size = vesa->bytes_per_scanline * vesa->y_resolution;
- }
-#endif
-
/*
* If the data at the load address is an elf image, then
* treat it like an elf image. Otherwise, assume that it is a
diff --git a/include/vxworks.h b/include/vxworks.h
index b1b5096..39f0a44 100644
--- a/include/vxworks.h
+++ b/include/vxworks.h
@@ -16,6 +16,9 @@
*/
#define VXWORKS_PHYS_MEM_BASE 0x100000
+/* x86 bootline offset relative to LOCAL_MEM_LOCAL_ADRS in VxWorks */
+#define X86_BOOT_LINE_OFFSET 0x1200
+
/*
* VxWorks x86 E820 related stuff
*
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [U-Boot] [PATCH v2 18/18] doc: vxworks: Update x86 specific instructions
2018-04-12 5:02 [U-Boot] [PATCH v2 00/18] bootvx: Various enhancements to booting VxWorks x86 kernels Bin Meng
` (16 preceding siblings ...)
2018-04-12 5:02 ` [U-Boot] [PATCH v2 17/18] bootvx: x86: Assign bootaddr based on kernel memory base Bin Meng
@ 2018-04-12 5:02 ` Bin Meng
2018-04-16 9:17 ` Bin Meng
17 siblings, 1 reply; 53+ messages in thread
From: Bin Meng @ 2018-04-12 5:02 UTC (permalink / raw)
To: u-boot
This updates the doc of booting VxWorks, like loading an x64 kernel,
and how to make VxWorks graphics console driver work.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2:
- update the graphics console driver information
doc/README.vxworks | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/doc/README.vxworks b/doc/README.vxworks
index b95a516..3d31db9 100644
--- a/doc/README.vxworks
+++ b/doc/README.vxworks
@@ -17,8 +17,6 @@ For booting old kernels (6.9.x) on PowerPC and ARM, and all kernel versions
on other architectures, 'bootvx' shall be used. For booting VxWorks 7 kernels
on PowerPC and ARM, 'bootm' shall be used.
-64-bit x86 kernel cannot be loaded as of today.
-
VxWork 7 on PowerPC and ARM
---------------------------
From VxWorks 7, VxWorks starts adopting device tree as its hardware decription
@@ -79,3 +77,22 @@ 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.
+
+Both 32-bit x86 and 64-bit x64 kernels can be loaded.
+
+There are two types of graphics console drivers in VxWorks. One is the 80x25
+VGA text mode driver. The other one is the EFI console bitmapped graphics mode
+driver. To make these drivers function, U-Boot needs to load and run the VGA
+BIOS of the graphics card first.
+
+ - If the kernel is configured with 80x25 VGA text mode driver,
+ CONFIG_FRAMEBUFFER_SET_VESA_MODE must be unset in U-Boot.
+ - If the kernel is configured with bitmapped graphics mode driver,
+ CONFIG_FRAMEBUFFER_SET_VESA_MODE need remain set but care must be taken
+ at which VESA mode is to be set. The supported pixel format is 32-bit
+ RGBA, hence the available VESA mode can only be one of the following:
+ * FRAMEBUFFER_VESA_MODE_10F
+ * FRAMEBUFFER_VESA_MODE_112
+ * FRAMEBUFFER_VESA_MODE_115
+ * FRAMEBUFFER_VESA_MODE_118
+ * FRAMEBUFFER_VESA_MODE_11B
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread