public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
  2021-11-08  1:14 ` 回复: " gaoliming
@ 2021-11-08  1:24   ` Jiang, Xiaolu
  2021-11-08  2:26     ` Jiang, Xiaolu
  0 siblings, 1 reply; 10+ messages in thread
From: Jiang, Xiaolu @ 2021-11-08  1:24 UTC (permalink / raw)
  To: gaoliming, devel@edk2.groups.io; +Cc: Feng, Bob C, Chen, Christine

1. Currently  the PCD value length is More than 1024, less than 2048, 
2. Now we have 14 members, Also need to add 4~6 part to the PCD.
So we Increase the length to 4096.

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Monday, November 8, 2021 9:15 AM
To: Jiang, Xiaolu <xiaolu.jiang@intel.com>; devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>
Subject: 回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Xiaolu:
  Why choose 4096? Is it enough?

Thanks
Liming
> -----邮件原件-----
> 发件人: Xiaolu.Jiang <xiaolu.jiang@intel.com>
> 发送时间: 2021年11月6日 11:51
> 收件人: devel@edk2.groups.io
> 抄送: Xiaolu.Jiang <xiaolu.jiang@intel.com>; Bob Feng 
> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei 
> Chen <yuwei.chen@intel.com>
> 主题: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for 
> support more PCD value.
> 
> Currently the PCD Value only support 13 Guid,When use more 13 pcd will 
> cause the build tool fail, Need increase the DevicePath length to 
> support more value.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> 
> Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
> ---
>  BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c
> b/BaseTools/Source/C/DevicePath/DevicePath.c
> index c4d224ed61..ef493f5506 100644
> --- a/BaseTools/Source/C/DevicePath/DevicePath.c
> +++ b/BaseTools/Source/C/DevicePath/DevicePath.c
> @@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
>      fprintf(stderr, "Invalid option value, Device Path can't be 
> NULL");
> 
>      return STATUS_ERROR;
> 
>    }
> 
> -  Str16 = (CHAR16 *)malloc(1024);
> 
> +  Str16 = (CHAR16 *)malloc(4096);
> 
>    if (Str16 == NULL) {
> 
>      fprintf(stderr, "Resource, memory cannot be allocated");
> 
>      return STATUS_ERROR;
> 
> --
> 2.30.2.windows.1




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

* Re: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
  2021-11-08  1:24   ` Jiang, Xiaolu
@ 2021-11-08  2:26     ` Jiang, Xiaolu
  2021-11-08  2:30       ` Bob Feng
  2021-11-08  3:17       ` 回复: " gaoliming
  0 siblings, 2 replies; 10+ messages in thread
From: Jiang, Xiaolu @ 2021-11-08  2:26 UTC (permalink / raw)
  To: gaoliming, devel@edk2.groups.io; +Cc: Feng, Bob C, Chen, Christine, Fu, Siyuan

Hi Liming,

I have checked with Team member , Totally We need support 50+ Driver GUID in DevicePath PCD value ,So the length need to increase again, I will change the Patch and re-send again.

Thanks!

-----Original Message-----
From: Jiang, Xiaolu 
Sent: Monday, November 8, 2021 9:24 AM
To: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <Yuwei.Chen@intel.com>
Subject: RE: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

1. Currently  the PCD value length is More than 1024, less than 2048, 2. Now we have 14 members, Also need to add 4~6 part to the PCD.
So we Increase the length to 4096.

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn>
Sent: Monday, November 8, 2021 9:15 AM
To: Jiang, Xiaolu <xiaolu.jiang@intel.com>; devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>
Subject: 回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Xiaolu:
  Why choose 4096? Is it enough?

Thanks
Liming
> -----邮件原件-----
> 发件人: Xiaolu.Jiang <xiaolu.jiang@intel.com>
> 发送时间: 2021年11月6日 11:51
> 收件人: devel@edk2.groups.io
> 抄送: Xiaolu.Jiang <xiaolu.jiang@intel.com>; Bob Feng 
> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei 
> Chen <yuwei.chen@intel.com>
> 主题: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for 
> support more PCD value.
> 
> Currently the PCD Value only support 13 Guid,When use more 13 pcd will 
> cause the build tool fail, Need increase the DevicePath length to 
> support more value.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> 
> Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
> ---
>  BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c
> b/BaseTools/Source/C/DevicePath/DevicePath.c
> index c4d224ed61..ef493f5506 100644
> --- a/BaseTools/Source/C/DevicePath/DevicePath.c
> +++ b/BaseTools/Source/C/DevicePath/DevicePath.c
> @@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
>      fprintf(stderr, "Invalid option value, Device Path can't be 
> NULL");
> 
>      return STATUS_ERROR;
> 
>    }
> 
> -  Str16 = (CHAR16 *)malloc(1024);
> 
> +  Str16 = (CHAR16 *)malloc(4096);
> 
>    if (Str16 == NULL) {
> 
>      fprintf(stderr, "Resource, memory cannot be allocated");
> 
>      return STATUS_ERROR;
> 
> --
> 2.30.2.windows.1




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

* Re: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
  2021-11-08  2:26     ` Jiang, Xiaolu
@ 2021-11-08  2:30       ` Bob Feng
  2021-11-08  3:17       ` 回复: " gaoliming
  1 sibling, 0 replies; 10+ messages in thread
From: Bob Feng @ 2021-11-08  2:30 UTC (permalink / raw)
  To: Jiang, Xiaolu, gaoliming, devel@edk2.groups.io
  Cc: Chen, Christine, Fu, Siyuan

Xiaolu,

I think you could calculate the Str16 length based on the input argument Str.

Thanks,
Bob

-----Original Message-----
From: Jiang, Xiaolu <xiaolu.jiang@intel.com> 
Sent: Monday, November 8, 2021 10:26 AM
To: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>
Subject: RE: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Hi Liming,

I have checked with Team member , Totally We need support 50+ Driver GUID in DevicePath PCD value ,So the length need to increase again, I will change the Patch and re-send again.

Thanks!

-----Original Message-----
From: Jiang, Xiaolu
Sent: Monday, November 8, 2021 9:24 AM
To: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <Yuwei.Chen@intel.com>
Subject: RE: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

1. Currently  the PCD value length is More than 1024, less than 2048, 2. Now we have 14 members, Also need to add 4~6 part to the PCD.
So we Increase the length to 4096.

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn>
Sent: Monday, November 8, 2021 9:15 AM
To: Jiang, Xiaolu <xiaolu.jiang@intel.com>; devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>
Subject: 回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Xiaolu:
  Why choose 4096? Is it enough?

Thanks
Liming
> -----邮件原件-----
> 发件人: Xiaolu.Jiang <xiaolu.jiang@intel.com>
> 发送时间: 2021年11月6日 11:51
> 收件人: devel@edk2.groups.io
> 抄送: Xiaolu.Jiang <xiaolu.jiang@intel.com>; Bob Feng 
> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei 
> Chen <yuwei.chen@intel.com>
> 主题: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for 
> support more PCD value.
> 
> Currently the PCD Value only support 13 Guid,When use more 13 pcd will 
> cause the build tool fail, Need increase the DevicePath length to 
> support more value.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> 
> Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
> ---
>  BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c
> b/BaseTools/Source/C/DevicePath/DevicePath.c
> index c4d224ed61..ef493f5506 100644
> --- a/BaseTools/Source/C/DevicePath/DevicePath.c
> +++ b/BaseTools/Source/C/DevicePath/DevicePath.c
> @@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
>      fprintf(stderr, "Invalid option value, Device Path can't be 
> NULL");
> 
>      return STATUS_ERROR;
> 
>    }
> 
> -  Str16 = (CHAR16 *)malloc(1024);
> 
> +  Str16 = (CHAR16 *)malloc(4096);
> 
>    if (Str16 == NULL) {
> 
>      fprintf(stderr, "Resource, memory cannot be allocated");
> 
>      return STATUS_ERROR;
> 
> --
> 2.30.2.windows.1




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

* Re: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
  2021-11-08  3:17       ` 回复: " gaoliming
@ 2021-11-08  3:20         ` Jiang, Xiaolu
  0 siblings, 0 replies; 10+ messages in thread
From: Jiang, Xiaolu @ 2021-11-08  3:20 UTC (permalink / raw)
  To: gaoliming, devel@edk2.groups.io; +Cc: Feng, Bob C, Chen, Christine, Fu, Siyuan

Hi Liming,

It's a good suggestion, I will try it first, Thanks !

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Monday, November 8, 2021 11:18 AM
To: Jiang, Xiaolu <xiaolu.jiang@intel.com>; devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>
Subject: 回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Xiaolu:
  Can you calculate the required memory, then allocate it instead of use hard code memory length?

Thanks
Liming
> -----邮件原件-----
> 发件人: Jiang, Xiaolu <xiaolu.jiang@intel.com>
> 发送时间: 2021年11月8日 10:26
> 收件人: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
> 抄送: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine 
> <yuwei.chen@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>
> 主题: RE: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length 
> for support more PCD value.
> 
> Hi Liming,
> 
> I have checked with Team member , Totally We need support 50+ Driver 
> GUID in DevicePath PCD value ,So the length need to increase again, I 
> will change the Patch and re-send again.
> 
> Thanks!
> 
> -----Original Message-----
> From: Jiang, Xiaolu
> Sent: Monday, November 8, 2021 9:24 AM
> To: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine 
> <Yuwei.Chen@intel.com>
> Subject: RE: [edk2-devel][PATCH] BaseTools: Increase the DevicePath 
> length for support more PCD value.
> 
> 1. Currently  the PCD value length is More than 1024, less than 2048, 
> 2. Now we have 14 members, Also need to add 4~6 part to the PCD.
> So we Increase the length to 4096.
> 
> -----Original Message-----
> From: gaoliming <gaoliming@byosoft.com.cn>
> Sent: Monday, November 8, 2021 9:15 AM
> To: Jiang, Xiaolu <xiaolu.jiang@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine 
> <yuwei.chen@intel.com>
> Subject: 回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath 
> length for support more PCD value.
> 
> Xiaolu:
>   Why choose 4096? Is it enough?
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: Xiaolu.Jiang <xiaolu.jiang@intel.com>
> > 发送时间: 2021年11月6日 11:51
> > 收件人: devel@edk2.groups.io
> > 抄送: Xiaolu.Jiang <xiaolu.jiang@intel.com>; Bob Feng 
> > <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei 
> > Chen <yuwei.chen@intel.com>
> > 主题: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length 
> > for support more PCD value.
> >
> > Currently the PCD Value only support 13 Guid,When use more 13 pcd 
> > will cause the build tool fail, Need increase the DevicePath length 
> > to support more value.
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718
> >
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Yuwei Chen <yuwei.chen@intel.com>
> >
> > Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
> > ---
> >  BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c
> > b/BaseTools/Source/C/DevicePath/DevicePath.c
> > index c4d224ed61..ef493f5506 100644
> > --- a/BaseTools/Source/C/DevicePath/DevicePath.c
> > +++ b/BaseTools/Source/C/DevicePath/DevicePath.c
> > @@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
> >      fprintf(stderr, "Invalid option value, Device Path can't be 
> > NULL");
> >
> >      return STATUS_ERROR;
> >
> >    }
> >
> > -  Str16 = (CHAR16 *)malloc(1024);
> >
> > +  Str16 = (CHAR16 *)malloc(4096);
> >
> >    if (Str16 == NULL) {
> >
> >      fprintf(stderr, "Resource, memory cannot be allocated");
> >
> >      return STATUS_ERROR;
> >
> > --
> > 2.30.2.windows.1
> 
> 




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

* Re: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
  2021-11-10  2:59 ` FW: " Jiang, Xiaolu
@ 2021-11-12  6:59   ` Jiang, Xiaolu
  0 siblings, 0 replies; 10+ messages in thread
From: Jiang, Xiaolu @ 2021-11-12  6:59 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Feng, Bob C, Liming Gao, Chen, Christine, Wu, Yidong

Hi,

Please help review the patch, If you have any concern pls let me know.

-----Original Message-----
From: Jiang, Xiaolu 
Sent: Wednesday, November 10, 2021 11:00 AM
To: devel@edk2.groups.io
Cc: Jiang, Xiaolu <xiaolu.jiang@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Wu, Yidong <yidong.wu@intel.com>
Subject: FW: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Hi  All,

I have update the patch for the comments, Please help review the patch.

-----Original Message-----
From: Jiang, Xiaolu <xiaolu.jiang@intel.com> 
Sent: Monday, November 8, 2021 4:22 PM
To: devel@edk2.groups.io
Cc: Jiang, Xiaolu <xiaolu.jiang@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>
Subject: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Currently the PCD Value only support 13 Guid,When use more 13 pcd will cause the build tool fail, Need calculate the required memory,then allocate it.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
---
 BaseTools/Source/C/DevicePath/DevicePath.c | 36 +++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/C/DevicePath/DevicePath.c
index c4d224ed61..8a0f5f4e2a 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -144,6 +144,40 @@ Returns:
   *UniString = '\0'; } ++/**+  Returns the length of a Null-terminated ASCII string.++  This function returns the number of ASCII characters in the Null-terminated+  ASCII string specified by String.++  If Length > 0 and Destination is NULL, then ASSERT().+  If Length > 0 and Source is NULL, then ASSERT().+  If PcdMaximumAsciiStringLength is not zero and String contains more than+  PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,+  then ASSERT().++  @param  String  A pointer to a Null-terminated ASCII string.++  @return The length of String.++**/+UINTN+EFIAPI+AsciiStrLen (+  IN      CONST CHAR8               *String+  )+{+  UINTN                             Length;++  ASSERT (String != NULL);++  for (Length = 0; *String != '\0'; String++, Length++) {++  }+  return Length;+}+ int main(int argc, CHAR8 *argv[]) {   CHAR8 * Str;@@ -170,7 +204,7 @@ int main(int argc, CHAR8 *argv[])
     fprintf(stderr, "Invalid option value, Device Path can't be NULL");     return STATUS_ERROR;   }-  Str16 = (CHAR16 *)malloc(1024);+  Str16 = (CHAR16 *)malloc((AsciiStrLen (Str) + 1) * sizeof (CHAR16));   if (Str16 == NULL) {     fprintf(stderr, "Resource, memory cannot be allocated");     return STATUS_ERROR;-- 
2.30.2.windows.1


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

* [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
@ 2021-11-16  1:42 Xiaolu.jiang
  2021-11-16 12:46 ` Bob Feng
  2021-11-24 15:01 ` 回复: " gaoliming
  0 siblings, 2 replies; 10+ messages in thread
From: Xiaolu.jiang @ 2021-11-16  1:42 UTC (permalink / raw)
  To: devel; +Cc: Xiaolu.Jiang, Bob Feng, Liming Gao, Yuwei Chen

Currently the PCD Value only support 13 Guid,When use more 13 pcd will cause the build tool fail,
Need calculate the required memory,then allocate it.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
---
 BaseTools/Source/C/DevicePath/DevicePath.c | 36 +++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/C/DevicePath/DevicePath.c
index c4d224ed61..8a0f5f4e2a 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -144,6 +144,40 @@ Returns:
   *UniString = '\0';
 }
 
+
+/**
+  Returns the length of a Null-terminated ASCII string.
+
+  This function returns the number of ASCII characters in the Null-terminated
+  ASCII string specified by String.
+
+  If Length > 0 and Destination is NULL, then ASSERT().
+  If Length > 0 and Source is NULL, then ASSERT().
+  If PcdMaximumAsciiStringLength is not zero and String contains more than
+  PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
+  then ASSERT().
+
+  @param  String  A pointer to a Null-terminated ASCII string.
+
+  @return The length of String.
+
+**/
+UINTN
+EFIAPI
+AsciiStrLen (
+  IN      CONST CHAR8               *String
+  )
+{
+  UINTN                             Length;
+
+  ASSERT (String != NULL);
+
+  for (Length = 0; *String != '\0'; String++, Length++) {
+
+  }
+  return Length;
+}
+
 int main(int argc, CHAR8 *argv[])
 {
   CHAR8 * Str;
@@ -170,7 +204,7 @@ int main(int argc, CHAR8 *argv[])
     fprintf(stderr, "Invalid option value, Device Path can't be NULL");
     return STATUS_ERROR;
   }
-  Str16 = (CHAR16 *)malloc(1024);
+  Str16 = (CHAR16 *)malloc((AsciiStrLen (Str) + 1) * sizeof (CHAR16));
   if (Str16 == NULL) {
     fprintf(stderr, "Resource, memory cannot be allocated");
     return STATUS_ERROR;
-- 
2.30.2.windows.1


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

* Re: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
  2021-11-16  1:42 [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value Xiaolu.jiang
@ 2021-11-16 12:46 ` Bob Feng
  2021-11-24 15:01 ` 回复: " gaoliming
  1 sibling, 0 replies; 10+ messages in thread
From: Bob Feng @ 2021-11-16 12:46 UTC (permalink / raw)
  To: Jiang, Xiaolu, devel@edk2.groups.io; +Cc: Liming Gao, Chen, Christine

This patch is good to me.

Reviewed-by: Bob Feng <bob.c.feng@intel.com>


-----Original Message-----
From: Jiang, Xiaolu <xiaolu.jiang@intel.com> 
Sent: Tuesday, November 16, 2021 9:42 AM
To: devel@edk2.groups.io
Cc: Jiang, Xiaolu <xiaolu.jiang@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>
Subject: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Currently the PCD Value only support 13 Guid,When use more 13 pcd will cause the build tool fail, Need calculate the required memory,then allocate it.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
---
 BaseTools/Source/C/DevicePath/DevicePath.c | 36 +++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/C/DevicePath/DevicePath.c
index c4d224ed61..8a0f5f4e2a 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -144,6 +144,40 @@ Returns:
   *UniString = '\0'; } ++/**+  Returns the length of a Null-terminated ASCII string.++  This function returns the number of ASCII characters in the Null-terminated+  ASCII string specified by String.++  If Length > 0 and Destination is NULL, then ASSERT().+  If Length > 0 and Source is NULL, then ASSERT().+  If PcdMaximumAsciiStringLength is not zero and String contains more than+  PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,+  then ASSERT().++  @param  String  A pointer to a Null-terminated ASCII string.++  @return The length of String.++**/+UINTN+EFIAPI+AsciiStrLen (+  IN      CONST CHAR8               *String+  )+{+  UINTN                             Length;++  ASSERT (String != NULL);++  for (Length = 0; *String != '\0'; String++, Length++) {++  }+  return Length;+}+ int main(int argc, CHAR8 *argv[]) {   CHAR8 * Str;@@ -170,7 +204,7 @@ int main(int argc, CHAR8 *argv[])
     fprintf(stderr, "Invalid option value, Device Path can't be NULL");     return STATUS_ERROR;   }-  Str16 = (CHAR16 *)malloc(1024);+  Str16 = (CHAR16 *)malloc((AsciiStrLen (Str) + 1) * sizeof (CHAR16));   if (Str16 == NULL) {     fprintf(stderr, "Resource, memory cannot be allocated");     return STATUS_ERROR;-- 
2.30.2.windows.1


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

* 回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
  2021-11-16  1:42 [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value Xiaolu.jiang
  2021-11-16 12:46 ` Bob Feng
@ 2021-11-24 15:01 ` gaoliming
  1 sibling, 0 replies; 10+ messages in thread
From: gaoliming @ 2021-11-24 15:01 UTC (permalink / raw)
  To: devel, Xiaolu.jiang; +Cc: 'Bob Feng', 'Yuwei Chen'

Xiaolu:
  BaseTools C source can directly use std libc API. You can use strlen() to
get the length of the input ascii string. 

  With this change, Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Xiaolu.Jiang
> 发送时间: 2021年11月16日 9:42
> 收件人: devel@edk2.groups.io
> 抄送: Xiaolu.Jiang <xiaolu.jiang@intel.com>; Bob Feng
> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei
> Chen <yuwei.chen@intel.com>
> 主题: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for
> support more PCD value.
> 
> Currently the PCD Value only support 13 Guid,When use more 13 pcd will
> cause the build tool fail,
> Need calculate the required memory,then allocate it.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> 
> Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
> ---
>  BaseTools/Source/C/DevicePath/DevicePath.c | 36
> +++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c
> b/BaseTools/Source/C/DevicePath/DevicePath.c
> index c4d224ed61..8a0f5f4e2a 100644
> --- a/BaseTools/Source/C/DevicePath/DevicePath.c
> +++ b/BaseTools/Source/C/DevicePath/DevicePath.c
> @@ -144,6 +144,40 @@ Returns:
>    *UniString = '\0';
> 
>  }
> 
> 
> 
> +
> 
> +/**
> 
> +  Returns the length of a Null-terminated ASCII string.
> 
> +
> 
> +  This function returns the number of ASCII characters in the
> Null-terminated
> 
> +  ASCII string specified by String.
> 
> +
> 
> +  If Length > 0 and Destination is NULL, then ASSERT().
> 
> +  If Length > 0 and Source is NULL, then ASSERT().
> 
> +  If PcdMaximumAsciiStringLength is not zero and String contains more
than
> 
> +  PcdMaximumAsciiStringLength ASCII characters, not including the
> Null-terminator,
> 
> +  then ASSERT().
> 
> +
> 
> +  @param  String  A pointer to a Null-terminated ASCII string.
> 
> +
> 
> +  @return The length of String.
> 
> +
> 
> +**/
> 
> +UINTN
> 
> +EFIAPI
> 
> +AsciiStrLen (
> 
> +  IN      CONST CHAR8               *String
> 
> +  )
> 
> +{
> 
> +  UINTN                             Length;
> 
> +
> 
> +  ASSERT (String != NULL);
> 
> +
> 
> +  for (Length = 0; *String != '\0'; String++, Length++) {
> 
> +
> 
> +  }
> 
> +  return Length;
> 
> +}
> 
> +
> 
>  int main(int argc, CHAR8 *argv[])
> 
>  {
> 
>    CHAR8 * Str;
> 
> @@ -170,7 +204,7 @@ int main(int argc, CHAR8 *argv[])
>      fprintf(stderr, "Invalid option value, Device Path can't be NULL");
> 
>      return STATUS_ERROR;
> 
>    }
> 
> -  Str16 = (CHAR16 *)malloc(1024);
> 
> +  Str16 = (CHAR16 *)malloc((AsciiStrLen (Str) + 1) * sizeof (CHAR16));
> 
>    if (Str16 == NULL) {
> 
>      fprintf(stderr, "Resource, memory cannot be allocated");
> 
>      return STATUS_ERROR;
> 
> --
> 2.30.2.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#83769): https://edk2.groups.io/g/devel/message/83769
> Mute This Topic: https://groups.io/mt/87089392/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 




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

* [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
@ 2021-11-29  2:13 Xiaolu.Jiang
  2021-11-29  5:04 ` 回复: " gaoliming
  0 siblings, 1 reply; 10+ messages in thread
From: Xiaolu.Jiang @ 2021-11-29  2:13 UTC (permalink / raw)
  To: devel; +Cc: Xiaolu.Jiang, Bob Feng, Liming Gao, Yuwei Chen

Currently the PCD Value only support 13 Guid,When use more 13 pcd will cause the build tool fail,
Need calculate the required memory,then allocate it.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
---
 BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/C/DevicePath/DevicePath.c
index c4d224ed61..ed19eb52f6 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
     fprintf(stderr, "Invalid option value, Device Path can't be NULL");
     return STATUS_ERROR;
   }
-  Str16 = (CHAR16 *)malloc(1024);
+  Str16 = (CHAR16 *)malloc((strlen (Str) + 1) * sizeof (CHAR16));
   if (Str16 == NULL) {
     fprintf(stderr, "Resource, memory cannot be allocated");
     return STATUS_ERROR;
-- 
2.30.2.windows.1


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

* Re: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
  2021-11-29  5:04 ` 回复: " gaoliming
@ 2021-12-09  0:10   ` Bob Feng
  0 siblings, 0 replies; 10+ messages in thread
From: Bob Feng @ 2021-12-09  0:10 UTC (permalink / raw)
  To: devel@edk2.groups.io, gaoliming@byosoft.com.cn, Jiang, Xiaolu
  Cc: Chen, Christine

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
Sent: Monday, November 29, 2021 1:05 PM
To: devel@edk2.groups.io; Jiang, Xiaolu <xiaolu.jiang@intel.com>
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>
Subject: 回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Xiaolu.Jiang
> 发送时间: 2021年11月29日 10:13
> 收件人: devel@edk2.groups.io
> 抄送: Xiaolu.Jiang <xiaolu.jiang@intel.com>; Bob Feng 
> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei 
> Chen <yuwei.chen@intel.com>
> 主题: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for 
> support more PCD value.
> 
> Currently the PCD Value only support 13 Guid,When use more 13 pcd will 
> cause the build tool fail, Need calculate the required memory,then 
> allocate it.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> 
> Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
> ---
>  BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c
> b/BaseTools/Source/C/DevicePath/DevicePath.c
> index c4d224ed61..ed19eb52f6 100644
> --- a/BaseTools/Source/C/DevicePath/DevicePath.c
> +++ b/BaseTools/Source/C/DevicePath/DevicePath.c
> @@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
>      fprintf(stderr, "Invalid option value, Device Path can't be 
> NULL");
> 
>      return STATUS_ERROR;
> 
>    }
> 
> -  Str16 = (CHAR16 *)malloc(1024);
> 
> +  Str16 = (CHAR16 *)malloc((strlen (Str) + 1) * sizeof (CHAR16));
> 
>    if (Str16 == NULL) {
> 
>      fprintf(stderr, "Resource, memory cannot be allocated");
> 
>      return STATUS_ERROR;
> 
> --
> 2.30.2.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#84123): 
> https://edk2.groups.io/g/devel/message/84123
> Mute This Topic: https://groups.io/mt/87369900/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 









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

end of thread, other threads:[~2021-12-09  0:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-16  1:42 [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value Xiaolu.jiang
2021-11-16 12:46 ` Bob Feng
2021-11-24 15:01 ` 回复: " gaoliming
  -- strict thread matches above, loose matches on Subject: below --
2021-11-29  2:13 Xiaolu.Jiang
2021-11-29  5:04 ` 回复: " gaoliming
2021-12-09  0:10   ` Bob Feng
     [not found] <20211108082136.2707-1-xiaolu.jiang@intel.com>
2021-11-10  2:59 ` FW: " Jiang, Xiaolu
2021-11-12  6:59   ` Jiang, Xiaolu
     [not found] <20211106035056.183-1-xiaolu.jiang@intel.com>
2021-11-08  1:14 ` 回复: " gaoliming
2021-11-08  1:24   ` Jiang, Xiaolu
2021-11-08  2:26     ` Jiang, Xiaolu
2021-11-08  2:30       ` Bob Feng
2021-11-08  3:17       ` 回复: " gaoliming
2021-11-08  3:20         ` Jiang, Xiaolu

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