diff mbox

[U-Boot,12/23] x86: Adjust the FSP types slightly

Message ID 1422321801-6743-13-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Jan. 27, 2015, 1:23 a.m. UTC
To avoid casts, find_fsp_header() should return a pointer. Add asmlinkage
to two API functions which use that convention. UPD_TERMINATOR is common
so move it into a common file.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h | 2 --
 arch/x86/include/asm/fsp/fsp_api.h                | 6 ++++--
 arch/x86/include/asm/fsp/fsp_support.h            | 4 +++-
 arch/x86/lib/fsp/fsp_support.c                    | 4 ++--
 4 files changed, 9 insertions(+), 7 deletions(-)

Comments

Bin Meng Jan. 27, 2015, 12:25 p.m. UTC | #1
On Tue, Jan 27, 2015 at 9:23 AM, Simon Glass <sjg@chromium.org> wrote:
> To avoid casts, find_fsp_header() should return a pointer. Add asmlinkage
> to two API functions which use that convention. UPD_TERMINATOR is common
> so move it into a common file.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h | 2 --
>  arch/x86/include/asm/fsp/fsp_api.h                | 6 ++++--
>  arch/x86/include/asm/fsp/fsp_support.h            | 4 +++-
>  arch/x86/lib/fsp/fsp_support.c                    | 4 ++--
>  4 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h
> index bce58b1..3c57558 100644
> --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h
> +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h
> @@ -10,8 +10,6 @@
>  #ifndef __VPDHEADER_H__
>  #define __VPDHEADER_H__
>
> -#define UPD_TERMINATOR 0x55AA
> -
>  struct __packed upd_region {
>         u64     sign;                   /* Offset 0x0000 */
>         u64     reserved;               /* Offset 0x0008 */
> diff --git a/arch/x86/include/asm/fsp/fsp_api.h b/arch/x86/include/asm/fsp/fsp_api.h
> index a9d7156..2d34d13 100644
> --- a/arch/x86/include/asm/fsp/fsp_api.h
> +++ b/arch/x86/include/asm/fsp/fsp_api.h
> @@ -8,6 +8,8 @@
>  #ifndef __FSP_API_H__
>  #define __FSP_API_H__
>
> +#include <linux/linkage.h>
> +
>  /*
>   * FspInit continuation function prototype.
>   * Control will be returned to this callback function after FspInit API call.
> @@ -47,9 +49,9 @@ struct fsp_notify_params {
>  };
>
>  /* FspInit API function prototype */
> -typedef u32 (*fsp_init_f)(struct fsp_init_params *params);
> +typedef asmlinkage u32 (*fsp_init_f)(struct fsp_init_params *params);
>
>  /* FspNotify API function prototype */
> -typedef u32 (*fsp_notify_f)(struct fsp_notify_params *params);
> +typedef asmlinkage u32 (*fsp_notify_f)(struct fsp_notify_params *params);
>
>  #endif
> diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h
> index 6329cfe..c6c7dc0 100644
> --- a/arch/x86/include/asm/fsp/fsp_support.h
> +++ b/arch/x86/include/asm/fsp/fsp_support.h
> @@ -26,6 +26,8 @@ struct shared_data {
>
>  #define FSP_LOWMEM_BASE                0x100000UL
>  #define FSP_HIGHMEM_BASE       0x100000000ULL
> +#define UPD_TERMINATOR         0x55AA
> +
>
>  /**
>   * FSP Continuation assembly helper routine
> @@ -61,7 +63,7 @@ void fsp_continue(struct shared_data *shared_data, u32 status,
>   *
>   * @retval: the offset of FSP header. If signature is invalid, returns 0.
>   */
> -u32 find_fsp_header(void);
> +struct fsp_header *find_fsp_header(void);
>
>  /**
>   * FSP initialization wrapper function.
> diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c
> index f6ae85a..bf37807 100644
> --- a/arch/x86/lib/fsp/fsp_support.c
> +++ b/arch/x86/lib/fsp/fsp_support.c
> @@ -30,7 +30,7 @@ static bool compare_guid(const struct efi_guid *guid1,
>                 return false;
>  }
>
> -u32 __attribute__((optimize("O0"))) find_fsp_header(void)
> +struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void)
>  {
>         /*
>          * This function may be called before the a stack is established,
> @@ -84,7 +84,7 @@ u32 __attribute__((optimize("O0"))) find_fsp_header(void)
>                 fsp = 0;
>         }
>
> -       return (u32)fsp;
> +       return (struct fsp_header *)fsp;
>  }
>
>  void fsp_continue(struct shared_data *shared_data, u32 status, void *hob_list)
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox

Patch

diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h
index bce58b1..3c57558 100644
--- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h
@@ -10,8 +10,6 @@ 
 #ifndef __VPDHEADER_H__
 #define __VPDHEADER_H__
 
-#define UPD_TERMINATOR	0x55AA
-
 struct __packed upd_region {
 	u64	sign;			/* Offset 0x0000 */
 	u64	reserved;		/* Offset 0x0008 */
diff --git a/arch/x86/include/asm/fsp/fsp_api.h b/arch/x86/include/asm/fsp/fsp_api.h
index a9d7156..2d34d13 100644
--- a/arch/x86/include/asm/fsp/fsp_api.h
+++ b/arch/x86/include/asm/fsp/fsp_api.h
@@ -8,6 +8,8 @@ 
 #ifndef __FSP_API_H__
 #define __FSP_API_H__
 
+#include <linux/linkage.h>
+
 /*
  * FspInit continuation function prototype.
  * Control will be returned to this callback function after FspInit API call.
@@ -47,9 +49,9 @@  struct fsp_notify_params {
 };
 
 /* FspInit API function prototype */
-typedef u32 (*fsp_init_f)(struct fsp_init_params *params);
+typedef asmlinkage u32 (*fsp_init_f)(struct fsp_init_params *params);
 
 /* FspNotify API function prototype */
-typedef u32 (*fsp_notify_f)(struct fsp_notify_params *params);
+typedef asmlinkage u32 (*fsp_notify_f)(struct fsp_notify_params *params);
 
 #endif
diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h
index 6329cfe..c6c7dc0 100644
--- a/arch/x86/include/asm/fsp/fsp_support.h
+++ b/arch/x86/include/asm/fsp/fsp_support.h
@@ -26,6 +26,8 @@  struct shared_data {
 
 #define FSP_LOWMEM_BASE		0x100000UL
 #define FSP_HIGHMEM_BASE	0x100000000ULL
+#define UPD_TERMINATOR		0x55AA
+
 
 /**
  * FSP Continuation assembly helper routine
@@ -61,7 +63,7 @@  void fsp_continue(struct shared_data *shared_data, u32 status,
  *
  * @retval: the offset of FSP header. If signature is invalid, returns 0.
  */
-u32 find_fsp_header(void);
+struct fsp_header *find_fsp_header(void);
 
 /**
  * FSP initialization wrapper function.
diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c
index f6ae85a..bf37807 100644
--- a/arch/x86/lib/fsp/fsp_support.c
+++ b/arch/x86/lib/fsp/fsp_support.c
@@ -30,7 +30,7 @@  static bool compare_guid(const struct efi_guid *guid1,
 		return false;
 }
 
-u32 __attribute__((optimize("O0"))) find_fsp_header(void)
+struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void)
 {
 	/*
 	 * This function may be called before the a stack is established,
@@ -84,7 +84,7 @@  u32 __attribute__((optimize("O0"))) find_fsp_header(void)
 		fsp = 0;
 	}
 
-	return (u32)fsp;
+	return (struct fsp_header *)fsp;
 }
 
 void fsp_continue(struct shared_data *shared_data, u32 status, void *hob_list)