mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] pbl: allow #include <pbl.h> from assembly
@ 2023-06-26  7:07 Ahmad Fatoum
  2023-06-26  9:56 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-06-26  7:07 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

When compiled with obj-pbl-y, C code can either check #ifdef __PBL__ or
include <pbl.h> and use the IN_PBL macro that's always defined to be
either 0 or 1. Support doing the same from assembly by making the
<pbl.h> safe to include from outside C.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/pbl.h | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/pbl.h b/include/pbl.h
index 7dc4fa309257..44957f59784e 100644
--- a/include/pbl.h
+++ b/include/pbl.h
@@ -6,6 +6,14 @@
 #ifndef __PBL_H__
 #define __PBL_H__
 
+#ifdef __PBL__
+#define IN_PBL	1
+#else
+#define IN_PBL	0
+#endif
+
+#ifndef __ASSEMBLY__
+
 #include <linux/types.h>
 
 extern unsigned long free_mem_ptr;
@@ -13,12 +21,6 @@ extern unsigned long free_mem_end_ptr;
 
 void pbl_barebox_uncompress(void *dest, void *compressed_start, unsigned int len);
 
-#ifdef __PBL__
-#define IN_PBL	1
-#else
-#define IN_PBL	0
-#endif
-
 void fdt_find_mem(const void *fdt, unsigned long *membase, unsigned long *memsize);
 
 struct fdt_device_id {
@@ -32,5 +34,6 @@ fdt_device_get_match_data(const void *fdt, const char *nodepath,
 
 int pbl_barebox_verify(const void *compressed_start, unsigned int len,
 		       const void *hash, unsigned int hash_len);
+#endif
 
 #endif /* __PBL_H__ */
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] pbl: allow #include <pbl.h> from assembly
  2023-06-26  7:07 [PATCH] pbl: allow #include <pbl.h> from assembly Ahmad Fatoum
@ 2023-06-26  9:56 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-06-26  9:56 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jun 26, 2023 at 09:07:47AM +0200, Ahmad Fatoum wrote:
> When compiled with obj-pbl-y, C code can either check #ifdef __PBL__ or
> include <pbl.h> and use the IN_PBL macro that's always defined to be
> either 0 or 1. Support doing the same from assembly by making the
> <pbl.h> safe to include from outside C.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  include/pbl.h | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/include/pbl.h b/include/pbl.h
> index 7dc4fa309257..44957f59784e 100644
> --- a/include/pbl.h
> +++ b/include/pbl.h
> @@ -6,6 +6,14 @@
>  #ifndef __PBL_H__
>  #define __PBL_H__
>  
> +#ifdef __PBL__
> +#define IN_PBL	1
> +#else
> +#define IN_PBL	0
> +#endif
> +
> +#ifndef __ASSEMBLY__
> +
>  #include <linux/types.h>
>  
>  extern unsigned long free_mem_ptr;
> @@ -13,12 +21,6 @@ extern unsigned long free_mem_end_ptr;
>  
>  void pbl_barebox_uncompress(void *dest, void *compressed_start, unsigned int len);
>  
> -#ifdef __PBL__
> -#define IN_PBL	1
> -#else
> -#define IN_PBL	0
> -#endif
> -
>  void fdt_find_mem(const void *fdt, unsigned long *membase, unsigned long *memsize);
>  
>  struct fdt_device_id {
> @@ -32,5 +34,6 @@ fdt_device_get_match_data(const void *fdt, const char *nodepath,
>  
>  int pbl_barebox_verify(const void *compressed_start, unsigned int len,
>  		       const void *hash, unsigned int hash_len);
> +#endif
>  
>  #endif /* __PBL_H__ */
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-26  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26  7:07 [PATCH] pbl: allow #include <pbl.h> from assembly Ahmad Fatoum
2023-06-26  9:56 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox