Re: [U-Boot] [PATCH 36/82] x86: lib: Fix types and casts for 64-bit compilation

2016-10-10 Thread Bin Meng
Hi Simon,

On Mon, Sep 26, 2016 at 11:33 AM, Simon Glass  wrote:
> Fix various compiler warnings in the x86 library code.
>
> Signed-off-by: Simon Glass 
> ---
>
>  arch/x86/lib/bios.c | 4 ++--
>  arch/x86/lib/pinctrl_ich6.c | 2 +-
>  arch/x86/lib/pirq_routing.c | 4 ++--
>  arch/x86/lib/sfi.c  | 4 ++--
>  arch/x86/lib/zimage.c   | 2 +-
>  5 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/lib/bios.c b/arch/x86/lib/bios.c
> index 9324bdb..66d7629 100644
> --- a/arch/x86/lib/bios.c
> +++ b/arch/x86/lib/bios.c
> @@ -157,7 +157,7 @@ static void setup_realmode_idt(void)
>  for (i = 0; i < 256; i++) {
> idts[i].cs = 0;
> idts[i].offset = 0x1000 + (i * __idt_handler_size);
> -   write_idt_stub((void *)((u32)idts[i].offset), i);
> +   write_idt_stub((void *)((ulong)idts[i].offset), i);
> }
>
> /*
> @@ -227,7 +227,7 @@ static void vbe_set_graphics(int vesa_mode, struct 
> vbe_mode_info *mode_info)
> mode_info->video_mode = (1 << 14) | vesa_mode;
> vbe_get_mode_info(mode_info);
>
> -   framebuffer = (unsigned char *)mode_info->vesa.phys_base_ptr;
> +   framebuffer = (unsigned char *)(ulong)mode_info->vesa.phys_base_ptr;
> debug("VBE: resolution:  %dx%d@%d\n",
>   le16_to_cpu(mode_info->vesa.x_resolution),
>   le16_to_cpu(mode_info->vesa.y_resolution),
> diff --git a/arch/x86/lib/pinctrl_ich6.c b/arch/x86/lib/pinctrl_ich6.c
> index 3f94cdf..fb2d294 100644
> --- a/arch/x86/lib/pinctrl_ich6.c
> +++ b/arch/x86/lib/pinctrl_ich6.c
> @@ -104,7 +104,7 @@ static int ich6_pinctrl_cfg_pin(s32 gpiobase, s32 iobase, 
> int pin_node)
>
> /* if iobase is present, let's configure the pad */
> if (iobase != -1) {
> -   int iobase_addr;
> +   ulong iobase_addr;
>
> /*
>  * The offset for the same pin for the IOBASE and GPIOBASE are

Reviewed-by: Bin Meng 

> diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c
> index a93d355..c98526d 100644
> --- a/arch/x86/lib/pirq_routing.c
> +++ b/arch/x86/lib/pirq_routing.c
> @@ -114,14 +114,14 @@ u32 copy_pirq_routing_table(u32 addr, struct 
> irq_routing_table *rt)
> addr = ALIGN(addr, 16);
>
> debug("Copying Interrupt Routing Table to 0x%x\n", addr);
> -   memcpy((void *)addr, rt, rt->size);
> +   memcpy((void *)(uintptr_t)addr, rt, rt->size);
>
> /*
>  * We do the sanity check here against the copied table after memcpy,
>  * as something might go wrong after the memcpy, which is normally
>  * due to the F segment decode is not turned on to systeam RAM.
>  */
> -   rom_rt = (struct irq_routing_table *)addr;
> +   rom_rt = (struct irq_routing_table *)(uintptr_t)addr;
> if (rom_rt->signature != PIRQ_SIGNATURE ||
> rom_rt->version != PIRQ_VERSION || rom_rt->size % 16) {
> printf("Interrupt Routing Table not valid\n");
> diff --git a/arch/x86/lib/sfi.c b/arch/x86/lib/sfi.c
> index 9564853..507e037 100644
> --- a/arch/x86/lib/sfi.c
> +++ b/arch/x86/lib/sfi.c
> @@ -38,14 +38,14 @@ static void *get_entry_start(struct table_info *tab)
> tab->table[tab->count] = tab->entry_start;
> tab->entry_start += sizeof(struct sfi_table_header);
>
> -   return (void *)tab->entry_start;
> +   return (void *)(uintptr_t)tab->entry_start;
>  }
>
>  static void finish_table(struct table_info *tab, const char *sig, void 
> *entry)
>  {
> struct sfi_table_header *hdr;
>
> -   hdr = (struct sfi_table_header *)(tab->base + tab->ptr);
> +   hdr = (struct sfi_table_header *)(uintptr_t)(tab->base + tab->ptr);
> strcpy(hdr->sig, sig);
> hdr->len = sizeof(*hdr) + ((ulong)entry - tab->entry_start);
> hdr->rev = 1;
> diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
> index 1b33c77..b6b0f2b 100644
> --- a/arch/x86/lib/zimage.c
> +++ b/arch/x86/lib/zimage.c
> @@ -165,7 +165,7 @@ struct boot_params *load_zimage(char *image, unsigned 
> long kernel_size,
>  * A very old kernel MUST have its real-mode code
>  * loaded at 0x9
>  */
> -   if ((u32)setup_base != 0x9) {
> +   if ((ulong)setup_base != 0x9) {
> /* Copy the real-mode kernel */
> memmove((void *)0x9, setup_base, setup_size);
>
> --

Can the above 3 changes merged into patch#23: x86: Use unsigned long
for address in table generation, since they are all table related
changes?

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 36/82] x86: lib: Fix types and casts for 64-bit compilation

2016-09-25 Thread Simon Glass
Fix various compiler warnings in the x86 library code.

Signed-off-by: Simon Glass 
---

 arch/x86/lib/bios.c | 4 ++--
 arch/x86/lib/pinctrl_ich6.c | 2 +-
 arch/x86/lib/pirq_routing.c | 4 ++--
 arch/x86/lib/sfi.c  | 4 ++--
 arch/x86/lib/zimage.c   | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/lib/bios.c b/arch/x86/lib/bios.c
index 9324bdb..66d7629 100644
--- a/arch/x86/lib/bios.c
+++ b/arch/x86/lib/bios.c
@@ -157,7 +157,7 @@ static void setup_realmode_idt(void)
 for (i = 0; i < 256; i++) {
idts[i].cs = 0;
idts[i].offset = 0x1000 + (i * __idt_handler_size);
-   write_idt_stub((void *)((u32)idts[i].offset), i);
+   write_idt_stub((void *)((ulong)idts[i].offset), i);
}
 
/*
@@ -227,7 +227,7 @@ static void vbe_set_graphics(int vesa_mode, struct 
vbe_mode_info *mode_info)
mode_info->video_mode = (1 << 14) | vesa_mode;
vbe_get_mode_info(mode_info);
 
-   framebuffer = (unsigned char *)mode_info->vesa.phys_base_ptr;
+   framebuffer = (unsigned char *)(ulong)mode_info->vesa.phys_base_ptr;
debug("VBE: resolution:  %dx%d@%d\n",
  le16_to_cpu(mode_info->vesa.x_resolution),
  le16_to_cpu(mode_info->vesa.y_resolution),
diff --git a/arch/x86/lib/pinctrl_ich6.c b/arch/x86/lib/pinctrl_ich6.c
index 3f94cdf..fb2d294 100644
--- a/arch/x86/lib/pinctrl_ich6.c
+++ b/arch/x86/lib/pinctrl_ich6.c
@@ -104,7 +104,7 @@ static int ich6_pinctrl_cfg_pin(s32 gpiobase, s32 iobase, 
int pin_node)
 
/* if iobase is present, let's configure the pad */
if (iobase != -1) {
-   int iobase_addr;
+   ulong iobase_addr;
 
/*
 * The offset for the same pin for the IOBASE and GPIOBASE are
diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c
index a93d355..c98526d 100644
--- a/arch/x86/lib/pirq_routing.c
+++ b/arch/x86/lib/pirq_routing.c
@@ -114,14 +114,14 @@ u32 copy_pirq_routing_table(u32 addr, struct 
irq_routing_table *rt)
addr = ALIGN(addr, 16);
 
debug("Copying Interrupt Routing Table to 0x%x\n", addr);
-   memcpy((void *)addr, rt, rt->size);
+   memcpy((void *)(uintptr_t)addr, rt, rt->size);
 
/*
 * We do the sanity check here against the copied table after memcpy,
 * as something might go wrong after the memcpy, which is normally
 * due to the F segment decode is not turned on to systeam RAM.
 */
-   rom_rt = (struct irq_routing_table *)addr;
+   rom_rt = (struct irq_routing_table *)(uintptr_t)addr;
if (rom_rt->signature != PIRQ_SIGNATURE ||
rom_rt->version != PIRQ_VERSION || rom_rt->size % 16) {
printf("Interrupt Routing Table not valid\n");
diff --git a/arch/x86/lib/sfi.c b/arch/x86/lib/sfi.c
index 9564853..507e037 100644
--- a/arch/x86/lib/sfi.c
+++ b/arch/x86/lib/sfi.c
@@ -38,14 +38,14 @@ static void *get_entry_start(struct table_info *tab)
tab->table[tab->count] = tab->entry_start;
tab->entry_start += sizeof(struct sfi_table_header);
 
-   return (void *)tab->entry_start;
+   return (void *)(uintptr_t)tab->entry_start;
 }
 
 static void finish_table(struct table_info *tab, const char *sig, void *entry)
 {
struct sfi_table_header *hdr;
 
-   hdr = (struct sfi_table_header *)(tab->base + tab->ptr);
+   hdr = (struct sfi_table_header *)(uintptr_t)(tab->base + tab->ptr);
strcpy(hdr->sig, sig);
hdr->len = sizeof(*hdr) + ((ulong)entry - tab->entry_start);
hdr->rev = 1;
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 1b33c77..b6b0f2b 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -165,7 +165,7 @@ struct boot_params *load_zimage(char *image, unsigned long 
kernel_size,
 * A very old kernel MUST have its real-mode code
 * loaded at 0x9
 */
-   if ((u32)setup_base != 0x9) {
+   if ((ulong)setup_base != 0x9) {
/* Copy the real-mode kernel */
memmove((void *)0x9, setup_base, setup_size);
 
-- 
2.8.0.rc3.226.g39d4020

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot