Re: [edk2] [Patch 1/2] BaseTools tools_def.txt: Remove -P option in GCC ASLPP_FLAGS

2016-11-27 Thread Ard Biesheuvel
On 28 November 2016 at 02:31, Gao, Liming  wrote:
> Ard:
>   I root cause the issue, and provide the fix. Could you help integrate it?
>

Thanks for tracking this down. I had no idea the culprit was the
platform .DSC rather than the core code

We will merge the fix.

Thanks,
Ard.

> Thanks
> Liming
>> -Original Message-
>> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>> Sent: Thursday, November 24, 2016 4:04 PM
>> To: Gao, Liming 
>> Cc: edk2-devel-01 
>> Subject: Re: [edk2] [Patch 1/2] BaseTools tools_def.txt: Remove -P option in
>> GCC ASLPP_FLAGS
>>
>> On 24 November 2016 at 04:40, Gao, Liming  wrote:
>> > Ard:
>> >   Which AArch64 platforms? I will investigate it further.
>> >
>>
>> https://git.linaro.org/uefi/OpenPlatformPkg.git master
>>
>> platform
>> OpenPlatformPkg/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.ds
>> c
>>
>> module
>> OpenPlatformPkg/Platforms/AMD/Styx/AcpiTables/AcpiAml.inf
>>
>>
>>
>> > Thanks
>> > Liming
>> >> -Original Message-
>> >> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>> >> Sent: Wednesday, November 23, 2016 6:09 PM
>> >> To: Gao, Liming 
>> >> Cc: edk2-devel-01 
>> >> Subject: Re: [edk2] [Patch 1/2] BaseTools tools_def.txt: Remove -P option
>> in
>> >> GCC ASLPP_FLAGS
>> >>
>> >> On 14 November 2016 at 06:37, Liming Gao  wrote:
>> >> > https://bugzilla.tianocore.org/show_bug.cgi?id=227
>> >> >
>> >> > After -P option is removed, the generated preprocessed ASL file will
>> have
>> >> > line markers. The extra information can be removed by Trim script. ASL
>> >> code
>> >> > can refer to the definition in C source file. This has been supported in
>> >> > VS and XCODE tool chains.
>> >> >
>> >> > Cc: Yonghong Zhu 
>> >> > Contributed-under: TianoCore Contribution Agreement 1.0
>> >> > Signed-off-by: Liming Gao 
>> >> > ---
>> >> >  BaseTools/Conf/tools_def.template | 4 ++--
>> >> >  1 file changed, 2 insertions(+), 2 deletions(-)
>> >> >
>> >>
>> >> This patch is breaking the build on some AArch64 platforms:
>> >>
>> >> Intel ACPI Component Architecture
>> >> Error6126 - syntax error, unexpected PARSEOP_NAMESEG, expecting
>> >> PARSEOP_DEFINITION_BLOCK and premature End-Of-File
>> >> ASL+ Optimizing Compiler version 20160831-64
>> >>
>> >> and the DSDT. source file has these lines at the beginning
>> >>
>> >> """
>> >> extern UINT8 _VerifySizeofBOOLEAN[(sizeof(BOOLEAN) == (1)) /
>> >> (sizeof(BOOLEAN) == (1))];
>> >> extern UINT8 _VerifySizeofINT8[(sizeof(INT8) == (1)) / (sizeof(INT8) ==
>> (1))];
>> >> extern UINT8 _VerifySizeofUINT8[(sizeof(UINT8) == (1)) /
>> >> (sizeof(UINT8) == (1))];
>> >> extern UINT8 _VerifySizeofINT16[(sizeof(INT16) == (2)) /
>> >> (sizeof(INT16) == (2))];
>> >> extern UINT8 _VerifySizeofUINT16[(sizeof(UINT16) == (2)) /
>> >> (sizeof(UINT16) == (2))];
>> >> extern UINT8 _VerifySizeofINT32[(sizeof(INT32) == (4)) /
>> >> (sizeof(INT32) == (4))];
>> >> extern UINT8 _VerifySizeofUINT32[(sizeof(UINT32) == (4)) /
>> >> (sizeof(UINT32) == (4))];
>> >> extern UINT8 _VerifySizeofINT64[(sizeof(INT64) == (8)) /
>> >> (sizeof(INT64) == (8))];
>> >> extern UINT8 _VerifySizeofUINT64[(sizeof(UINT64) == (8)) /
>> >> (sizeof(UINT64) == (8))];
>> >> extern UINT8 _VerifySizeofCHAR8[(sizeof(CHAR8) == (1)) /
>> >> (sizeof(CHAR8) == (1))];
>> >> extern UINT8 _VerifySizeofCHAR16[(sizeof(CHAR16) == (2)) /
>> >> (sizeof(CHAR16) == (2))];
>> >> extern UINT8
>> >>
>> _VerifySizeof__VERIFY_UINT8_ENUM_SIZE[(sizeof(__VERIFY_UINT8_ENUM
>> >> _SIZE)
>> >> == (4)) / (sizeof(__VERIFY_UINT8_ENUM_SIZE) == (4))];
>> >> extern UINT8
>> >>
>> _VerifySizeof__VERIFY_UINT16_ENUM_SIZE[(sizeof(__VERIFY_UINT16_EN
>> >> UM_SIZE)
>> >> == (4)) / (sizeof(__VERIFY_UINT16_ENUM_SIZE) == (4))];
>> >> extern UINT8
>> >>
>> _VerifySizeof__VERIFY_UINT32_ENUM_SIZE[(sizeof(__VERIFY_UINT32_EN
>> >> UM_SIZE)
>> >> == (4)) / (sizeof(__VERIFY_UINT32_ENUM_SIZE) == (4))];
>> >> struct _LIST_ENTRY {
>> >>   LIST_ENTRY *ForwardLink;
>> >>   LIST_ENTRY *BackLink;
>> >> };
>> >>   void * __builtin_return_address (unsigned int level);
>> >> extern GUID gEfiCallerIdGuid;
>> >> extern CHAR8 *gEfiCallerBaseName;
>> >> """
>> >>
>> >>
>> >> > diff --git a/BaseTools/Conf/tools_def.template
>> >> b/BaseTools/Conf/tools_def.template
>> >> > index 39fda78..fd56ff3 100755
>> >> > --- a/BaseTools/Conf/tools_def.template
>> >> > +++ b/BaseTools/Conf/tools_def.template
>> >> > @@ -4359,7 +4359,7 @@ DEFINE GCC_IPF_SYMRENAME_FLAGS = --
>> >> redefine-sym memcpy=CopyMem
>> >> >  DEFINE GCC_ASM_FLAGS   = -c -x assembler -imacros
>> >> $(DEST_DIR_DEBUG)/AutoGen.h
>> >> >  DEFINE GCC_PP_FLAGS= -E -x assembler-with-cpp -include
>> >> $(DEST_DIR_DEBUG)/AutoGen.h
>> >> >  DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include
>> >> $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
>> >> > -DEFINE GCC_ASLPP_FLAGS = -x c -E -P
>> >> > +DEFINE GCC_ASLPP_FLAGS = -x c -E
>> >> >  DEFINE GCC_ASLCC_FLAGS = -x c
>> >

Re: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6 command.

2016-11-27 Thread Zhang, Lubo
Yes, it seems more readable. I will send updated patch later

Thanks
Lubo


> -Original Message-
> From: Ye, Ting
> Sent: Monday, November 28, 2016 3:03 PM
> To: Zhang, Lubo ; edk2-devel@lists.01.org
> Cc: Fu, Siyuan ; Wu, Jiaxin 
> Subject: RE: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6
> command.
> 
> Hi Lubo,
> 
> I suggest to change below error messages to be more user friendly:
> Don't support to change the IP address manual if the policy is set to auto. 
> Set IP
> address fail.
> Don't support to change the IP address manual if the policy is set to auto. 
> Set
> Getway fail.\ Don't support to change the IP address manual if the policy is 
> set
> to auto. Set DNS fail.
> 
> For example, update to:
> The gateway address is not configurable when the policy is
> Ip6ConfigPolicyAutomatic.
> 
> Best Regards,
> Ting
> 
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang
> Lubo
> Sent: Monday, November 28, 2016 1:43 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin
> 
> Subject: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6
> command.
> 
> It should display error prompt message when Ifconfig6 can not configure
> correctly.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Cc: Wu Jiaxin 
> ---
>  ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 15
> +++
>  .../UefiShellNetwork2CommandsLib.uni  |  9 +
>  2 files changed, 24 insertions(+)
> 
> diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> index 32dd284..fb308cc 100644
> --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> @@ -1315,10 +1315,24 @@ IfConfig6SetInterfaceInfo (
>  goto ON_EXIT;
>}
> 
>VarArg= VarArg->Next;
> 
> +  if (StrCmp (VarArg->Arg, L"host") == 0) {
> +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status);
> +ShellStatus = EFI_INVALID_PARAMETER;
> +goto ON_EXIT;
> +  } else if (StrCmp (VarArg->Arg, L"gw") == 0) {
> +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle,
> Status);
> +ShellStatus = EFI_INVALID_PARAMETER;
> +goto ON_EXIT;
> +  } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
> +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle,
> Status);
> +ShellStatus = EFI_INVALID_PARAMETER;
> +goto ON_EXIT;
> +  }
> +
>  } else if (StrCmp (VarArg->Arg, L"man") == 0) {
>//
>// Set manual config policy.
>//
>Policy = Ip6ConfigPolicyManual;
> @@ -1509,10 +1523,11 @@ IfConfig6SetInterfaceInfo (
>CfgAddr
>);
> 
>if (EFI_ERROR (Status)) {
>  ShellStatus = SHELL_ACCESS_DENIED;
> +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> + (STR_IFCONFIG6_ERR_MAN_GW), gShellNetwork2HiiHandle, Status);
>  goto ON_EXIT;
>}
> 
>  } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
>//
> diff --git
> a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Comma
> ndsLib.uni
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Comma
> ndsLib.uni
> index c3445bb..66ff05c 100644
> ---
> a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Comma
> ndsLib.uni
> +++
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Com
> +++ mandsLib.uni
> @@ -75,10 +75,19 @@
>  #string STR_IFCONFIG6_ERR_LACK_ARGUMENTS   #language en-US"Lack
> arguments. Bad command %H%s%N is skipped.\r\n"
>"Hint: 
> Please type 'IfConfig6 -?' for help
> info.\r\n"
>  #string STR_IFCONFIG6_ERR_LACK_OPTION  #language en-US"Lack
> options.\r\n"
>"Hint: 
> Please type 'IfConfig6 -?' for help
> info.\r\n"
>  #string STR_IFCONFIG6_ERR_MAN_HOST #language en-US"Manual
> address configuration failed. Please retry.\r\n"
> +
> +#string STR_IFCONFIG6_ERR_MAN_GW   #language en-US"Getway
> address configuration failed. Please check the argument.\r\n"
> +
> +#string STR_IFCONFIG6_ERR_INVALID_IP_CONFIG#language en-US"Don't
> support to change the IP address manual if the policy is set to auto. Set IP
> address fail.\r\n"
> +
> +#string STR_IFCONFIG6_ERR_INVALID_GW_CONFIG#language en-US
> "Don't support to change the IP address manual if the policy is set to auto. 
> Set
> Getway fail.\r\n"
> +
> +#string STR_IFCONFIG6_ERR_INVALID_

Re: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6 command.

2016-11-27 Thread Ye, Ting
Hi Lubo,

I suggest to change below error messages to be more user friendly:
Don't support to change the IP address manual if the policy is set to auto. Set 
IP address fail.
Don't support to change the IP address manual if the policy is set to auto. Set 
Getway fail.\
Don't support to change the IP address manual if the policy is set to auto. Set 
DNS fail.

For example, update to:
The gateway address is not configurable when the policy is 
Ip6ConfigPolicyAutomatic. 

Best Regards,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang 
Lubo
Sent: Monday, November 28, 2016 1:43 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6 command.

It should display error prompt message when Ifconfig6 can not configure 
correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Jiaxin 
---
 ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 15 +++
 .../UefiShellNetwork2CommandsLib.uni  |  9 +
 2 files changed, 24 insertions(+)

diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c 
b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
index 32dd284..fb308cc 100644
--- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
+++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
@@ -1315,10 +1315,24 @@ IfConfig6SetInterfaceInfo (
 goto ON_EXIT;
   }
 
   VarArg= VarArg->Next;
 
+  if (StrCmp (VarArg->Arg, L"host") == 0) {
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status);
+ShellStatus = EFI_INVALID_PARAMETER;
+goto ON_EXIT;
+  } else if (StrCmp (VarArg->Arg, L"gw") == 0) {
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status);
+ShellStatus = EFI_INVALID_PARAMETER;
+goto ON_EXIT;
+  } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status);
+ShellStatus = EFI_INVALID_PARAMETER;
+goto ON_EXIT;
+  }
+
 } else if (StrCmp (VarArg->Arg, L"man") == 0) {
   //
   // Set manual config policy.
   //
   Policy = Ip6ConfigPolicyManual;
@@ -1509,10 +1523,11 @@ IfConfig6SetInterfaceInfo (
   CfgAddr
   );
 
   if (EFI_ERROR (Status)) {
 ShellStatus = SHELL_ACCESS_DENIED;
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
+ (STR_IFCONFIG6_ERR_MAN_GW), gShellNetwork2HiiHandle, Status);
 goto ON_EXIT;
   }
 
 } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
   //
diff --git 
a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
 
b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
index c3445bb..66ff05c 100644
--- 
a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Com
+++ mandsLib.uni
@@ -75,10 +75,19 @@
 #string STR_IFCONFIG6_ERR_LACK_ARGUMENTS   #language en-US"Lack 
arguments. Bad command %H%s%N is skipped.\r\n"
   "Hint: 
Please type 'IfConfig6 -?' for help info.\r\n"
 #string STR_IFCONFIG6_ERR_LACK_OPTION  #language en-US"Lack 
options.\r\n"
   "Hint: 
Please type 'IfConfig6 -?' for help info.\r\n"
 #string STR_IFCONFIG6_ERR_MAN_HOST #language en-US"Manual 
address configuration failed. Please retry.\r\n"
+
+#string STR_IFCONFIG6_ERR_MAN_GW   #language en-US"Getway 
address configuration failed. Please check the argument.\r\n"
+
+#string STR_IFCONFIG6_ERR_INVALID_IP_CONFIG#language en-US"Don't 
support to change the IP address manual if the policy is set to auto. Set IP 
address fail.\r\n"
+
+#string STR_IFCONFIG6_ERR_INVALID_GW_CONFIG#language en-US"Don't 
support to change the IP address manual if the policy is set to auto. Set 
Getway fail.\r\n"
+
+#string STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG   #language en-US"Don't 
support to change the IP address manual if the policy is set to auto. Set DNS 
fail.\r\n"
+
 #string STR_IFCONFIG6_ERR_DUPLICATE_COMMAND#language en-US"Duplicate 
commands. Bad command %H%s%N is skipped.\r\n"
   "Hint: 
Please type 'IfConfig6 -?' for help info.\r\n"
 #string STR_IFCONFIG6_ERR_CONFLICT_COMMAND #language en-US"Conflict 
commands. Bad command %H%s%N is skipped.\r\n"
   

Re: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6 command.

2016-11-27 Thread Fu, Siyuan
Reviewed-by: Fu Siyuan 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Zhang Lubo
> Sent: Monday, November 28, 2016 1:43 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting ; Fu, Siyuan ; Wu,
> Jiaxin 
> Subject: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6
> command.
> 
> It should display error prompt message when Ifconfig6 can
> not configure correctly.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Cc: Wu Jiaxin 
> ---
>  ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 15
> +++
>  .../UefiShellNetwork2CommandsLib.uni  |  9 +
>  2 files changed, 24 insertions(+)
> 
> diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> index 32dd284..fb308cc 100644
> --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> @@ -1315,10 +1315,24 @@ IfConfig6SetInterfaceInfo (
>  goto ON_EXIT;
>}
> 
>VarArg= VarArg->Next;
> 
> +  if (StrCmp (VarArg->Arg, L"host") == 0) {
> +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status);
> +ShellStatus = EFI_INVALID_PARAMETER;
> +goto ON_EXIT;
> +  } else if (StrCmp (VarArg->Arg, L"gw") == 0) {
> +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status);
> +ShellStatus = EFI_INVALID_PARAMETER;
> +goto ON_EXIT;
> +  } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
> +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status);
> +ShellStatus = EFI_INVALID_PARAMETER;
> +goto ON_EXIT;
> +  }
> +
>  } else if (StrCmp (VarArg->Arg, L"man") == 0) {
>//
>// Set manual config policy.
>//
>Policy = Ip6ConfigPolicyManual;
> @@ -1509,10 +1523,11 @@ IfConfig6SetInterfaceInfo (
>CfgAddr
>);
> 
>if (EFI_ERROR (Status)) {
>  ShellStatus = SHELL_ACCESS_DENIED;
> +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG6_ERR_MAN_GW), gShellNetwork2HiiHandle, Status);
>  goto ON_EXIT;
>}
> 
>  } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
>//
> diff --git
> a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL
> ib.uni
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL
> ib.uni
> index c3445bb..66ff05c 100644
> ---
> a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL
> ib.uni
> +++
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL
> ib.uni
> @@ -75,10 +75,19 @@
>  #string STR_IFCONFIG6_ERR_LACK_ARGUMENTS   #language en-US"Lack
> arguments. Bad command %H%s%N is skipped.\r\n"
>"Hint:
> Please type 'IfConfig6 -?' for help info.\r\n"
>  #string STR_IFCONFIG6_ERR_LACK_OPTION  #language en-US"Lack
> options.\r\n"
>"Hint:
> Please type 'IfConfig6 -?' for help info.\r\n"
>  #string STR_IFCONFIG6_ERR_MAN_HOST #language en-US"Manual
> address configuration failed. Please retry.\r\n"
> +
> +#string STR_IFCONFIG6_ERR_MAN_GW   #language en-US"Getway
> address configuration failed. Please check the argument.\r\n"
> +
> +#string STR_IFCONFIG6_ERR_INVALID_IP_CONFIG#language en-US"Don't
> support to change the IP address manual if the policy is set to auto. Set
> IP address fail.\r\n"
> +
> +#string STR_IFCONFIG6_ERR_INVALID_GW_CONFIG#language en-US"Don't
> support to change the IP address manual if the policy is set to auto. Set
> Getway fail.\r\n"
> +
> +#string STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG   #language en-US"Don't
> support to change the IP address manual if the policy is set to auto. Set
> DNS fail.\r\n"
> +
>  #string STR_IFCONFIG6_ERR_DUPLICATE_COMMAND#language en-US
> "Duplicate commands. Bad command %H%s%N is skipped.\r\n"
>"Hint:
> Please type 'IfConfig6 -?' for help info.\r\n"
>  #string STR_IFCONFIG6_ERR_CONFLICT_COMMAND #language en-US
> "Conflict commands. Bad command %H%s%N is skipped.\r\n"
>"Hint:
> Please type 'IfConfig6 -?' for help info.\r\n"
>  #string STR_IFCONFIG6_ERR_UNKNOWN_COMMAND  #language en-US
> "Unknown commands. Bad command %H%s%N is skipped.\r\n"
> --
> 1.9.5.msysgit.1
> 
> ___
> edk2-devel maili

[edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6 command.

2016-11-27 Thread Zhang Lubo
It should display error prompt message when Ifconfig6 can
not configure correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Jiaxin 
---
 ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 15 +++
 .../UefiShellNetwork2CommandsLib.uni  |  9 +
 2 files changed, 24 insertions(+)

diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c 
b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
index 32dd284..fb308cc 100644
--- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
+++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
@@ -1315,10 +1315,24 @@ IfConfig6SetInterfaceInfo (
 goto ON_EXIT;
   }
 
   VarArg= VarArg->Next;
 
+  if (StrCmp (VarArg->Arg, L"host") == 0) {
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status);
+ShellStatus = EFI_INVALID_PARAMETER;
+goto ON_EXIT;
+  } else if (StrCmp (VarArg->Arg, L"gw") == 0) {
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status);
+ShellStatus = EFI_INVALID_PARAMETER;
+goto ON_EXIT;
+  } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status);
+ShellStatus = EFI_INVALID_PARAMETER;
+goto ON_EXIT;
+  }
+
 } else if (StrCmp (VarArg->Arg, L"man") == 0) {
   //
   // Set manual config policy.
   //
   Policy = Ip6ConfigPolicyManual;
@@ -1509,10 +1523,11 @@ IfConfig6SetInterfaceInfo (
   CfgAddr
   );
 
   if (EFI_ERROR (Status)) {
 ShellStatus = SHELL_ACCESS_DENIED;
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG6_ERR_MAN_GW), gShellNetwork2HiiHandle, Status);
 goto ON_EXIT;
   }
 
 } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
   //
diff --git 
a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
 
b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
index c3445bb..66ff05c 100644
--- 
a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
+++ 
b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
@@ -75,10 +75,19 @@
 #string STR_IFCONFIG6_ERR_LACK_ARGUMENTS   #language en-US"Lack 
arguments. Bad command %H%s%N is skipped.\r\n"
   "Hint: 
Please type 'IfConfig6 -?' for help info.\r\n"
 #string STR_IFCONFIG6_ERR_LACK_OPTION  #language en-US"Lack 
options.\r\n"
   "Hint: 
Please type 'IfConfig6 -?' for help info.\r\n"
 #string STR_IFCONFIG6_ERR_MAN_HOST #language en-US"Manual 
address configuration failed. Please retry.\r\n"
+
+#string STR_IFCONFIG6_ERR_MAN_GW   #language en-US"Getway 
address configuration failed. Please check the argument.\r\n"
+
+#string STR_IFCONFIG6_ERR_INVALID_IP_CONFIG#language en-US"Don't 
support to change the IP address manual if the policy is set to auto. Set IP 
address fail.\r\n"
+
+#string STR_IFCONFIG6_ERR_INVALID_GW_CONFIG#language en-US"Don't 
support to change the IP address manual if the policy is set to auto. Set 
Getway fail.\r\n"
+
+#string STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG   #language en-US"Don't 
support to change the IP address manual if the policy is set to auto. Set DNS 
fail.\r\n"
+
 #string STR_IFCONFIG6_ERR_DUPLICATE_COMMAND#language en-US"Duplicate 
commands. Bad command %H%s%N is skipped.\r\n"
   "Hint: 
Please type 'IfConfig6 -?' for help info.\r\n"
 #string STR_IFCONFIG6_ERR_CONFLICT_COMMAND #language en-US"Conflict 
commands. Bad command %H%s%N is skipped.\r\n"
   "Hint: 
Please type 'IfConfig6 -?' for help info.\r\n"
 #string STR_IFCONFIG6_ERR_UNKNOWN_COMMAND  #language en-US"Unknown 
commands. Bad command %H%s%N is skipped.\r\n"
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 2/3] UefiCpuPkg/MpInitLib: wait no longer than necessary for initial AP startup

2016-11-27 Thread Fan, Jeff
Laszlo,

Setting PcdCpuApInitTimeOutInMicroSeconds to infinity (marked with 0) is 
behavior changing. 

Even there is no any multi-processor supporting platform set this PCD to zero, 
this PCD maybe set to 0 on single processor platform.

I prefer to setting PcdCpuApInitTimeOutInMicroSeconds to 0x (about 1.1 
hour) for such purpose.

Thanks!
Jeff

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Friday, November 25, 2016 4:57 AM
To: edk2-devel-01
Cc: Kinney, Michael D; Fan, Jeff; Justen, Jordan L
Subject: [edk2] [PATCH v2 2/3] UefiCpuPkg/MpInitLib: wait no longer than 
necessary for initial AP startup

Sometimes a platform knows exactly how many CPUs it has at boot. It should be 
able to
- set PcdCpuMaxLogicalProcessorNumber dynamically to this number,
- set PcdCpuApInitTimeOutInMicroSeconds to infinity (marked with 0),
- and expect that MpInitLib wait exactly as long as necessary for all APs
  to report in.

Other platforms should be able to continue setting a reasonably large upper 
bound on supported CPUs, and waiting for a reasonable, fixed amount of time for 
all APs to report in.

Add this functionality. The TimedWaitForApFinish() function will return when 
all APs have reported in, or the timeout has expired -- whichever happens first.

(Accessing these PCDs dynamically is safe. The PEI and DXE phase instances of 
this library are restricted to PEIM and DXE_DRIVER client modules, thus the PCD 
accesses cannot be linked into runtime code.)

Cc: Igor Mammedov 
Cc: Jeff Fan 
Cc: Jordan Justen 
Cc: Michael Kinney 
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=116
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 UefiCpuPkg/UefiCpuPkg.dec|  3 +-
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 67 +++-
 2 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 
ca560398bbef..8607ae8b7ae8 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -174,7 +174,8 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, 
PcdsDynamicEx]
   # @Prompt Configure max supported number of Logical Processors
   
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|64|UINT32|0x0002
   ## Specifies timeout value in microseconds for the BSP to detect all APs for 
the first time.
-  # @Prompt Timeout for the BSP to detect all APs for the first time.
+  #  When set to zero, the BSP will wait forever for all 
(PcdCpuMaxLogicalProcessorNumber-1) APs to report in.
+  # @Prompt Timeout for the BSP to detect all APs for the first time (zero 
means await maximum supported AP count).
   
gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds|5|UINT32|0x0004
   ## Specifies the base address of the first microcode Patch in the microcode 
Region.
   # @Prompt Microcode Region base address.
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 15dbfa1e7d6c..76de92fa552a 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -684,6 +684,22 @@ FillExchangeInfoData (  }
 
 /**
+  Helper function that waits until the finished AP count reaches the 
+ specified  limit, or the specified timeout elapses (whichever comes first).
+
+  @param[in] CpuMpDataPointer to CPU MP Data.
+  @param[in] FinishedApLimit  The number of finished APs to wait for.
+  @param[in] TimeLimitThe number of microseconds to wait for. Zero
+  means infinity.
+**/
+VOID
+TimedWaitForApFinish (
+  IN CPU_MP_DATA   *CpuMpData,
+  IN UINT32FinishedApLimit,
+  IN UINT32TimeLimit
+  );
+
+/**
   This function will be called by BSP to wakeup AP.
 
   @param[in] CpuMpData  Pointer to CPU MP Data
@@ -748,7 +764,11 @@ WakeUpAP (
   //
   // Wait for all potential APs waken up in one specified period
   //
-  MicroSecondDelay (PcdGet32(PcdCpuApInitTimeOutInMicroSeconds));
+  TimedWaitForApFinish (
+CpuMpData,
+PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
+PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
+);
 } else {
   //
   // Wait all APs waken up if this is not the 1st broadcast of SIPI @@ 
-895,6 +915,51 @@ CheckTimeout (  }
 
 /**
+  Helper function that waits until the finished AP count reaches the 
+ specified  limit, or the specified timeout elapses (whichever comes first).
+
+  @param[in] CpuMpDataPointer to CPU MP Data.
+  @param[in] FinishedApLimit  The number of finished APs to wait for.
+  @param[in] TimeLimitThe number of microseconds to wait for. Zero
+  means infinity.
+**/
+VOID
+TimedWaitForApFinish (
+  IN CPU_MP_DATA   *CpuMpData,
+  IN UINT32FinishedApLimit,
+  IN UINT32Ti

Re: [edk2] [Patch 1/2] BaseTools tools_def.txt: Remove -P option in GCC ASLPP_FLAGS

2016-11-27 Thread Gao, Liming
Ard:
  I root cause the issue, and provide the fix. Could you help integrate it?

Thanks
Liming
> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Thursday, November 24, 2016 4:04 PM
> To: Gao, Liming 
> Cc: edk2-devel-01 
> Subject: Re: [edk2] [Patch 1/2] BaseTools tools_def.txt: Remove -P option in
> GCC ASLPP_FLAGS
> 
> On 24 November 2016 at 04:40, Gao, Liming  wrote:
> > Ard:
> >   Which AArch64 platforms? I will investigate it further.
> >
> 
> https://git.linaro.org/uefi/OpenPlatformPkg.git master
> 
> platform
> OpenPlatformPkg/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.ds
> c
> 
> module
> OpenPlatformPkg/Platforms/AMD/Styx/AcpiTables/AcpiAml.inf
> 
> 
> 
> > Thanks
> > Liming
> >> -Original Message-
> >> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> >> Sent: Wednesday, November 23, 2016 6:09 PM
> >> To: Gao, Liming 
> >> Cc: edk2-devel-01 
> >> Subject: Re: [edk2] [Patch 1/2] BaseTools tools_def.txt: Remove -P option
> in
> >> GCC ASLPP_FLAGS
> >>
> >> On 14 November 2016 at 06:37, Liming Gao  wrote:
> >> > https://bugzilla.tianocore.org/show_bug.cgi?id=227
> >> >
> >> > After -P option is removed, the generated preprocessed ASL file will
> have
> >> > line markers. The extra information can be removed by Trim script. ASL
> >> code
> >> > can refer to the definition in C source file. This has been supported in
> >> > VS and XCODE tool chains.
> >> >
> >> > Cc: Yonghong Zhu 
> >> > Contributed-under: TianoCore Contribution Agreement 1.0
> >> > Signed-off-by: Liming Gao 
> >> > ---
> >> >  BaseTools/Conf/tools_def.template | 4 ++--
> >> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >> >
> >>
> >> This patch is breaking the build on some AArch64 platforms:
> >>
> >> Intel ACPI Component Architecture
> >> Error6126 - syntax error, unexpected PARSEOP_NAMESEG, expecting
> >> PARSEOP_DEFINITION_BLOCK and premature End-Of-File
> >> ASL+ Optimizing Compiler version 20160831-64
> >>
> >> and the DSDT. source file has these lines at the beginning
> >>
> >> """
> >> extern UINT8 _VerifySizeofBOOLEAN[(sizeof(BOOLEAN) == (1)) /
> >> (sizeof(BOOLEAN) == (1))];
> >> extern UINT8 _VerifySizeofINT8[(sizeof(INT8) == (1)) / (sizeof(INT8) ==
> (1))];
> >> extern UINT8 _VerifySizeofUINT8[(sizeof(UINT8) == (1)) /
> >> (sizeof(UINT8) == (1))];
> >> extern UINT8 _VerifySizeofINT16[(sizeof(INT16) == (2)) /
> >> (sizeof(INT16) == (2))];
> >> extern UINT8 _VerifySizeofUINT16[(sizeof(UINT16) == (2)) /
> >> (sizeof(UINT16) == (2))];
> >> extern UINT8 _VerifySizeofINT32[(sizeof(INT32) == (4)) /
> >> (sizeof(INT32) == (4))];
> >> extern UINT8 _VerifySizeofUINT32[(sizeof(UINT32) == (4)) /
> >> (sizeof(UINT32) == (4))];
> >> extern UINT8 _VerifySizeofINT64[(sizeof(INT64) == (8)) /
> >> (sizeof(INT64) == (8))];
> >> extern UINT8 _VerifySizeofUINT64[(sizeof(UINT64) == (8)) /
> >> (sizeof(UINT64) == (8))];
> >> extern UINT8 _VerifySizeofCHAR8[(sizeof(CHAR8) == (1)) /
> >> (sizeof(CHAR8) == (1))];
> >> extern UINT8 _VerifySizeofCHAR16[(sizeof(CHAR16) == (2)) /
> >> (sizeof(CHAR16) == (2))];
> >> extern UINT8
> >>
> _VerifySizeof__VERIFY_UINT8_ENUM_SIZE[(sizeof(__VERIFY_UINT8_ENUM
> >> _SIZE)
> >> == (4)) / (sizeof(__VERIFY_UINT8_ENUM_SIZE) == (4))];
> >> extern UINT8
> >>
> _VerifySizeof__VERIFY_UINT16_ENUM_SIZE[(sizeof(__VERIFY_UINT16_EN
> >> UM_SIZE)
> >> == (4)) / (sizeof(__VERIFY_UINT16_ENUM_SIZE) == (4))];
> >> extern UINT8
> >>
> _VerifySizeof__VERIFY_UINT32_ENUM_SIZE[(sizeof(__VERIFY_UINT32_EN
> >> UM_SIZE)
> >> == (4)) / (sizeof(__VERIFY_UINT32_ENUM_SIZE) == (4))];
> >> struct _LIST_ENTRY {
> >>   LIST_ENTRY *ForwardLink;
> >>   LIST_ENTRY *BackLink;
> >> };
> >>   void * __builtin_return_address (unsigned int level);
> >> extern GUID gEfiCallerIdGuid;
> >> extern CHAR8 *gEfiCallerBaseName;
> >> """
> >>
> >>
> >> > diff --git a/BaseTools/Conf/tools_def.template
> >> b/BaseTools/Conf/tools_def.template
> >> > index 39fda78..fd56ff3 100755
> >> > --- a/BaseTools/Conf/tools_def.template
> >> > +++ b/BaseTools/Conf/tools_def.template
> >> > @@ -4359,7 +4359,7 @@ DEFINE GCC_IPF_SYMRENAME_FLAGS = --
> >> redefine-sym memcpy=CopyMem
> >> >  DEFINE GCC_ASM_FLAGS   = -c -x assembler -imacros
> >> $(DEST_DIR_DEBUG)/AutoGen.h
> >> >  DEFINE GCC_PP_FLAGS= -E -x assembler-with-cpp -include
> >> $(DEST_DIR_DEBUG)/AutoGen.h
> >> >  DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include
> >> $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
> >> > -DEFINE GCC_ASLPP_FLAGS = -x c -E -P
> >> > +DEFINE GCC_ASLPP_FLAGS = -x c -E
> >> >  DEFINE GCC_ASLCC_FLAGS = -x c
> >> >  DEFINE GCC_WINDRES_FLAGS   = -J rc -O coff
> >> >  DEFINE GCC_IA32_RC_FLAGS   = -I binary -O elf32-i386  
> >> > -B i386
> --
> >> rename-section .data=.hii
> >> > @@ -5804,7 +5804,7 @@ RELEASE_CLANG38_X64_CC_FLAGS   =
> >> DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__
> >> >  *_ELFGCC_*_ASL_

Re: [edk2] [PATCH v4 4/5] MdeModulePkg/NonDiscoverablePciDeviceDxe: add support for non-coherent DMA

2016-11-27 Thread Ni, Ruiyu
Comments in NonCoherentPciIoAllocateBuffer().

Thanks/Ray

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Friday, November 25, 2016 11:42 PM
> To: edk2-devel@lists.01.org; leif.lindh...@linaro.org; Gao, Liming
> ; af...@apple.com; Ni, Ruiyu ;
> Kinney, Michael D ; m...@semihalf.com; Tian,
> Feng 
> Cc: Ard Biesheuvel 
> Subject: [PATCH v4 4/5] MdeModulePkg/NonDiscoverablePciDeviceDxe: add
> support for non-coherent DMA
> 
> Add support for non-coherent DMA, either by performing explicit cache
> maintenance when DMA mappings are aligned to the CPU's DMA buffer
> alignment, or by bounce buffering via uncached mappings otherwise.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci
> DeviceDxe.c   |  14 +-
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci
> DeviceDxe.inf |   2 +
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci
> DeviceIo.c| 319 
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci
> DeviceIo.h|  29 ++
>  4 files changed, 357 insertions(+), 7 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceDxe.c
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceDxe.c
> index ee765d7a5d9c..0fcf2b2ec1bf 100644
> ---
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceDxe.c
> +++
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> Pc
> +++ iDeviceDxe.c
> @@ -16,6 +16,8 @@
> 
>  #include 
> 
> +EFI_CPU_ARCH_PROTOCOL  *mCpu;
> +
>  //
>  // We only support the following device types  // @@ -69,14 +71,7 @@
> NonDiscoverablePciDeviceSupported (
>  return Status;
>}
> 
> -  //
> -  // Restricted to DMA coherent for now
> -  //
>Status = EFI_UNSUPPORTED;
> -  if (Device->DmaType != NonDiscoverableDeviceDmaTypeCoherent) {
> -goto CloseProtocol;
> -  }
> -
>for (Idx = 0; Idx < ARRAY_SIZE (SupportedNonDiscoverableDevices); Idx++)
> {
>  if (CompareGuid (Device->Type, SupportedNonDiscoverableDevices [Idx]))
> {
>Status = EFI_SUCCESS;
> @@ -224,6 +219,11 @@ NonDiscoverablePciDeviceDxeEntryPoint (
>IN EFI_SYSTEM_TABLE *SystemTable
>)
>  {
> +  EFI_STATUS  Status;
> +
> +  Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID
> + **)&mCpu);  ASSERT_EFI_ERROR(Status);
> +
>return EfiLibInstallDriverBindingComponentName2 (
> ImageHandle,
> SystemTable,
> diff --git
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceDxe.inf
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceDxe.inf
> index 996fe310e0e3..5faa8945134c 100644
> ---
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceDxe.inf
> +++
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> Pc
> +++ iDeviceDxe.inf
> @@ -32,6 +32,7 @@ [Packages]
>  [LibraryClasses]
>BaseMemoryLib
>DebugLib
> +  DxeServicesTableLib
>MemoryAllocationLib
>UefiBootServicesTableLib
>UefiDriverEntryPoint
> @@ -40,6 +41,7 @@ [LibraryClasses]
>  [Protocols]
>gEfiPciIoProtocolGuid ## BY_START
>gEdkiiNonDiscoverableDeviceProtocolGuid   ## TO_START
> +  gEfiCpuArchProtocolGuid   ## CONSUMES
> 
>  [Guids]
>gEdkiiNonDiscoverableAhciDeviceGuid
> diff --git
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceIo.c
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceIo.c
> index fd59267a8d66..5a4861a17717 100644
> ---
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceIo.c
> +++
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> Pc
> +++ iDeviceIo.c
> @@ -15,6 +15,8 @@
> 
>  #include "NonDiscoverablePciDeviceIo.h"
> 
> +#include 
> +
>  #include 
> 
>  #include 
> @@ -523,6 +525,316 @@ CoherentPciIoFreeBuffer (
>return EFI_SUCCESS;
>  }
> 
> +STATIC
> +EFI_STATUS
> +NonCoherentPciIoFreeBuffer (
> +  IN  EFI_PCI_IO_PROTOCOL *This,
> +  IN  UINTN   Pages,
> +  IN  VOID*HostAddress
> +  )
> +{
> +  NON_DISCOVERABLE_PCI_DEVICE   *Dev;
> +  LIST_ENTRY*Entry;
> +  EFI_STATUSStatus;
> +  NON_DISCOVERABLE_DEVICE_UNCACHED_ALLOCATION   *Alloc;
> +  BOOLEAN   Found;
> +
> +  Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);
> +
> +  Found = FALSE;
> +
> +  //
> +  // Find the uncached allocation list entry associated  // with this
> + allocation  //  for (Entry = Dev->UncachedAllocationList.ForwardLink;
> +   Entry != &Dev->UncachedAllocationList;
> +   Entry = Entry

Re: [edk2] [PATCH v2 1/3] UefiCpuPkg/PiSmmCpuDxeSmm: handle dynamic PcdCpuMaxLogicalProcessorNumber

2016-11-27 Thread Fan, Jeff
Laszlo,

Even getting PcdCpuMaxLogicalProcessorNumber is legal in 
InitSmmProfileInternal() that is only invoked on boot time, I agree to do this 
updating in this patch.
We need to try to use mMaxNumberOfCpus as possible for size saving and 
performance improvement.

Reviewed-by: Jeff Fan 

Jeff

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Friday, November 25, 2016 4:57 AM
To: edk2-devel-01
Cc: Igor Mammedov; Fan, Jeff; Justen, Jordan L; Kinney, Michael D
Subject: [PATCH v2 1/3] UefiCpuPkg/PiSmmCpuDxeSmm: handle dynamic 
PcdCpuMaxLogicalProcessorNumber

"UefiCpuPkg/UefiCpuPkg.dec" already allows platforms to make 
PcdCpuMaxLogicalProcessorNumber dynamic, however PiSmmCpuDxeSmm does not take 
this into account everywhere. As soon as a platform turns the PCD into a 
dynamic one, at least S3 fails. When the PCD is dynamic, all
PcdGet() calls translate into PCD DXE protocol calls, which are only permitted 
at boot time, not at runtime or during S3 resume.

We already have a variable called mMaxNumberOfCpus; it is initialized in the 
entry point function like this:

> //
> // If support CPU hot plug, we need to allocate resources for possibly 
> // hot-added processors // if (FeaturePcdGet (PcdCpuHotPlugSupport)) {
>   mMaxNumberOfCpus = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
> } else {
>   mMaxNumberOfCpus = mNumberOfCpus;
> }

There's another use of the PCD a bit higher up, also in the entry point
function:

> //
> // Use MP Services Protocol to retrieve the number of processors and 
> // number of enabled processors // Status = 
> MpServices->GetNumberOfProcessors (MpServices, &mNumberOfCpus,
>&NumberOfEnabledProcessors); ASSERT_EFI_ERROR 
> (Status); ASSERT (mNumberOfCpus <= PcdGet32 
> (PcdCpuMaxLogicalProcessorNumber));

Preserve these calls in the entry point function, and replace all other uses of 
PcdCpuMaxLogicalProcessorNumber -- there are only reads -- with 
mMaxNumberOfCpus.

For PcdCpuHotPlugSupport==TRUE, this is an unobservable change.

For PcdCpuHotPlugSupport==FALSE, we even save SMRAM, because we no longer 
allocate resources needlessly for CPUs that can never appear in the system.

PcdCpuMaxLogicalProcessorNumber is also retrieved in 
"UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c",  but only in the 
library instance constructor, which runs even before the entry point function 
is called.

Cc: Igor Mammedov 
Cc: Jeff Fan 
Cc: Jordan Justen 
Cc: Michael Kinney 
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=116
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c |  2 +-
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 18 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
index 4baba1e9f8dc..f957de1f4764 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -344,7 +344,7 @@ SmmInitHandler (
   AsmWriteIdtr (&gcSmiIdtr);
   ApicId = GetApicId ();
 
-  ASSERT (mNumberOfCpus <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
+  ASSERT (mNumberOfCpus <= mMaxNumberOfCpus);
 
   for (Index = 0; Index < mNumberOfCpus; Index++) {
 if (ApicId == (UINT32)gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId) { 
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
index c1a48d100e0f..f53819ee24c2 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
@@ -139,7 +139,7 @@ GetCpuIndex (
 
   ApicId = GetApicId ();
 
-  for (Index = 0; Index < PcdGet32 (PcdCpuMaxLogicalProcessorNumber); Index++) 
{
+  for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
 if (gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId == ApicId) {
   return Index;
 }
@@ -825,13 +825,13 @@ InitSmmProfileInternal (
   UINTN  MsrDsAreaSizePerCpu;
   UINTN  TotalSize;
 
-  mPFEntryCount = (UINTN *)AllocateZeroPool (sizeof (UINTN) * PcdGet32 
(PcdCpuMaxLogicalProcessorNumber));
+  mPFEntryCount = (UINTN *)AllocateZeroPool (sizeof (UINTN) * 
+ mMaxNumberOfCpus);
   ASSERT (mPFEntryCount != NULL);
   mLastPFEntryValue = (UINT64  (*)[MAX_PF_ENTRY_COUNT])AllocateZeroPool (
- sizeof 
(mLastPFEntryValue[0]) * PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
+ sizeof 
+ (mLastPFEntryValue[0]) * mMaxNumberOfCpus);
   ASSERT (mLastPFEntryValue != NULL);
   mLastPFEntryPointer = (UINT64 *(*)[MAX_PF_ENTRY_COUNT])AllocateZeroPool (
-   sizeof 
(mLastPFEntryPointer[0]) * PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
+   sizeof 
+ (mLastPFEntryPointer[0]) * mMaxNumberOfCpus);

Re: [edk2] [PATCH v4 2/5] MdeModulePkg: introduce helper library to register non-discoverable devices

2016-11-27 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Thanks/Ray

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Friday, November 25, 2016 11:42 PM
> To: edk2-devel@lists.01.org; leif.lindh...@linaro.org; Gao, Liming
> ; af...@apple.com; Ni, Ruiyu ;
> Kinney, Michael D ; m...@semihalf.com; Tian,
> Feng 
> Cc: Ard Biesheuvel 
> Subject: [PATCH v4 2/5] MdeModulePkg: introduce helper library to register
> non-discoverable devices
> 
> Non-discoverable devices need to be registered explicitly by the platform.
> Introduce a helper library that takes care of this.
> 
> This implementation currently only supports registering devices that are
> covered by one or more MMIO resources. The underlying protocol allows for
> more flexibility than that, but this is currently sufficient for the use 
> cases that
> we know about.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h
> |  62 ++
> 
> MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscove
> rableDeviceRegistrationLib.c   | 204 
> 
> MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscove
> rableDeviceRegistrationLib.inf |  46 +
>  MdeModulePkg/MdeModulePkg.dec
>   |   4
> +
>  MdeModulePkg/MdeModulePkg.dsc
>   |   2
> +
>  5 files changed, 318 insertions(+)
> 
> diff --git
> a/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h
> b/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h
> new file mode 100644
> index ..120d91466095
> --- /dev/null
> +++
> b/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.
> +++ h
> @@ -0,0 +1,62 @@
> +/** @file
> +  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
> +
> +  This program and the accompanying materials  are licensed and made
> + available under the terms and conditions of the BSD License  which
> + accompanies this distribution.  The full text of the license may be
> + found at  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +#ifndef __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__
> +#define __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__
> +
> +#include 
> +
> +typedef enum {
> +  NonDiscoverableDeviceTypeAhci,
> +  NonDiscoverableDeviceTypeAmba,
> +  NonDiscoverableDeviceTypeEhci,
> +  NonDiscoverableDeviceTypeNvme,
> +  NonDiscoverableDeviceTypeOhci,
> +  NonDiscoverableDeviceTypeSdhci,
> +  NonDiscoverableDeviceTypeUfs,
> +  NonDiscoverableDeviceTypeUhci,
> +  NonDiscoverableDeviceTypeXhci,
> +  NonDiscoverableDeviceTypeMax,
> +} NON_DISCOVERABLE_DEVICE_TYPE;
> +
> +/**
> +  Register a non-discoverable MMIO device
> +
> +  @param[in]  DeviceType  The type of non-discoverable device
> +  @param[in]  DmaType Whether the device is DMA coherent
> +  @param[in]  InitFuncInitialization routine to be invoked 
> when
> +  the device is enabled
> +  @param[in,out]  Handle  The handle onto which to install the
> +  non-discoverable device protocol.
> +  If Handle is NULL or *Handle is NULL, a
> +  new handle will be allocated.
> +  @param[in]  NumMmioResourcesThe number of UINTN base/size
> pairs that
> +  follow, each describing an MMIO region
> +  owned by the device
> +
> +  @retval EFI_SUCCESS The registration succeeded.
> +  @retval Other   The registration failed.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RegisterNonDiscoverableMmioDevice (
> +  IN  NON_DISCOVERABLE_DEVICE_TYPE  Type,
> +  IN  NON_DISCOVERABLE_DEVICE_DMA_TYPE  DmaType,
> +  IN  NON_DISCOVERABLE_DEVICE_INIT  InitFunc,
> +  IN OUT  EFI_HANDLE*Handle OPTIONAL,
> +  IN  UINTN NumMmioResources,
> +  ...
> +  );
> +
> +#endif
> diff --git
> a/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDisco
> verableDeviceRegistrationLib.c
> b/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDisco
> verableDeviceRegistrationLib.c
> new file mode 100644
> index ..94cd946b69d3
> --- /dev/null
> +++
> b/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDisco
> +++ verableDeviceRegistrationLib.c
> @@ -0,0 +1,204 @@
> +/** @file
> +  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
> +
> +  This program and the accompanying materials  are licensed and made
> + available under t

Re: [edk2] [PATCH v4 1/5] MdeModulePkg: introduce non-discoverable device protocol

2016-11-27 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Thanks/Ray

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Friday, November 25, 2016 11:42 PM
> To: edk2-devel@lists.01.org; leif.lindh...@linaro.org; Gao, Liming
> ; af...@apple.com; Ni, Ruiyu ;
> Kinney, Michael D ; m...@semihalf.com; Tian,
> Feng 
> Cc: Ard Biesheuvel 
> Subject: [PATCH v4 1/5] MdeModulePkg: introduce non-discoverable device
> protocol
> 
> Introduce a protocol that can be exposed by a platform for devices that are
> not discoverable, usually because they are wired straight to the memory bus
> rather than to an enumerable bus like PCI or USB.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  MdeModulePkg/Include/Guid/NonDiscoverableDevice.h | 58
> +++
>  MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h | 77
> 
>  MdeModulePkg/MdeModulePkg.dec | 14 
>  3 files changed, 149 insertions(+)
> 
> diff --git a/MdeModulePkg/Include/Guid/NonDiscoverableDevice.h
> b/MdeModulePkg/Include/Guid/NonDiscoverableDevice.h
> new file mode 100644
> index ..d182e4b9d2fe
> --- /dev/null
> +++ b/MdeModulePkg/Include/Guid/NonDiscoverableDevice.h
> @@ -0,0 +1,58 @@
> +/** @file
> +  GUIDs to identify devices that are not on a discoverable bus but can
> +be
> +  controlled by a standard class driver
> +
> +  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
> +
> +  This program and the accompanying materials  are licensed and made
> + available under the terms and conditions of the BSD License  which
> + accompanies this distribution.  The full text of the license may be
> + found at  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +#ifndef __NON_DISCOVERABLE_DEVICE_GUID_H__
> +#define __NON_DISCOVERABLE_DEVICE_GUID_H__
> +
> +#define EDKII_NON_DISCOVERABLE_AHCI_DEVICE_GUID \
> +  { 0xC7D35798, 0xE4D2, 0x4A93, {0xB1, 0x45, 0x54, 0x88, 0x9F, 0x02,
> +0x58, 0x4B } }
> +
> +#define EDKII_NON_DISCOVERABLE_AMBA_DEVICE_GUID \
> +  { 0x94440339, 0xCC93, 0x4506, {0xB4, 0xC6, 0xEE, 0x8D, 0x0F, 0x4C,
> +0xA1, 0x91 } }
> +
> +#define EDKII_NON_DISCOVERABLE_EHCI_DEVICE_GUID \
> +  { 0xEAEE5615, 0x0CFD, 0x45FC, {0x87, 0x69, 0xA0, 0xD8, 0x56, 0x95,
> +0xAF, 0x85 } }
> +
> +#define EDKII_NON_DISCOVERABLE_NVME_DEVICE_GUID \
> +  { 0xC5F25542, 0x2A79, 0x4A26, {0x81, 0xBB, 0x4E, 0xA6, 0x32, 0x33,
> +0xB3, 0x09 } }
> +
> +#define EDKII_NON_DISCOVERABLE_OHCI_DEVICE_GUID \
> +  { 0xB20005B0, 0xBB2D, 0x496F, {0x86, 0x9C, 0x23, 0x0B, 0x44, 0x79,
> +0xE7, 0xD1 } }
> +
> +#define EDKII_NON_DISCOVERABLE_SDHCI_DEVICE_GUID \
> +  { 0x1DD1D619, 0xF9B8, 0x463E, {0x86, 0x81, 0xD1, 0xDC, 0x7C, 0x07,
> +0xB7, 0x2C } }
> +
> +#define EDKII_NON_DISCOVERABLE_UFS_DEVICE_GUID \
> +  { 0x2EA77912, 0x80A8, 0x4947, {0xBE, 0x69, 0xCD, 0xD0, 0x0A, 0xFB,
> +0xE5, 0x56 } }
> +
> +#define EDKII_NON_DISCOVERABLE_UHCI_DEVICE_GUID \
> +  { 0xA8CDA0A2, 0x4F37, 0x4A1B, {0x8E, 0x10, 0x8E, 0xF3, 0xCC, 0x3B,
> +0xF3, 0xA8 } }
> +
> +#define EDKII_NON_DISCOVERABLE_XHCI_DEVICE_GUID \
> +  { 0xB1BE0BC5, 0x6C28, 0x442D, {0xAA, 0x37, 0x15, 0x1B, 0x42, 0x57,
> +0xBD, 0x78 } }
> +
> +
> +extern EFI_GUID gEdkiiNonDiscoverableAhciDeviceGuid;
> +extern EFI_GUID gEdkiiNonDiscoverableAmbaDeviceGuid;
> +extern EFI_GUID gEdkiiNonDiscoverableEhciDeviceGuid;
> +extern EFI_GUID gEdkiiNonDiscoverableNvmeDeviceGuid;
> +extern EFI_GUID gEdkiiNonDiscoverableOhciDeviceGuid;
> +extern EFI_GUID gEdkiiNonDiscoverableSdhciDeviceGuid;
> +extern EFI_GUID gEdkiiNonDiscoverableUfsDeviceGuid;
> +extern EFI_GUID gEdkiiNonDiscoverableUhciDeviceGuid;
> +extern EFI_GUID gEdkiiNonDiscoverableXhciDeviceGuid;
> +
> +#endif
> diff --git a/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h
> b/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h
> new file mode 100644
> index ..976ae8387376
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h
> @@ -0,0 +1,77 @@
> +/** @file
> +  Protocol to describe devices that are not on a discoverable bus
> +
> +  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
> +
> +  This program and the accompanying materials  are licensed and made
> + available under the terms and conditions of the BSD License  which
> + accompanies this distribution.  The full text of the license may be
> + found at  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +#ifndef __NON_DISCOVERABLE_DEVICE_H__
> +#define __NON_DISCOVERABLE_DEVICE_H__
> +
> +#include 
> +
> +#define EDKII_NON_DISCOVERABLE_DEVICE_PROTOCOL_GUID \
> +  { 0x0d51905b, 0xb77e, 0x452a, {0xa2, 0xc0, 0xec, 0xa0, 0xcc, 0x

Re: [edk2] [PATCH v4 3/5] MdeModulePkg: implement generic PCI I/O driver for non-discoverable devices

2016-11-27 Thread Ni, Ruiyu
Ard,
I found you removed the SDHCI special handling code.
Only one minor comments in below. (you could search RShiftU64 in below).

Reviewed-by: Ruiyu Ni 

Thanks/Ray

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Friday, November 25, 2016 11:42 PM
> To: edk2-devel@lists.01.org; leif.lindh...@linaro.org; Gao, Liming
> ; af...@apple.com; Ni, Ruiyu ;
> Kinney, Michael D ; m...@semihalf.com; Tian,
> Feng 
> Cc: Ard Biesheuvel 
> Subject: [PATCH v4 3/5] MdeModulePkg: implement generic PCI I/O driver
> for non-discoverable devices
> 
> This implements support for non-discoverable PCI compatible devices, i.e,
> devices that are not on a PCI bus but that can be controlled by generic PCI
> drivers in EDK2.
> 
> This is implemented as a UEFI driver, which means we take full advantage of
> the UEFI driver model, and only instantiate those devices that are necessary
> for booting.
> 
> Care is taken to deal with DMA addressing limitations: DMA mappings and
> allocations are moved below 4 GB if the PCI driver has not informed us that
> the device being driven is 64-bit DMA capable. DMA is implemented as
> coherent, support for non-coherent DMA is implemented by a subsequent
> patch.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/ComponentName.c
> |  75 ++
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci
> DeviceDxe.c   | 235 ++
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci
> DeviceDxe.inf |  52 ++
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci
> DeviceIo.c| 797 
> 
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci
> DeviceIo.h|  84 +++
>  MdeModulePkg/MdeModulePkg.dsc
> |   1 +
>  6 files changed, 1244 insertions(+)
> 
> diff --git
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/ComponentNam
> e.c
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/ComponentNam
> e.c
> new file mode 100644
> index ..6e51d00fe434
> --- /dev/null
> +++
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/ComponentNam
> e.c
> @@ -0,0 +1,75 @@
> +/** @file
> +
> +  Copyright (C) 2016, Linaro Ltd. All rights reserved.
> +
> +  This program and the accompanying materials are licensed and made
> + available  under the terms and conditions of the BSD License which
> + accompanies this  distribution. The full text of the license may be
> + found at  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> + WITHOUT  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +#include "NonDiscoverablePciDeviceIo.h"
> +
> +//
> +// The purpose of the following scaffolding
> +(EFI_COMPONENT_NAME_PROTOCOL and //
> EFI_COMPONENT_NAME2_PROTOCOL
> +implementation) is to format the driver's name // in English, for
> +display on standard console devices. This is recommended for // UEFI
> +drivers that follow the UEFI Driver Model. Refer to the Driver Writer's //
> Guide for UEFI 2.3.1 v1.01, 11 UEFI Driver and Controller Names.
> +//
> +
> +STATIC
> +EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
> +  { "eng;en", L"PCI I/O protocol emulation driver for non-discoverable
> devices" },
> +  { NULL, NULL   }
> +};
> +
> +EFI_COMPONENT_NAME_PROTOCOL gComponentName;
> +
> +STATIC
> +EFI_STATUS
> +EFIAPI
> +NonDiscoverablePciGetDriverName (
> +  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
> +  IN  CHAR8   *Language,
> +  OUT CHAR16  **DriverName
> +  )
> +{
> +  return LookupUnicodeString2 (
> +   Language,
> +   This->SupportedLanguages,
> +   mDriverNameTable,
> +   DriverName,
> +   (BOOLEAN)(This == &gComponentName) // Iso639Language
> +   );
> +}
> +
> +STATIC
> +EFI_STATUS
> +EFIAPI
> +NonDiscoverablePciGetDeviceName (
> +  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
> +  IN  EFI_HANDLE  DeviceHandle,
> +  IN  EFI_HANDLE  ChildHandle,
> +  IN  CHAR8   *Language,
> +  OUT CHAR16  **ControllerName
> +  )
> +{
> +  return EFI_UNSUPPORTED;
> +}
> +
> +EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
> +  &NonDiscoverablePciGetDriverName,
> +  &NonDiscoverablePciGetDeviceName,
> +  "eng" // SupportedLanguages, ISO 639-2 language codes };
> +
> +EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
> +  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)
> &NonDiscoverablePciGetDriverName,
> +  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)
> +&NonDiscoverablePciGetDeviceName,
> +  "en" // SupportedLanguages, RFC 4646 language codes };
> diff --git
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
> PciDeviceDxe.c
> b/MdeModulePkg/Bus/Pci/NonDiscove

[edk2] [PATCH] Omap35xxPkg, BeagleBoardPkg: Use Pcd for INTERRUPT_BASE

2016-11-27 Thread Leif Lindholm
The base address for the interrupt controller is hard-coded in
Omap3530Interrupt.h, although Omap35xxPkg/InterruptDxe appears to
have initially intended to make use of PcdInterruptBaseAddress from
EmbeddedPkg. Move it to use said Pcd, and also declare use of it in
BeagleBoardLib, which makes a direct access.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm 
---

Linux uses the same driver for OMAP2/OMAP3 and the AM3xxx variants,
so this tweak should make it possible to reuse across different
platforms.

 BeagleBoardPkg/BeagleBoardPkg.dsc| 4 
 BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf | 3 +++
 Omap35xxPkg/Include/Omap3530/Omap3530Interrupt.h | 5 -
 Omap35xxPkg/Omap35xxPkg.dsc  | 4 
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc 
b/BeagleBoardPkg/BeagleBoardPkg.dsc
index f40095a..9b4142f 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -3,6 +3,7 @@
 #
 # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
 # Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2016, Linaro Ltd. All rights reserved.
 #
 #This program and the accompanying materials
 #are licensed and made available under the terms and conditions of the BSD 
License
@@ -359,6 +360,9 @@
   gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|77
   gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|1300
 
+  # OMAP Interrupt Controller
+  gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress|0x4820
+
   # We want to use the Shell Libraries but don't want it to initialise
   # automatically. We initialise the libraries when the command is called by 
the
   # Shell.
diff --git a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf 
b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
index b1139a4..e004d6f 100644
--- a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
+++ b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
@@ -1,5 +1,6 @@
 #/* @file
 #  Copyright (c) 2011-2013, ARM Limited. All rights reserved.
+#  Copyright (c) 2016, Linaro Ltd. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -52,3 +53,5 @@
 
   gArmTokenSpaceGuid.PcdSystemMemoryBase
   gArmTokenSpaceGuid.PcdSystemMemorySize
+
+  gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
diff --git a/Omap35xxPkg/Include/Omap3530/Omap3530Interrupt.h 
b/Omap35xxPkg/Include/Omap3530/Omap3530Interrupt.h
index 774d873..d8d727e 100644
--- a/Omap35xxPkg/Include/Omap3530/Omap3530Interrupt.h
+++ b/Omap35xxPkg/Include/Omap3530/Omap3530Interrupt.h
@@ -1,6 +1,7 @@
 /** @file
 
   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+  Copyright (c) 2016, Linaro Ltd. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -15,7 +16,9 @@
 #ifndef __OMAP3530INTERRUPT_H__
 #define __OMAP3530INTERRUPT_H__
 
-#define INTERRUPT_BASE (0x4820)
+#include 
+
+#define INTERRUPT_BASE(PcdGet32 (PcdInterruptBaseAddress))
 
 #define INT_NROF_VECTORS  (96)
 #define MAX_VECTOR(INT_NROF_VECTORS - 1)
diff --git a/Omap35xxPkg/Omap35xxPkg.dsc b/Omap35xxPkg/Omap35xxPkg.dsc
index 4a3317f..436c10b 100644
--- a/Omap35xxPkg/Omap35xxPkg.dsc
+++ b/Omap35xxPkg/Omap35xxPkg.dsc
@@ -2,6 +2,7 @@
 # Omap35xx SoC package.
 #
 # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
+# Copyright (c) 2016, Linaro Ltd. All rights reserved.
 #
 #This program and the accompanying materials
 #are licensed and made available under the terms and conditions of the BSD 
License
@@ -159,6 +160,9 @@
   gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|77
   gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|1300
 
+  # OMAP Interrupt Controller
+  gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress|0x4820
+
   #
   # ARM Pcds
   #
-- 
2.10.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v4 0/5] MdeModulePkg: add support for non-discoverable devices

2016-11-27 Thread Marcin Wojtas
Hi Ard,

Solution works on Marvell Armada 7040, tested SATA/USB/SD/eMMC.

Tested-by: Marcin Wojtas 

Best regards,
Marcin

2016-11-25 16:42 GMT+01:00 Ard Biesheuvel :
> The rationale for this series is the fact that many ARM platforms implement
> some form of PCI 'emulation', to allow non-discoverable devices that implement
> standardized host controller interfaces (i.e., EHCI, AHCI) to be controlled by
> the generic EDK2 drivers, which are layered on top of the PCI I/O protocols
> (even though the respective host controller specifications don't mandate that)
>
> There are a couple of problems with that approach:
> - Most implementations are based on the original code created for BeagleBoard,
>   which is a 32-bit platform. Unlike x86, which usually does not perform PCI
>   DMA above 4 GB, the ARM ecosystem is much more heterogeneous, and platforms
>   that have memory both above and below the 4 GB mark may ship with, e.g., 
> EHCI
>   controllers that do not implement 64-bit DMA addressing.
> - Implementations depend on the DmaLib library class in EmbeddedPkg, of which
>   coherent and non-coherent implementations exists. However, both types of
>   devices may appear on a single platform, requiring several instances of the
>   same driver.
> - Existing implementations do not follow the UEFI driver model, but 
> instantiate
>   a fixed number of PCI I/O protocol handles, and bring up all the devices 
> when
>   doing so. However, the UEFI philosophy is to only instantiate (and thus
>   initialize) devices that are involved in booting.
>
> So instead, let's define a base protocol that simply asserts the presence of
> a certain kind of device at a certain memory offset, allowing platforms to
> instantiate any number of these statically, and leave it to post-DXE driver
> dispatch to actually bind the drivers as usual. This is implemented in patch 
> #1.
> Note that it includes an AMBA device type, which we intend to use in the 
> future
> to move ARM AMBA drivers to the UEFI driver model as well (i.e., LCD 
> controller,
> SD/MMC controller)
>
> Patch #2 implements a utility library to register non-discoverable devices.
>
> Patch #3 implements the UEFI driver that instantiates PCI I/O protocol handles
> for non-discoverable devices that we know can be driven by a generic driver in
> EDK2. The initial version implements coherent DMA only.
>
> Patch #4 implements non-coherent DMA for the driver added in patch #3.
>
> Patch #5 is included for reference. It ports the BeagleBoard platform to the
> new driver stack.
>
> Changes in v4:
> - use GUIDs to describe the type of device (AHCI, EHCI, etc), rathen than en
>   enum, to make the protocol more flexible and futureproof
> - revert special handling of SDHCI, which does not map cleanly onto a single
>   PCI device (SDHCI-PCI may expose several slots, each of which is a full
>   fledged implementation of the SDHCI spec, but the EDK2 SDHCI driver does
>   not model those as a bus)
> - don't treat 64-bit BARs as 2 logical BARs
>
> Branch can be found here
> https://git.linaro.org/people/ard.biesheuvel/uefi-next.git/log/?h=non-discoverable-pci-v4
>
> Changes in v3:
> - Modified the base protocol to describe any number of resources using ACPI
>   resource descriptors. The current crop of targeted peripherals does not
>   require that, but it allows for much more flexibility in the future. This
>   also means that the MMIO region sizes are no longer hard-coded base on the
>   controller type (EHCI, AHCI, etc) but need to be declared when the devices
>   are registered.
> - Update the registration library API to allow multiple MMIO regions to be
>   declared.
> - When performing uncached allocations, record the original memory region
>   attributes so we can restore them correctly on free.
> - Some fixes in the 4GB boundary checks for Map/Unmap
> - Rename gNonDiscoverableDeviceProtocolGuid to
>   gEdkiiNonDiscoverableDeviceProtocolGuid
>
> Ard Biesheuvel (5):
>   MdeModulePkg: introduce non-discoverable device protocol
>   MdeModulePkg: introduce helper library to register non-discoverable
> devices
>   MdeModulePkg: implement generic PCI I/O driver for non-discoverable
> devices
>   MdeModulePkg/NonDiscoverablePciDeviceDxe: add support for non-coherent
> DMA
>   Omap35xxPkg/PciEmulation: port to new non-discoverable device
> infrastructure
>
>  BeagleBoardPkg/BeagleBoardPkg.dsc
>   |2 +
>  BeagleBoardPkg/BeagleBoardPkg.fdf
>   |1 +
>  MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/ComponentName.c 
>   |   75 ++
>  
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.c
>  |  235 +
>  
> MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
>|   54 +
>  
> MdeModulePkg/Bus/Pci/NonDiscoverablePc