OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] Don't use SBI functions in fdt code
@ 2021-05-17 11:33 Daniel Schaefer
  2021-05-17 11:33 ` [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy Daniel Schaefer
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Daniel Schaefer @ 2021-05-17 11:33 UTC (permalink / raw)
  To: opensbi

My previous solution to build v0.9 in EDK2 wasn't correct:
http://lists.infradead.org/pipermail/opensbi/2021-May/000982.html

Abner reminded me that he had done a similar change before. It was
to not use SBI functions in the FDT files but instead call those from
libfdt_env.h.

See:
2cfd2fc9048806353298a1b967abf985901e36e8
2845d2d2cf4fb74a89452ba223995aa4a118c07e
8e47649eff96c303e02fbd58cdc6c4ed341066ec

Doing the same kinds of changes again, solves the issue.

Cc: Abner Chang <abner.chang@hpe.com>
Cc: Anup Patel <Anup.Patel@wdc.com>

Daniel Schaefer (3):
  lib: utils: Add macro to libfdt_env.h for strncpy
  lib: fdt: Don't use sbi_string functions
  lib: utils: Replace strcmp with strcmp

 lib/utils/fdt/fdt_domain.c    | 7 ++++---
 lib/utils/libfdt/libfdt_env.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.30.1



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

* [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy
  2021-05-17 11:33 [PATCH v1 0/3] Don't use SBI functions in fdt code Daniel Schaefer
@ 2021-05-17 11:33 ` Daniel Schaefer
  2021-05-17 13:47   ` Xiang W
  2021-05-17 11:33 ` [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions Daniel Schaefer
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Daniel Schaefer @ 2021-05-17 11:33 UTC (permalink / raw)
  To: opensbi

Just like 2845d2d2cf4fb74a89452ba223995aa4a118c07e

Cc: Abner Chang <abner.chang@hpe.com>
Cc: Anup Patel <Anup.Patel@wdc.com>
Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
---
 lib/utils/libfdt/libfdt_env.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/utils/libfdt/libfdt_env.h b/lib/utils/libfdt/libfdt_env.h
index bc3e7588660a..f9d9c6783c52 100644
--- a/lib/utils/libfdt/libfdt_env.h
+++ b/lib/utils/libfdt/libfdt_env.h
@@ -31,6 +31,7 @@
 #define strchr		sbi_strchr
 #define strrchr		sbi_strrchr
 #define strcpy		sbi_strcpy
+#define strncpy		sbi_strncpy
 #define strcmp		sbi_strcmp
 #define strncmp		sbi_strncmp
 #define strlen		sbi_strlen
-- 
2.30.1



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

* [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions
  2021-05-17 11:33 [PATCH v1 0/3] Don't use SBI functions in fdt code Daniel Schaefer
  2021-05-17 11:33 ` [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy Daniel Schaefer
@ 2021-05-17 11:33 ` Daniel Schaefer
  2021-05-17 13:54   ` Xiang W
  2021-05-17 11:33 ` [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp Daniel Schaefer
  2021-05-19  7:35 ` [PATCH v1 0/3] Don't use SBI functions in fdt code Anup Patel
  3 siblings, 1 reply; 13+ messages in thread
From: Daniel Schaefer @ 2021-05-17 11:33 UTC (permalink / raw)
  To: opensbi

When SBI is built by external firmware, we need to use their functions,
defined in libfdt_env.h.
Just like 2cfd2fc9048806353298a1b967abf985901e36e8

Cc: Abner Chang <abner.chang@hpe.com>
Cc: Anup Patel <Anup.Patel@wdc.com>
Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
---
 lib/utils/fdt/fdt_domain.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
index 95c195d65238..c1f6a8c8a10b 100644
--- a/lib/utils/fdt/fdt_domain.c
+++ b/lib/utils/fdt/fdt_domain.c
@@ -9,6 +9,7 @@
  */
 
 #include <libfdt.h>
+#include <libfdt_env.h>
 #include <sbi/sbi_domain.h>
 #include <sbi/sbi_error.h>
 #include <sbi/sbi_hartmask.h>
@@ -95,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt, int doff, void *p)
 {
 	struct __fixup_find_domain_offset_info *fdo = p;
 
-	if (!sbi_strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
+	if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
 		*fdo->doffset = doff;
 
 	return 0;
@@ -287,7 +288,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque)
 	regions = &fdt_regions[fdt_domains_count][0];
 
 	/* Read DT node name */
-	sbi_strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL),
+	strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL),
 		    sizeof(dom->name));
 	dom->name[sizeof(dom->name) - 1] = '\0';
 
@@ -313,7 +314,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque)
 
 	/* Setup memregions from DT */
 	val32 = 0;
-	sbi_memset(regions, 0,
+	memset(regions, 0,
 		   sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT + 1));
 	dom->regions = regions;
 	err = fdt_iterate_each_memregion(fdt, domain_offset, &val32,
-- 
2.30.1



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

* [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp
  2021-05-17 11:33 [PATCH v1 0/3] Don't use SBI functions in fdt code Daniel Schaefer
  2021-05-17 11:33 ` [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy Daniel Schaefer
  2021-05-17 11:33 ` [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions Daniel Schaefer
@ 2021-05-17 11:33 ` Daniel Schaefer
  2021-05-17 11:52   ` Andreas Schwab
  2021-05-17 13:57   ` Xiang W
  2021-05-19  7:35 ` [PATCH v1 0/3] Don't use SBI functions in fdt code Anup Patel
  3 siblings, 2 replies; 13+ messages in thread
From: Daniel Schaefer @ 2021-05-17 11:33 UTC (permalink / raw)
  To: opensbi

Cc: Abner Chang <abner.chang@hpe.com>
Cc: Anup Patel <Anup.Patel@wdc.com>
Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
---
 lib/utils/fdt/fdt_domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
index c1f6a8c8a10b..a9ebbdca3c52 100644
--- a/lib/utils/fdt/fdt_domain.c
+++ b/lib/utils/fdt/fdt_domain.c
@@ -96,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt, int doff, void *p)
 {
 	struct __fixup_find_domain_offset_info *fdo = p;
 
-	if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
+	if (!strncmp(fdo->name, fdt_get_name(fdt, doff, NULL), strlen(fdo->name)))
 		*fdo->doffset = doff;
 
 	return 0;
-- 
2.30.1



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

* [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp
  2021-05-17 11:33 ` [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp Daniel Schaefer
@ 2021-05-17 11:52   ` Andreas Schwab
  2021-05-17 13:57   ` Xiang W
  1 sibling, 0 replies; 13+ messages in thread
From: Andreas Schwab @ 2021-05-17 11:52 UTC (permalink / raw)
  To: opensbi

s/strcmp with strcmp/strcmp with strncmp/

Andreas.

-- 
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


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

* [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy
  2021-05-17 11:33 ` [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy Daniel Schaefer
@ 2021-05-17 13:47   ` Xiang W
  2021-05-18  0:36     ` Chang, Abner
  0 siblings, 1 reply; 13+ messages in thread
From: Xiang W @ 2021-05-17 13:47 UTC (permalink / raw)
  To: opensbi

? 2021-05-17?? 19:33 +0800?Daniel Schaefer???
> Just like 2845d2d2cf4fb74a89452ba223995aa4a118c07e
> 
> Cc: Abner Chang <abner.chang@hpe.com>
> Cc: Anup Patel <Anup.Patel@wdc.com>
> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Look good to me.
This description doesn't look very clear.

I recommend reword:

lib: utils: Add a macro in libfdt_env.h for strncpy

This commit add a macro to replace strncpy with sbi_strncpy.

Regards
Xiang W
> ---
>  lib/utils/libfdt/libfdt_env.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/utils/libfdt/libfdt_env.h
> b/lib/utils/libfdt/libfdt_env.h
> index bc3e7588660a..f9d9c6783c52 100644
> --- a/lib/utils/libfdt/libfdt_env.h
> +++ b/lib/utils/libfdt/libfdt_env.h
> @@ -31,6 +31,7 @@
>  #define strchr		sbi_strchr
>  #define strrchr		sbi_strrchr
>  #define strcpy		sbi_strcpy
> +#define strncpy		sbi_strncpy
>  #define strcmp		sbi_strcmp
>  #define strncmp		sbi_strncmp
>  #define strlen		sbi_strlen
> -- 
> 2.30.1
> 
> 



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

* [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions
  2021-05-17 11:33 ` [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions Daniel Schaefer
@ 2021-05-17 13:54   ` Xiang W
  2021-05-18  0:36     ` Chang, Abner
  2021-05-18  0:58     ` Schaefer, Daniel
  0 siblings, 2 replies; 13+ messages in thread
From: Xiang W @ 2021-05-17 13:54 UTC (permalink / raw)
  To: opensbi

? 2021-05-17?? 19:33 +0800?Daniel Schaefer???
> When SBI is built by external firmware, we need to use their
> functions,
> defined in libfdt_env.h.
> Just like 2cfd2fc9048806353298a1b967abf985901e36e8
> 
> Cc: Abner Chang <abner.chang@hpe.com>
> Cc: Anup Patel <Anup.Patel@wdc.com>
> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Look good to me.

but lost sbi_memcpy in line 340.

Regards
Xiang W
> ---
>  lib/utils/fdt/fdt_domain.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
> index 95c195d65238..c1f6a8c8a10b 100644
> --- a/lib/utils/fdt/fdt_domain.c
> +++ b/lib/utils/fdt/fdt_domain.c
> @@ -9,6 +9,7 @@
>   */
>  
>  #include <libfdt.h>
> +#include <libfdt_env.h>
>  #include <sbi/sbi_domain.h>
>  #include <sbi/sbi_error.h>
>  #include <sbi/sbi_hartmask.h>
> @@ -95,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt,
> int doff, void *p)
>  {
>  	struct __fixup_find_domain_offset_info *fdo = p;
>  
> -	if (!sbi_strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
> +	if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
>  		*fdo->doffset = doff;
>  
>  	return 0;
> @@ -287,7 +288,7 @@ static int __fdt_parse_domain(void *fdt, int
> domain_offset, void *opaque)
>  	regions = &fdt_regions[fdt_domains_count][0];
>  
>  	/* Read DT node name */
> -	sbi_strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL),
> +	strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL),
>  		    sizeof(dom->name));
>  	dom->name[sizeof(dom->name) - 1] = '\0';
>  
> @@ -313,7 +314,7 @@ static int __fdt_parse_domain(void *fdt, int
> domain_offset, void *opaque)
>  
>  	/* Setup memregions from DT */
>  	val32 = 0;
> -	sbi_memset(regions, 0,
> +	memset(regions, 0,
>  		   sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT +
> 1));
>  	dom->regions = regions;
>  	err = fdt_iterate_each_memregion(fdt, domain_offset, &val32,
> -- 
> 2.30.1
> 
> 



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

* [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp
  2021-05-17 11:33 ` [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp Daniel Schaefer
  2021-05-17 11:52   ` Andreas Schwab
@ 2021-05-17 13:57   ` Xiang W
  2021-05-18  0:34     ` Chang, Abner
  1 sibling, 1 reply; 13+ messages in thread
From: Xiang W @ 2021-05-17 13:57 UTC (permalink / raw)
  To: opensbi

? 2021-05-17?? 19:33 +0800?Daniel Schaefer???
> Cc: Abner Chang <abner.chang@hpe.com>
> Cc: Anup Patel <Anup.Patel@wdc.com>
> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Look good to me.

Reviewed-by: Xiang W <wxjstz@126.com>
> ---
>  lib/utils/fdt/fdt_domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
> index c1f6a8c8a10b..a9ebbdca3c52 100644
> --- a/lib/utils/fdt/fdt_domain.c
> +++ b/lib/utils/fdt/fdt_domain.c
> @@ -96,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt,
> int doff, void *p)
>  {
>  	struct __fixup_find_domain_offset_info *fdo = p;
>  
> -	if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
> +	if (!strncmp(fdo->name, fdt_get_name(fdt, doff, NULL),
> strlen(fdo->name)))
>  		*fdo->doffset = doff;
>  
>  	return 0;
> -- 
> 2.30.1
> 
> 



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

* [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp
  2021-05-17 13:57   ` Xiang W
@ 2021-05-18  0:34     ` Chang, Abner
  0 siblings, 0 replies; 13+ messages in thread
From: Chang, Abner @ 2021-05-18  0:34 UTC (permalink / raw)
  To: opensbi

Reviewed-by: Abner Chang <abner.chang@hpe.com>

> -----Original Message-----
> From: Xiang W [mailto:wxjstz at 126.com]
> Sent: Monday, May 17, 2021 9:58 PM
> To: Schaefer, Daniel <daniel.schaefer@hpe.com>; opensbi at lists.infradead.org
> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>; Anup
> Patel <Anup.Patel@wdc.com>
> Subject: Re: [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp
> 
> ? 2021-05-17?? 19:33 +0800?Daniel Schaefer???
> > Cc: Abner Chang <abner.chang@hpe.com>
> > Cc: Anup Patel <Anup.Patel@wdc.com>
> > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
> Look good to me.
> 
> Reviewed-by: Xiang W <wxjstz@126.com>
> > ---
> >  lib/utils/fdt/fdt_domain.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
> > index c1f6a8c8a10b..a9ebbdca3c52 100644
> > --- a/lib/utils/fdt/fdt_domain.c
> > +++ b/lib/utils/fdt/fdt_domain.c
> > @@ -96,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt,
> > int doff, void *p)
> >  {
> >  	struct __fixup_find_domain_offset_info *fdo = p;
> >
> > -	if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
> > +	if (!strncmp(fdo->name, fdt_get_name(fdt, doff, NULL),
> > strlen(fdo->name)))
> >  		*fdo->doffset = doff;
> >
> >  	return 0;
> > --
> > 2.30.1
> >
> >


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

* [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions
  2021-05-17 13:54   ` Xiang W
@ 2021-05-18  0:36     ` Chang, Abner
  2021-05-18  0:58     ` Schaefer, Daniel
  1 sibling, 0 replies; 13+ messages in thread
From: Chang, Abner @ 2021-05-18  0:36 UTC (permalink / raw)
  To: opensbi

After addressing Xiang's comment.

Reviewed-by: Abner Chang <abner.chang@hpe.com>

> -----Original Message-----
> From: Xiang W [mailto:wxjstz at 126.com]
> Sent: Monday, May 17, 2021 9:54 PM
> To: Schaefer, Daniel <daniel.schaefer@hpe.com>; opensbi at lists.infradead.org
> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>; Anup
> Patel <Anup.Patel@wdc.com>
> Subject: Re: [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions
> 
> ? 2021-05-17?? 19:33 +0800?Daniel Schaefer???
> > When SBI is built by external firmware, we need to use their
> > functions,
> > defined in libfdt_env.h.
> > Just like 2cfd2fc9048806353298a1b967abf985901e36e8
> >
> > Cc: Abner Chang <abner.chang@hpe.com>
> > Cc: Anup Patel <Anup.Patel@wdc.com>
> > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
> Look good to me.
> 
> but lost sbi_memcpy in line 340.
> 
> Regards
> Xiang W
> > ---
> >  lib/utils/fdt/fdt_domain.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
> > index 95c195d65238..c1f6a8c8a10b 100644
> > --- a/lib/utils/fdt/fdt_domain.c
> > +++ b/lib/utils/fdt/fdt_domain.c
> > @@ -9,6 +9,7 @@
> >   */
> >
> >  #include <libfdt.h>
> > +#include <libfdt_env.h>
> >  #include <sbi/sbi_domain.h>
> >  #include <sbi/sbi_error.h>
> >  #include <sbi/sbi_hartmask.h>
> > @@ -95,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt,
> > int doff, void *p)
> >  {
> >  	struct __fixup_find_domain_offset_info *fdo = p;
> >
> > -	if (!sbi_strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
> > +	if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
> >  		*fdo->doffset = doff;
> >
> >  	return 0;
> > @@ -287,7 +288,7 @@ static int __fdt_parse_domain(void *fdt, int
> > domain_offset, void *opaque)
> >  	regions = &fdt_regions[fdt_domains_count][0];
> >
> >  	/* Read DT node name */
> > -	sbi_strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL),
> > +	strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL),
> >  		    sizeof(dom->name));
> >  	dom->name[sizeof(dom->name) - 1] = '\0';
> >
> > @@ -313,7 +314,7 @@ static int __fdt_parse_domain(void *fdt, int
> > domain_offset, void *opaque)
> >
> >  	/* Setup memregions from DT */
> >  	val32 = 0;
> > -	sbi_memset(regions, 0,
> > +	memset(regions, 0,
> >  		   sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT +
> > 1));
> >  	dom->regions = regions;
> >  	err = fdt_iterate_each_memregion(fdt, domain_offset, &val32,
> > --
> > 2.30.1
> >
> >


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

* [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy
  2021-05-17 13:47   ` Xiang W
@ 2021-05-18  0:36     ` Chang, Abner
  0 siblings, 0 replies; 13+ messages in thread
From: Chang, Abner @ 2021-05-18  0:36 UTC (permalink / raw)
  To: opensbi

Reviewed-by: Abner Chang <abner.chang@hpe.com>

> -----Original Message-----
> From: Xiang W [mailto:wxjstz at 126.com]
> Sent: Monday, May 17, 2021 9:48 PM
> To: Schaefer, Daniel <daniel.schaefer@hpe.com>; opensbi at lists.infradead.org
> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>; Anup
> Patel <Anup.Patel@wdc.com>
> Subject: Re: [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy
> 
> ? 2021-05-17?? 19:33 +0800?Daniel Schaefer???
> > Just like 2845d2d2cf4fb74a89452ba223995aa4a118c07e
> >
> > Cc: Abner Chang <abner.chang@hpe.com>
> > Cc: Anup Patel <Anup.Patel@wdc.com>
> > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
> Look good to me.
> This description doesn't look very clear.
> 
> I recommend reword:
> 
> lib: utils: Add a macro in libfdt_env.h for strncpy
> 
> This commit add a macro to replace strncpy with sbi_strncpy.
> 
> Regards
> Xiang W
> > ---
> >  lib/utils/libfdt/libfdt_env.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/utils/libfdt/libfdt_env.h
> > b/lib/utils/libfdt/libfdt_env.h
> > index bc3e7588660a..f9d9c6783c52 100644
> > --- a/lib/utils/libfdt/libfdt_env.h
> > +++ b/lib/utils/libfdt/libfdt_env.h
> > @@ -31,6 +31,7 @@
> >  #define strchr		sbi_strchr
> >  #define strrchr		sbi_strrchr
> >  #define strcpy		sbi_strcpy
> > +#define strncpy		sbi_strncpy
> >  #define strcmp		sbi_strcmp
> >  #define strncmp		sbi_strncmp
> >  #define strlen		sbi_strlen
> > --
> > 2.30.1
> >
> >


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

* [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions
  2021-05-17 13:54   ` Xiang W
  2021-05-18  0:36     ` Chang, Abner
@ 2021-05-18  0:58     ` Schaefer, Daniel
  1 sibling, 0 replies; 13+ messages in thread
From: Schaefer, Daniel @ 2021-05-18  0:58 UTC (permalink / raw)
  To: opensbi

On 5/17/21 9:54 PM, Xiang W wrote:
> ? 2021-05-17?? 19:33 +0800?Daniel Schaefer???
>> When SBI is built by external firmware, we need to use their
>> functions,
>> defined in libfdt_env.h.
>> Just like 2cfd2fc9048806353298a1b967abf985901e36e8
>>
>> Cc: Abner Chang <abner.chang@hpe.com>
>> Cc: Anup Patel <Anup.Patel@wdc.com>
>> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
> Look good to me.
> 
> but lost sbi_memcpy in line 340.

Oh, good catch, thanks! I had made the changes based on v0.9 originally.
I'll send out another series.

> Regards
> Xiang W
>> ---
>>  lib/utils/fdt/fdt_domain.c | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
>> index 95c195d65238..c1f6a8c8a10b 100644
>> --- a/lib/utils/fdt/fdt_domain.c
>> +++ b/lib/utils/fdt/fdt_domain.c
>> @@ -9,6 +9,7 @@
>>   */
>>  
>>  #include <libfdt.h>
>> +#include <libfdt_env.h>
>>  #include <sbi/sbi_domain.h>
>>  #include <sbi/sbi_error.h>
>>  #include <sbi/sbi_hartmask.h>
>> @@ -95,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt,
>> int doff, void *p)
>>  {
>>  	struct __fixup_find_domain_offset_info *fdo = p;
>>  
>> -	if (!sbi_strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
>> +	if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
>>  		*fdo->doffset = doff;
>>  
>>  	return 0;
>> @@ -287,7 +288,7 @@ static int __fdt_parse_domain(void *fdt, int
>> domain_offset, void *opaque)
>>  	regions = &fdt_regions[fdt_domains_count][0];
>>  
>>  	/* Read DT node name */
>> -	sbi_strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL),
>> +	strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL),
>>  		    sizeof(dom->name));
>>  	dom->name[sizeof(dom->name) - 1] = '\0';
>>  
>> @@ -313,7 +314,7 @@ static int __fdt_parse_domain(void *fdt, int
>> domain_offset, void *opaque)
>>  
>>  	/* Setup memregions from DT */
>>  	val32 = 0;
>> -	sbi_memset(regions, 0,
>> +	memset(regions, 0,
>>  		   sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT +
>> 1));
>>  	dom->regions = regions;
>>  	err = fdt_iterate_each_memregion(fdt, domain_offset, &val32,
>> -- 
>> 2.30.1
>>
>>
> 


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

* [PATCH v1 0/3] Don't use SBI functions in fdt code
  2021-05-17 11:33 [PATCH v1 0/3] Don't use SBI functions in fdt code Daniel Schaefer
                   ` (2 preceding siblings ...)
  2021-05-17 11:33 ` [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp Daniel Schaefer
@ 2021-05-19  7:35 ` Anup Patel
  3 siblings, 0 replies; 13+ messages in thread
From: Anup Patel @ 2021-05-19  7:35 UTC (permalink / raw)
  To: opensbi

Hi Daniel,

On Mon, May 17, 2021 at 5:04 PM Daniel Schaefer <daniel.schaefer@hpe.com> wrote:
>
> My previous solution to build v0.9 in EDK2 wasn't correct:
> http://lists.infradead.org/pipermail/opensbi/2021-May/000982.html
>
> Abner reminded me that he had done a similar change before. It was
> to not use SBI functions in the FDT files but instead call those from
> libfdt_env.h.
>
> See:
> 2cfd2fc9048806353298a1b967abf985901e36e8
> 2845d2d2cf4fb74a89452ba223995aa4a118c07e
> 8e47649eff96c303e02fbd58cdc6c4ed341066ec
>
> Doing the same kinds of changes again, solves the issue.
>
> Cc: Abner Chang <abner.chang@hpe.com>
> Cc: Anup Patel <Anup.Patel@wdc.com>
>
> Daniel Schaefer (3):
>   lib: utils: Add macro to libfdt_env.h for strncpy
>   lib: fdt: Don't use sbi_string functions
>   lib: utils: Replace strcmp with strcmp

You would be sending a v2 with comments addressed. Right ??

>
>  lib/utils/fdt/fdt_domain.c    | 7 ++++---
>  lib/utils/libfdt/libfdt_env.h | 1 +
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> --
> 2.30.1
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi

Regards,
Anup


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

end of thread, other threads:[~2021-05-19  7:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-17 11:33 [PATCH v1 0/3] Don't use SBI functions in fdt code Daniel Schaefer
2021-05-17 11:33 ` [PATCH v1 1/3] lib: utils: Add macro to libfdt_env.h for strncpy Daniel Schaefer
2021-05-17 13:47   ` Xiang W
2021-05-18  0:36     ` Chang, Abner
2021-05-17 11:33 ` [PATCH v1 2/3] lib: fdt: Don't use sbi_string functions Daniel Schaefer
2021-05-17 13:54   ` Xiang W
2021-05-18  0:36     ` Chang, Abner
2021-05-18  0:58     ` Schaefer, Daniel
2021-05-17 11:33 ` [PATCH v1 3/3] lib: utils: Replace strcmp with strcmp Daniel Schaefer
2021-05-17 11:52   ` Andreas Schwab
2021-05-17 13:57   ` Xiang W
2021-05-18  0:34     ` Chang, Abner
2021-05-19  7:35 ` [PATCH v1 0/3] Don't use SBI functions in fdt code Anup Patel

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