Re: [edk2] [PATCH v2 1/2] MdeModulePkg: introduce SD/MMC override protocol

2017-12-04 Thread Zeng, Star
If making this protocol a platform level singleton instance, is it so hard to 
define the interfaces and parameters since different controllers may need 
different hook points and parameters?

Thanks,
Star
-Original Message-
From: Ni, Ruiyu 
Sent: Tuesday, December 5, 2017 3:09 PM
To: Ard Biesheuvel ; edk2-devel@lists.01.org
Cc: "hao.a...@intel.com; Kinney.d.michael"@intel.com; Tian, Feng 
; Zeng, Star ; 
leif.lindh...@linaro.org
Subject: Re: [edk2] [PATCH v2 1/2] MdeModulePkg: introduce SD/MMC override 
protocol

On 11/30/2017 6:11 PM, Ard Biesheuvel wrote:
> Many ARM based SoCs have integrated SDHCI controllers, and often, 
> these implementations deviate in subtle ways from the pertinent 
> specifications. On the one hand, these deviations are quite easy to 
> work around, but on the other hand, having a collection of SoC 
> specific workarounds in the generic driver stack is undesirable.
> 
> So let's introduce an optional SD/MMC override protocol that we can 
> invoke at the appropriate moments in the device initialization.
> That way, the workaround itself remains platform specific, but we can 
> still use the generic driver stack on such platforms.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>   MdeModulePkg/Include/Protocol/SdMmcOverride.h | 103 
>   MdeModulePkg/MdeModulePkg.dec |   3 +
>   2 files changed, 106 insertions(+)
> 
> diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h 
> b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> new file mode 100644
> index ..5a5c393896f4
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> @@ -0,0 +1,103 @@
> +/** @file
> +  Protocol to describe overrides required to support non-standard 
> +SDHCI
> +  implementations
> +
> +  Copyright (c) 2017, 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 __SD_MMC_OVERRIDE_H__
> +#define __SD_MMC_OVERRIDE_H__
> +
> +#include 
> +
> +#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_GUID \
> +  { 0xeaf9e3c1, 0xc9cd, 0x46db, { 0xa5, 0xe5, 0x5a, 0x12, 0x4c, 0x83, 
> +0x23, 0x23 } }
> +
> +#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION0x1
> +
> +typedef struct _SD_MMC_OVERRIDE SD_MMC_OVERRIDE;
> +
> +typedef enum {
> +  SD_MMC_OVERRIDE_RESET_PRE_HOOK,
> +  SD_MMC_OVERRIDE_RESET_POST_HOOK,
> +  SD_MMC_OVERRIDE_INIT_HOST_PRE_HOOK,
> +  SD_MMC_OVERRIDE_INIT_HOST_POST_HOOK,
> +} SD_MMC_OVERRIDE_HOOK;
> +
> +/**
> +
> +  Override function for SDHCI capability bits
> +
> +  @param[in]  PassThru  A pointer to the
> +EFI_SD_MMC_PASS_THRU_PROTOCOL 
> instance.
> +  @param[in]  ControllerHandle  The EFI_HANDLE of the controller.
> +  @param[in]  Slot  The 0 based slot index.
> +  @param[in,out]  SdMmcHcSlotCapability The SDHCI capability structure.
> +
> +  @retval EFI_SUCCESS   The override function completed successfully.
> +  @retval EFI_NOT_FOUND The specified controller or slot does not 
> exist.
> +  @retval EFI_INVALID_PARAMETER SdMmcHcSlotCapability is NULL
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI * SD_MMC_OVERRIDE_CAPABILITY) (
> +  IN  EFI_SD_MMC_PASS_THRU_PROTOCOL   *PassThru,
> +  IN  EFI_HANDLE  ControllerHandle,
> +  IN  UINT8   Slot,
> +  IN  OUT UINT64  *SdMmcHcSlotCapability
> +  );
> +
> +/**
> +
> +  Override function for SDHCI controller operations
> +
> +  @param[in]  PassThru  A pointer to the
> +EFI_SD_MMC_PASS_THRU_PROTOCOL 
> instance.
> +  @param[in]  ControllerHandle  The EFI_HANDLE of the controller.
> +  @param[in]  Slot  The 0 based slot index.
> +  @param[in,out]  HookType  The type of operation and whether the
> +hook is invoked right before (pre) or
> +right after (post)
> +
> +  @retval EFI_SUCCESS   The override function completed successfully.
> +  @retval EFI_NOT_FOUND The specified controller or slot does not 
> exist.
> +  @retval EFI_INVALID_PARAMETER HookType is invalid
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI * SD_MMC_OVERRIDE_INVOKE_HOOK) (
> +  IN  EFI_SD_MMC_PASS_THRU_PROTOCOL   *PassThru,
> +  IN  EFI_HANDLE  

Re: [edk2] [PATCH v2 1/2] MdeModulePkg: introduce SD/MMC override protocol

2017-12-04 Thread Ni, Ruiyu

On 11/30/2017 6:11 PM, Ard Biesheuvel wrote:

Many ARM based SoCs have integrated SDHCI controllers, and often,
these implementations deviate in subtle ways from the pertinent
specifications. On the one hand, these deviations are quite easy
to work around, but on the other hand, having a collection of SoC
specific workarounds in the generic driver stack is undesirable.

So let's introduce an optional SD/MMC override protocol that we
can invoke at the appropriate moments in the device initialization.
That way, the workaround itself remains platform specific, but we
can still use the generic driver stack on such platforms.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
  MdeModulePkg/Include/Protocol/SdMmcOverride.h | 103 
  MdeModulePkg/MdeModulePkg.dec |   3 +
  2 files changed, 106 insertions(+)

diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h 
b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
new file mode 100644
index ..5a5c393896f4
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
@@ -0,0 +1,103 @@
+/** @file
+  Protocol to describe overrides required to support non-standard SDHCI
+  implementations
+
+  Copyright (c) 2017, 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 __SD_MMC_OVERRIDE_H__
+#define __SD_MMC_OVERRIDE_H__
+
+#include 
+
+#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_GUID \
+  { 0xeaf9e3c1, 0xc9cd, 0x46db, { 0xa5, 0xe5, 0x5a, 0x12, 0x4c, 0x83, 0x23, 
0x23 } }
+
+#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION0x1
+
+typedef struct _SD_MMC_OVERRIDE SD_MMC_OVERRIDE;
+
+typedef enum {
+  SD_MMC_OVERRIDE_RESET_PRE_HOOK,
+  SD_MMC_OVERRIDE_RESET_POST_HOOK,
+  SD_MMC_OVERRIDE_INIT_HOST_PRE_HOOK,
+  SD_MMC_OVERRIDE_INIT_HOST_POST_HOOK,
+} SD_MMC_OVERRIDE_HOOK;
+
+/**
+
+  Override function for SDHCI capability bits
+
+  @param[in]  PassThru  A pointer to the
+EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
+  @param[in]  ControllerHandle  The EFI_HANDLE of the controller.
+  @param[in]  Slot  The 0 based slot index.
+  @param[in,out]  SdMmcHcSlotCapability The SDHCI capability structure.
+
+  @retval EFI_SUCCESS   The override function completed successfully.
+  @retval EFI_NOT_FOUND The specified controller or slot does not 
exist.
+  @retval EFI_INVALID_PARAMETER SdMmcHcSlotCapability is NULL
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI * SD_MMC_OVERRIDE_CAPABILITY) (
+  IN  EFI_SD_MMC_PASS_THRU_PROTOCOL   *PassThru,
+  IN  EFI_HANDLE  ControllerHandle,
+  IN  UINT8   Slot,
+  IN  OUT UINT64  *SdMmcHcSlotCapability
+  );
+
+/**
+
+  Override function for SDHCI controller operations
+
+  @param[in]  PassThru  A pointer to the
+EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
+  @param[in]  ControllerHandle  The EFI_HANDLE of the controller.
+  @param[in]  Slot  The 0 based slot index.
+  @param[in,out]  HookType  The type of operation and whether the
+hook is invoked right before (pre) or
+right after (post)
+
+  @retval EFI_SUCCESS   The override function completed successfully.
+  @retval EFI_NOT_FOUND The specified controller or slot does not 
exist.
+  @retval EFI_INVALID_PARAMETER HookType is invalid
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI * SD_MMC_OVERRIDE_INVOKE_HOOK) (
+  IN  EFI_SD_MMC_PASS_THRU_PROTOCOL   *PassThru,
+  IN  EFI_HANDLE  ControllerHandle,
+  IN  UINT8   Slot,
+  IN  SD_MMC_OVERRIDE_HOOKHookType
+  );
+
+struct _SD_MMC_OVERRIDE {
+  //
+  // Protocol version of this implementation
+  //
+  UINTN   Version;
+  //
+  // Callback to override SD/MMC host controller capability bits
+  //
+  SD_MMC_OVERRIDE_CAPABILITY  OverrideCapability;
+  //
+  // Callback to invoke SD/MMC override hooks
+  //
+  SD_MMC_OVERRIDE_INVOKE_HOOK InvokeHook;
+};
+
+extern EFI_GUID gEdkiiSdMmcOverrideProtocolGuid;
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 856d67aceb21..64ceea029f94 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -562,6 +562,9 @@ [Protocols]
## Include/Protocol/SmmMemoryAttribute.h

Re: [edk2] [Patch] NetworkPkg: Update IScsiDxe to pass XCODE build

2017-12-04 Thread Wu, Jiaxin
Reviewed-by: Jiaxin Wu 

Thanks,
Jiaxin

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Liming Gao
> Sent: Tuesday, November 28, 2017 11:19 AM
> To: edk2-devel@lists.01.org
> Cc: Liang, Vincent 
> Subject: [edk2] [Patch] NetworkPkg: Update IScsiDxe to pass XCODE build
> 
> Fix the warning equality comparison with extraneous parentheses
> [-Werror,-Wparentheses-equality].
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Liang Vincent 
> ---
>  NetworkPkg/IScsiDxe/IScsiDhcp.c| 2 +-
>  NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp.c
> b/NetworkPkg/IScsiDxe/IScsiDhcp.c
> index 6587a05..309ce0d 100644
> --- a/NetworkPkg/IScsiDxe/IScsiDhcp.c
> +++ b/NetworkPkg/IScsiDxe/IScsiDhcp.c
> @@ -266,7 +266,7 @@ IScsiDhcpSelectOffer (
>  break;
>}
> 
> -  if ((Index == OptionCount)) {
> +  if (Index == OptionCount) {
>  Status = EFI_NOT_READY;
>}
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
> b/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
> index f971244..90e26d4 100644
> --- a/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
> +++ b/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
> @@ -1,7 +1,7 @@
>  /** @file
>The implementation of EFI_EXT_SCSI_PASS_THRU_PROTOCOL.
> 
> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2017, Intel Corporation. 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
> @@ -219,7 +219,7 @@ IScsiExtScsiPassThruBuildDevicePath (
>EFI_DEV_PATH  *Node;
>UINTN DevPathNodeLen;
> 
> -  if ((DevicePath == NULL)) {
> +  if (DevicePath == NULL) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> --
> 2.8.0.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/4] NetworkPkg/DnsDxe: Avoid to access the freed memory buffer.

2017-12-04 Thread Jiaxin Wu
The HostNameToIp() is a asynchronous function, so the caller
may free the HostName buffer immediately once HostNameToIp()
is returned. Then DNS driver may access the freed memory buffer
later.

This patch is to fix above issue.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/DnsDxe/DnsProtocol.c | 69 +++--
 1 file changed, 39 insertions(+), 30 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c
index df737dc..1fcaabd 100644
--- a/NetworkPkg/DnsDxe/DnsProtocol.c
+++ b/NetworkPkg/DnsDxe/DnsProtocol.c
@@ -462,13 +462,19 @@ Dns4HostNameToIp (
 Status = EFI_OUT_OF_RESOURCES;
 goto ON_EXIT;
   }
   
   TokenEntry->PacketToLive = Token->RetryInterval;
-  TokenEntry->QueryHostName = HostName;
   TokenEntry->Token = Token;
-
+  TokenEntry->QueryHostName = AllocateZeroPool (StrSize (HostName));
+  if (TokenEntry->QueryHostName == NULL) {
+Status = EFI_OUT_OF_RESOURCES;
+goto ON_EXIT;
+  }
+  
+  CopyMem (TokenEntry->QueryHostName, HostName, StrSize (HostName));
+  
   //
   // Construct QName.
   //
   QueryName = NetLibCreateDnsQName (TokenEntry->QueryHostName);
   if (QueryName == NULL) {
@@ -478,49 +484,48 @@ Dns4HostNameToIp (
   
   //
   // Construct DNS Query Packet.
   //
   Status = ConstructDNSQuery (Instance, QueryName, DNS_TYPE_A, DNS_CLASS_INET, 
);
-  if (EFI_ERROR (Status)) {
-if (TokenEntry != NULL) {
-  FreePool (TokenEntry);
-}
-
+  if (EFI_ERROR (Status)) { 
 goto ON_EXIT;
   }
 
   ASSERT (Packet != NULL);
 
   //
   // Save the token into the Dns4TxTokens map.
   //
   Status = NetMapInsertTail (>Dns4TxTokens, TokenEntry, Packet);
   if (EFI_ERROR (Status)) {
-if (TokenEntry != NULL) {
-  FreePool (TokenEntry);
-}
-
-NetbufFree (Packet);
-
 goto ON_EXIT;
   }
   
   //
   // Dns Query Ip
   //
   Status = DoDnsQuery (Instance, Packet);
   if (EFI_ERROR (Status)) {
 Dns4RemoveTokenEntry (>Dns4TxTokens, TokenEntry);
+  }
+  
+ON_EXIT:
 
+  if (EFI_ERROR (Status)) {
 if (TokenEntry != NULL) {
+  if (TokenEntry->QueryHostName != NULL) {
+FreePool (TokenEntry->QueryHostName);
+  }
+  
   FreePool (TokenEntry);
 }
 
-NetbufFree (Packet);
+if (Packet != NULL) {
+  NetbufFree (Packet);
+}
   }
   
-ON_EXIT:
   if (QueryName != NULL) {
 FreePool (QueryName);
   }
   
   gBS->RestoreTPL (OldTpl);
@@ -1299,13 +1304,18 @@ Dns6HostNameToIp (
 Status = EFI_OUT_OF_RESOURCES;
 goto ON_EXIT;
   }
   
   TokenEntry->PacketToLive = Token->RetryInterval;
-  TokenEntry->QueryHostName = HostName;
   TokenEntry->Token = Token;
-
+  TokenEntry->QueryHostName = AllocateZeroPool (StrSize (HostName));
+  if (TokenEntry->QueryHostName == NULL) {
+Status = EFI_OUT_OF_RESOURCES;
+goto ON_EXIT;
+  }
+  
+  CopyMem (TokenEntry->QueryHostName, HostName, StrSize (HostName));
 
   //
   // Construct QName.
   //
   QueryName = NetLibCreateDnsQName (TokenEntry->QueryHostName);
@@ -1317,48 +1327,47 @@ Dns6HostNameToIp (
   //
   // Construct DNS Query Packet.
   //
   Status = ConstructDNSQuery (Instance, QueryName, DNS_TYPE_, 
DNS_CLASS_INET, );
   if (EFI_ERROR (Status)) {
-if (TokenEntry != NULL) {
-  FreePool (TokenEntry);
-}
-
 goto ON_EXIT;
   }
 
   ASSERT (Packet != NULL);
 
   //
   // Save the token into the Dns6TxTokens map.
   //
   Status = NetMapInsertTail (>Dns6TxTokens, TokenEntry, Packet);
   if (EFI_ERROR (Status)) {
-if (TokenEntry != NULL) {
-  FreePool (TokenEntry);
-}
-
-NetbufFree (Packet);
-
 goto ON_EXIT;
   }
   
   //
   // Dns Query Ip
   //
   Status = DoDnsQuery (Instance, Packet);
   if (EFI_ERROR (Status)) {
 Dns6RemoveTokenEntry (>Dns6TxTokens, TokenEntry);
-
+  }
+  
+ON_EXIT:
+
+  if (EFI_ERROR (Status)) {
 if (TokenEntry != NULL) {
+  if (TokenEntry->QueryHostName != NULL) {
+FreePool (TokenEntry->QueryHostName);
+  }
+  
   FreePool (TokenEntry);
 }
 
-NetbufFree (Packet);
+if (Packet != NULL) {
+  NetbufFree (Packet);
+}
   }
   
-ON_EXIT:
   if (QueryName != NULL) {
 FreePool (QueryName);
   }
   
   gBS->RestoreTPL (OldTpl);
-- 
1.9.5.msysgit.1

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


[edk2] [Patch 1/4] NetworkPkg/DnsDxe: Remove the unnecessary if condition check in DNS.Config

2017-12-04 Thread Jiaxin Wu
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/DnsDxe/DnsProtocol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c
index bd189ae..7435607 100644
--- a/NetworkPkg/DnsDxe/DnsProtocol.c
+++ b/NetworkPkg/DnsDxe/DnsProtocol.c
@@ -254,11 +254,11 @@ Dns4Configure (
 Status = Dns4CopyConfigure (>Dns4CfgData, DnsConfigData);
 if (EFI_ERROR (Status)) {
   goto ON_EXIT;
 }
 
-if (DnsConfigData->DnsServerListCount == 0 || DnsConfigData->DnsServerList 
== NULL) {
+if (DnsConfigData->DnsServerListCount == 0) {
   gBS->RestoreTPL (OldTpl); 
   
   //
   // The DNS instance will retrieve DNS server from DHCP Server
   //
@@ -1076,11 +1076,11 @@ Dns6Configure (
 Status = Dns6CopyConfigure (>Dns6CfgData, DnsConfigData);
 if (EFI_ERROR (Status)) {
   goto ON_EXIT;
 }
 
-if (DnsConfigData->DnsServerCount == 0 || DnsConfigData->DnsServerList == 
NULL) {
+if (DnsConfigData->DnsServerCount == 0) {
   gBS->RestoreTPL (OldTpl);
 
   //
   //The DNS instance will retrieve DNS server from DHCP Server.
   //
-- 
1.9.5.msysgit.1

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


[edk2] [Patch 2/4] NetworkPkg/DnsDxe: Update RetryCount/RetryInterval to comply with UEFI spec.

2017-12-04 Thread Jiaxin Wu
According to UEFI spec:
"Retry number if no response received after RetryInterval. If zero, use
the parameter configured through Dns.Configure() interface."
"Minimum interval of retry is 2 second. If the retry interval is less
than 2 second, then use the 2 second. If zero, use the parameter configured
through Dns.Configure() interface."

For both DNS.HostNameToIp and DNS.GeneralLookUp, the value of RetryCount /
RetryInterval need to be updated to comply with UEFI spec.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/DnsDxe/DnsDriver.h   |   4 +-
 NetworkPkg/DnsDxe/DnsImpl.c |   4 +-
 NetworkPkg/DnsDxe/DnsImpl.h |   5 +-
 NetworkPkg/DnsDxe/DnsProtocol.c | 102 
 4 files changed, 67 insertions(+), 48 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsDriver.h b/NetworkPkg/DnsDxe/DnsDriver.h
index 6632bb2..49f6a1d 100644
--- a/NetworkPkg/DnsDxe/DnsDriver.h
+++ b/NetworkPkg/DnsDxe/DnsDriver.h
@@ -1,9 +1,9 @@
 /** @file
 The header files of the driver binding and service binding protocol for DnsDxe 
driver.
 
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. 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
 
@@ -87,12 +87,10 @@ struct _DNS_INSTANCE {
   EFI_IP_ADDRESSSessionDnsServer;
 
   NET_MAP   Dns4TxTokens;
   NET_MAP   Dns6TxTokens;
 
-  UINT32MaxRetry;
-
   UDP_IO*UdpIo;
 };
 
 typedef struct {
   EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;
diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c
index ea3d27d..7c236a0 100644
--- a/NetworkPkg/DnsDxe/DnsImpl.c
+++ b/NetworkPkg/DnsDxe/DnsImpl.c
@@ -1946,11 +1946,11 @@ DnsOnTimerRetransmit (
 
 //
 // Retransmit the packet if haven't reach the maxmium retry count,
 // otherwise exit the transfer.
 //
-if (++Dns4TokenEntry->Token->RetryCount < Instance->MaxRetry) {
+if (++Dns4TokenEntry->RetryCounting <= 
Dns4TokenEntry->Token->RetryCount) {
   DnsRetransmit (Instance, (NET_BUF *)ItemNetMap->Value);
   EntryNetMap = EntryNetMap->ForwardLink;
 } else {
   //
   // Maximum retries reached, clean the Token up.
@@ -1990,11 +1990,11 @@ DnsOnTimerRetransmit (
 
 //
 // Retransmit the packet if haven't reach the maxmium retry count,
 // otherwise exit the transfer.
 //
-if (++Dns6TokenEntry->Token->RetryCount < Instance->MaxRetry) {
+if (++Dns6TokenEntry->RetryCounting <= 
Dns6TokenEntry->Token->RetryCount) {
   DnsRetransmit (Instance, (NET_BUF *) ItemNetMap->Value);
   EntryNetMap = EntryNetMap->ForwardLink;
 } else {
   //
   // Maximum retries reached, clean the Token up.
diff --git a/NetworkPkg/DnsDxe/DnsImpl.h b/NetworkPkg/DnsDxe/DnsImpl.h
index 5fa7f24..3c6296c 100644
--- a/NetworkPkg/DnsDxe/DnsImpl.h
+++ b/NetworkPkg/DnsDxe/DnsImpl.h
@@ -1,9 +1,9 @@
 /** @file
 DnsDxe support functions implementation.

-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. 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
 
@@ -84,11 +84,10 @@ extern EFI_DNS6_PROTOCOL mDns6Protocol;
 #define DNS_STATE_UNCONFIGED 0
 #define DNS_STATE_CONFIGED   1
 #define DNS_STATE_DESTROY2
 
 #define DNS_DEFAULT_TIMEOUT  2
-#define DNS_DEFAULT_RETRY3
 
 #define DNS_TIME_TO_GETMAP   5
 
 #pragma pack(1)
 
@@ -113,18 +112,20 @@ typedef struct {
   LIST_ENTRY AllServerLink;
   EFI_IPv6_ADDRESS   Dns6ServerIp;   
 } DNS6_SERVER_IP;
 
 typedef struct {
+  UINT32 RetryCounting;
   UINT32 PacketToLive;
   CHAR16 *QueryHostName;
   EFI_IPv4_ADDRESS   QueryIpAddress;
   BOOLEANGeneralLookUp;
   EFI_DNS4_COMPLETION_TOKEN  *Token;
 } DNS4_TOKEN_ENTRY;
 
 typedef struct {
+  UINT32 RetryCounting;
   UINT32 PacketToLive;
   CHAR16 *QueryHostName;
   EFI_IPv6_ADDRESS   QueryIpAddress;
   BOOLEANGeneralLookUp;
   EFI_DNS6_COMPLETION_TOKEN  *Token;
diff --git 

[edk2] [Patch 0/4] NetworkPkg/DnsDxe: Fix several issues in DnsDxe driver.

2017-12-04 Thread Jiaxin Wu
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 

Jiaxin Wu (4):
  NetworkPkg/DnsDxe: Remove the unnecessary if condition check in DNS.Config
  NetworkPkg/DnsDxe: Update RetryCount/RetryInterval to comply with UEFI spec.
  NetworkPkg/DnsDxe: Fix the potential memory leak issue.
  NetworkPkg/DnsDxe: Avoid to access the freed memory buffer.

 NetworkPkg/DnsDxe/DnsDriver.h   |   4 +-
 NetworkPkg/DnsDxe/DnsImpl.c | 135 ---
 NetworkPkg/DnsDxe/DnsImpl.h |   5 +-
 NetworkPkg/DnsDxe/DnsProtocol.c | 175 +++-
 4 files changed, 229 insertions(+), 90 deletions(-)

-- 
1.9.5.msysgit.1

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


[edk2] [Patch 3/4] NetworkPkg/DnsDxe: Fix the potential memory leak issue.

2017-12-04 Thread Jiaxin Wu
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/DnsDxe/DnsImpl.c | 131 
 1 file changed, 121 insertions(+), 10 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c
index 7c236a0..7057bfb 100644
--- a/NetworkPkg/DnsDxe/DnsImpl.c
+++ b/NetworkPkg/DnsDxe/DnsImpl.c
@@ -790,10 +790,14 @@ UpdateDns4Cache (
   if (DeleteFlag) {
 //
 // Delete matching DNS Cache entry
 //
 RemoveEntryList (>AllCacheLink);
+
+FreePool (Item->DnsCache.HostName);
+FreePool (Item->DnsCache.IpAddress);
+FreePool (Item);
 
 return EFI_SUCCESS;
   } else if (Override) {
 //
 // Update this one
@@ -817,17 +821,20 @@ UpdateDns4Cache (
   
   InitializeListHead (>AllCacheLink);

   NewDnsCache->DnsCache.HostName = AllocatePool (StrSize 
(DnsCacheEntry.HostName));
   if (NewDnsCache->DnsCache.HostName == NULL) { 
+FreePool (NewDnsCache);
 return EFI_OUT_OF_RESOURCES;
   }
   
   CopyMem (NewDnsCache->DnsCache.HostName, DnsCacheEntry.HostName, StrSize 
(DnsCacheEntry.HostName));
 
   NewDnsCache->DnsCache.IpAddress = AllocatePool (sizeof (EFI_IPv4_ADDRESS));
-  if (NewDnsCache->DnsCache.IpAddress == NULL) { 
+  if (NewDnsCache->DnsCache.IpAddress == NULL) {
+FreePool (NewDnsCache->DnsCache.HostName);
+FreePool (NewDnsCache);
 return EFI_OUT_OF_RESOURCES;
   }
 
   CopyMem (NewDnsCache->DnsCache.IpAddress, DnsCacheEntry.IpAddress, sizeof 
(EFI_IPv4_ADDRESS));
 
@@ -882,10 +889,14 @@ UpdateDns6Cache (
 //
 // Delete matching DNS Cache entry
 //
 RemoveEntryList (>AllCacheLink);
 
+FreePool (Item->DnsCache.HostName);
+FreePool (Item->DnsCache.IpAddress);
+FreePool (Item);
+
 return EFI_SUCCESS;
   } else if (Override) {
 //
 // Update this one
 //
@@ -908,17 +919,20 @@ UpdateDns6Cache (
   
   InitializeListHead (>AllCacheLink);

   NewDnsCache->DnsCache.HostName = AllocatePool (StrSize 
(DnsCacheEntry.HostName));
   if (NewDnsCache->DnsCache.HostName == NULL) { 
+FreePool (NewDnsCache);
 return EFI_OUT_OF_RESOURCES;
   }
   
   CopyMem (NewDnsCache->DnsCache.HostName, DnsCacheEntry.HostName, StrSize 
(DnsCacheEntry.HostName));
 
   NewDnsCache->DnsCache.IpAddress = AllocatePool (sizeof (EFI_IPv6_ADDRESS));
-  if (NewDnsCache->DnsCache.IpAddress == NULL) { 
+  if (NewDnsCache->DnsCache.IpAddress == NULL) {
+FreePool (NewDnsCache->DnsCache.HostName);
+FreePool (NewDnsCache);
 return EFI_OUT_OF_RESOURCES;
   }
   
   CopyMem (NewDnsCache->DnsCache.IpAddress, DnsCacheEntry.IpAddress, sizeof 
(EFI_IPv6_ADDRESS));
 
@@ -1254,31 +1268,31 @@ ParseDnsResponse (
 
 if (Dns4TokenEntry->GeneralLookUp) {
   //
   // It's the GeneralLookUp querying.
   //
-  Dns4TokenEntry->Token->RspData.GLookupData = AllocatePool (sizeof 
(DNS_RESOURCE_RECORD));
+  Dns4TokenEntry->Token->RspData.GLookupData = AllocateZeroPool (sizeof 
(DNS_RESOURCE_RECORD));
   if (Dns4TokenEntry->Token->RspData.GLookupData == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto ON_EXIT;
   }
-  Dns4TokenEntry->Token->RspData.GLookupData->RRList = AllocatePool 
(DnsHeader->AnswersNum * sizeof (DNS_RESOURCE_RECORD));
+  Dns4TokenEntry->Token->RspData.GLookupData->RRList = AllocateZeroPool 
(DnsHeader->AnswersNum * sizeof (DNS_RESOURCE_RECORD));
   if (Dns4TokenEntry->Token->RspData.GLookupData->RRList == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto ON_EXIT;
   }
 } else {
   //
   // It's not the GeneralLookUp querying. Check the Query type.
   //
   if (QuerySection->Type == DNS_TYPE_A) {
-Dns4TokenEntry->Token->RspData.H2AData = AllocatePool (sizeof 
(DNS_HOST_TO_ADDR_DATA));
+Dns4TokenEntry->Token->RspData.H2AData = AllocateZeroPool (sizeof 
(DNS_HOST_TO_ADDR_DATA));
 if (Dns4TokenEntry->Token->RspData.H2AData == NULL) {
   Status = EFI_OUT_OF_RESOURCES;
   goto ON_EXIT;
 }
-Dns4TokenEntry->Token->RspData.H2AData->IpList = AllocatePool 
(DnsHeader->AnswersNum * sizeof (EFI_IPv4_ADDRESS));
+Dns4TokenEntry->Token->RspData.H2AData->IpList = AllocateZeroPool 
(DnsHeader->AnswersNum * sizeof (EFI_IPv4_ADDRESS));
 if (Dns4TokenEntry->Token->RspData.H2AData->IpList == NULL) {
   Status = EFI_OUT_OF_RESOURCES;
   goto ON_EXIT;
 }
   } else {
@@ -1291,31 +1305,31 @@ ParseDnsResponse (
 
 if (Dns6TokenEntry->GeneralLookUp) {
   //
   // It's the GeneralLookUp querying.
   //
-  Dns6TokenEntry->Token->RspData.GLookupData = AllocatePool (sizeof 
(DNS_RESOURCE_RECORD));
+  

Re: [edk2] [PATCH v3 00/11] Implement stack guard feature

2017-12-04 Thread Wang, Jian J
Jiewen,

Thanks for the comments.

1) It's only used for Ex version of the API so I added Ex. But I don't have 
strong opinion on the name.
2) Do you mean we need to use separate the definition for IA32 and X64 even 
they share the same data?
3) Sure.
4) I'm not sure if it's necessary. But a version field won't do any harm.
5) You're right it's just for exceptions needing stack switch. I'll change the 
wording.
6) Yes. ExceptionTss is better.
7) You're right. I'll add sanity checks.
8) Yes. I think current data meets SMM requirement. Let me know if you find 
anything missing.

Jian
> -Original Message-
> From: Yao, Jiewen
> Sent: Tuesday, December 05, 2017 10:03 AM
> To: Wang, Jian J ; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH v3 00/11] Implement stack guard feature
> 
> Good enhancement. I think it resolved my compatibility concern for the old 
> API.
> 
> Some comment:
> 
> 1) Can we just use CPU_EXCEPTION_INIT_DATA instead of
> CPU_EXCEPTION_INIT_DATA_EX? I am not sure why we add _EX here.
> 
> 2) Is CPU_EXCEPTION_INIT_DATA_EX for IA32 only or both IA32/X64? I found
> "Ia32" may bring confusing here. See EFI_DEBUG_SUPPORT_PROTOCOL, we
> have Ia32 for IA32 arch, X64 for X64 arch.
> 
> //
> // Flag to indicate if default handlers should be initialized or not.
> //
> BOOLEAN   InitDefaultHandlers;
>   } Ia32;
> } CPU_EXCEPTION_INIT_DATA_EX;
> 
> 3) Can we add IdtTableSize in CPU_EXCEPTION_INIT_DATA_EX?
> 
> 4) Can we add Version field in CPU_EXCEPTION_INIT_DATA_EX? I am not sure if
> we need add more entry later.
> 
> 5) You mentioned "KnownGoodStackTop is for *ALL* exceptions".
> Does ALL here mean StackSwitchExceptionNumber, or arch specific number such
> as 0x20 for X86 system?
> I think StackSwitchExceptionNumber is enough.
> 
> 6) There might be more than one TSS entry in GDT.
> Does TssDesc/Tss in CPU_EXCEPTION_INIT_DATA_EX mean the exception Tss?
> (normal TSS does not need be reported here)
> If so, I suggest we use ExceptionTss as the keyword.
> 
> 7) Below code may cause buffer overrun on IST.
> 
>   for (Index = 0; Index < StackSwitchData->Ia32.StackSwitchExceptionNumber;
> ++Index) {
> //
> // Fixup IST
> //
> Tss->IST[Index] = StackTop;
> 
> I suggest we add some basic check for StackSwitchExceptionNumber.
> 
> 8) Do you think we need mention the TssDesc/Tss size requirement for that?
> 
>   TssDesc = StackSwitchData->Ia32.TssDesc;
>   Tss = StackSwitchData->Ia32.Tss;
>   for (Index = 0; Index < StackSwitchData->Ia32.StackSwitchExceptionNumber;
> ++Index) {
> TssDesc += 1;
> Tss += 1;
> 
> I suggest we add TssDescSize and TssSize in CPU_EXCEPTION_INIT_DATA_EX
> and check the size in the code.
> 
> 9) Last but not least important, have you evaluated if current
> CPU_EXCEPTION_INIT_DATA_EX is enough for SMM version stack guard
> exception?
> 
> 
> Thank you
> Yao Jiewen
> 
> 
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jian
> J
> > Wang
> > Sent: Friday, December 1, 2017 10:37 AM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH v3 00/11] Implement stack guard feature
> >
> > > v3:
> > >  a. Change new API InitializeCpuExceptionStackSwitchHandlers() to
> > > InitializeCpuExceptionHandlersEx(). Related code are updated
> > accordingly.
> > >  b. Move EXCEPTION_STACK_SWITCH_DATA to CpuExceptionHandlerLib.h
> > > and change the name to CPU_EXCEPTION_INIT_DATA_EX for the sake
> > > of the API name change.
> > >  c. Add more general macros in BaseLib.h.
> > >  d. Add dummy implementation of InitializeCpuExceptionHandlersEx for
> > > SEC, PEI and SMM but implement a full version for DXE.
> > >  e. Add dummy InitializeCpuExceptionHandlersEx for ARM's
> > CpuExceptionHandlerLib
> > > and NULL version of CpuExceptionHandlerLib
> > >  f. Call InitializeCpuExceptionHandlersEx() in DxeMain instead of
> > > InitializeCpuExceptionHandlers().
> >
> >
> > > v2:
> > >  a. Introduce and implement new API
> > InitializeCpuExceptionStackSwitchHandlers().
> > >  b. Add stack switch related general definitions of IA32 in BaseLib.h.
> > >  c. Add two new PCDs to configure exception vector list and stack size.
> > >  d. Add code to save/restore GDTR, IDTR and TR for AP.
> > >  e. Refactor exception handler code for stack switch.
> > >  f. Add code to setup stack switch for AP besides BSP.
> >
> > Stack guard feature makes use of paging mechanism to monitor if there's a
> > stack overflow occurred during boot. A new PCD PcdCpuStackGuard is added
> to
> > enable/disable this feature. PCD PcdCpuStackSwitchExceptionList and
> > PcdCpuKnownGoodStackSize are introduced to configure the required
> > exceptions
> > and stack size.
> >
> > If this feature is enabled, DxeIpl will setup page tables and set page where
> > the stack bottom is at to be NON-PRESENT. If stack overflow occurs, Page
> > Fault exception will be 

Re: [edk2] [PATCH 0/2] MdeModulePkg: Remove unnecessary parentheses in 'if'

2017-12-04 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Wu, Hao A
> Sent: Tuesday, December 5, 2017 1:18 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A ; Gao, Liming ; Ni, 
> Ruiyu ; Zeng, Star
> ; Dong, Eric ; Bi, Dandan 
> 
> Subject: [PATCH 0/2] MdeModulePkg: Remove unnecessary parentheses in 'if'
> 
> The series removes unnecessary parentheses in 'if' statements.
> 
> Cc: Liming Gao 
> Cc: Ruiyu Ni 
> Cc: Star Zeng 
> Cc: Eric Dong 
> Cc: Dandan Bi 
> 
> Hao Wu (2):
>   MdeModulePkg/PartitionDxe: Remove unnecessary parentheses in 'if'
>   MdeModulePkg/DisplayEngineDxe: Remove unnecessary parentheses in 'if'
> 
>  MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 2 +-
>  MdeModulePkg/Universal/DisplayEngineDxe/Popup.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> --
> 2.12.0.windows.1

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


Re: [edk2] [PATCH v2 0/4] Enable page table write protection

2017-12-04 Thread Wang, Jian J
I haven't got time to do it in automatic way. V1 may need a shell app to
check it, but current implementation might not need it because we now
have 2 or 3 continuous 2MB pages to hold all page tables. We just
need to verify the page attribute of those 2 or 3 page tables. It's easy
to do it in a JTAG debugger manually.

> -Original Message-
> From: Yao, Jiewen
> Sent: Tuesday, December 05, 2017 10:32 AM
> To: Wang, Jian J ; edk2-devel@lists.01.org
> Cc: Yao, Jiewen 
> Subject: RE: [edk2] [PATCH v2 0/4] Enable page table write protection
> 
> Hi Jian
> In V1 review, I suggest to test in UEFI shell env to make sure all page table 
> is
> read only, with PageTable split in CPU driver.
> 
> May I know if that is done?
> 
> Thank you
> Yao Jiewen
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jian
> J
> > Wang
> > Sent: Monday, December 4, 2017 4:36 PM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH v2 0/4] Enable page table write protection
> >
> > > v2 changes:
> > >  a. Enable protection on any newly added page table after DxeIpl.
> > >  b. Introduce page table pool concept to make page table allocation
> > > and protection easier and error free.
> >
> > Write Protect feature (CR0.WP) is always enabled in driver
> UefiCpuPkg/CpuDxe.
> > But the memory pages used for page table are not set as read-only in the
> driver
> > DxeIplPeim, after the paging is setup. This might jeopardize the page table
> > integrity if there's buffer overflow occured in other part of system.
> >
> > This patch series will change this situation by clearing R/W bit in page 
> > attribute
> > of the pages used as page table.
> >
> > Validation works include booting Windows (10/server 2016) and Linux
> > (Fedora/Ubuntu)
> > on OVMF and Intel real platform.
> >
> > Jian J Wang (4):
> >   MdeModulePkg/MdeModulePkg.dec: Add new PCDs and Guid
> >   MdeModulePkg/PageTablePool.h: Page table pool GUID definition file
> >   MdeModulePkg/DxeIpl: Mark page table as read-only
> >   UefiCpuPkg/CpuDxe: Enable protection for newly added page table
> >
> >  MdeModulePkg/Core/DxeIplPeim/DxeIpl.h|  34 +++
> >  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf  |   3 +
> >  MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c  |   8 +-
> >  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 315
> > +-
> >  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.h |  15 ++
> >  MdeModulePkg/Include/Guid/PageTablePool.h|  53 
> >  MdeModulePkg/MdeModulePkg.dec|  28 ++
> >  UefiCpuPkg/CpuDxe/CpuDxe.c   |  17 +-
> >  UefiCpuPkg/CpuDxe/CpuDxe.h   |   2 +
> >  UefiCpuPkg/CpuDxe/CpuDxe.inf |   3 +
> >  UefiCpuPkg/CpuDxe/CpuPageTable.c | 329
> > ++-
> >  UefiCpuPkg/CpuDxe/CpuPageTable.h |  22 ++
> >  12 files changed, 816 insertions(+), 13 deletions(-)
> >  create mode 100644 MdeModulePkg/Include/Guid/PageTablePool.h
> >
> > --
> > 2.14.1.windows.1
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.

2017-12-04 Thread Fu Siyuan
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan 
Cc: Wu Jiaxin 
Cc: Ye Ting 
---
 MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c 
b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
index 17183e1a6c..2e59b680bf 100644
--- a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
+++ b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.
   It provides the helper routines to access TCP service.
 
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. 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
@@ -585,6 +585,11 @@ TcpIoConnect (
   }
 
   if (!TcpIo->IsConnDone) {
+if (TcpIo->TcpVersion == TCP_VERSION_4) {
+  Tcp4->Cancel (Tcp4, >ConnToken.Tcp4Token.CompletionToken);
+} else {
+  Tcp6->Cancel (Tcp6, >ConnToken.Tcp6Token.CompletionToken);
+}
 Status = EFI_TIMEOUT;
   } else {
 Status = TcpIo->ConnToken.Tcp4Token.CompletionToken.Status;
@@ -655,6 +660,11 @@ TcpIoAccept (
   }
 
   if (!TcpIo->IsListenDone) {
+if (TcpIo->TcpVersion == TCP_VERSION_4) {
+  Tcp4->Cancel (Tcp4, >ListenToken.Tcp4Token.CompletionToken);
+} else {
+  Tcp6->Cancel (Tcp6, >ListenToken.Tcp6Token.CompletionToken);
+}
 Status = EFI_TIMEOUT;
   } else {
 Status = TcpIo->ListenToken.Tcp4Token.CompletionToken.Status;
-- 
2.13.0.windows.1

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


[edk2] [Patch] MdeModulePkg/TcpIoLib: Check input Timeout before calling CheckEvent() service.

2017-12-04 Thread Fu Siyuan
For TcpIoConnect() and TcpIoAccept(), this patch adds the check for Timeout 
event
before calling CheckEvent() service so as to avoid the unnecessary function 
call.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan 
Cc: Wu Jiaxin 
Cc: Ye Ting 
---
 MdeModulePkg/Include/Library/TcpIoLib.h| 14 +++---
 MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c | 20 ++--
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/MdeModulePkg/Include/Library/TcpIoLib.h 
b/MdeModulePkg/Include/Library/TcpIoLib.h
index 2871f6747e..22629dbcd5 100644
--- a/MdeModulePkg/Include/Library/TcpIoLib.h
+++ b/MdeModulePkg/Include/Library/TcpIoLib.h
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.
   It provides the helper routines to access TCP service.
 
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. 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
@@ -144,7 +144,7 @@ TcpIoDestroySocket (
   Connect to the other endpoint of the TCP socket.
 
   @param[in, out]  TcpIo The TcpIo wrapping the TCP socket.
-  @param[in]   Timeout   The time to wait for connection done.
+  @param[in]   Timeout   The time to wait for connection done. Set to NULL 
for infinite wait.
   
   @retval EFI_SUCCESSConnect to the other endpoint of the TCP 
socket
  successfully.
@@ -160,14 +160,14 @@ EFI_STATUS
 EFIAPI
 TcpIoConnect (
   IN OUT TCP_IO *TcpIo,
-  IN EFI_EVENT  Timeout
+  IN EFI_EVENT  TimeoutOPTIONAL
   );
 
 /**
   Accept the incomding request from the other endpoint of the TCP socket.
 
   @param[in, out]  TcpIo The TcpIo wrapping the TCP socket.
-  @param[in]   Timeout   The time to wait for connection done.
+  @param[in]   Timeout   The time to wait for connection done. Set to NULL 
for infinite wait.
 
   
   @retval EFI_SUCCESSConnect to the other endpoint of the TCP 
socket
@@ -185,7 +185,7 @@ EFI_STATUS
 EFIAPI
 TcpIoAccept (
   IN OUT TCP_IO *TcpIo,
-  IN EFI_EVENT  Timeout
+  IN EFI_EVENT  TimeoutOPTIONAL
   );
   
 /**
@@ -229,7 +229,7 @@ TcpIoTransmit (
   @param[in]   Packet  The buffer to hold the data copy from the 
socket rx buffer.
   @param[in]   AsyncMode   Is this receive asyncronous or not.
   @param[in]   Timeout The time to wait for receiving the amount of 
data the Packet
-   can hold.
+   can hold. Set to NULL for infinite wait.
 
   @retval EFI_SUCCESSThe required amount of data is received from 
the socket.
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
@@ -246,7 +246,7 @@ TcpIoReceive (
   IN OUT TCP_IO *TcpIo,
   IN NET_BUF*Packet,
   IN BOOLEANAsyncMode,
-  IN EFI_EVENT  Timeout
+  IN EFI_EVENT  Timeout   OPTIONAL
   );
 
 #endif
diff --git a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c 
b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
index 17183e1a6c..a7637579f2 100644
--- a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
+++ b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.
   It provides the helper routines to access TCP service.
 
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. 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
@@ -530,7 +530,7 @@ TcpIoDestroySocket (
   Connect to the other endpoint of the TCP socket.
 
   @param[in, out]  TcpIo The TcpIo wrapping the TCP socket.
-  @param[in]   Timeout   The time to wait for connection done.
+  @param[in]   Timeout   The time to wait for connection done. Set to NULL 
for infinite wait.
   
   @retval EFI_SUCCESSConnect to the other endpoint of the TCP 
socket
  successfully.
@@ -546,7 +546,7 @@ EFI_STATUS
 EFIAPI
 TcpIoConnect (
   IN OUT TCP_IO *TcpIo,
-  IN EFI_EVENT  Timeout
+  IN EFI_EVENT  TimeoutOPTIONAL
   )
 {
   EFI_TCP4_PROTOCOL *Tcp4;
@@ -576,7 +576,7 @@ TcpIoConnect (
 return Status;
   }
 
-  while (!TcpIo->IsConnDone && EFI_ERROR (gBS->CheckEvent (Timeout))) {
+  while (!TcpIo->IsConnDone && ((Timeout == NULL) || EFI_ERROR 
(gBS->CheckEvent 

Re: [edk2] [PATCH v2 0/4] Enable page table write protection

2017-12-04 Thread Wang, Jian J
It's for sharing the pool between the DxeIpl and CpuDxe. If we don't care about 
wasting a little bit memory, it's ok to drop this definition. CpuDxe can reserve
a block of memory for page table for its own uses.

> -Original Message-
> From: Yao, Jiewen
> Sent: Tuesday, December 05, 2017 10:27 AM
> To: Wang, Jian J ; Zeng, Star ;
> edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Dong, Eric 
> Subject: RE: [edk2] [PATCH v2 0/4] Enable page table write protection
> 
> I do not suggest we define PAGE_TABLE_POOL_HEADER.
> If we can figure out other way, that will be better.
> 
> Thank you
> Yao Jiewen
> 
> 
> > -Original Message-
> > From: Wang, Jian J
> > Sent: Monday, December 4, 2017 5:26 PM
> > To: Zeng, Star ; edk2-devel@lists.01.org
> > Cc: Yao, Jiewen ; Ni, Ruiyu ;
> Dong,
> > Eric 
> > Subject: RE: [edk2] [PATCH v2 0/4] Enable page table write protection
> >
> > That means we can't share page table pool between DxeIpl and CpuDxe. If this
> is
> > acceptable, I can remove them.
> >
> > > -Original Message-
> > > From: Zeng, Star
> > > Sent: Monday, December 04, 2017 5:11 PM
> > > To: Wang, Jian J ; edk2-devel@lists.01.org
> > > Cc: Yao, Jiewen ; Ni, Ruiyu ;
> > Dong,
> > > Eric ; Zeng, Star 
> > > Subject: RE: [edk2] [PATCH v2 0/4] Enable page table write protection
> > >
> > > Recommend to not introduce the new header file and PCDs as new
> interfaces,
> > > but handle the page table pool separately in DxeIpl and CpuDxe.
> > >
> > > Thanks,
> > > Star
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Jian
> > J
> > > Wang
> > > Sent: Monday, December 4, 2017 4:36 PM
> > > To: edk2-devel@lists.01.org
> > > Subject: [edk2] [PATCH v2 0/4] Enable page table write protection
> > >
> > > > v2 changes:
> > > >  a. Enable protection on any newly added page table after DxeIpl.
> > > >  b. Introduce page table pool concept to make page table allocation
> > > > and protection easier and error free.
> > >
> > > Write Protect feature (CR0.WP) is always enabled in driver
> > UefiCpuPkg/CpuDxe.
> > > But the memory pages used for page table are not set as read-only in the
> driver
> > > DxeIplPeim, after the paging is setup. This might jeopardize the page 
> > > table
> > > integrity if there's buffer overflow occured in other part of system.
> > >
> > > This patch series will change this situation by clearing R/W bit in page
> attribute
> > > of the pages used as page table.
> > >
> > > Validation works include booting Windows (10/server 2016) and Linux
> > > (Fedora/Ubuntu) on OVMF and Intel real platform.
> > >
> > > Jian J Wang (4):
> > >   MdeModulePkg/MdeModulePkg.dec: Add new PCDs and Guid
> > >   MdeModulePkg/PageTablePool.h: Page table pool GUID definition file
> > >   MdeModulePkg/DxeIpl: Mark page table as read-only
> > >   UefiCpuPkg/CpuDxe: Enable protection for newly added page table
> > >
> > >  MdeModulePkg/Core/DxeIplPeim/DxeIpl.h|  34 +++
> > >  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf  |   3 +
> > >  MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c  |   8 +-
> > >  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 315
> > > +-
> > > MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.h |  15 ++
> > >  MdeModulePkg/Include/Guid/PageTablePool.h|  53 
> > >  MdeModulePkg/MdeModulePkg.dec|  28 ++
> > >  UefiCpuPkg/CpuDxe/CpuDxe.c   |  17 +-
> > >  UefiCpuPkg/CpuDxe/CpuDxe.h   |   2 +
> > >  UefiCpuPkg/CpuDxe/CpuDxe.inf |   3 +
> > >  UefiCpuPkg/CpuDxe/CpuPageTable.c | 329
> > > ++-
> > >  UefiCpuPkg/CpuDxe/CpuPageTable.h |  22 ++
> > >  12 files changed, 816 insertions(+), 13 deletions(-)  create mode 100644
> > > MdeModulePkg/Include/Guid/PageTablePool.h
> > >
> > > --
> > > 2.14.1.windows.1
> > >
> > > ___
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [platforms: PATCH v3 4/4] Marvell/Drivers: MvPhyDxe: Cleanup the header

2017-12-04 Thread Marcin Wojtas
This patch removes unused macros defined in MvPhyDxe.h, as well
as improves the style and comments. Pick single definition
of the autonegotiation timeout - two different macros were used
for the same purpose.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Leif Lindholm 
---
 Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c |   2 +-
 Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h | 152 
 2 files changed, 31 insertions(+), 123 deletions(-)

diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c 
b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
index e776a91..dd2edae 100644
--- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
+++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
@@ -328,7 +328,7 @@ MvPhyInit1512 (
 
 DEBUG((DEBUG_ERROR, "MvPhyDxe: Waiting for PHY auto negotiation... "));
 for (i = 0; !(Data & BMSR_ANEGCOMPLETE); i++) {
-  if (i > PHY_ANEG_TIMEOUT) {
+  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
 DEBUG((DEBUG_ERROR, "timeout\n"));
 PhyDev->LinkUp = FALSE;
 return EFI_TIMEOUT;
diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h 
b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h
index 0c3d935..66974bb 100644
--- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h
+++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h
@@ -34,137 +34,45 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
DAMAGE.
 #ifndef __MV_PHY_DXE_H__
 #define __MV_PHY_DXE_H__
 
-#define MII_BMCR  0x00  /* Basic mode control Register */
-#define MII_BMSR  0x01  /* Basic mode status Register  */
-#define MII_PHYSID1  0x02  /* PHYS ID 1   */
-#define MII_PHYSID2  0x03  /* PHYS ID 2   */
-#define MII_ADVERTISE  0x04  /* Advertisement control Reg   */
-#define MII_LPA0x05  /* Link partner ability Reg*/
-#define MII_EXPANSION  0x06  /* Expansion Register */
-#define MII_CTRL1000  0x09  /* 1000BASE-T control */
-#define MII_STAT1000  0x0a  /* 1000BASE-T status */
-#define MII_ESTATUS  0x0f  /* Extended Status */
-#define MII_DCOUNTER  0x12  /* Disconnect counter */
-#define MII_FCSCOUNTER  0x13  /* False carrier counter   */
-#define MII_NWAYTEST  0x14  /* N-way auto-neg test Reg */
-#define MII_RERRCOUNTER 0x15  /* Receive error counter   */
-#define MII_SREVISION  0x16  /* Silicon revision */
-#define MII_RESV1  0x17  /* Reserved...   */
-#define MII_LBRERROR  0x18  /* Lpback, rx, bypass error*/
-#define MII_PHYADDR  0x19  /* PHY address   */
-#define MII_RESV2  0x1a  /* Reserved...   */
-#define MII_TPISTATUS  0x1b  /* TPI status for 10mbps   */
-#define MII_NCONFIG  0x1c  /* Network interface config*/
-
-/* Basic mode control Register. */
-#define BMCR_RESV0x003f  /* Unused...   */
-#define BMCR_SPEED10000x0040  /* MSB of Speed (1000) */
-#define BMCR_CTST0x0080  /* Collision test */
-#define BMCR_FULLDPLX0x0100  /* Full duplex   */
-#define BMCR_ANRESTART0x0200  /* Auto negotiation restart*/
-#define BMCR_ISOLATE0x0400  /* Disconnect DP83840 from MII */
-#define BMCR_PDOWN0x0800  /* Powerdown the DP83840   */
-#define BMCR_ANENABLE0x1000  /* Enable auto negotiation */
-#define BMCR_SPEED1000x2000  /* Select 100Mbps */
-#define BMCR_LOOPBACK0x4000  /* TXD loopback bits */
-#define BMCR_RESET0x8000  /* Reset the DP83840 */
-
-/* Basic mode status Register. */
-#define BMSR_ERCAP0x0001  /* Ext-Reg capability */
-#define BMSR_JCD0x0002  /* Jabber detected */
-#define BMSR_LSTATUS0x0004  /* Link status   */
-#define BMSR_ANEGCAPABLE  0x0008  /* Able to do auto-negotiation */
-#define BMSR_RFAULT0x0010  /* Remote fault detected   */
-#define BMSR_ANEGCOMPLETE  0x0020  /* Auto-negotiation complete   */
-#define BMSR_RESV0x00c0  /* Unused...   */
-#define BMSR_ESTATEN0x0100  /* Extended Status in R15 */
-#define BMSR_100HALF20x0200  /* Can do 100BASE-T2 HDX */
-#define BMSR_100FULL20x0400  /* Can do 100BASE-T2 FDX */
-#define BMSR_10HALF0x0800  /* Can do 10mbps, half-duplex  */
-#define BMSR_10FULL0x1000  /* Can do 10mbps, full-duplex  */
-#define BMSR_100HALF0x2000  /* Can do 100mbps, half-duplex */
-#define BMSR_100FULL0x4000  /* Can do 100mbps, full-duplex */
-#define BMSR_100BASE40x8000  /* Can do 100mbps, 4k packets  */
-
-#define PHY_ANEG_TIMEOUT 4000
-
-#define PHY_INTERFACE_MODE_RGMII 0
-#define PHY_INTERFACE_MODE_RGMII_ID 1
-#define PHY_INTERFACE_MODE_RGMII_RXID 2
-#define PHY_INTERFACE_MODE_RGMII_TXID 3
-#define PHY_INTERFACE_MODE_SGMII 4
-#define PHY_INTERFACE_MODE_RTBI 5
-
-#define PHY_AUTONEGOTIATE_TIMEOUT 5000

[edk2] [platforms: PATCH v3 1/4] Marvell/Armada: Switch to dynamic tftp command

2017-12-04 Thread Marcin Wojtas
After removal of the tftp library in EDK2, the tftp was
disabled on Armada platform. Re-enable this functionality
as a dynamic command on Armada 70x0 DB board. For this
purpose add it as an option, depending on a new
INCLUDE_TFTP_COMMAND parameter, which can be passed
in the command line during build time.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Leif Lindholm 
---
 Platform/Marvell/Armada/Armada.dsc.inc | 4 
 Platform/Marvell/Armada/Armada70x0.fdf | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/Platform/Marvell/Armada/Armada.dsc.inc 
b/Platform/Marvell/Armada/Armada.dsc.inc
index 2a8a226..6040493 100644
--- a/Platform/Marvell/Armada/Armada.dsc.inc
+++ b/Platform/Marvell/Armada/Armada.dsc.inc
@@ -525,6 +525,10 @@
   gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000
   }
 
+!ifdef $(INCLUDE_TFTP_COMMAND)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+!endif #$(INCLUDE_TFTP_COMMAND)
+
 
[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
diff --git a/Platform/Marvell/Armada/Armada70x0.fdf 
b/Platform/Marvell/Armada/Armada70x0.fdf
index ca92c60..c03bc42 100644
--- a/Platform/Marvell/Armada/Armada70x0.fdf
+++ b/Platform/Marvell/Armada/Armada70x0.fdf
@@ -176,6 +176,9 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c
 
   # UEFI application (Shell Embedded Boot Loader)
   INF ShellPkg/Application/Shell/Shell.inf
+!ifdef $(INCLUDE_TFTP_COMMAND)
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+!endif #$(INCLUDE_TFTP_COMMAND)
 
   # Bds
   INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
-- 
2.7.4

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


[edk2] [platforms: PATCH v3 3/4] Marvell/Applications: FirmwareUpdate: Fix usage information

2017-12-04 Thread Marcin Wojtas
fupdate command's usage information referred to a deprecated
'-f' flag in 'examples' section. It was a residue from the
initial version of the application, removed during review
before merging to upstream branch. Correct the help information
and also on the occasion improve the message and its style.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
---
 Platform/Marvell/Applications/FirmwareUpdate/FUpdate.uni | Bin 5146 -> 5190 
bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/Platform/Marvell/Applications/FirmwareUpdate/FUpdate.uni 
b/Platform/Marvell/Applications/FirmwareUpdate/FUpdate.uni
index 
9d52e590c6d239621d226a240a3f9755210f52fe..146f624737d96e2cd354857dbb63390ebe2f347e
 100644
GIT binary patch
delta 56

[edk2] [platforms: PATCH v3 2/4] Marvell/Armada: Fix watchdog control base

2017-12-04 Thread Marcin Wojtas
Proper watchdog control base is 0xf061, so fix the
incorrect value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Leif Lindholm 
---
 Platform/Marvell/Armada/Armada.dsc.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/Marvell/Armada/Armada.dsc.inc 
b/Platform/Marvell/Armada/Armada.dsc.inc
index 6040493..4b29691 100644
--- a/Platform/Marvell/Armada/Armada.dsc.inc
+++ b/Platform/Marvell/Armada/Armada.dsc.inc
@@ -269,7 +269,7 @@
   gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod|1000
 
   # ARM SBSA Watchdog
-  gArmTokenSpaceGuid.PcdGenericWatchdogControlBase|0xF062
+  gArmTokenSpaceGuid.PcdGenericWatchdogControlBase|0xF061
   gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase|0xF060
   gArmTokenSpaceGuid.PcdGenericWatchdogEl2IntrNum|34
 
-- 
2.7.4

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


[edk2] [platforms: PATCH v3 0/4] Armada 7k/8k - misc improvements pt.3

2017-12-04 Thread Marcin Wojtas
Hi,

The third version of the patchset brings the corrections
requested in the review. Details can be found in the changelog
below.

The patches are available in the github:
https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/misc-upstream-r20171205

I'm looking forward to your comments or remarks.

Best regards,
Marcin

Changelog:
v2 -> v3
* 1/4
- remove hardcoded DEFINE from the dsc file and enable
  passing the argument in a command line during build time
- Add RB

* 3/4
- Mention additional help information improvements in the
  commit log

* 4/4
- Add RB

v1 -> v2

* 1/4
- Add tftp as a build-time selectable option
- Update commit message

* 2/4
- Add RB

* 3/4
- Leave initial file format and reword commit message

* 4/4
- Leave PHY_AUTONEGOTIATE_TIMEOUT unmodified and
  remove double definition of the timeout.

Marcin Wojtas (4):
  Marvell/Armada: Switch to dynamic tftp command
  Marvell/Armada: Fix watchdog control base
  Marvell/Applications: FirmwareUpdate: Fix usage information
  Marvell/Drivers: MvPhyDxe: Cleanup the header

 Platform/Marvell/Applications/FirmwareUpdate/FUpdate.uni | Bin 5146 -> 5190 
bytes
 Platform/Marvell/Armada/Armada.dsc.inc   |   6 +-
 Platform/Marvell/Armada/Armada70x0.fdf   |   3 +
 Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c |   2 +-
 Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h | 152 

 5 files changed, 39 insertions(+), 124 deletions(-)

-- 
2.7.4

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


Re: [edk2] [PATCH 0/2] MdeModulePkg: Remove unnecessary parentheses in 'if'

2017-12-04 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Hao Wu
Sent: Tuesday, December 5, 2017 1:18 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Dong, Eric ; Wu, Hao A 
; Gao, Liming ; Bi, Dandan 
; Zeng, Star 
Subject: [edk2] [PATCH 0/2] MdeModulePkg: Remove unnecessary parentheses in 'if'

The series removes unnecessary parentheses in 'if' statements.

Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Dandan Bi 

Hao Wu (2):
  MdeModulePkg/PartitionDxe: Remove unnecessary parentheses in 'if'
  MdeModulePkg/DisplayEngineDxe: Remove unnecessary parentheses in 'if'

 MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 2 +-
 MdeModulePkg/Universal/DisplayEngineDxe/Popup.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.12.0.windows.1

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


[edk2] [PATCH 2/2] MdeModulePkg/DisplayEngineDxe: Remove unnecessary parentheses in 'if'

2017-12-04 Thread Hao Wu
This commit removes unnecessary parentheses in 'if' statements to
resolve the build failures by the XCODE5 tool chain.

Cc: Liming Gao 
Cc: Eric Dong 
Cc: Dandan Bi 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Universal/DisplayEngineDxe/Popup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/Popup.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/Popup.c
index 7c76f69447..0a832052ef 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/Popup.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/Popup.c
@@ -686,7 +686,7 @@ CreatePopup (
   }
 
   gMessageString = HiiGetString (HiiHandle, Message, NULL);
-  if((gMessageString == NULL)) {
+  if(gMessageString == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
-- 
2.12.0.windows.1

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


[edk2] [PATCH 1/2] MdeModulePkg/PartitionDxe: Remove unnecessary parentheses in 'if'

2017-12-04 Thread Hao Wu
This commit removes unnecessary parentheses in 'if' statements to
resolve the build failures by the XCODE5 tool chain.

Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c 
b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
index 603abfe55a..bb9d0b70ce 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
@@ -1212,7 +1212,7 @@ PartitionInstallChildHandle (
   //
   CopyMem (>PartitionInfo, PartitionInfo, sizeof 
(EFI_PARTITION_INFO_PROTOCOL));
 
-  if ((PartitionInfo->System == 1)) {
+  if (PartitionInfo->System == 1) {
 Private->EspGuid = 
   } else {
 //
-- 
2.12.0.windows.1

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


[edk2] [PATCH 0/2] MdeModulePkg: Remove unnecessary parentheses in 'if'

2017-12-04 Thread Hao Wu
The series removes unnecessary parentheses in 'if' statements.

Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Dandan Bi 

Hao Wu (2):
  MdeModulePkg/PartitionDxe: Remove unnecessary parentheses in 'if'
  MdeModulePkg/DisplayEngineDxe: Remove unnecessary parentheses in 'if'

 MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 2 +-
 MdeModulePkg/Universal/DisplayEngineDxe/Popup.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.12.0.windows.1

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


Re: [edk2] [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : Add support for Watchdog driver

2017-12-04 Thread Udit Kumar
>   I suggest return EFI_UNSUPPORTED for this case. The protocol implementation
> could return its status besides spec defined status.

Thanks to help me , how core will treat this error  
1/  Wdt not available 
2/ ignoring this error 
3/ core is not registering handler  
I guess 3 is valid, 

On side track, looks wdt is not used by core services then do we really need 
this 
as part of arch protocol ?

regards
Udit 

> -Original Message-
> From: Gao, Liming [mailto:liming@intel.com]
> Sent: Monday, December 04, 2017 8:53 PM
> To: Leif Lindholm ; Kinney, Michael D
> 
> Cc: Meenakshi Aggarwal ;
> ard.biesheu...@linaro.org; edk2-devel@lists.01.org; Udit Kumar
> ; Varun Sethi 
> Subject: RE: [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : Add support
> for Watchdog driver
> 
> Leif:
>   I suggest return EFI_UNSUPPORTED for this case. The protocol implementation
> could return its status besides spec defined status.
> 
> Thanks
> Liming
> > -Original Message-
> > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > Sent: Monday, December 4, 2017 10:36 PM
> > To: Kinney, Michael D ; Gao, Liming
> > 
> > Cc: Meenakshi Aggarwal ;
> > ard.biesheu...@linaro.org; edk2-devel@lists.01.org;
> > udit.ku...@nxp.com; v.se...@nxp.com
> > Subject: Re: [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : Add
> > support for Watchdog driver
> >
> > Mike, Liming, as MdePkg mainteiners - one question below:
> >
> > On Mon, Nov 27, 2017 at 04:21:50PM +0530, Meenakshi Aggarwal wrote:
> > > diff --git a/Platform/NXP/Drivers/WatchDog/WatchDog.c
> > > b/Platform/NXP/Drivers/WatchDog/WatchDog.c
> > > new file mode 100644
> > > index 000..a9c70ef
> > > --- /dev/null
> > > +++ b/Platform/NXP/Drivers/WatchDog/WatchDog.c
> > > @@ -0,0 +1,421 @@
> >
> > ...
> >
> > > +/**
> > > +  This function registers the handler NotifyFunction so it is
> > > +called every time
> > > +  the watchdog timer expires.  It also passes the amount of time
> > > +since the last
> > > +  handler call to the NotifyFunction.
> > > +  If NotifyFunction is not NULL and a handler is not already
> > > +registered,
> > > +  then the new handler is registered and EFI_SUCCESS is returned.
> > > +  If NotifyFunction is NULL, and a handler is already registered,
> > > +  then that handler is unregistered.
> > > +  If an attempt is made to register a handler when a handler is
> > > +already registered,
> > > +  then EFI_ALREADY_STARTED is returned.
> > > +  If an attempt is made to unregister a handler when a handler is
> > > +not registered,
> > > +  then EFI_INVALID_PARAMETER is returned.
> > > +
> > > +  @param  This The EFI_TIMER_ARCH_PROTOCOL instance.
> > > +  @param  NotifyFunction   The function to call when a timer interrupt 
> > > fires.
> This
> > > +   function executes at TPL_HIGH_LEVEL. The DXE 
> > > Core will
> > > +   register a handler for the timer interrupt, 
> > > so it can know
> > > +   how much time has passed. This information is 
> > > used to
> > > +   signal timer based events. NULL will 
> > > unregister the handler.
> > > +
> > > +  @retval EFI_SUCCESS   The watchdog timer handler was 
> > > registered.
> > > +  @retval EFI_ALREADY_STARTED   NotifyFunction is not NULL, and a
> handler is already
> > > +registered.
> > > +  @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler
> was not
> > > +previously registered.
> > > +
> > > +**/
> > > +STATIC
> > > +EFI_STATUS
> > > +EFIAPI
> > > +WdogRegisterHandler (
> > > +  IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL   *This,
> > > +  IN EFI_WATCHDOG_TIMER_NOTIFY  NotifyFunction
> > > +  )
> > > +{
> > > +  // ERROR: This function is not supported.
> > > +  // The hardware watchdog will reset the board
> > > +  return EFI_INVALID_PARAMETER;
> >
> > Michael, Liming - what's your take on this?
> >
> > Is EFI_WATCHDOG_TIMER_ARCH_PROTOCOL suitable for use with a pure-hw
> > watchdog such as this?
> >
> > If so, what would be a suitable return code here?
> > EFI_INVALID_PARAMETER does not look ideal.
> >
> > /
> > Leif
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/Core/Dxe: log informative memprotect msgs at DEBUG_INFO level

2017-12-04 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, December 5, 2017 3:48 AM
To: edk2-devel-01 
Cc: Ard Biesheuvel ; Dong, Eric 
; Yao, Jiewen ; Gao, Liming 
; Zeng, Star 
Subject: [PATCH] MdeModulePkg/Core/Dxe: log informative memprotect msgs at 
DEBUG_INFO level

In commit 7eb927db3e25 ("MdeModulePkg/DxeCore: implement memory protection 
policy", 2017-02-24), we added two informative messages with the
InitializeDxeNxMemoryProtectionPolicy() function:

> InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to 
> active memory regions

and

> InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to 
> inactive memory regions

The messages don't report errors or warnings, thus downgrade their log masks 
from DEBUG_ERROR to DEBUG_INFO.

Cc: Ard Biesheuvel 
Cc: Eric Dong 
Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Star Zeng 
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1520485
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
index 21a52d0af55a..a74cfc137a22 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
@@ -831,8 +831,11 @@ InitializeDxeNxMemoryProtectionPolicy (
   } while (Status == EFI_BUFFER_TOO_SMALL);
   ASSERT_EFI_ERROR (Status);
 
-  DEBUG((DEBUG_ERROR, "%a: applying strict permissions to active memory 
regions\n",
-__FUNCTION__));
+  DEBUG ((
+DEBUG_INFO,
+"%a: applying strict permissions to active memory regions\n",
+__FUNCTION__
+));
 
   MergeMemoryMapForProtectionPolicy (MemoryMap, , 
DescriptorSize);
 
@@ -856,9 +859,11 @@ InitializeDxeNxMemoryProtectionPolicy (
   // accessible, but have not been added to the UEFI memory map (yet).
   //
   if (GetPermissionAttributeForMemoryType (EfiConventionalMemory) != 0) {
-DEBUG((DEBUG_ERROR,
+DEBUG ((
+  DEBUG_INFO,
   "%a: applying strict permissions to inactive memory regions\n",
-  __FUNCTION__));
+  __FUNCTION__
+  ));
 
 CoreAcquireGcdMemoryLock ();
 
--
2.14.1.3.gb7cf6e02401b

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


Re: [edk2] [PATCH v2 0/4] Enable page table write protection

2017-12-04 Thread Yao, Jiewen
Hi Jian
In V1 review, I suggest to test in UEFI shell env to make sure all page table 
is read only, with PageTable split in CPU driver.

May I know if that is done?

Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jian J
> Wang
> Sent: Monday, December 4, 2017 4:36 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v2 0/4] Enable page table write protection
> 
> > v2 changes:
> >  a. Enable protection on any newly added page table after DxeIpl.
> >  b. Introduce page table pool concept to make page table allocation
> > and protection easier and error free.
> 
> Write Protect feature (CR0.WP) is always enabled in driver UefiCpuPkg/CpuDxe.
> But the memory pages used for page table are not set as read-only in the 
> driver
> DxeIplPeim, after the paging is setup. This might jeopardize the page table
> integrity if there's buffer overflow occured in other part of system.
> 
> This patch series will change this situation by clearing R/W bit in page 
> attribute
> of the pages used as page table.
> 
> Validation works include booting Windows (10/server 2016) and Linux
> (Fedora/Ubuntu)
> on OVMF and Intel real platform.
> 
> Jian J Wang (4):
>   MdeModulePkg/MdeModulePkg.dec: Add new PCDs and Guid
>   MdeModulePkg/PageTablePool.h: Page table pool GUID definition file
>   MdeModulePkg/DxeIpl: Mark page table as read-only
>   UefiCpuPkg/CpuDxe: Enable protection for newly added page table
> 
>  MdeModulePkg/Core/DxeIplPeim/DxeIpl.h|  34 +++
>  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf  |   3 +
>  MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c  |   8 +-
>  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 315
> +-
>  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.h |  15 ++
>  MdeModulePkg/Include/Guid/PageTablePool.h|  53 
>  MdeModulePkg/MdeModulePkg.dec|  28 ++
>  UefiCpuPkg/CpuDxe/CpuDxe.c   |  17 +-
>  UefiCpuPkg/CpuDxe/CpuDxe.h   |   2 +
>  UefiCpuPkg/CpuDxe/CpuDxe.inf |   3 +
>  UefiCpuPkg/CpuDxe/CpuPageTable.c | 329
> ++-
>  UefiCpuPkg/CpuDxe/CpuPageTable.h |  22 ++
>  12 files changed, 816 insertions(+), 13 deletions(-)
>  create mode 100644 MdeModulePkg/Include/Guid/PageTablePool.h
> 
> --
> 2.14.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 0/4] Enable page table write protection

2017-12-04 Thread Yao, Jiewen
I do not suggest we define PAGE_TABLE_POOL_HEADER.
If we can figure out other way, that will be better.

Thank you
Yao Jiewen


> -Original Message-
> From: Wang, Jian J
> Sent: Monday, December 4, 2017 5:26 PM
> To: Zeng, Star ; edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Ni, Ruiyu ; Dong,
> Eric 
> Subject: RE: [edk2] [PATCH v2 0/4] Enable page table write protection
> 
> That means we can't share page table pool between DxeIpl and CpuDxe. If this 
> is
> acceptable, I can remove them.
> 
> > -Original Message-
> > From: Zeng, Star
> > Sent: Monday, December 04, 2017 5:11 PM
> > To: Wang, Jian J ; edk2-devel@lists.01.org
> > Cc: Yao, Jiewen ; Ni, Ruiyu ;
> Dong,
> > Eric ; Zeng, Star 
> > Subject: RE: [edk2] [PATCH v2 0/4] Enable page table write protection
> >
> > Recommend to not introduce the new header file and PCDs as new interfaces,
> > but handle the page table pool separately in DxeIpl and CpuDxe.
> >
> > Thanks,
> > Star
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jian
> J
> > Wang
> > Sent: Monday, December 4, 2017 4:36 PM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH v2 0/4] Enable page table write protection
> >
> > > v2 changes:
> > >  a. Enable protection on any newly added page table after DxeIpl.
> > >  b. Introduce page table pool concept to make page table allocation
> > > and protection easier and error free.
> >
> > Write Protect feature (CR0.WP) is always enabled in driver
> UefiCpuPkg/CpuDxe.
> > But the memory pages used for page table are not set as read-only in the 
> > driver
> > DxeIplPeim, after the paging is setup. This might jeopardize the page table
> > integrity if there's buffer overflow occured in other part of system.
> >
> > This patch series will change this situation by clearing R/W bit in page 
> > attribute
> > of the pages used as page table.
> >
> > Validation works include booting Windows (10/server 2016) and Linux
> > (Fedora/Ubuntu) on OVMF and Intel real platform.
> >
> > Jian J Wang (4):
> >   MdeModulePkg/MdeModulePkg.dec: Add new PCDs and Guid
> >   MdeModulePkg/PageTablePool.h: Page table pool GUID definition file
> >   MdeModulePkg/DxeIpl: Mark page table as read-only
> >   UefiCpuPkg/CpuDxe: Enable protection for newly added page table
> >
> >  MdeModulePkg/Core/DxeIplPeim/DxeIpl.h|  34 +++
> >  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf  |   3 +
> >  MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c  |   8 +-
> >  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 315
> > +-
> > MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.h |  15 ++
> >  MdeModulePkg/Include/Guid/PageTablePool.h|  53 
> >  MdeModulePkg/MdeModulePkg.dec|  28 ++
> >  UefiCpuPkg/CpuDxe/CpuDxe.c   |  17 +-
> >  UefiCpuPkg/CpuDxe/CpuDxe.h   |   2 +
> >  UefiCpuPkg/CpuDxe/CpuDxe.inf |   3 +
> >  UefiCpuPkg/CpuDxe/CpuPageTable.c | 329
> > ++-
> >  UefiCpuPkg/CpuDxe/CpuPageTable.h |  22 ++
> >  12 files changed, 816 insertions(+), 13 deletions(-)  create mode 100644
> > MdeModulePkg/Include/Guid/PageTablePool.h
> >
> > --
> > 2.14.1.windows.1
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 0/2] quirks handling for SDHCI controllers

2017-12-04 Thread Zeng, Star
Include Ruiyu and Mike.


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard 
Biesheuvel
Sent: Monday, December 4, 2017 10:53 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A ; Tian, Feng ; Zeng, 
Star ; Leif Lindholm ; Ard 
Biesheuvel 
Subject: Re: [edk2] [PATCH v2 0/2] quirks handling for SDHCI controllers

On 30 November 2017 at 10:11, Ard Biesheuvel  wrote:
> Many SDHCI implementations exist that are almost spec complicant, and 
> could be driven by the generic SD/MMC host controller driver except 
> for some minimal necessary init time tweaks.
>
> Adding such tweaks to the generic driver is undesirable. On the other 
> hand, forking the driver for every platform that has such a SDHCI 
> controller is problematic when it comes to upstreaming and ongoing 
> maintenance (which is arguably the point of upstreaming in the first 
> place).
>
> So these patches propose a workaround that is minimally invasive on 
> the
> EDK2 side, but gives platforms a lot of leeway when it comes to 
> applying SDHCI quirks.
>
> Changes since RFC/v1:
> - add EFI_SD_MMC_PASS_THRU_PROTOCOL* member to override methods
> - use UINT64* not VOID* to pass capability structure (which is alwys 64 bits
>   in size)
>
> Ard Biesheuvel (2):
>   MdeModulePkg: introduce SD/MMC override protocol
>   MdeModulePkg/SdMmcPciHcDxe: allow HC capabilities to be overridden
>

Hao, Star,

Any comments?

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


Re: [edk2] [PATCH v3 00/11] Implement stack guard feature

2017-12-04 Thread Yao, Jiewen
Good enhancement. I think it resolved my compatibility concern for the old API.

Some comment:

1) Can we just use CPU_EXCEPTION_INIT_DATA instead of 
CPU_EXCEPTION_INIT_DATA_EX? I am not sure why we add _EX here.

2) Is CPU_EXCEPTION_INIT_DATA_EX for IA32 only or both IA32/X64? I found "Ia32" 
may bring confusing here. See EFI_DEBUG_SUPPORT_PROTOCOL, we have Ia32 for IA32 
arch, X64 for X64 arch.

//
// Flag to indicate if default handlers should be initialized or not.
//
BOOLEAN   InitDefaultHandlers;
  } Ia32;
} CPU_EXCEPTION_INIT_DATA_EX;

3) Can we add IdtTableSize in CPU_EXCEPTION_INIT_DATA_EX?

4) Can we add Version field in CPU_EXCEPTION_INIT_DATA_EX? I am not sure if we 
need add more entry later.

5) You mentioned "KnownGoodStackTop is for *ALL* exceptions".
Does ALL here mean StackSwitchExceptionNumber, or arch specific number such as 
0x20 for X86 system?
I think StackSwitchExceptionNumber is enough.

6) There might be more than one TSS entry in GDT.
Does TssDesc/Tss in CPU_EXCEPTION_INIT_DATA_EX mean the exception Tss? (normal 
TSS does not need be reported here)
If so, I suggest we use ExceptionTss as the keyword.

7) Below code may cause buffer overrun on IST.

  for (Index = 0; Index < StackSwitchData->Ia32.StackSwitchExceptionNumber; 
++Index) {
//
// Fixup IST
//
Tss->IST[Index] = StackTop;

I suggest we add some basic check for StackSwitchExceptionNumber.

8) Do you think we need mention the TssDesc/Tss size requirement for that?

  TssDesc = StackSwitchData->Ia32.TssDesc;
  Tss = StackSwitchData->Ia32.Tss;
  for (Index = 0; Index < StackSwitchData->Ia32.StackSwitchExceptionNumber; 
++Index) {
TssDesc += 1;
Tss += 1;

I suggest we add TssDescSize and TssSize in CPU_EXCEPTION_INIT_DATA_EX and 
check the size in the code.

9) Last but not least important, have you evaluated if current 
CPU_EXCEPTION_INIT_DATA_EX is enough for SMM version stack guard exception?


Thank you
Yao Jiewen



> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jian J
> Wang
> Sent: Friday, December 1, 2017 10:37 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v3 00/11] Implement stack guard feature
> 
> > v3:
> >  a. Change new API InitializeCpuExceptionStackSwitchHandlers() to
> > InitializeCpuExceptionHandlersEx(). Related code are updated
> accordingly.
> >  b. Move EXCEPTION_STACK_SWITCH_DATA to CpuExceptionHandlerLib.h
> > and change the name to CPU_EXCEPTION_INIT_DATA_EX for the sake
> > of the API name change.
> >  c. Add more general macros in BaseLib.h.
> >  d. Add dummy implementation of InitializeCpuExceptionHandlersEx for
> > SEC, PEI and SMM but implement a full version for DXE.
> >  e. Add dummy InitializeCpuExceptionHandlersEx for ARM's
> CpuExceptionHandlerLib
> > and NULL version of CpuExceptionHandlerLib
> >  f. Call InitializeCpuExceptionHandlersEx() in DxeMain instead of
> > InitializeCpuExceptionHandlers().
> 
> 
> > v2:
> >  a. Introduce and implement new API
> InitializeCpuExceptionStackSwitchHandlers().
> >  b. Add stack switch related general definitions of IA32 in BaseLib.h.
> >  c. Add two new PCDs to configure exception vector list and stack size.
> >  d. Add code to save/restore GDTR, IDTR and TR for AP.
> >  e. Refactor exception handler code for stack switch.
> >  f. Add code to setup stack switch for AP besides BSP.
> 
> Stack guard feature makes use of paging mechanism to monitor if there's a
> stack overflow occurred during boot. A new PCD PcdCpuStackGuard is added to
> enable/disable this feature. PCD PcdCpuStackSwitchExceptionList and
> PcdCpuKnownGoodStackSize are introduced to configure the required
> exceptions
> and stack size.
> 
> If this feature is enabled, DxeIpl will setup page tables and set page where
> the stack bottom is at to be NON-PRESENT. If stack overflow occurs, Page
> Fault exception will be triggered.
> 
> In order to make sure exception handler works normally even when the stack
> is corrupted, stack switching is implemented in exception library.
> 
> Due to the mechanism behind Stack Guard, this feature is only avaiable for
> UEFI drivers (memory avaiable). That also means it doesn't support NT32
> emulated platform (paging not supported).
> 
> Jian J Wang (11):
>   MdeModulePkg/metafile: Add PCD PcdCpuStackGuard
>   UefiCpuPkg/UefiCpuPkg.dec: Add two new PCDs for stack switch
>   MdeModulePkg/CpuExceptionHandlerLib.h: Add a new API
> InitializeCpuExceptionHandlersEx
>   MdePkg/BaseLib: Add stack switch related definitions for IA32
>   UefiCpuPkg/CpuExceptionHandlerLib: Add stack switch support
>   MdeModulePkg/CpuExceptionHandlerLibNull: Add new API implementation
>   ArmPkg/ArmExceptionLib: Add implementation of new API
>   UefiCpuPkg/MpLib: Add GDTR, IDTR and TR in saved AP data
>   UefiCpuPkg/CpuDxe: Initialize stack switch for MP
>   MdeModulePkg/Core/Dxe: Call new API 

Re: [edk2] [PATCH v2] MdeModulePkg/NvmExpressDxe: fix error status override

2017-12-04 Thread Heyi Guo

Thanks Hao :)


在 12/5/2017 8:29 AM, Wu, Hao A 写道:

Pushed at 9a77210b43ef34af52ea7285fadc0ce5779306fe.

Best Regards,
Hao Wu



-Original Message-
From: Zeng, Star
Sent: Monday, December 04, 2017 1:54 PM
To: Wu, Hao A; Heyi Guo; linaro-u...@lists.linaro.org; edk2-devel@lists.01.org
Cc: Dong, Eric; Ni, Ruiyu; Zeng, Star
Subject: RE: [PATCH v2] MdeModulePkg/NvmExpressDxe: fix error status
override

Reviewed-by: Star Zeng 

Hao, please help push the patch if no other comments received.


Thanks,
Star
-Original Message-
From: Wu, Hao A
Sent: Monday, December 4, 2017 10:47 AM
To: Heyi Guo ; linaro-u...@lists.linaro.org; edk2-
de...@lists.01.org
Cc: Zeng, Star ; Dong, Eric ; Ni,
Ruiyu 
Subject: RE: [PATCH v2] MdeModulePkg/NvmExpressDxe: fix error status
override

Reviewed-by: Hao Wu 

Best Regards,
Hao Wu



-Original Message-
From: Heyi Guo [mailto:heyi@linaro.org]
Sent: Monday, December 04, 2017 10:28 AM
To: linaro-u...@lists.linaro.org; edk2-devel@lists.01.org
Cc: Heyi Guo; Zeng, Star; Dong, Eric; Wu, Hao A; Ni, Ruiyu
Subject: [PATCH v2] MdeModulePkg/NvmExpressDxe: fix error status
override

Commit f6b139b added return status handling to PciIo->Mem.Write.
However, the second status handling will override EFI_DEVICE_ERROR
returned in this branch:

   //
   // Check the NVMe cmd execution result
   //
   if (Status != EFI_TIMEOUT) {
 if ((Cq->Sct == 0) && (Cq->Sc == 0)) {
   Status = EFI_SUCCESS;
 } else {
   Status = EFI_DEVICE_ERROR;


Since PciIo->Mem.Write will probably return SUCCESS, it causes
NvmExpressPassThru to return SUCCESS even when DEVICE_ERROR occurs.
Callers of NvmExpressPassThru will then continue executing which may
cause further unexpected results, e.g. DiscoverAllNamespaces couldn't
break out the loop.

So we save previous status before calling PciIo->Mem.Write and restore
the previous one if it already contains error.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Hao Wu 
Cc: Ruiyu Ni 
---
  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
index c33038f..7356c1d 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
@@ -453,6 +453,7 @@ NvmExpressPassThru (  {
NVME_CONTROLLER_PRIVATE_DATA   *Private;
EFI_STATUS Status;
+  EFI_STATUS PreviousStatus;
EFI_PCI_IO_PROTOCOL*PciIo;
NVME_SQ*Sq;
NVME_CQ*Cq;
@@ -831,6 +832,7 @@ NvmExpressPassThru (
}

Data = ReadUnaligned32 ((UINT32*)>CqHdbl[QueueId]);
+  PreviousStatus = Status;
Status = PciIo->Mem.Write (
 PciIo,
 EfiPciIoWidthUint32,
@@ -839,6 +841,9 @@ NvmExpressPassThru (
 1,
 
 );
+  // The return status of PciIo->Mem.Write should not override  //
+ previous status if previous status contains error.
+  Status = EFI_ERROR (PreviousStatus) ? PreviousStatus : Status;

//
// For now, the code does not support the non-blocking feature for
admin queue.
--
2.7.2.windows.1


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


Re: [edk2] [PATCH] MdeModulePkg CapsulePei: Sort and merge memory resource entries

2017-12-04 Thread Yao, Jiewen
Reviewed-by: jiewen@intel.com

> -Original Message-
> From: Zeng, Star
> Sent: Monday, December 4, 2017 6:01 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Yao, Jiewen ;
> Chiu, Chasel ; Chiang, Dakota
> 
> Subject: [PATCH] MdeModulePkg CapsulePei: Sort and merge memory resource
> entries
> 
> Sort and merge memory resource entries to handle the case that
> the memory resource HOBs are reported differently between
> BOOT_ON_FLASH_UPDATE boot mode and normal boot mode, and the
> capsule buffer from UpdateCapsule at normal boot sits across
> two memory resource descriptors at BOOT_ON_FLASH_UPDATE boot mode.
> 
> Cc: Jiewen Yao 
> Cc: Chasel Chiu 
> Cc: Dakota Chiang 
> Tested-by: Dakota Chiang 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Universal/CapsulePei/UefiCapsule.c | 90
> +
>  1 file changed, 90 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> index cca455ec396c..043365f7f770 100644
> --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> @@ -625,6 +625,82 @@ GetPhysicalAddressBits (
>  #endif
> 
>  /**
> +  Sort memory resource entries based upon PhysicalStart, from low to high.
> +
> +  @param[in, out] MemoryResourceA pointer to the memory resource
> entry buffer.
> +
> +**/
> +VOID
> +SortMemoryResourceDescriptor (
> +  IN OUT MEMORY_RESOURCE_DESCRIPTOR *MemoryResource
> +  )
> +{
> +  MEMORY_RESOURCE_DESCRIPTOR*MemoryResourceEntry;
> +  MEMORY_RESOURCE_DESCRIPTOR*NextMemoryResourceEntry;
> +  MEMORY_RESOURCE_DESCRIPTORTempMemoryResource;
> +
> +  MemoryResourceEntry = MemoryResource;
> +  NextMemoryResourceEntry = MemoryResource + 1;
> +  while (MemoryResourceEntry->ResourceLength != 0) {
> +while (NextMemoryResourceEntry->ResourceLength != 0) {
> +  if (MemoryResourceEntry->PhysicalStart >
> NextMemoryResourceEntry->PhysicalStart) {
> +CopyMem (, MemoryResourceEntry, sizeof
> (MEMORY_RESOURCE_DESCRIPTOR));
> +CopyMem (MemoryResourceEntry, NextMemoryResourceEntry,
> sizeof (MEMORY_RESOURCE_DESCRIPTOR));
> +CopyMem (NextMemoryResourceEntry, ,
> sizeof (MEMORY_RESOURCE_DESCRIPTOR));
> +  }
> +
> +  NextMemoryResourceEntry = NextMemoryResourceEntry + 1;
> +}
> +
> +MemoryResourceEntry = MemoryResourceEntry + 1;
> +NextMemoryResourceEntry = MemoryResourceEntry + 1;
> +  }
> +}
> +
> +/**
> +  Merge continous memory resource entries.
> +
> +  @param[in, out] MemoryResourceA pointer to the memory resource
> entry buffer.
> +
> +**/
> +VOID
> +MergeMemoryResourceDescriptor (
> +  IN OUT MEMORY_RESOURCE_DESCRIPTOR *MemoryResource
> +  )
> +{
> +  MEMORY_RESOURCE_DESCRIPTOR*MemoryResourceEntry;
> +  MEMORY_RESOURCE_DESCRIPTOR*NewMemoryResourceEntry;
> +  MEMORY_RESOURCE_DESCRIPTOR*NextMemoryResourceEntry;
> +  MEMORY_RESOURCE_DESCRIPTOR*MemoryResourceEnd;
> +
> +  MemoryResourceEntry = MemoryResource;
> +  NewMemoryResourceEntry = MemoryResource;
> +  while (MemoryResourceEntry->ResourceLength != 0) {
> +CopyMem (NewMemoryResourceEntry, MemoryResourceEntry, sizeof
> (MEMORY_RESOURCE_DESCRIPTOR));
> +NextMemoryResourceEntry = MemoryResourceEntry + 1;
> +
> +while ((NextMemoryResourceEntry->ResourceLength != 0) &&
> +   (NextMemoryResourceEntry->PhysicalStart ==
> (MemoryResourceEntry->PhysicalStart +
> MemoryResourceEntry->ResourceLength))) {
> +  MemoryResourceEntry->ResourceLength +=
> NextMemoryResourceEntry->ResourceLength;
> +  if (NewMemoryResourceEntry != MemoryResourceEntry) {
> +NewMemoryResourceEntry->ResourceLength +=
> NextMemoryResourceEntry->ResourceLength;
> +  }
> +
> +  NextMemoryResourceEntry = NextMemoryResourceEntry + 1;
> +}
> +
> +MemoryResourceEntry = NextMemoryResourceEntry;
> +NewMemoryResourceEntry = NewMemoryResourceEntry + 1;
> +  }
> +
> +  //
> +  // Set NULL terminate memory resource descriptor after merging.
> +  //
> +  MemoryResourceEnd = NewMemoryResourceEntry;
> +  ZeroMem (MemoryResourceEnd, sizeof
> (MEMORY_RESOURCE_DESCRIPTOR));
> +}
> +
> +/**
>Build memory resource descriptor from resource descriptor in HOB list.
> 
>@return Pointer to the buffer of memory resource descriptor.
> @@ -704,6 +780,20 @@ BuildMemoryResourceDescriptor (
>  Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR,
> Hob.Raw);
>}
> 
> +  SortMemoryResourceDescriptor (MemoryResource);
> +  MergeMemoryResourceDescriptor (MemoryResource);
> +
> +  DEBUG ((DEBUG_INFO, "Dump MemoryResource[] after sorted and
> merged\n"));
> +  for (Index = 0; 

Re: [edk2] [PATCH v2] MdeModulePkg/NvmExpressDxe: fix error status override

2017-12-04 Thread Wu, Hao A
Pushed at 9a77210b43ef34af52ea7285fadc0ce5779306fe.

Best Regards,
Hao Wu


> -Original Message-
> From: Zeng, Star
> Sent: Monday, December 04, 2017 1:54 PM
> To: Wu, Hao A; Heyi Guo; linaro-u...@lists.linaro.org; edk2-devel@lists.01.org
> Cc: Dong, Eric; Ni, Ruiyu; Zeng, Star
> Subject: RE: [PATCH v2] MdeModulePkg/NvmExpressDxe: fix error status
> override
> 
> Reviewed-by: Star Zeng 
> 
> Hao, please help push the patch if no other comments received.
> 
> 
> Thanks,
> Star
> -Original Message-
> From: Wu, Hao A
> Sent: Monday, December 4, 2017 10:47 AM
> To: Heyi Guo ; linaro-u...@lists.linaro.org; edk2-
> de...@lists.01.org
> Cc: Zeng, Star ; Dong, Eric ; Ni,
> Ruiyu 
> Subject: RE: [PATCH v2] MdeModulePkg/NvmExpressDxe: fix error status
> override
> 
> Reviewed-by: Hao Wu 
> 
> Best Regards,
> Hao Wu
> 
> 
> > -Original Message-
> > From: Heyi Guo [mailto:heyi@linaro.org]
> > Sent: Monday, December 04, 2017 10:28 AM
> > To: linaro-u...@lists.linaro.org; edk2-devel@lists.01.org
> > Cc: Heyi Guo; Zeng, Star; Dong, Eric; Wu, Hao A; Ni, Ruiyu
> > Subject: [PATCH v2] MdeModulePkg/NvmExpressDxe: fix error status
> > override
> >
> > Commit f6b139b added return status handling to PciIo->Mem.Write.
> > However, the second status handling will override EFI_DEVICE_ERROR
> > returned in this branch:
> >
> >   //
> >   // Check the NVMe cmd execution result
> >   //
> >   if (Status != EFI_TIMEOUT) {
> > if ((Cq->Sct == 0) && (Cq->Sc == 0)) {
> >   Status = EFI_SUCCESS;
> > } else {
> >   Status = EFI_DEVICE_ERROR;
> >
> >
> > Since PciIo->Mem.Write will probably return SUCCESS, it causes
> > NvmExpressPassThru to return SUCCESS even when DEVICE_ERROR occurs.
> > Callers of NvmExpressPassThru will then continue executing which may
> > cause further unexpected results, e.g. DiscoverAllNamespaces couldn't
> > break out the loop.
> >
> > So we save previous status before calling PciIo->Mem.Write and restore
> > the previous one if it already contains error.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Heyi Guo 
> > Cc: Star Zeng 
> > Cc: Eric Dong 
> > Cc: Hao Wu 
> > Cc: Ruiyu Ni 
> > ---
> >  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> > b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> > index c33038f..7356c1d 100644
> > --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> > +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> > @@ -453,6 +453,7 @@ NvmExpressPassThru (  {
> >NVME_CONTROLLER_PRIVATE_DATA   *Private;
> >EFI_STATUS Status;
> > +  EFI_STATUS PreviousStatus;
> >EFI_PCI_IO_PROTOCOL*PciIo;
> >NVME_SQ*Sq;
> >NVME_CQ*Cq;
> > @@ -831,6 +832,7 @@ NvmExpressPassThru (
> >}
> >
> >Data = ReadUnaligned32 ((UINT32*)>CqHdbl[QueueId]);
> > +  PreviousStatus = Status;
> >Status = PciIo->Mem.Write (
> > PciIo,
> > EfiPciIoWidthUint32,
> > @@ -839,6 +841,9 @@ NvmExpressPassThru (
> > 1,
> > 
> > );
> > +  // The return status of PciIo->Mem.Write should not override  //
> > + previous status if previous status contains error.
> > +  Status = EFI_ERROR (PreviousStatus) ? PreviousStatus : Status;
> >
> >//
> >// For now, the code does not support the non-blocking feature for
> > admin queue.
> > --
> > 2.7.2.windows.1

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


Re: [edk2] [PATCH v3 07/11] ArmPkg/ArmExceptionLib: Add implementation of new API

2017-12-04 Thread Wang, Jian J
Sure. Thanks for the feedback.

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Monday, December 04, 2017 9:59 PM
> To: Wang, Jian J 
> Cc: edk2-devel@lists.01.org; Leif Lindholm ; Yao,
> Jiewen 
> Subject: Re: [PATCH v3 07/11] ArmPkg/ArmExceptionLib: Add implementation of
> new API
> 
> On 1 December 2017 at 02:37, Jian J Wang  wrote:
> >> v3:
> >>Newly added
> >
> > This patch add implementation of following new API introduced into
> > CpuExceptionHandlerLib. Since this lib hasn't support Stack Guard
> > and stack switch, the new method just calls original
> > InitializeCpuExceptionHandlers.
> >
> >   EFI_STATUS
> >   EFIAPI
> >   InitializeCpuExceptionHandlersEx (
> > IN EFI_VECTOR_HANDOFF_INFO*VectorInfo OPTIONAL,
> > IN CPU_EXCEPTION_INIT_DATA_EX *InitDataEx OPTIONAL
> > );
> >
> > Cc: Leif Lindholm 
> > Cc: Ard Biesheuvel 
> > Cc: Jiewen Yao 
> > Suggested-by: Ayellet Wolman 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Jian J Wang 
> > ---
> >  ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c | 33
> 
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> > index e8ea1f159d..9fb4a05845 100644
> > --- a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> > +++ b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> > @@ -320,3 +320,36 @@ CommonCExceptionHandler(
> >
> >DefaultExceptionHandler(ExceptionType, SystemContext);
> >  }
> > +
> > +/**
> > +  Initializes all CPU exceptions entries with optional extra 
> > initializations.
> > +
> > +  By default, this method should include all functionalities implemented by
> > +  InitializeCpuExceptionHandlers(), plus extra initialization works, if 
> > any.
> > +  This is could be done by calling InitializeCpuExceptionHandlers() 
> > directly
> > +  in this method besides the extra works.
> > +
> > +  InitDataEx is optional and its use and content are processor arch 
> > dependent.
> > +  The typical usage of it is to convey resources which have to be reserved
> > +  elsewhere and are necessary for the extra initializations of exception.
> > +
> > +  @param[in]  VectorInfoPointer to reserved vector list.
> > +  @param[in]  InitDataExPointer to data optional for extra 
> > initializations
> > +of exception.
> > +
> > +  @retval EFI_SUCCESS The exceptions have been successfully
> > +  initialized.
> > +  @retval EFI_INVALID_PARAMETER   VectorInfo or InitDataEx contains
> invalid
> > +  content.
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +InitializeCpuExceptionHandlersEx (
> > +  IN EFI_VECTOR_HANDOFF_INFO*VectorInfo OPTIONAL,
> > +  IN CPU_EXCEPTION_INIT_DATA_EX *InitDataEx OPTIONAL
> > +  )
> > +{
> > +  return InitializeCpuExceptionHandlers (VectorInfo);
> > +}
> > +
> 
> I would appreciate it if you could clean up the grammar in the comment block.
> 
> Other than that,
> 
> Reviewed-by: Ard Biesheuvel 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 13/13] ArmPlatformPkg: remove unused SP804 driver and TimerLib implementation

2017-12-04 Thread Ard Biesheuvel
None of the platforms we support use these so remove them.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by-if-no-comments-by-15-Dec: Leif Lindholm 
---
 ArmPlatformPkg/ArmPlatformPkg.dec  |   7 -
 ArmPlatformPkg/Drivers/SP804TimerDxe/SP804Timer.c  | 395 

 ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf |  59 ---
 ArmPlatformPkg/Include/Drivers/SP804Timer.h|  57 ---
 ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c   | 256 -
 ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf |  44 ---
 6 files changed, 818 deletions(-)

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec 
b/ArmPlatformPkg/ArmPlatformPkg.dec
index d42404e8cd38..6a7bbc02d011 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -86,13 +86,6 @@ [PcdsFixedAtBuild.common]
   # ARM Primecells
   #
 
-  ## SP804 DualTimer
-  gArmPlatformTokenSpaceGuid.PcdSP804TimerFrequencyInMHz|1|UINT32|0x001D
-  
gArmPlatformTokenSpaceGuid.PcdSP804TimerPeriodicInterruptNum|0|UINT32|0x001E
-  gArmPlatformTokenSpaceGuid.PcdSP804TimerPeriodicBase|0|UINT32|0x002A
-  gArmPlatformTokenSpaceGuid.PcdSP804TimerPerformanceBase|0|UINT32|0x002B
-  gArmPlatformTokenSpaceGuid.PcdSP804TimerMetronomeBase|0|UINT32|0x002C
-
   ## SP805 Watchdog
   gArmPlatformTokenSpaceGuid.PcdSP805WatchdogBase|0x0|UINT32|0x0023
   
gArmPlatformTokenSpaceGuid.PcdSP805WatchdogClockFrequencyInHz|32000|UINT32|0x0021
diff --git a/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804Timer.c 
b/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804Timer.c
deleted file mode 100644
index 7ae25e9bb92a..
--- a/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804Timer.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/** @file
-  Template for Timer Architecture Protocol driver of the ARM flavor
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-  Copyright (c) 2011 - 2012, ARM 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 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-#include 
-
-#define SP804_TIMER_PERIODIC_BASE ((UINTN)PcdGet32 
(PcdSP804TimerPeriodicBase))
-#define SP804_TIMER_METRONOME_BASE((UINTN)PcdGet32 
(PcdSP804TimerMetronomeBase))
-#define SP804_TIMER_PERFORMANCE_BASE  ((UINTN)PcdGet32 
(PcdSP804TimerPerformanceBase))
-
-// The notification function to call on every timer interrupt.
-EFI_TIMER_NOTIFY  mTimerNotifyFunction = (EFI_TIMER_NOTIFY)NULL;
-EFI_EVENT EfiExitBootServicesEvent = (EFI_EVENT)NULL;
-
-// The current period of the timer interrupt
-UINT64 mTimerPeriod = 0;
-
-// Cached copy of the Hardware Interrupt protocol instance
-EFI_HARDWARE_INTERRUPT_PROTOCOL *gInterrupt = NULL;
-
-// Cached interrupt vector
-UINTN  gVector;
-
-
-/**
-
-  C Interrupt Handler called in the interrupt context when Source interrupt is 
active.
-
-
-  @param Source Source of the interrupt. Hardware routing off a 
specific platform defines
-what source means.
-
-  @param SystemContext  Pointer to system register context. Mostly used by 
debuggers and will
-update the system context after the return from the 
interrupt if
-modified. Don't change these values unless you know 
what you are doing
-
-**/
-VOID
-EFIAPI
-TimerInterruptHandler (
-  IN  HARDWARE_INTERRUPT_SOURCE   Source,
-  IN  EFI_SYSTEM_CONTEXT  SystemContext
-  )
-{
-  EFI_TPL OriginalTPL;
-
-  //
-  // DXE core uses this callback for the EFI timer tick. The DXE core uses 
locks
-  // that raise to TPL_HIGH and then restore back to current level. Thus we 
need
-  // to make sure TPL level is set to TPL_HIGH while we are handling the timer 
tick.
-  //
-  OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
-  // If the interrupt is shared then we must check if this interrupt source is 
the one associated to this Timer
-  if (MmioRead32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_MSK_INT_STS_REG) != 
0) {
-// Clear the periodic interrupt
-MmioWrite32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_INT_CLR_REG, 0);
-
-// Signal end of interrupt early to help avoid losing subsequent ticks 
from long duration handlers
-gInterrupt->EndOfInterrupt (gInterrupt, Source);
-
-if (mTimerNotifyFunction) {
-  mTimerNotifyFunction (mTimerPeriod);
-}
-  }
-
-  gBS->RestoreTPL (OriginalTPL);
-}
-
-/**
-  This function registers the 

[edk2] [PATCH v2 10/13] ArmPlatformPkg: remove PL34xDmc driver

2017-12-04 Thread Ard Biesheuvel
Remove PL34xDmc driver which is not used by any platforms

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by-if-no-comments-by-15-Dec: Leif Lindholm 
---
 ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.c   | 227 -
 ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.inf |  29 --
 ArmPlatformPkg/Include/Drivers/PL341Dmc.h| 336 
 3 files changed, 592 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.c 
b/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.c
deleted file mode 100644
index 08eba6ec6930..
--- a/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/** @file
-*
-*  Copyright (c) 2011, ARM Limited. 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 
-
-#include 
-#include 
-
-#include 
-
-// Macros for writing to DDR2 controller.
-#define DmcWriteReg(reg,val)MmioWrite32(DmcBase + reg, val)
-#define DmcReadReg(reg) MmioRead32(DmcBase + reg)
-
-// Macros for writing/reading to DDR2 PHY controller
-#define DmcPhyWriteReg(reg,val)MmioWrite32(DmcPhyBase + 
reg, val)
-#define DmcPhyReadReg(reg) MmioRead32(DmcPhyBase + reg)
-
-// Initialise PL341 Dynamic Memory Controller
-VOID
-PL341DmcInit (
-  IN  UINTN DmcBase,
-  IN  PL341_DMC_CONFIG* DmcConfig
-  )
-{
-  UINTN Index;
-  UINT32 Chip;
-
-  // Set config mode
-  DmcWriteReg(DMC_COMMAND_REG, DMC_COMMAND_CONFIGURE);
-
-  //
-  // Setup the QoS AXI ID bits
-  //
-  if (DmcConfig->HasQos) {
-// CLCD AXIID = 000
-DmcWriteReg(DMC_ID_0_CFG_REG, DMC_ID_CFG_QOS_ENABLE | DMC_ID_CFG_QOS_MIN);
-
-// Default disable QoS
-DmcWriteReg(DMC_ID_1_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_2_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_3_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_4_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_5_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_6_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_7_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_8_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_9_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_10_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_11_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_12_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_13_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_14_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-DmcWriteReg(DMC_ID_15_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
-  }
-
-  //
-  // Initialise memory controlller
-  //
-  DmcWriteReg(DMC_REFRESH_PRD_REG, DmcConfig->RefreshPeriod);
-  DmcWriteReg(DMC_CAS_LATENCY_REG, DmcConfig->CasLatency);
-  DmcWriteReg(DMC_WRITE_LATENCY_REG, DmcConfig->WriteLatency);
-  DmcWriteReg(DMC_T_MRD_REG, DmcConfig->t_mrd);
-  DmcWriteReg(DMC_T_RAS_REG, DmcConfig->t_ras);
-  DmcWriteReg(DMC_T_RC_REG, DmcConfig->t_rc);
-  DmcWriteReg(DMC_T_RCD_REG, DmcConfig->t_rcd);
-  DmcWriteReg(DMC_T_RFC_REG, DmcConfig->t_rfc);
-  DmcWriteReg(DMC_T_RP_REG, DmcConfig->t_rp);
-  DmcWriteReg(DMC_T_RRD_REG, DmcConfig->t_rrd);
-  DmcWriteReg(DMC_T_WR_REG, DmcConfig->t_wr);
-  DmcWriteReg(DMC_T_WTR_REG, DmcConfig->t_wtr);
-  DmcWriteReg(DMC_T_XP_REG, DmcConfig->t_xp);
-  DmcWriteReg(DMC_T_XSR_REG, DmcConfig->t_xsr);
-  DmcWriteReg(DMC_T_ESR_REG, DmcConfig->t_esr);
-  DmcWriteReg(DMC_T_FAW_REG, DmcConfig->t_faw);
-  DmcWriteReg(DMC_T_WRLAT_DIFF, DmcConfig->t_wdata_en);
-  DmcWriteReg(DMC_T_RDATA_EN, DmcConfig->t_data_en);
-
-  //
-  // Initialise PL341 Mem Config Registers
-  //
-
-  // Set PL341 Memory Config
-  DmcWriteReg(DMC_MEMORY_CONFIG_REG, DmcConfig->MemoryCfg);
-
-  // Set PL341 Memory Config 2
-  DmcWriteReg(DMC_MEMORY_CFG2_REG, DmcConfig->MemoryCfg2);
-
-  // Set PL341 Memory Config 3
-  DmcWriteReg(DMC_MEMORY_CFG3_REG, DmcConfig->MemoryCfg3);
-
-  // Set PL341 Chip Select 
-  DmcWriteReg(DMC_CHIP_0_CFG_REG, DmcConfig->ChipCfg0);
-  DmcWriteReg(DMC_CHIP_1_CFG_REG, DmcConfig->ChipCfg1);
-  DmcWriteReg(DMC_CHIP_2_CFG_REG, DmcConfig->ChipCfg2);
-  DmcWriteReg(DMC_CHIP_3_CFG_REG, DmcConfig->ChipCfg3);
-
-  // Delay
-  for (Index = 0; Index < 10; Index++) {
-DmcReadReg(DMC_STATUS_REG);
-  }
-
-  if (DmcConfig->IsUserCfg) {
-//
-// Set Test Chip PHY Registers via PL341 User Config Reg
-// Note that user_cfgX registers are Write Only
-//
-// DLL Freq set = 250MHz - 266MHz
-//
-

[edk2] [PATCH v2 05/13] ArmPlatformPkg: remove old PL011UartLib implementation

2017-12-04 Thread Ard Biesheuvel
Remove the PL011UartLib implementation that has been superseded by
the one under Library/

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c   | 470 
 ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf |  42 --
 ArmPlatformPkg/Include/Drivers/PL011Uart.h | 290 
 3 files changed, 802 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c 
b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
deleted file mode 100644
index 77630237ae91..
--- a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/** @file
-  Serial I/O Port library functions with no library constructor/destructor
-
-  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
-  Copyright (c) 2011 - 2016, ARM 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 
-#include 
-#include 
-
-#include 
-
-#define FRACTION_PART_SIZE_IN_BITS  6
-#define FRACTION_PART_MASK  ((1 << FRACTION_PART_SIZE_IN_BITS) - 1)
-
-//
-// EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE is the only
-// control bit that is not supported.
-//
-STATIC CONST UINT32 mInvalidControlBits = EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
-
-/**
-
-  Initialise the serial port to the specified settings.
-  The serial port is re-configured only if the specified settings
-  are different from the current settings.
-  All unspecified settings will be set to the default values.
-
-  @param  UartBaseThe base address of the serial device.
-  @param  UartClkInHz The clock in Hz for the serial device.
-  Ignored if the PCD PL011UartInteger is not 0
-  @param  BaudRateThe baud rate of the serial device. If the
-  baud rate is not supported, the speed will be
-  reduced to the nearest supported one and the
-  variable's value will be updated accordingly.
-  @param  ReceiveFifoDepthThe number of characters the device will
-  buffer on input.  Value of 0 will use the
-  device's default FIFO depth.
-  @param  Parity  If applicable, this is the EFI_PARITY_TYPE
-  that is computed or checked as each character
-  is transmitted or received. If the device
-  does not support parity, the value is the
-  default parity value.
-  @param  DataBitsThe number of data bits in each character.
-  @param  StopBitsIf applicable, the EFI_STOP_BITS_TYPE number
-  of stop bits per character.
-  If the device does not support stop bits, the
-  value is the default stop bit value.
-
-  @retval RETURN_SUCCESSAll attributes were set correctly on the
-serial device.
-  @retval RETURN_INVALID_PARAMETER  One or more of the attributes has an
-unsupported value.
-
-**/
-RETURN_STATUS
-EFIAPI
-PL011UartInitializePort (
-  IN UINTN   UartBase,
-  IN UINT32  UartClkInHz,
-  IN OUT UINT64  *BaudRate,
-  IN OUT UINT32  *ReceiveFifoDepth,
-  IN OUT EFI_PARITY_TYPE *Parity,
-  IN OUT UINT8   *DataBits,
-  IN OUT EFI_STOP_BITS_TYPE  *StopBits
-  )
-{
-  UINT32  LineControl;
-  UINT32  Divisor;
-  UINT32  Integer;
-  UINT32  Fractional;
-  UINT32  HardwareFifoDepth;
-
-  HardwareFifoDepth = (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) \
-   > PL011_VER_R1P4) \
-  ? 32 : 16 ;
-  // The PL011 supports a buffer of 1, 16 or 32 chars. Therefore we can accept
-  // 1 char buffer as the minimum FIFO size. Because everything can be rounded
-  // down, there is no maximum FIFO size.
-  if ((*ReceiveFifoDepth == 0) || (*ReceiveFifoDepth >= HardwareFifoDepth)) {
-// Enable FIFO
-LineControl = PL011_UARTLCR_H_FEN;
-*ReceiveFifoDepth = HardwareFifoDepth;
-  } else {
-// Disable FIFO
-LineControl = 0;
-// Nothing else to do. 1 byte FIFO is default.
-*ReceiveFifoDepth = 1;
-  }
-
-  //
-  // Parity
-  //
-  switch (*Parity) {
-  case DefaultParity:
-*Parity = NoParity;
-  case NoParity:
-

[edk2] [PATCH v2 02/13] ArmPlatformPkg: remove ArmVExpressPkg

2017-12-04 Thread Ard Biesheuvel
Remove ArmVExpressPkg from EDK2 now that its contents have moved into
edk2-platforms/Platform/ARM where they belong.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c   
 |  90 
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf 
 |  38 --
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c
 |  38 --
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf  
 |  37 --
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c 
 | 519 
 
ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBootDxe.inf 
|  51 --
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec   
 |  53 --
 ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h  
 | 154 --
 ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM/ArmPlatform.h  
 |  79 ---
 ArmPlatformPkg/ArmVExpressPkg/Include/VExpressMotherBoard.h
 | 140 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/ArmVExpressLib.inf 
|  53 --
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c
 | 182 ---
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S  
 |  81 ---
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm 
|  96 
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Mem.c 
 | 182 ---
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S  
 |  61 ---
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S  
 |  97 
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
 | 118 -
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
 |  62 ---
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf 
 |  59 ---
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c
 | 195 
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c 
 | 161 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c
| 273 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
   |  35 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c
   | 283 ---
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf
 |  37 --
 ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c   
 | 285 ---
 
ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf
   |  45 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c
  | 370 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf
 |  44 --
 ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c  
 | 111 -
 ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf
 |  35 --
 32 files changed, 4064 deletions(-)

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c 
b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c
deleted file mode 100644
index 7827c50d8bbf..
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/** @file
-
-  Copyright (c) 2013-2015, ARM 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 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#define ARM_FVP_BASE_VIRTIO_BLOCK_BASE0x1c13
-

[edk2] [PATCH v2 08/13] ArmPlatformPkg: remove unused PL301Axi driver

2017-12-04 Thread Ard Biesheuvel
No platforms use this driver so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by-if-no-comments-by-15-Dec: Leif Lindholm 
---
 ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.c   | 108 
 ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.inf |  27 -
 ArmPlatformPkg/Include/Drivers/PL301Axi.h|  21 
 3 files changed, 156 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.c 
b/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.c
deleted file mode 100644
index 8600721c581f..
--- a/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/** @file
-*
-*  Copyright (c) 2011, ARM Limited. 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 
-#include 
-
-#define PL301_QOS_TIDEMARK_MI_0  0x400
-#define PL301_QOS_ACCESSCONTROL_MI_0 0x404
-
-#define PL301_QOS_TIDEMARK_MI_1  0x420
-#define PL301_QOS_ACCESSCONTROL_MI_1 0x424
-
-#define PL301_QOS_TIDEMARK_MI_2  0x440
-#define PL301_QOS_ACCESSCONTROL_MI_2 0x444
-
-#define PL301_AR_ARB_MI_00x408
-#define PL301_AW_ARB_MI_00x40C
-
-#define PL301_AR_ARB_MI_10x428
-#define PL301_AW_ARB_MI_10x42C
-
-#define PL301_AR_ARB_MI_20x448
-#define PL301_AW_ARB_MI_20x44C
-
-#define PL301_MI_1_OFFSET0x20
-#define PL301_MI_2_OFFSET0x40
-#define PL301_MI_3_OFFSET0x60
-#define PL301_MI_4_OFFSET0x80
-#define PL301_MI_5_OFFSET0xa0
-
-#define V2P_CA9_FAXI_MI0_TIDEMARK_VAL0x6
-#define V2P_CA9_FAXI_MI0_ACCESSCNTRL_VAL 0x1
-
-#define V2P_CA9_FAXI_MI1_TIDEMARK_VAL0x6
-#define V2P_CA9_FAXI_MI1_ACCESSCNTRL_VAL 0x1
-
-#define V2P_CA9_FAXI_MI2_TIDEMARK_VAL0x6
-#define V2P_CA9_FAXI_MI2_ACCESSCNTRL_VAL 0x1
-
-
-#define FAxiWriteReg(reg,val)MmioWrite32(FAxiBase + reg, 
val)
-#define FAxiReadReg(reg) MmioRead32(FAxiBase + reg)
-
-// IN FAxiBase
-// Initialize PL301 Dynamic Memory Controller
-VOID PL301AxiInit(UINTN FAxiBase) {
-// Configure Tidemark Register for Master Port 0 (MI 0)
-FAxiWriteReg(PL301_QOS_TIDEMARK_MI_0, V2P_CA9_FAXI_MI0_TIDEMARK_VAL);
-
-// Configure the Access Control Register (MI 0)
-FAxiWriteReg(PL301_QOS_ACCESSCONTROL_MI_0, 
V2P_CA9_FAXI_MI0_ACCESSCNTRL_VAL);
-
-// MP0
-// Set priority for Read
-FAxiWriteReg(PL301_AR_ARB_MI_0, 0x0100);
-FAxiWriteReg(PL301_AR_ARB_MI_0, 0x01000200);
-FAxiWriteReg(PL301_AR_ARB_MI_0, 0x02000200);
-FAxiWriteReg(PL301_AR_ARB_MI_0, 0x03000200);
-FAxiWriteReg(PL301_AR_ARB_MI_0, 0x04000200);
-
-// Set priority for Write
-FAxiWriteReg(PL301_AW_ARB_MI_0, 0x0100);
-FAxiWriteReg(PL301_AW_ARB_MI_0, 0x01000200);
-FAxiWriteReg(PL301_AW_ARB_MI_0, 0x02000200);
-FAxiWriteReg(PL301_AW_ARB_MI_0, 0x03000200);
-FAxiWriteReg(PL301_AW_ARB_MI_0, 0x04000200);
-
-// MP1
-// Set priority for Read
-FAxiWriteReg(PL301_AR_ARB_MI_1, 0x0100);
-FAxiWriteReg(PL301_AR_ARB_MI_1, 0x01000200);
-FAxiWriteReg(PL301_AR_ARB_MI_1, 0x02000200);
-FAxiWriteReg(PL301_AR_ARB_MI_1, 0x03000200);
-FAxiWriteReg(PL301_AR_ARB_MI_1, 0x04000200);
-
-// Set priority for Write
-FAxiWriteReg(PL301_AW_ARB_MI_1, 0x0100);
-FAxiWriteReg(PL301_AW_ARB_MI_1, 0x01000200);
-FAxiWriteReg(PL301_AW_ARB_MI_1, 0x02000200);
-FAxiWriteReg(PL301_AW_ARB_MI_1, 0x03000200);
-FAxiWriteReg(PL301_AW_ARB_MI_1, 0x04000200);
-
-// MP2
-// Set priority for Read
-FAxiWriteReg(PL301_AR_ARB_MI_2, 0x0100);
-FAxiWriteReg(PL301_AR_ARB_MI_2, 0x01000100);
-FAxiWriteReg(PL301_AR_ARB_MI_2, 0x02000100);
-FAxiWriteReg(PL301_AR_ARB_MI_2, 0x03000100);
-FAxiWriteReg(PL301_AR_ARB_MI_2, 0x04000100);
-
-// Set priority for Write
-FAxiWriteReg(PL301_AW_ARB_MI_2, 0x0100);
-FAxiWriteReg(PL301_AW_ARB_MI_2, 0x01000200);
-FAxiWriteReg(PL301_AW_ARB_MI_2, 0x02000200);
-FAxiWriteReg(PL301_AW_ARB_MI_2, 0x03000200);
-FAxiWriteReg(PL301_AW_ARB_MI_2, 0x04000200);
-}
diff --git a/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.inf 
b/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.inf
deleted file mode 100644
index 108161fc16c4..
--- 

[edk2] [PATCH v2 11/13] ArmPlatformPkg: remove unused PL310 driver

2017-12-04 Thread Ard Biesheuvel
This driver is not used by any platforms so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by-if-no-comments-by-15-Dec: Leif Lindholm 
---
 ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2Cache.c  | 126 

 ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2CacheSec.inf |  31 -
 ArmPlatformPkg/Include/Drivers/PL310L2Cache.h   |  79 
 3 files changed, 236 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2Cache.c 
b/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2Cache.c
deleted file mode 100644
index 1a6ab33720e5..
--- a/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2Cache.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/** @file
-*
-*  Copyright (c) 2011, ARM Limited. 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 
-#include 
-#include 
-#include 
-#include 
-
-#define L2x0WriteReg(reg,val)   
MmioWrite32(PcdGet32(PcdL2x0ControllerBase) + reg, val)
-#define L2x0ReadReg(reg)
MmioRead32(PcdGet32(PcdL2x0ControllerBase) + reg)
-
-// Initialize PL320 L2 Cache Controller
-VOID
-L2x0CacheInit (
-  IN  UINTN   L2x0Base,
-  IN  UINT32  L2x0TagLatencies,
-  IN  UINT32  L2x0DataLatencies,
-  IN  UINT32  L2x0AuxValue,
-  IN  UINT32  L2x0AuxMask,
-  IN  BOOLEAN CacheEnabled
-  )
-{
-  UINT32 Data;
-  UINT32 Revision;
-  UINT32 Aux;
-  UINT32 PfCtl;
-  UINT32 PwrCtl;
-
-  // Check if L2x0 is present and is an ARM implementation
-  Data = L2x0ReadReg(L2X0_CACHEID);
-  if ((Data >> 24) != L2X0_CACHEID_IMPLEMENTER_ARM) {
-ASSERT(0);
-return;
-  }
-
-  // Check if L2x0 is PL310
-  if (((Data >> 6) & 0xF) != L2X0_CACHEID_PARTNUM_PL310) {
-ASSERT(0);
-return;
-  }
-
-  // RTL release
-  Revision = Data & 0x3F;
-
-  // Check if L2x0 is already enabled then we disable it
-  Data = L2x0ReadReg(L2X0_CTRL);
-  if (Data & L2X0_CTRL_ENABLED) {
-L2x0WriteReg(L2X0_CTRL, L2X0_CTRL_DISABLED);
-  }
-
-  //
-  // Set up global configurations
-  //
-
-  // Auxiliary register: Non-secure interrupt access Control + Event monitor 
bus enable + SBO
-  Aux = L2X0_AUXCTRL_NSAC | L2X0_AUXCTRL_EM | L2X0_AUXCTRL_SBO;
-  // Use AWCACHE attributes for WA
-  Aux |= L2x0_AUXCTRL_AW_AWCACHE;
-  // Use default Size
-  Data = L2x0ReadReg(L2X0_AUXCTRL);
-  Aux |= Data & L2X0_AUXCTRL_WAYSIZE_MASK;
-  // Use default associativity
-  Aux |= Data & L2X0_AUXCTRL_ASSOCIATIVITY;
-  // Enabled I & D Prefetch
-  Aux |= L2x0_AUXCTRL_IPREFETCH | L2x0_AUXCTRL_DPREFETCH;
-
-  if (Revision >= 5) {
-// Prefetch Offset Register
-PfCtl = L2x0ReadReg(L2X0_PFCTRL);
-// - Prefetch increment set to 0
-// - Prefetch dropping off
-// - Double linefills off
-L2x0WriteReg(L2X0_PFCTRL, PfCtl);
-
-// Power Control Register - L2X0_PWRCTRL
-PwrCtl = L2x0ReadReg(L2X0_PWRCTRL);
-// - Standby when idle off
-// - Dynamic clock gating off
-// - Nc,NC-shared dropping off
-L2x0WriteReg(L2X0_PWRCTRL, PwrCtl);
-  }
-
-  if (Revision >= 2) {
-L2x0WriteReg(L230_TAG_LATENCY, L2x0TagLatencies);
-L2x0WriteReg(L230_DATA_LATENCY, L2x0DataLatencies);
-  } else {
-// PL310 old style latency is not supported yet
-ASSERT(0);
-  }
-
-  // Set the platform specific values
-  Aux = (Aux & L2x0AuxMask) | L2x0AuxValue;
-
-  // Write Auxiliary value
-  L2x0WriteReg(L2X0_AUXCTRL, Aux);
-
-  //
-  // Invalidate all entries in cache
-  //
-  L2x0WriteReg(L2X0_INVWAY, 0x);
-  // Poll cache maintenance register until invalidate operation is complete
-  while(L2x0ReadReg(L2X0_INVWAY) & 0x);
-
-  // Write to the Lockdown D and Lockdown I Register 9 if required
-  // - Not required
-
-  // Clear any residual raw interrupts
-  L2x0WriteReg(L2X0_INTCLEAR, 0x1FF);
-
-  // Enable the cache
-  if (CacheEnabled) {
-L2x0WriteReg(L2X0_CTRL, L2X0_CTRL_ENABLED);
-  }
-}
diff --git a/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2CacheSec.inf 
b/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2CacheSec.inf
deleted file mode 100644
index 78f952a1d0c8..
--- a/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2CacheSec.inf
+++ /dev/null
@@ -1,31 +0,0 @@
-#/* @file
-#  Copyright (c) 2011, ARM Limited. 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 

[edk2] [PATCH v2 12/13] ArmPlatformPkg: remove unused ArmTrustZone driver

2017-12-04 Thread Ard Biesheuvel
This driver is no longer used anywhere so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by-if-no-comments-by-15-Dec: Leif Lindholm 
---
 ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c   | 113 
 ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf |  33 --
 ArmPlatformPkg/Include/Drivers/ArmTrustzone.h| 105 --
 3 files changed, 251 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c 
b/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c
deleted file mode 100644
index 1f002198e552..
--- a/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/** @file
-*
-*  Copyright (c) 2011-2012, ARM Limited. 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 
-#include 
-
-#include 
-
-#define TZPC_DECPROT0_STATUS_REG0x800
-#define TZPC_DECPROT0_SET_REG   0x804
-#define TZPC_DECPROT0_CLEAR_REG 0x808
-
-#define TZASC_CONFIGURATION_REG 0x000
-#define TZASC_REGIONS_REG   0x100
-#define TZASC_REGION0_LOW_ADDRESS_REG   0x100
-#define TZASC_REGION0_HIGH_ADDRESS_REG  0x104
-#define TZASC_REGION0_ATTRIBUTES0x108
-
-/**
-FIXME: Need documentation
-**/
-EFI_STATUS
-TZPCSetDecProtBits (
-  IN  UINTN TzpcBase,
-  IN  UINTN TzpcId,
-  IN  UINTN Bits
-  )
-{
-  if (TzpcId > TZPC_DECPROT_MAX) {
-return EFI_INVALID_PARAMETER;
-  }
-
-  MmioWrite32 ((UINTN)TzpcBase + TZPC_DECPROT0_SET_REG + (TzpcId * 0x0C), 
Bits);
-
-  return EFI_SUCCESS;
-}
-
-/**
-FIXME: Need documentation
-**/
-EFI_STATUS
-TZPCClearDecProtBits (
-  IN  UINTN TzpcBase,
-  IN  UINTN TzpcId,
-  IN  UINTN Bits
-  )
-{
-  if (TzpcId> TZPC_DECPROT_MAX) {
-return EFI_INVALID_PARAMETER;
-  }
-
-  MmioWrite32 ((UINTN)TzpcBase + TZPC_DECPROT0_CLEAR_REG + (TzpcId * 0x0C), 
Bits);
-
-  return EFI_SUCCESS;
-}
-
-/**
-FIXME: Need documentation
-**/
-UINT32
-TZASCGetNumRegions (
-  IN UINTN TzascBase
-  )
-{
-  return (MmioRead32 ((UINTN)TzascBase + TZASC_CONFIGURATION_REG) & 0xF);
-}
-
-/**
-FIXME: Need documentation
-**/
-EFI_STATUS
-TZASCSetRegion (
-  IN  INTN  TzascBase,
-  IN  UINTN RegionId,
-  IN  UINTN Enabled,
-  IN  UINTN LowAddress,
-  IN  UINTN HighAddress,
-  IN  UINTN Size,
-  IN  UINTN Security,
-  IN  UINTN SubregionDisableMask
-  )
-{
-  UINT32* Region;
-  UINT32  RegionAttributes;
-
-  if (RegionId > TZASCGetNumRegions(TzascBase)) {
-return EFI_INVALID_PARAMETER;
-  }
-
-  RegionAttributes = TZASC_REGION_ATTR_SECURITY(Security) |
- TZASC_REGION_ATTR_SUBREG_DISABLE(SubregionDisableMask) |
- TZASC_REGION_ATTR_SIZE(Size) |
- TZASC_REGION_ATTR_ENABLE(Enabled);
-
-  Region = (UINT32*)((UINTN)TzascBase + TZASC_REGIONS_REG + (RegionId * 0x10));
-
-  MmioWrite32((UINTN)(Region), TZASC_REGION_SETUP_LO_ADDR(LowAddress));
-  MmioWrite32((UINTN)(Region+1), HighAddress);
-  MmioWrite32((UINTN)(Region+2), RegionAttributes);
-
-  return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf 
b/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf
deleted file mode 100644
index 6f90589a5b90..
--- a/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf
+++ /dev/null
@@ -1,33 +0,0 @@
-#/* @file
-#  Copyright (c) 2011-2012, ARM Limited. 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.
-#
-#*/
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = ArmTrustZoneLib
-  FILE_GUID  = 5962d040-8b8a-11df-9a71-0002a5d5c51b
-  MODULE_TYPE= BASE
-  VERSION_STRING = 1.0
-  LIBRARY_CLASS  = ArmTrustZoneLib
-
-
-[Sources.common]
-  ArmTrustZone.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-  ArmPkg/ArmPkg.dec
-  ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
-  BaseLib
-  IoLib
diff --git a/ArmPlatformPkg/Include/Drivers/ArmTrustzone.h 
b/ArmPlatformPkg/Include/Drivers/ArmTrustzone.h
deleted file mode 100644
index 827b5cd568c1..
--- 

[edk2] [PATCH v2 06/13] ArmPlatformPkg: add missing library class declarations to .dec file

2017-12-04 Thread Ard Biesheuvel
Add ArmPlatformLib, LcdPlatformlib and NorFlashPlatformLib to the
[LibraryClasses] section of ArmPlatformPkg.dec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 ArmPlatformPkg/ArmPlatformPkg.dec | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec 
b/ArmPlatformPkg/ArmPlatformPkg.dec
index 9d47e459eadc..d42404e8cd38 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -32,6 +32,9 @@ [Includes.common]
   Include# Root include for the package
 
 [LibraryClasses]
+  ArmPlatformLib|Include/Library/ArmPlatformLib.h
+  LcdPlatformLib|Include/Library/LcdPlatformLib.h
+  NorFlashPlatformLib|Include/Library/NorFlashPlatformLib.h
   PL011UartLib|Include/Library/PL011UartLib.h
 
 [Guids.common]
-- 
2.11.0

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


[edk2] [PATCH v2 03/13] ArmPlatformPkg: remove ArmPlatformSysConfigLib library class

2017-12-04 Thread Ard Biesheuvel
The only remaining user of ArmPlatformSysConfigLib has absorbed this
definition into its own edk2-platforms package, so let's remove it from
the shared code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Leif Lindholm 
---
 ArmPlatformPkg/Include/Library/ArmPlatformSysConfigLib.h   
| 63 ---
 
ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.c
   | 85 
 
ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf
 | 28 ---
 3 files changed, 176 deletions(-)

diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformSysConfigLib.h 
b/ArmPlatformPkg/Include/Library/ArmPlatformSysConfigLib.h
deleted file mode 100644
index 39a0cc7f734c..
--- a/ArmPlatformPkg/Include/Library/ArmPlatformSysConfigLib.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/** @file  ArmPlatformSysConfigLib.h
-
-  Copyright (c) 2011-2012, ARM 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 __ARM_PLATFORM_SYS_CONFIG_H__
-#define __ARM_PLATFORM_SYS_CONFIG_H__
-
-#include 
-
-/* This header file makes it easier to access the System Configuration 
Registers
- * in the ARM Versatile Express motherboard.
- */
-
-//
-// Typedef
-//
-typedef UINT32  SYS_CONFIG_FUNCTION;
-
-//
-// Functions
-//
-RETURN_STATUS
-ArmPlatformSysConfigInitialize (
-  VOID
-  );
-
-RETURN_STATUS
-ArmPlatformSysConfigGet (
-  IN  SYS_CONFIG_FUNCTION   Function,
-  OUT UINT32*   Value
-  );
-
-RETURN_STATUS
-ArmPlatformSysConfigGetValues (
-  IN  SYS_CONFIG_FUNCTION   Function,
-  IN  UINTN Size,
-  OUT UINT32*   Values
-  );
-
-RETURN_STATUS
-ArmPlatformSysConfigSet (
-  IN  SYS_CONFIG_FUNCTION   Function,
-  IN  UINT32Value
-  );
-
-RETURN_STATUS
-ArmPlatformSysConfigSetDevice (
-  IN  SYS_CONFIG_FUNCTION   Function,
-  IN  UINT32Device,
-  IN  UINT32Value
-  );
-
-#endif /* __SYS_CFG_REGISTERS_H__ */
diff --git 
a/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.c
 
b/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.c
deleted file mode 100644
index a7199e65d8f6..
--- 
a/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/** @file
-
-  Copyright (c) 2011-2014, ARM 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 
-
-#include 
-
-
-RETURN_STATUS
-ArmPlatformSysConfigInitialize (
-  VOID
-  )
-{
-  return RETURN_SUCCESS;
-}
-
-/***
- * GENERAL FUNCTION: AccessSysCfgRegister
- * Interacts with
- *SYS_CFGSTAT
- *SYS_CFGDATA
- *SYS_CFGCTRL
- * for setting and for reading out values
- ***/
-RETURN_STATUS
-AccessSysCfgRegister (
-  IN UINT32   ReadWrite,
-  IN UINT32   Function,
-  IN UINT32   Site,
-  IN UINT32   Position,
-  IN UINT32   Device,
-  IN OUT UINT32*  Data
-  )
-{
-  return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigGet (
-  IN  SYS_CONFIG_FUNCTION   Function,
-  OUT UINT32*   Value
-  )
-{
-  return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigGetValues (
-  IN  SYS_CONFIG_FUNCTION   Function,
-  IN  UINTN Size,
-  OUT UINT32*   Values
-  )
-{
-  return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigSet (
-  IN  SYS_CONFIG_FUNCTION   Function,
-  IN  UINT32Value
-  )
-{
-  return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigSetDevice (
-  IN  SYS_CONFIG_FUNCTION   Function,
-  IN  UINT32Device,
-  IN  UINT32Value
-  )
-{
-  return RETURN_UNSUPPORTED;
-}
diff --git 
a/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf
 
b/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf
deleted file mode 100644
index f379d7228cd4..
--- 

[edk2] [PATCH v2 01/13] ArmPlatformPkg: remove NorFlashArmVExpressLib

2017-12-04 Thread Ard Biesheuvel
Remove NorFlashArmVExpressLib now that it has been moved into edk2-platforms
where it belongs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Leif Lindholm 
---
 
ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c
  | 84 
 
ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
 | 32 
 2 files changed, 116 deletions(-)

diff --git 
a/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c
 
b/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c
deleted file mode 100644
index a136bff4a1d6..
--- 
a/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2014, ARM 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 
-#include 
-#include 
-#include 
-#include 
-
-#define NOR_FLASH_DEVICE_COUNT 4
-
-NOR_FLASH_DESCRIPTION mNorFlashDevices[NOR_FLASH_DEVICE_COUNT] = {
-  { // BootMon
-ARM_VE_SMB_NOR0_BASE,
-ARM_VE_SMB_NOR0_BASE,
-SIZE_256KB * 255,
-SIZE_256KB,
-{ 0xE7223039, 0x5836, 0x41E1, { 0xB5, 0x42, 0xD7, 0xEC, 0x73, 0x6C, 0x5E, 
0x59 } }
-  },
-  { // BootMon non-volatile storage
-ARM_VE_SMB_NOR0_BASE,
-ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255,
-SIZE_64KB * 4,
-SIZE_64KB,
-{ 0x02118005, 0x9DA7, 0x443A, { 0x92, 0xD5, 0x78, 0x1F, 0x02, 0x2A, 0xED, 
0xBB } }
-  },
-  { // UEFI
-ARM_VE_SMB_NOR1_BASE,
-ARM_VE_SMB_NOR1_BASE,
-SIZE_256KB * 255,
-SIZE_256KB,
-{ 0x1F15DA3C, 0x37FF, 0x4070, { 0xB4, 0x71, 0xBB, 0x4A, 0xF1, 0x2A, 0x72, 
0x4A } }
-  },
-  { // UEFI Variable Services non-volatile storage
-ARM_VE_SMB_NOR1_BASE,
-ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255,
-SIZE_64KB * 3, //FIXME: Set 3 blocks because I did not succeed to copy 4 
blocks into the ARM Versatile Express NOR Flash in the last NOR Flash. It 
should be 4 blocks
-SIZE_64KB,
-{ 0xCC2CBF29, 0x1498, 0x4CDD, { 0x81, 0x71, 0xF8, 0xB6, 0xB4, 0x1D, 0x09, 
0x09 } }
-  }
-};
-
-EFI_STATUS
-NorFlashPlatformInitialization (
-  VOID
-  )
-{
-  // Everything seems ok so far, so now we need to disable the 
platform-specific
-  // flash write protection for Versatile Express
-  if ((MmioRead32 (ARM_VE_SYS_FLASH) & 0x1) == 0) {
-// Writing to NOR FLASH is disabled, so enable it
-MmioWrite32 (ARM_VE_SYS_FLASH,1);
-DEBUG((DEBUG_BLKIO, "NorFlashWriteBlocks: informational - Had to enable 
HSYS_FLASH flag.\n" ));
-  }
-
-  return EFI_SUCCESS;
-}
-
-EFI_STATUS
-NorFlashPlatformGetDevices (
-  OUT NOR_FLASH_DESCRIPTION   **NorFlashDevices,
-  OUT UINT32  *Count
-  )
-{
-  if ((NorFlashDevices == NULL) || (Count == NULL)) {
-return EFI_INVALID_PARAMETER;
-  }
-
-  *NorFlashDevices = mNorFlashDevices;
-  *Count = NOR_FLASH_DEVICE_COUNT;
-
-  return EFI_SUCCESS;
-}
diff --git 
a/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
 
b/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
deleted file mode 100644
index 0798cc30d8fc..
--- 
a/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
+++ /dev/null
@@ -1,32 +0,0 @@
-#/** @file
-#
-#  Copyright (c) 2011, ARM 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.
-#
-#**/
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = NorFlashArmVExpressLib
-  FILE_GUID  = c0f5dfa0-7599-11e0-9665-0002a5d5c51b
-  MODULE_TYPE= DXE_DRIVER
-  VERSION_STRING = 1.0
-  LIBRARY_CLASS  = NorFlashPlatformLib
-
-[Sources.common]
-  NorFlashArmVExpress.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-  ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
-  BaseLib
-  DebugLib
-  IoLib
-- 
2.11.0

___
edk2-devel mailing list
edk2-devel@lists.01.org

[edk2] [PATCH v2 07/13] ArmPlatformPkg/LcdGraphicsOutputDxe: move headers into driver directory

2017-12-04 Thread Ard Biesheuvel
The HdLcd.h and PL111Lcd.h header files are internal headers that should
not be used by other drivers. So move them from Include/Drivers into the
driver directory instead.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c | 
3 +--
 ArmPlatformPkg/{Include/Drivers => Drivers/LcdGraphicsOutputDxe}/HdLcd.h| 0
 ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c  | 
3 +--
 ArmPlatformPkg/{Include/Drivers => Drivers/LcdGraphicsOutputDxe}/PL111Lcd.h | 0
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c 
b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c
index 2bfe2c0fe2dc..f5d7b53905fb 100644
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c
+++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c
@@ -18,8 +18,7 @@
 #include 
 #include 
 
-#include 
-
+#include "HdLcd.h"
 #include "LcdGraphicsOutputDxe.h"
 
 /**
diff --git a/ArmPlatformPkg/Include/Drivers/HdLcd.h 
b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.h
similarity index 100%
rename from ArmPlatformPkg/Include/Drivers/HdLcd.h
rename to ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.h
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c 
b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c
index b5e113b844d4..a9ce60c5b0a6 100644
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c
+++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c
@@ -15,9 +15,8 @@
 #include 
 #include 
 
-#include 
-
 #include "LcdGraphicsOutputDxe.h"
+#include "PL111Lcd.h"
 
 /**
  *
diff --git a/ArmPlatformPkg/Include/Drivers/PL111Lcd.h 
b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.h
similarity index 100%
rename from ArmPlatformPkg/Include/Drivers/PL111Lcd.h
rename to ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.h
-- 
2.11.0

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


[edk2] [PATCH v2 00/13] ArmPlatformPkg: remove unused or migrated modules

2017-12-04 Thread Ard Biesheuvel
Remove everything from ArmPlatformPkg that is either unused, or so highly
specific to development platforms manufactured by ARM Ltd. that they really
don't belong in the main branch.

Note that the migration involves patches against edk2-platforms that add
some of this code back under Platform/ARM. Most of it (but not all of it)
has been posted as a separate series already.

Changes since v1:
- keep LcdGraphicsOutputDxe
- drop merged patches
- add some new cleanup patches (#5 - #7)

Ard Biesheuvel (13):
  ArmPlatformPkg: remove NorFlashArmVExpressLib
  ArmPlatformPkg: remove ArmVExpressPkg
  ArmPlatformPkg: remove ArmPlatformSysConfigLib library class
  ArmPlatformPkg: remove BootMonFs and ArmShellCmdRunAxf
  ArmPlatformPkg: remove old PL011UartLib implementation
  ArmPlatformPkg: add missing library class declarations to .dec file
  ArmPlatformPkg/LcdGraphicsOutputDxe: move headers into driver
directory
  ArmPlatformPkg: remove unused PL301Axi driver
  ArmPlatformPkg: remove unused PL35x driver
  ArmPlatformPkg: remove PL34xDmc driver
  ArmPlatformPkg: remove unused PL310 driver
  ArmPlatformPkg: remove unused ArmTrustZone driver
  ArmPlatformPkg: remove unused SP804 driver and TimerLib implementation

 ArmPlatformPkg/ArmPlatformPkg.dec  
 |   10 +-
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c   
 |   90 --
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf 
 |   38 -
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c
 |   38 -
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf  
 |   37 -
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c 
 |  519 --
 
ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBootDxe.inf 
|   51 -
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec   
 |   53 -
 ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h  
 |  154 ---
 ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM/ArmPlatform.h  
 |   79 --
 ArmPlatformPkg/ArmVExpressPkg/Include/VExpressMotherBoard.h
 |  140 ---
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/ArmVExpressLib.inf 
|   53 -
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c
 |  182 
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S  
 |   81 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm 
|   96 --
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Mem.c 
 |  182 
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S  
 |   61 --
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S  
 |   97 --
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
 |  118 ---
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
 |   62 --
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf 
 |   59 --
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c
 |  195 
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c 
 |  161 ---
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c
|  273 -
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
   |   35 -
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c
   |  283 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf
 |   37 -
 ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c   
 |  285 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf
   |   45 -
 
ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c
  |   84 --
 
ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
 |   32 -
 
ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c
  |  370 ---
 

[edk2] [PATCH v2 09/13] ArmPlatformPkg: remove unused PL35x driver

2017-12-04 Thread Ard Biesheuvel
No platform uses this so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by-if-no-comments-by-15-Dec: Leif Lindholm 
---
 ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S   | 60 
 ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.asm | 62 
 ArmPlatformPkg/Drivers/PL35xSmc/PL35xSmc.inf  | 29 
 ArmPlatformPkg/Include/Drivers/PL35xSmc.h | 75 
 4 files changed, 226 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S 
b/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S
deleted file mode 100644
index a26a4d43770e..
--- a/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-#  Copyright (c) 2011-2012, ARM Limited. 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 
-#include 
-#include 
-#include 
-
-.text
-
-#Maintain 8 byte alignment
-.align 3
-
-GCC_ASM_EXPORT(PL35xSmcInitialize)
-GCC_ASM_EXPORT(PL35xSmcSetRefresh)
-
-// IN r1 Smc Base Address
-// IN r2 Smc Configuration Start Address
-// IN r3 Smc Configuration End Address
-// NOTE: This code is been called before any stack has been setup. It means 
some registers
-//   could be overwritten (case of 'r0')
-ASM_PFX(PL35xSmcInitialize):
-  // While (SmcConfigurationStart < SmcConfigurationEnd)
-  cmp   r2, r3
-  blxge lr
-
-  // Write to set_cycle register(holding register for NOR 1 cycle register or 
NAND cycle register)
-  ldr   r0, [r2, #0x4]
-  str   r0, [r1, #PL350_SMC_SET_CYCLES_OFFSET]
-
-  // Write to set_opmode register(holding register for NOR 1 opomode register 
or NAND opmode register)
-  ldr   r0, [r2, #0x8]
-  str   r0, [r1, #PL350_SMC_SET_OPMODE_OFFSET]
-
-  // Write to direct_cmd register so that the NOR 1 registers(set-cycles and 
opmode) are updated with holding registers
-  ldr   r0, =PL350_SMC_DIRECT_CMD_ADDR_CMD_UPDATE
-  ldr   r4, [r2, #0x0]
-  orr   r0, r0, r4
-  str   r0, [r1, #PL350_SMC_DIRECT_CMD_OFFSET]
-
-  add   r2, #0xC
-  b ASM_PFX(PL35xSmcInitialize)
-
-// IN r1 Smc Base Address
-// IN r2 Smc Refresh Period 0
-// IN r3 Smc Refresh Period 1
-ASM_PFX(PL35xSmcSetRefresh):
-  str   r2, [r1, #PL350_SMC_REFRESH_0_OFFSET]
-  str   r3, [r1, #PL350_SMC_REFRESH_1_OFFSET]
-  blx lr
diff --git a/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.asm 
b/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.asm
deleted file mode 100644
index 661b0688c85c..
--- a/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.asm
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-//  Copyright (c) 2011-2012, ARM Limited. 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 
-#include 
-#include 
-#include 
-
-  INCLUDE AsmMacroIoLib.inc
-
-  EXPORT  PL35xSmcInitialize
-  EXPORT  PL35xSmcSetRefresh
-
-  PRESERVE8
-  AREAModuleInitializeSMC, CODE, READONLY
-
-// IN r1 Smc Base Address
-// IN r2 Smc Configuration Start Address
-// IN r3 Smc Configuration End Address
-// NOTE: This code is been called before any stack has been setup. It means 
some registers
-//   could be overwritten (case of 'r0')
-PL35xSmcInitialize
-  // While (SmcConfigurationStart < SmcConfigurationEnd)
-  cmp   r2, r3
-  blxge lr
-
-  // Write to set_cycle register(holding register for NOR 1 cycle register or 
NAND cycle register)
-  ldr   r0, [r2, #0x4]
-  str   r0, [r1, #PL350_SMC_SET_CYCLES_OFFSET]
-
-  // Write to set_opmode register(holding register for NOR 1 opomode register 
or NAND opmode register)
-  ldr   r0, [r2, #0x8]
-  str   r0, [r1, #PL350_SMC_SET_OPMODE_OFFSET]
-
-  // Write to direct_cmd register so that the NOR 1 registers(set-cycles and 
opmode) are updated with holding registers
-  ldr   r0, =PL350_SMC_DIRECT_CMD_ADDR_CMD_UPDATE
-  ldr   r4, [r2, #0x0]
-  orr   r0, r0, r4
-  str   r0, [r1, #PL350_SMC_DIRECT_CMD_OFFSET]
-
-  add   r2, #0xC
-  b PL35xSmcInitialize
-
-// IN r1 Smc Base Address
-// IN r2 Smc Refresh Period 0
-// IN r3 Smc Refresh Period 1
-PL35xSmcSetRefresh
-  str   r2, [r1, #PL350_SMC_REFRESH_0_OFFSET]
-  str   r3, [r1, #PL350_SMC_REFRESH_1_OFFSET]
-  blx lr
-
-  END
diff 

[edk2] [PATCH v3 edk2-platforms 0/2] Move ArmPlatformPkg stuff into edk2-platforms

2017-12-04 Thread Ard Biesheuvel
This v3 series contains the remaining patches that move drivers and other code 
that
is highly specific to ARM Ltd. Versatile Express platforms into edk2-platforms,
hopefully making the line between generic drivers for ARM IP and VExpress boards
incorporating it less blurry.

The most notable change in this version is that the LCD graphics output driver 
is
no longer migrated. There is work ongoing to add Mali support to it, which will
hopefully be reusable by other platforms than VExpress ones.

Ard Biesheuvel (2):
  Platform/ARM/VExpress: import VExpressPkg from EDK2
  Platform/ARM: import BootMonFs and ArmShellCmdRunAxf from EDK2

 Platform/ARM/ARM.dec   
|   25 +
 Platform/ARM/Drivers/BootMonFs/BootMonFs.dec   
|   26 +
 Platform/ARM/Drivers/BootMonFs/BootMonFs.inf   
|   63 ++
 Platform/ARM/Drivers/BootMonFs/BootMonFsApi.h  
|  388 +++
 Platform/ARM/Drivers/BootMonFs/BootMonFsDir.c  
|  766 ++
 Platform/ARM/Drivers/BootMonFs/BootMonFsEntryPoint.c   
|  529 ++
 Platform/ARM/Drivers/BootMonFs/BootMonFsHw.h   
|   57 ++
 Platform/ARM/Drivers/BootMonFs/BootMonFsImages.c   
|  222 
 Platform/ARM/Drivers/BootMonFs/BootMonFsInternal.h 
|  101 ++
 Platform/ARM/Drivers/BootMonFs/BootMonFsOpenClose.c
|  795 +++
 Platform/ARM/Drivers/BootMonFs/BootMonFsReadWrite.c
|  259 +
 Platform/ARM/Drivers/BootMonFs/BootMonFsUnsupported.c  
|   37 +
 Platform/ARM/Include/Guid/BootMonFsFileInfo.h  
|   47 +
 Platform/ARM/Include/Library/ArmShellCmdLib.h  
|   57 ++
 Platform/ARM/JunoPkg/ArmJuno.dsc   
|2 +-
 Platform/ARM/JunoPkg/ArmJuno.fdf   
|2 +-
 Platform/ARM/JunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf 
|1 +
 Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c 
|   95 ++
 Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.h 
|   83 ++
 Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf   
|   54 +
 Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.uni   
|   68 ++
 Platform/ARM/Library/ArmShellCmdRunAxf/BootMonFsLoader.c   
|  154 +++
 Platform/ARM/Library/ArmShellCmdRunAxf/BootMonFsLoader.h   
|   66 ++
 Platform/ARM/Library/ArmShellCmdRunAxf/ElfLoader.c 
|  340 +++
 Platform/ARM/Library/ArmShellCmdRunAxf/ElfLoader.h 
|   64 ++
 Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c
|  395 
 Platform/ARM/Library/ArmShellCmdRunAxf/elf32.h 
|  258 +
 Platform/ARM/Library/ArmShellCmdRunAxf/elf64.h 
|  260 +
 Platform/ARM/Library/ArmShellCmdRunAxf/elf_common.h
| 1059 
 Platform/ARM/VExpressPkg/AcpiTables/AcpiTables.inf 
|3 +-
 Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc  
|   29 +-
 Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.fdf  
|8 +-
 Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc   
|   19 +-
 Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf   
|2 +-
 Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc   
|   14 +-
 Platform/ARM/VExpressPkg/ArmVExpressPkg.dec
|   60 ++
 Platform/ARM/VExpressPkg/Drivers/ArmVExpressDxe/ArmFvpDxe.c
|   90 ++
 Platform/ARM/VExpressPkg/Drivers/ArmVExpressDxe/ArmFvpDxe.inf  
|   40 +
 Platform/ARM/VExpressPkg/Drivers/ArmVExpressDxe/ArmHwDxe.c

Re: [edk2] [PATCH] ArmPlatformPkg/LcdGraphicsOutputDxe: remove VExpressPkg dependency

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 21:34, Leif Lindholm  wrote:
> On Mon, Dec 04, 2017 at 08:50:52PM +, Ard Biesheuvel wrote:
>> The two instantiations of LcdGraphicsOutputDxe reference VExpressPkg.dec
>> without actually relying on anything it defines. In preparation of
>> moving out VExpressPkg into edk2-platforms, drop these references so we
>> can keep LcdGraphicsOutputDxe in EDK2.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ard Biesheuvel 
>
> Reviewed-by: Leif Lindholm 
>

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


Re: [edk2] [PATCH] ArmPlatformPkg/LcdGraphicsOutputDxe: remove VExpressPkg dependency

2017-12-04 Thread Leif Lindholm
On Mon, Dec 04, 2017 at 08:50:52PM +, Ard Biesheuvel wrote:
> The two instantiations of LcdGraphicsOutputDxe reference VExpressPkg.dec
> without actually relying on anything it defines. In preparation of
> moving out VExpressPkg into edk2-platforms, drop these references so we
> can keep LcdGraphicsOutputDxe in EDK2.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

> ---
> This is a preparatory patch for my rebase of the ArmPlatformPkg cleanup
> series, allowing future contributions to the LCD output driver to remain
> in EDK2, while forcing VExpress specific glue code to be factored out
> correctly and contributed to edk2-platforms.
> 
>  ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf| 
> 1 -
>  ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf | 
> 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git 
> a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf 
> b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
> index 462d1fa402d7..896fc588b275 100644
> --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
> +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
> @@ -31,7 +31,6 @@ [Packages]
>MdePkg/MdePkg.dec
>MdeModulePkg/MdeModulePkg.dec
>ArmPkg/ArmPkg.dec
> -  ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
>ArmPlatformPkg/ArmPlatformPkg.dec
>  
>  [LibraryClasses]
> diff --git 
> a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf 
> b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
> index 003cc2ffa912..39e42bcbab2a 100644
> --- 
> a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
> +++ 
> b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
> @@ -30,7 +30,6 @@ [Packages]
>MdePkg/MdePkg.dec
>MdeModulePkg/MdeModulePkg.dec
>ArmPkg/ArmPkg.dec
> -  ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
>ArmPlatformPkg/ArmPlatformPkg.dec
>  
>  [LibraryClasses]
> -- 
> 2.11.0
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] ArmPlatformPkg/LcdGraphicsOutputDxe: remove VExpressPkg dependency

2017-12-04 Thread Ard Biesheuvel
The two instantiations of LcdGraphicsOutputDxe reference VExpressPkg.dec
without actually relying on anything it defines. In preparation of
moving out VExpressPkg into edk2-platforms, drop these references so we
can keep LcdGraphicsOutputDxe in EDK2.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
This is a preparatory patch for my rebase of the ArmPlatformPkg cleanup
series, allowing future contributions to the LCD output driver to remain
in EDK2, while forcing VExpress specific glue code to be factored out
correctly and contributed to edk2-platforms.

 ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf| 1 -
 ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf | 1 -
 2 files changed, 2 deletions(-)

diff --git 
a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf 
b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
index 462d1fa402d7..896fc588b275 100644
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
+++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
@@ -31,7 +31,6 @@ [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   ArmPkg/ArmPkg.dec
-  ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
   ArmPlatformPkg/ArmPlatformPkg.dec
 
 [LibraryClasses]
diff --git 
a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf 
b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
index 003cc2ffa912..39e42bcbab2a 100644
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
+++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
@@ -30,7 +30,6 @@ [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   ArmPkg/ArmPkg.dec
-  ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
   ArmPlatformPkg/ArmPlatformPkg.dec
 
 [LibraryClasses]
-- 
2.11.0

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


Re: [edk2] [PATCH] MdeModulePkg/Core/Dxe: log informative memprotect msgs at DEBUG_INFO level

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 19:47, Laszlo Ersek  wrote:
> In commit 7eb927db3e25 ("MdeModulePkg/DxeCore: implement memory protection
> policy", 2017-02-24), we added two informative messages with the
> InitializeDxeNxMemoryProtectionPolicy() function:
>
>> InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to
>> active memory regions
>
> and
>
>> InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to
>> inactive memory regions
>
> The messages don't report errors or warnings, thus downgrade their log
> masks from DEBUG_ERROR to DEBUG_INFO.
>
> Cc: Ard Biesheuvel 
> Cc: Eric Dong 
> Cc: Jiewen Yao 
> Cc: Liming Gao 
> Cc: Star Zeng 
> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1520485
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek 

Acked-by: Ard Biesheuvel 

> ---
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c 
> b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> index 21a52d0af55a..a74cfc137a22 100644
> --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> @@ -831,8 +831,11 @@ InitializeDxeNxMemoryProtectionPolicy (
>} while (Status == EFI_BUFFER_TOO_SMALL);
>ASSERT_EFI_ERROR (Status);
>
> -  DEBUG((DEBUG_ERROR, "%a: applying strict permissions to active memory 
> regions\n",
> -__FUNCTION__));
> +  DEBUG ((
> +DEBUG_INFO,
> +"%a: applying strict permissions to active memory regions\n",
> +__FUNCTION__
> +));
>
>MergeMemoryMapForProtectionPolicy (MemoryMap, , 
> DescriptorSize);
>
> @@ -856,9 +859,11 @@ InitializeDxeNxMemoryProtectionPolicy (
>// accessible, but have not been added to the UEFI memory map (yet).
>//
>if (GetPermissionAttributeForMemoryType (EfiConventionalMemory) != 0) {
> -DEBUG((DEBUG_ERROR,
> +DEBUG ((
> +  DEBUG_INFO,
>"%a: applying strict permissions to inactive memory regions\n",
> -  __FUNCTION__));
> +  __FUNCTION__
> +  ));
>
>  CoreAcquireGcdMemoryLock ();
>
> --
> 2.14.1.3.gb7cf6e02401b
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] MdeModulePkg/Core/Dxe: log informative memprotect msgs at DEBUG_INFO level

2017-12-04 Thread Laszlo Ersek
In commit 7eb927db3e25 ("MdeModulePkg/DxeCore: implement memory protection
policy", 2017-02-24), we added two informative messages with the
InitializeDxeNxMemoryProtectionPolicy() function:

> InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to
> active memory regions

and

> InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to
> inactive memory regions

The messages don't report errors or warnings, thus downgrade their log
masks from DEBUG_ERROR to DEBUG_INFO.

Cc: Ard Biesheuvel 
Cc: Eric Dong 
Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Star Zeng 
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1520485
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
index 21a52d0af55a..a74cfc137a22 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
@@ -831,8 +831,11 @@ InitializeDxeNxMemoryProtectionPolicy (
   } while (Status == EFI_BUFFER_TOO_SMALL);
   ASSERT_EFI_ERROR (Status);
 
-  DEBUG((DEBUG_ERROR, "%a: applying strict permissions to active memory 
regions\n",
-__FUNCTION__));
+  DEBUG ((
+DEBUG_INFO,
+"%a: applying strict permissions to active memory regions\n",
+__FUNCTION__
+));
 
   MergeMemoryMapForProtectionPolicy (MemoryMap, , 
DescriptorSize);
 
@@ -856,9 +859,11 @@ InitializeDxeNxMemoryProtectionPolicy (
   // accessible, but have not been added to the UEFI memory map (yet).
   //
   if (GetPermissionAttributeForMemoryType (EfiConventionalMemory) != 0) {
-DEBUG((DEBUG_ERROR,
+DEBUG ((
+  DEBUG_INFO,
   "%a: applying strict permissions to inactive memory regions\n",
-  __FUNCTION__));
+  __FUNCTION__
+  ));
 
 CoreAcquireGcdMemoryLock ();
 
-- 
2.14.1.3.gb7cf6e02401b

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


Re: [edk2] [PATCH 3/6] MdePkg/Library/BaseLib: Enable VS2017/ARM builds

2017-12-04 Thread Pete Batard

On 2017.12.04 15:40, Gao, Liming wrote:

Pete:
   Why override compiler option /GL- here?


I carried this /GL- override from an earlier patch, as I was initially 
experiencing breakage when trying to compile some drivers without it 
during linking.


However, I have now re-tested without this option, and I can't see any 
instance where /GL- appears to be needed.


I will therefore remove it and submit a new patch.

Regards,

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


Re: [edk2] [PATCH 6/6] BaseTools/Conf: Add VS2017/ARM support

2017-12-04 Thread Pete Batard

On 2017.12.04 15:48, Gao, Liming wrote:

  1. You add new build for ARM. I remember the reason is that --convert-hex 
can't be used by trim for ARM ASM file. Right?


That is correct.

Maybe there's a better option to achieve just that, as duplicating the 
whole section just to remove an option seems a bit of an overkill...



  2. On tools_def.txt. Why introduce 
/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE option?


The MSFT toolchain for ARM actively prevents compilation of native 
applications, when using Microsoft headers, unless this value is 
defined. If that is not the case, you get the error: "Compiling Desktop 
applications for the ARM platform is not supported."


So this was needed when we were still using Microsoft headers for 
stdarg.h, as compilation would break otherwise.


However, now that we are no longer relying on any standard headers from 
the VS toolchain, I just confirmed that the option is no longer needed 
(as the check for this definition is done in one of the Microsoft 
headers, not the compiler).


I will therefore remove that option, as it is no longer needed.

Regards,

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


Re: [edk2] [PATCH 1/6] MdePkg: Disable some Level 4 warnings for VS2017/ARM

2017-12-04 Thread Pete Batard

Hi Liming,

Thanks for reviewing these patches.

As explained in the git comment, I chose to disable warnings that I saw 
being generated more than 5 times during QEMU compilation, as I suspect 
we may inherit things from gcc that we may not want to spend too much 
time changing, just to keep MSVC happy.


Considering that we are introducing a new target for MS users, it may be 
worth being a bit more lenient with warnings for the time being, so that 
people don't have to spend too much time addressing issues that they 
wouldn't get with other compilers (gcc, Clang), if they decide to try 
VS2017/ARM, as it may drive them off otherwise.


Especially, if we try to align ARM warnings with IA32/X64, then we're 
going to have to address at least 78 instances of C4244 warnings 
("conversion from 'type1' to 'type2', possible loss of data") in our ARM 
codebase eventually, which is probably not in our best interest.


For reference, here is the list of Level 4 compiler warnings I got, 
during QEMU compilation, along with the number of times they occurred:


C4018:   7
C4101:   6
C4132:   1
C4146:   3
C4244:  78
C4366:   1
C4389:   1
C4456:  10
C4701:  50
C4703:  48

This being said, I suspect most of the warnings above may not be 
generated when compiling regular UEFI ARM applications or drivers, as I 
only started to see those when trying to compile QEMU.


So, if you think that's preferable, we can proceed as you suggest, and 
align ARM disabled warnings with IA32 and X64. Then we can wait and see 
if users of VS2017/ARM start to complain that more warnings need to be 
disabled...


Regards,

/Pete

On 2017.12.04 15:36, Gao, Liming wrote:

Pete:
   I suggest to align the disabled warning list to IA32/X64 arch. I find 
someone are not listed in IA32/X64 arch. Could you give the more detail on why 
disable them by default?

Thanks
Liming

-Original Message-
From: Pete Batard [mailto:p...@akeo.ie]
Sent: Monday, December 4, 2017 9:12 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [PATCH 1/6] MdePkg: Disable some Level 4 warnings for VS2017/ARM

Warnings 4018, 4100, 4101, 4127, 4214, 4244, 4456, 4701 and 4703 are
disabled as they were found to occur more than 5 times during QEMU
firmware compilation.

Also create a dummy macro for PRESERVE8, as this is not supported by
the Microsoft ARM assembler.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
  MdePkg/Include/Arm/ProcessorBind.h | 96 +++-
  1 file changed, 75 insertions(+), 21 deletions(-)

diff --git a/MdePkg/Include/Arm/ProcessorBind.h 
b/MdePkg/Include/Arm/ProcessorBind.h
index dde1fd1152ba..00de80bafe0a 100644
--- a/MdePkg/Include/Arm/ProcessorBind.h
+++ b/MdePkg/Include/Arm/ProcessorBind.h
@@ -1,15 +1,15 @@
  /** @file
Processor or Compiler specific defines and types for ARM.

-  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
Portions copyright (c) 2008 - 2009, Apple Inc. 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
+  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.
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

  **/

@@ -28,14 +28,63 @@
  #pragma pack()
  #endif

+#if defined(_MSC_EXTENSIONS)
+
  //
-// RVCT does not support the __builtin_unreachable() macro
+// Disable 'signed/unsigned mismatch' warnings.
  //
-#ifdef __ARMCC_VERSION
+#pragma warning ( disable : 4018 )
+
+//
+// Disable 'unreferenced formal parameter' warnings.
+//
+#pragma warning ( disable : 4100 )
+
+//
+// Disable 'unreferenced local variable' warnings.
+//
+#pragma warning ( disable : 4101 )
+
+//
+// Suppress warnings for ASSERT(FALSE) or while(TRUE).
+//
+#pragma warning ( disable : 4127 )
+
+//
+// Disable bitfield type check warnings.
+//
+#pragma warning ( disable : 4214 )
+
+//
+// Disable 'conversion from X to Y, possible loss of data' warnings
+//
+#pragma warning ( disable : 4244 )
+
+//
+// Disable 'declaration of X hides previous local declaration' warnings
+//
+#pragma warning ( disable : 4456 )
+
+//
+// Disable 'potentially uninitialized local variable X used' warnings
+//
+#pragma warning ( disable : 4701 )
+
+//
+// Disable 'potentially 

Re: [edk2] [PATCH edk2-platforms 2/2] Platform/Hisilicon: fix conditional inclusion of tftp shell command

2017-12-04 Thread Leif Lindholm
On Mon, Dec 04, 2017 at 05:17:15PM +, Leif Lindholm wrote:
> On Mon, Dec 04, 2017 at 05:15:35PM +, Ard Biesheuvel wrote:
> > On 4 December 2017 at 17:13, Leif Lindholm  wrote:
> > > D02, D03 and D05 all have nice conditional clauses to only include
> > > the non-standard tftp shell command ifdef(INCLUDE_TFTP_COMMAND).
> > >
> > > Unfortunately, they all explicitly set DEFINE INCLUDE_TFTP_COMMAND=1 in
> > > their platform description files, meaning there is no way to exclude the
> > > command without an editor.
> > >
> > > So remove the DEFINE and let people specify on the command line whether
> > > to include it, as originally intended.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Leif Lindholm 
> > 
> > Assuming that not defining the macro is the same as defining it to 0
> 
> Well, the test was ifdef, which is what made the below a bug rather
> than an undesirable default :)

(After confirming with Ard on IRC that the above was a resonable
explanation.)

Series pushed as 7511d626b3..84c212b1b4.

Thanks.

> > Reviewed-by: Ard Biesheuvel 
> > 
> > > ---
> > >  Platform/Hisilicon/D02/Pv660D02.dsc | 1 -
> > >  Platform/Hisilicon/D03/D03.dsc  | 1 -
> > >  Platform/Hisilicon/D05/D05.dsc  | 1 -
> > >  3 files changed, 3 deletions(-)
> > >
> > > diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc 
> > > b/Platform/Hisilicon/D02/Pv660D02.dsc
> > > index ab7c7ba7b7..a2a94945e5 100644
> > > --- a/Platform/Hisilicon/D02/Pv660D02.dsc
> > > +++ b/Platform/Hisilicon/D02/Pv660D02.dsc
> > > @@ -28,7 +28,6 @@ [Defines]
> > >BUILD_TARGETS  = DEBUG|RELEASE
> > >SKUID_IDENTIFIER   = DEFAULT
> > >FLASH_DEFINITION   = 
> > > Platform/Hisilicon/D02/$(PLATFORM_NAME).fdf
> > > -  DEFINE INCLUDE_TFTP_COMMAND=1
> > >
> > >  !include Silicon/Hisilicon/Hisilicon.dsc.inc
> > >
> > > diff --git a/Platform/Hisilicon/D03/D03.dsc 
> > > b/Platform/Hisilicon/D03/D03.dsc
> > > index 00b459ab35..d37c370648 100644
> > > --- a/Platform/Hisilicon/D03/D03.dsc
> > > +++ b/Platform/Hisilicon/D03/D03.dsc
> > > @@ -28,7 +28,6 @@ [Defines]
> > >BUILD_TARGETS  = DEBUG|RELEASE
> > >SKUID_IDENTIFIER   = DEFAULT
> > >FLASH_DEFINITION   = 
> > > Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
> > > -  DEFINE INCLUDE_TFTP_COMMAND=1
> > >
> > >  !include Silicon/Hisilicon/Hisilicon.dsc.inc
> > >
> > > diff --git a/Platform/Hisilicon/D05/D05.dsc 
> > > b/Platform/Hisilicon/D05/D05.dsc
> > > index 60eca3c6fc..1574c3feef 100644
> > > --- a/Platform/Hisilicon/D05/D05.dsc
> > > +++ b/Platform/Hisilicon/D05/D05.dsc
> > > @@ -29,7 +29,6 @@ [Defines]
> > >SKUID_IDENTIFIER   = DEFAULT
> > >FLASH_DEFINITION   = 
> > > Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
> > >DEFINE EDK2_SKIP_PEICORE=0
> > > -  DEFINE INCLUDE_TFTP_COMMAND=1
> > >DEFINE NETWORK_IP6_ENABLE  = FALSE
> > >DEFINE HTTP_BOOT_ENABLE= FALSE
> > >
> > > --
> > > 2.11.0
> > >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 2/2] Platform/Hisilicon: fix conditional inclusion of tftp shell command

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 17:17, Leif Lindholm  wrote:
> On Mon, Dec 04, 2017 at 05:15:35PM +, Ard Biesheuvel wrote:
>> On 4 December 2017 at 17:13, Leif Lindholm  wrote:
>> > D02, D03 and D05 all have nice conditional clauses to only include
>> > the non-standard tftp shell command ifdef(INCLUDE_TFTP_COMMAND).
>> >
>> > Unfortunately, they all explicitly set DEFINE INCLUDE_TFTP_COMMAND=1 in
>> > their platform description files, meaning there is no way to exclude the
>> > command without an editor.
>> >
>> > So remove the DEFINE and let people specify on the command line whether
>> > to include it, as originally intended.
>> >
>> > Contributed-under: TianoCore Contribution Agreement 1.1
>> > Signed-off-by: Leif Lindholm 
>>
>> Assuming that not defining the macro is the same as defining it to 0
>
> Well, the test was ifdef, which is what made the below a bug rather
> than an undesirable default :)
>

Ah right. I missed that. So yes, please remove that.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 00/19] ArmPlatformPkg: remove unused or migrated modules

2017-12-04 Thread Leif Lindholm
On Sat, Nov 25, 2017 at 11:47:39AM +, Leif Lindholm wrote:
> On Wed, Nov 15, 2017 at 04:56:18PM +, Ard Biesheuvel wrote:
> > Remove everything from ArmPlatformPkg that is either unused, or so highly
> > specific to development platforms manufactured by ARM Ltd. that they really
> > don't belong in the main branch.
> > 
> > Note that the migration involves patches against edk2-platforms that add
> > some of this code back under Platform/ARM. Most of it (but not all of it)
> > has been posted as a separate series already.
> > 
> > Ard Biesheuvel (19):
> >   ArmPkg: remove unused ArmGicSecLib library implementation
> >   ArmPlatformPkg: remove ArmPlatformSecLib definition and
> > implementations
> >   ArmPlatformPkg: remove unused DebugSecExtraActionLib library
> >   ArmPlatformPkg: remove ArmTrustedMonitorLib definition and
> > implementation
> >   ArmPlatformPkg: remove ArmGetCpuCountPerCluster () from ArmPlatformLib
> >   ArmPlatformPkg: remove NorFlashArmVExpressLib
> >   ArmPlatformPkg: remove ArmJunoPkg
> >   ArmPlatformPkg/PL031RealTimeClockLib: drop ArmPlatformSysConfigLib
> > reference
> >   ArmPlatformPkg: remove ArmVExpressPkg
> 
> Please hold off on this one (remove ArmVExpressPkg) until we hear back
> from Evan.

Once imported into edk2-platforms:
Reviewed-by: Leif Lindholm 

> >   ArmPlatformPkg: remove ArmPlatformSysConfigLib library class
> 
> No separate comment on this one, just to break it away from the below.
> 
> >   ArmPlatformPkg: remove unused PL301Axi driver
> >   ArmPlatformPkg: remove unused PL35x driver
> >   ArmPlatformPkg: remove PL34xDmc driver
> >   ArmPlatformPkg: remove unused PL310 driver
> >   ArmPlatformPkg: remove unused ArmTrustZone driver
> >   ArmPlatformPkg: remove unused SP804 driver and TimerLib
> >   implementation
> 
> Please separate the "delete used drivers" from the rest of this set.
> Let's give potential out-of-tree users a few weeks to respond.
> 
> My last working day before sabbatical is 15 Dec, so how about
> Reviewed-by-if-no-comments-by-15-Dec: Leif Lindholm 
> ?
> 
> >   ArmPlatformPkg: remove unused L2X0CacheLibNull library
> >   ArmPlatformPkg: remove EblCmdLib implementation
> >   ArmPlatformPkg: remove BootMonFs and ArmShellCmdRunAxf
> 
> For the remainder:
> Reviewed-by: Leif Lindholm 
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms v2 00/13] Move ArmPlatformPkg stuff into edk2-platforms

2017-12-04 Thread Leif Lindholm
On Sat, Nov 25, 2017 at 12:12:45PM +, Leif Lindholm wrote:
> On Thu, Nov 16, 2017 at 05:58:30PM +, Ard Biesheuvel wrote:
> > This is mostly a preparatory series that will allow us to get rid of a lot
> > of code that is specific to only a single ARM development platform out of
> > the main EDK2 tree.
> > 
> > First of all, it removes a couple of false dependencies of various platforms
> > on libraries that are no longer used, or not actually used by the platform
> > in question. Patches #5, #6 and #11 move the bulk of the support for ARM
> > development platforms into edk2-platforms.
> > 
> > Ard Biesheuvel (13):
> >   Platform: remove bogus ArmPlatformSecExtraActionLib references
> >   Platform: remove bogus ArmTrustedMonitorLib references
> >   Platform/ArmVExpress-FVP: remove bogus ArmPlatformSecLib reference
> >   Platform/Hisilicon: remove bogus VExpress dependencies
> >   Platform/ARM/Juno: import ArmJunoPkg from EDK2
> >   Platform/ARM/VExpress: import VExpressPkg from EDK2
> 
> Again, please hold off on this one (import VExpressPkg) for a few days.
> As far as I can see, the subsequent ones would not be affected and so
> can be merged without conflict.

OK, I don't think we need to hold off on this any longer:
Reviewed-by: Leif Lindholm 

> >   Platform/ARM: remove outdated SP804 TimerLib reference
> >   Platform/Hisilicon: remove SP804 PCD definitions
> >   Platform: remove references to EBL libraries
> >   Platform: remove stale PL35xSmcLib references
> >   Platform/ARM: import BootMonFs and ArmShellCmdRunAxf from EDK2
> >   Platform: remove stale EBL related PCD setting
> >   Platform: switch to new PL011UartLib
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] ArmPlatformPkg: remove PlatformIntelBdsLib

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 16:51, Leif Lindholm  wrote:
> On Mon, Dec 04, 2017 at 04:16:57PM +, Ard Biesheuvel wrote:
>> Now that the last user has switched to the generic BDS, the
>> PlatformIntelBdsLib code in ArmPlatformPkg is no longer used, so
>> remove it.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ard Biesheuvel 
>
> Yes please:
> Reviewed-by: Leif Lindholm 
>

Thanks. Pushed as  51a9af80508c
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 2/2] Platform/Hisilicon: fix conditional inclusion of tftp shell command

2017-12-04 Thread Leif Lindholm
On Mon, Dec 04, 2017 at 05:15:35PM +, Ard Biesheuvel wrote:
> On 4 December 2017 at 17:13, Leif Lindholm  wrote:
> > D02, D03 and D05 all have nice conditional clauses to only include
> > the non-standard tftp shell command ifdef(INCLUDE_TFTP_COMMAND).
> >
> > Unfortunately, they all explicitly set DEFINE INCLUDE_TFTP_COMMAND=1 in
> > their platform description files, meaning there is no way to exclude the
> > command without an editor.
> >
> > So remove the DEFINE and let people specify on the command line whether
> > to include it, as originally intended.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Leif Lindholm 
> 
> Assuming that not defining the macro is the same as defining it to 0

Well, the test was ifdef, which is what made the below a bug rather
than an undesirable default :)

> Reviewed-by: Ard Biesheuvel 
> 
> > ---
> >  Platform/Hisilicon/D02/Pv660D02.dsc | 1 -
> >  Platform/Hisilicon/D03/D03.dsc  | 1 -
> >  Platform/Hisilicon/D05/D05.dsc  | 1 -
> >  3 files changed, 3 deletions(-)
> >
> > diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc 
> > b/Platform/Hisilicon/D02/Pv660D02.dsc
> > index ab7c7ba7b7..a2a94945e5 100644
> > --- a/Platform/Hisilicon/D02/Pv660D02.dsc
> > +++ b/Platform/Hisilicon/D02/Pv660D02.dsc
> > @@ -28,7 +28,6 @@ [Defines]
> >BUILD_TARGETS  = DEBUG|RELEASE
> >SKUID_IDENTIFIER   = DEFAULT
> >FLASH_DEFINITION   = 
> > Platform/Hisilicon/D02/$(PLATFORM_NAME).fdf
> > -  DEFINE INCLUDE_TFTP_COMMAND=1
> >
> >  !include Silicon/Hisilicon/Hisilicon.dsc.inc
> >
> > diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
> > index 00b459ab35..d37c370648 100644
> > --- a/Platform/Hisilicon/D03/D03.dsc
> > +++ b/Platform/Hisilicon/D03/D03.dsc
> > @@ -28,7 +28,6 @@ [Defines]
> >BUILD_TARGETS  = DEBUG|RELEASE
> >SKUID_IDENTIFIER   = DEFAULT
> >FLASH_DEFINITION   = 
> > Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
> > -  DEFINE INCLUDE_TFTP_COMMAND=1
> >
> >  !include Silicon/Hisilicon/Hisilicon.dsc.inc
> >
> > diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
> > index 60eca3c6fc..1574c3feef 100644
> > --- a/Platform/Hisilicon/D05/D05.dsc
> > +++ b/Platform/Hisilicon/D05/D05.dsc
> > @@ -29,7 +29,6 @@ [Defines]
> >SKUID_IDENTIFIER   = DEFAULT
> >FLASH_DEFINITION   = 
> > Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
> >DEFINE EDK2_SKIP_PEICORE=0
> > -  DEFINE INCLUDE_TFTP_COMMAND=1
> >DEFINE NETWORK_IP6_ENABLE  = FALSE
> >DEFINE HTTP_BOOT_ENABLE= FALSE
> >
> > --
> > 2.11.0
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 2/2] Platform/Hisilicon: fix conditional inclusion of tftp shell command

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 17:13, Leif Lindholm  wrote:
> D02, D03 and D05 all have nice conditional clauses to only include
> the non-standard tftp shell command ifdef(INCLUDE_TFTP_COMMAND).
>
> Unfortunately, they all explicitly set DEFINE INCLUDE_TFTP_COMMAND=1 in
> their platform description files, meaning there is no way to exclude the
> command without an editor.
>
> So remove the DEFINE and let people specify on the command line whether
> to include it, as originally intended.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Leif Lindholm 

Assuming that not defining the macro is the same as defining it to 0

Reviewed-by: Ard Biesheuvel 

> ---
>  Platform/Hisilicon/D02/Pv660D02.dsc | 1 -
>  Platform/Hisilicon/D03/D03.dsc  | 1 -
>  Platform/Hisilicon/D05/D05.dsc  | 1 -
>  3 files changed, 3 deletions(-)
>
> diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc 
> b/Platform/Hisilicon/D02/Pv660D02.dsc
> index ab7c7ba7b7..a2a94945e5 100644
> --- a/Platform/Hisilicon/D02/Pv660D02.dsc
> +++ b/Platform/Hisilicon/D02/Pv660D02.dsc
> @@ -28,7 +28,6 @@ [Defines]
>BUILD_TARGETS  = DEBUG|RELEASE
>SKUID_IDENTIFIER   = DEFAULT
>FLASH_DEFINITION   = 
> Platform/Hisilicon/D02/$(PLATFORM_NAME).fdf
> -  DEFINE INCLUDE_TFTP_COMMAND=1
>
>  !include Silicon/Hisilicon/Hisilicon.dsc.inc
>
> diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
> index 00b459ab35..d37c370648 100644
> --- a/Platform/Hisilicon/D03/D03.dsc
> +++ b/Platform/Hisilicon/D03/D03.dsc
> @@ -28,7 +28,6 @@ [Defines]
>BUILD_TARGETS  = DEBUG|RELEASE
>SKUID_IDENTIFIER   = DEFAULT
>FLASH_DEFINITION   = 
> Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
> -  DEFINE INCLUDE_TFTP_COMMAND=1
>
>  !include Silicon/Hisilicon/Hisilicon.dsc.inc
>
> diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
> index 60eca3c6fc..1574c3feef 100644
> --- a/Platform/Hisilicon/D05/D05.dsc
> +++ b/Platform/Hisilicon/D05/D05.dsc
> @@ -29,7 +29,6 @@ [Defines]
>SKUID_IDENTIFIER   = DEFAULT
>FLASH_DEFINITION   = 
> Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
>DEFINE EDK2_SKIP_PEICORE=0
> -  DEFINE INCLUDE_TFTP_COMMAND=1
>DEFINE NETWORK_IP6_ENABLE  = FALSE
>DEFINE HTTP_BOOT_ENABLE= FALSE
>
> --
> 2.11.0
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 1/2] Platform/Hisilicon: fix D05 .dsc line endings

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 17:13, Leif Lindholm  wrote:
> Commit b324d85a466b,
> ("Hisilicon D03/D05: get firmware version from FIRMWARE_VER"),
> added some non CRLF line endings, resolve this.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Leif Lindholm 

Reviewed-by: Ard Biesheuvel 

> ---
>  Platform/Hisilicon/D05/D05.dsc | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
> index efd748e5ef..60eca3c6fc 100644
> --- a/Platform/Hisilicon/D05/D05.dsc
> +++ b/Platform/Hisilicon/D05/D05.dsc
> @@ -181,11 +181,11 @@ [PcdsFixedAtBuild.common]
>
>gHisiTokenSpaceGuid.PcdIsMPBoot|1
>gHisiTokenSpaceGuid.PcdSocketMask|0x3
> -  !ifdef $(FIRMWARE_VER)
> -
> gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
> -  !else
> +  !ifdef $(FIRMWARE_VER)
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
> +  !else
>  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Development 
> build base on Hisilicon D05 UEFI 17.10 Release"
> -  !endif
> +  !endif
>
>gHisiTokenSpaceGuid.PcdBiosVersionString|L"10.01.01T18"
>
> --
> 2.11.0
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH edk2-platforms 1/2] Platform/Hisilicon: fix D05 .dsc line endings

2017-12-04 Thread Leif Lindholm
Commit b324d85a466b,
("Hisilicon D03/D05: get firmware version from FIRMWARE_VER"),
added some non CRLF line endings, resolve this.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm 
---
 Platform/Hisilicon/D05/D05.dsc | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
index efd748e5ef..60eca3c6fc 100644
--- a/Platform/Hisilicon/D05/D05.dsc
+++ b/Platform/Hisilicon/D05/D05.dsc
@@ -181,11 +181,11 @@ [PcdsFixedAtBuild.common]
 
   gHisiTokenSpaceGuid.PcdIsMPBoot|1
   gHisiTokenSpaceGuid.PcdSocketMask|0x3
-  !ifdef $(FIRMWARE_VER)
-gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
-  !else
+  !ifdef $(FIRMWARE_VER)
+gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
+  !else
 gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Development 
build base on Hisilicon D05 UEFI 17.10 Release"
-  !endif
+  !endif
 
   gHisiTokenSpaceGuid.PcdBiosVersionString|L"10.01.01T18"
 
-- 
2.11.0

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


[edk2] [PATCH edk2-platforms 2/2] Platform/Hisilicon: fix conditional inclusion of tftp shell command

2017-12-04 Thread Leif Lindholm
D02, D03 and D05 all have nice conditional clauses to only include
the non-standard tftp shell command ifdef(INCLUDE_TFTP_COMMAND).

Unfortunately, they all explicitly set DEFINE INCLUDE_TFTP_COMMAND=1 in
their platform description files, meaning there is no way to exclude the
command without an editor.

So remove the DEFINE and let people specify on the command line whether
to include it, as originally intended.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm 
---
 Platform/Hisilicon/D02/Pv660D02.dsc | 1 -
 Platform/Hisilicon/D03/D03.dsc  | 1 -
 Platform/Hisilicon/D05/D05.dsc  | 1 -
 3 files changed, 3 deletions(-)

diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc 
b/Platform/Hisilicon/D02/Pv660D02.dsc
index ab7c7ba7b7..a2a94945e5 100644
--- a/Platform/Hisilicon/D02/Pv660D02.dsc
+++ b/Platform/Hisilicon/D02/Pv660D02.dsc
@@ -28,7 +28,6 @@ [Defines]
   BUILD_TARGETS  = DEBUG|RELEASE
   SKUID_IDENTIFIER   = DEFAULT
   FLASH_DEFINITION   = Platform/Hisilicon/D02/$(PLATFORM_NAME).fdf
-  DEFINE INCLUDE_TFTP_COMMAND=1
 
 !include Silicon/Hisilicon/Hisilicon.dsc.inc
 
diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
index 00b459ab35..d37c370648 100644
--- a/Platform/Hisilicon/D03/D03.dsc
+++ b/Platform/Hisilicon/D03/D03.dsc
@@ -28,7 +28,6 @@ [Defines]
   BUILD_TARGETS  = DEBUG|RELEASE
   SKUID_IDENTIFIER   = DEFAULT
   FLASH_DEFINITION   = 
Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
-  DEFINE INCLUDE_TFTP_COMMAND=1
 
 !include Silicon/Hisilicon/Hisilicon.dsc.inc
 
diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
index 60eca3c6fc..1574c3feef 100644
--- a/Platform/Hisilicon/D05/D05.dsc
+++ b/Platform/Hisilicon/D05/D05.dsc
@@ -29,7 +29,6 @@ [Defines]
   SKUID_IDENTIFIER   = DEFAULT
   FLASH_DEFINITION   = 
Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
   DEFINE EDK2_SKIP_PEICORE=0
-  DEFINE INCLUDE_TFTP_COMMAND=1
   DEFINE NETWORK_IP6_ENABLE  = FALSE
   DEFINE HTTP_BOOT_ENABLE= FALSE
 
-- 
2.11.0

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


Re: [edk2] [PATCH] ArmPlatformPkg: remove PlatformIntelBdsLib

2017-12-04 Thread Leif Lindholm
On Mon, Dec 04, 2017 at 04:16:57PM +, Ard Biesheuvel wrote:
> Now that the last user has switched to the generic BDS, the
> PlatformIntelBdsLib code in ArmPlatformPkg is no longer used, so
> remove it.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Yes please:
Reviewed-by: Leif Lindholm 

(I was going to object that the Hisilicon platforms in edk2-platforms
still use it, but they actually have their own copy.)

> ---
>  ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c  | 406 
> 
>  ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h  |  36 --
>  ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf |  66 
>  3 files changed, 508 deletions(-)
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [platforms: PATCH v2 4/4] Marvell/Drivers: MvPhyDxe: Cleanup the header

2017-12-04 Thread Marcin Wojtas
2017-12-04 17:10 GMT+01:00 Leif Lindholm :
> On Mon, Dec 04, 2017 at 04:22:33PM +0100, Marcin Wojtas wrote:
>> Hi Leif,
>>
>>
>>
>> 2017-12-04 15:00 GMT+01:00 Leif Lindholm :
>> > On Fri, Dec 01, 2017 at 04:35:07PM +0100, Marcin Wojtas wrote:
>> >> This patch removes unused macros defined in MvPhyDxe.h, as well
>> >> as improves the style and comments. Pick single definition
>> >> of the autonegotiation timeout - two different macros were used
>> >> for the same purpose.
>> >>
>> >> Contributed-under: TianoCore Contribution Agreement 1.1
>> >> Signed-off-by: Marcin Wojtas 
>> >> ---
>> >>  Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c |   2 +-
>> >>  Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h | 152 
>> >> 
>> >>  2 files changed, 31 insertions(+), 123 deletions(-)
>> >>
>> >> diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c 
>> >> b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
>> >> index e776a91..dd2edae 100644
>> >> --- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
>> >> +++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
>> >> @@ -328,7 +328,7 @@ MvPhyInit1512 (
>> >>
>> >>  DEBUG((DEBUG_ERROR, "MvPhyDxe: Waiting for PHY auto negotiation... 
>> >> "));
>> >>  for (i = 0; !(Data & BMSR_ANEGCOMPLETE); i++) {
>> >> -  if (i > PHY_ANEG_TIMEOUT) {
>> >> +  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
>> >
>> > I think you've had a git accident somewhere:
>> > The existing line upstream is still
>> >  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
>> > This hunk should have just dropped out.
>> >
>>
>> No, it's ok. It just turned out, there were two concurrent definitions
>> of the same thing. Please take a look at what's available on top of
>> the master branch:
>
> Aah, that's not the same location as in your v1, is it? :)
>

Indeed :)

Thanks,
Marcin

> *grumble*
>
> Sure:
> Reviewed-by: Leif Lindholm 
>
>> Header:
>> [...]
>> #define PHY_ANEG_TIMEOUT 4000
>>
>> #define PHY_INTERFACE_MODE_RGMII 0
>> #define PHY_INTERFACE_MODE_RGMII_ID 1
>> #define PHY_INTERFACE_MODE_RGMII_RXID 2
>> #define PHY_INTERFACE_MODE_RGMII_TXID 3
>> #define PHY_INTERFACE_MODE_SGMII 4
>> #define PHY_INTERFACE_MODE_RTBI 5
>>
>> #define PHY_AUTONEGOTIATE_TIMEOUT 5000
>> [...]
>>
>> Driver:
>> ~Line 204:
>> DEBUG((DEBUG_ERROR,"MvPhyDxe: Waiting for PHY realtime link"));
>> while (!(Data & MIIM_88E1xxx_PHYSTAT_SPDDONE)) {
>>   if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
>>
>> ~Line 327:
>> DEBUG((DEBUG_ERROR, "MvPhyDxe: Waiting for PHY auto negotiation... "));
>> for (i = 0; !(Data & BMSR_ANEGCOMPLETE); i++) {
>>   if (i > PHY_ANEG_TIMEOUT) {
>> DEBUG((DEBUG_ERROR, "timeout\n"));
>>
>> Best regards,
>> Marcin
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support for big-endian MMIO

2017-12-04 Thread Kinney, Michael D
Sounds good.

Mike

> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Monday, December 4, 2017 7:54 AM
> To: Kinney, Michael D 
> Cc: Udit Kumar ; Meenakshi Aggarwal
> ; Varun Sethi
> ; edk2-devel@lists.01.org; Gao, Liming
> ; Ard Biesheuvel
> 
> Subject: Re: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support
> for big-endian MMIO
> 
> Hi Mike,
> 
> This separate library would only be necessary
> specifically because
> an additional library to the default platform IoLib was
> needed.
> So while it's another dependency, it would likely reduce
> image size.
> 
> Which is why I was leaning towards a wrapper.
> 
> This also means the actual hw-dependent bit gets
> abstracted away from
> the portable and predictable byteswapping. Which always
> makes me
> slightly more comfortable.
> 
> If you're OK with the concept, I can throw an RFC
> together.
> 
> Best Regards,
> 
> Leif
> 
> On Mon, Dec 04, 2017 at 03:31:10PM +, Kinney, Michael
> D wrote:
> > Leif,
> >
> > I may make more sense to add to MdePkg as a peer to
> IoLib.
> > This minimizes the package dependencies for Si modules.
> >
> > I am ok as a wrapper on top of IoLib.  Whatever reduces
> > code duplication and reduces maintenance.
> >
> > Best regards,
> >
> > Mike
> >
> > > -Original Message-
> > > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > > Sent: Monday, December 4, 2017 4:36 AM
> > > To: Kinney, Michael D 
> > > Cc: Udit Kumar ; Meenakshi
> Aggarwal
> > > ; Varun Sethi
> > > ; edk2-devel@lists.01.org; Gao,
> Liming
> > > ; Ard Biesheuvel
> > > 
> > > Subject: Re: [edk2] [PATCH 1/1] MdePkg/IoLib: Add
> support
> > > for big-endian MMIO
> > >
> > > Mike,
> > >
> > > In that case - do you think it should be added to
> > > MdeModulePkg?
> > >
> > > Should it be implemented simply as a wrapper on IoLib
> > > (depending on
> > > it)?
> > >
> > > /
> > > Leif
> > >
> > > On Fri, Dec 01, 2017 at 10:41:26PM +, Kinney,
> Michael
> > > D wrote:
> > > > Udit,
> > > >
> > > > I agree with your concern.
> > > >
> > > > I am in favor of adding new APIs that perform the
> > > > byte swap operations.
> > > >
> > > > Mike
> > > >
> > > > > -Original Message-
> > > > > From: Udit Kumar [mailto:udit.ku...@nxp.com]
> > > > > Sent: Friday, December 1, 2017 9:58 AM
> > > > > To: Leif Lindholm ;
> > > Meenakshi
> > > > > Aggarwal ; Varun
> Sethi
> > > > > 
> > > > > Cc: Kinney, Michael D
> ;
> > > edk2-
> > > > > de...@lists.01.org; Gao, Liming
> > > ;
> > > > > Ard Biesheuvel 
> > > > > Subject: RE: [edk2] [PATCH 1/1] MdePkg/IoLib: Add
> > > support
> > > > > for big-endian MMIO
> > > > >
> > > > > Thanks Leif,
> > > > >
> > > > > > It may require a little bit more of up-front
> work,
> > > but
> > > > > the end result will be a
> > > > > > platform port that works with the intended edk2
> > > design
> > > > > principles rather than
> > > > >
> > > > > Yes, this will be re-design/code for us, breaking
> all
> > > > > software pieces into
> > > > > smaller blocks and exposing protocol from the
> same.
> > > > > This could be managed.
> > > > >
> > > > > But how do you see,  if there is such dependency
> oN
> > > lib.
> > > > > Say a driver which is in BE mode, and is using
> > > DebugLib
> > > > > (BaseDebugLibSerialPort)
> > > > > And DebugLib uses SerialPortLib, which is in LE
> mode
> > > > >
> > > > > Thanks
> > > > > Udit
> > > > >
> > > > > > -Original Message-
> > > > > > From: edk2-devel [mailto:edk2-devel-
> > > > > boun...@lists.01.org] On Behalf Of Leif
> > > > > > Lindholm
> > > > > > Sent: Friday, December 01, 2017 4:28 PM
> > > > > > To: Meenakshi Aggarwal
> 
> > > > > > Cc: Kinney, Michael D
> ;
> > > > > edk2-devel@lists.01.org;
> > > > > > Gao, Liming ; Ard
> Biesheuvel
> > > > > > 
> > > > > > Subject: Re: [edk2] [PATCH 1/1] MdePkg/IoLib:
> Add
> > > > > support for big-endian
> > > > > > MMIO
> > > > > >
> > > > > > On Thu, Nov 30, 2017 at 04:15:38AM +,
> Meenakshi
> > > > > Aggarwal wrote:
> > > > > > > Hi Leif, Mike,
> > > > > > >
> > > > > > >
> > > > > > > NXP boards, at present, have few controllers
> with
> > > big
> > > > > endian and other
> > > > > > > with little endian memory access.
> > > > > >
> > > > > > Sure, this is not a problem.
> > > > > >
> > > > > > > Maximum controllers depend on SocLib library
> for
> > > > > clock information and
> > > > > > > endianness for SocLib and controllers is
> > > different.
> > > > > >

[edk2] [PATCH] ArmPlatformPkg: remove PlatformIntelBdsLib

2017-12-04 Thread Ard Biesheuvel
Now that the last user has switched to the generic BDS, the
PlatformIntelBdsLib code in ArmPlatformPkg is no longer used, so
remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c  | 406 

 ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h  |  36 --
 ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf |  66 
 3 files changed, 508 deletions(-)

diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c 
b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
deleted file mode 100644
index 5632b5da7500..
--- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/** @file
-
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
-Copyright (c) 2014, ARM 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 "IntelBdsPlatform.h"
-
-///
-/// Predefined platform default time out value
-///
-UINT16  gPlatformBootTimeOutDefault;
-
-EFI_STATUS
-EFIAPI
-PlatformIntelBdsConstructor (
-  IN EFI_HANDLEImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
-  )
-{
-  gPlatformBootTimeOutDefault = (UINT16)PcdGet16 (PcdPlatformBootTimeOut);
-  return EFI_SUCCESS;
-}
-
-//
-// BDS Platform Functions
-//
-/**
-  Platform Bds init. Include the platform firmware vendor, revision
-  and so crc check.
-
-**/
-VOID
-EFIAPI
-PlatformBdsInit (
-  VOID
-  )
-{
-  //
-  // Signal EndOfDxe PI Event
-  //
-  EfiEventGroupSignal ();
-}
-
-STATIC
-EFI_STATUS
-GetConsoleDevicePathFromVariable (
-  IN  CHAR16* ConsoleVarName,
-  IN  CHAR16* DefaultConsolePaths,
-  OUT EFI_DEVICE_PATH**   DevicePaths
-  )
-{
-  EFI_STATUSStatus;
-  UINTN Size;
-  EFI_DEVICE_PATH_PROTOCOL* DevicePathInstances;
-  EFI_DEVICE_PATH_PROTOCOL* DevicePathInstance;
-  CHAR16*   DevicePathStr;
-  CHAR16*   NextDevicePathStr;
-  EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL  *EfiDevicePathFromTextProtocol;
-
-  Status = EFI_SUCCESS;
-  Size = 0;
-
-  DevicePathInstances = BdsLibGetVariableAndSize (ConsoleVarName, 
, );
-  if (DevicePathInstances == NULL) {
-// In case no default console device path has been defined we assume a 
driver handles the console (eg: SimpleTextInOutSerial)
-if ((DefaultConsolePaths == NULL) || (DefaultConsolePaths[0] == L'\0')) {
-  *DevicePaths = NULL;
-  return EFI_SUCCESS;
-}
-
-Status = gBS->LocateProtocol (, NULL, 
(VOID **));
-ASSERT_EFI_ERROR(Status);
-
-// Extract the Device Path instances from the multi-device path string
-while ((DefaultConsolePaths != NULL) && (DefaultConsolePaths[0] != L'\0')) 
{
-  NextDevicePathStr = StrStr (DefaultConsolePaths, L";");
-  if (NextDevicePathStr == NULL) {
-DevicePathStr = DefaultConsolePaths;
-DefaultConsolePaths = NULL;
-  } else {
-DevicePathStr = (CHAR16*)AllocateCopyPool ((NextDevicePathStr - 
DefaultConsolePaths + 1) * sizeof(CHAR16), DefaultConsolePaths);
-*(DevicePathStr + (NextDevicePathStr - DefaultConsolePaths)) = L'\0';
-DefaultConsolePaths = NextDevicePathStr;
-if (DefaultConsolePaths[0] == L';') {
-  DefaultConsolePaths++;
-}
-  }
-
-  DevicePathInstance = 
EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (DevicePathStr);
-  ASSERT(DevicePathInstance != NULL);
-  DevicePathInstances = AppendDevicePathInstance (DevicePathInstances, 
DevicePathInstance);
-
-  if (NextDevicePathStr != NULL) {
-FreePool (DevicePathStr);
-  }
-  FreePool (DevicePathInstance);
-}
-
-// Set the environment variable with this device path multi-instances
-Size = GetDevicePathSize (DevicePathInstances);
-if (Size > 0) {
-  gRT->SetVariable (
-  ConsoleVarName,
-  ,
-  EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_RUNTIME_ACCESS,
-  Size,
-  DevicePathInstances
-  );
-} else {
-  Status = EFI_INVALID_PARAMETER;
-}
-  }
-
-  if (!EFI_ERROR(Status)) {
-*DevicePaths = DevicePathInstances;
-  }
-  return Status;
-}
-
-STATIC
-EFI_STATUS
-InitializeConsolePipe (
-  IN EFI_DEVICE_PATH*ConsoleDevicePaths,
-  IN EFI_GUID   *Protocol,
-  OUT EFI_HANDLE*Handle,
-  OUT VOID* *Interface
-  )
-{
-  EFI_STATUSStatus;
-  UINTN 

Re: [edk2] [PATCH RFT] ArmVirtPkg/ArmVirtXen: move from Intel to generic BDS

2017-12-04 Thread Ard Biesheuvel
On 1 December 2017 at 10:08, Laszlo Ersek  wrote:
> On 11/30/17 21:31, Ard Biesheuvel wrote:
>> ArmVirtXen is the only remaining consumer of ArmPlatformPkg's
>> PlatformIntelBdsLib implementation, which is tightly coupled to the
>> deprecated Intel BDS. So move ArmVirtXen to the generic BDS as well,
>> allowing us to get rid of PlatformIntelBdsLib entirely.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ard Biesheuvel 
>> ---
>>  ArmVirtPkg/ArmVirtXen.dsc | 14 +++---
>>  ArmVirtPkg/ArmVirtXen.fdf |  3 ++-
>>  2 files changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
>> index 11e073287a84..ae43d5990110 100644
>> --- a/ArmVirtPkg/ArmVirtXen.dsc
>> +++ b/ArmVirtPkg/ArmVirtXen.dsc
>> @@ -48,8 +48,9 @@ [LibraryClasses]
>>TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
>>
>>CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
>> -  
>> GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
>> -  
>> PlatformBdsLib|ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
>> +  
>> UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
>> +  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
>> +  
>> PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>>
>> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>>
>>  [LibraryClasses.common.UEFI_DRIVER]
>> @@ -86,6 +87,7 @@ [PcdsFixedAtBuild.common]
>>gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0
>>
>>gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 
>> 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 
>> }
>>gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 
>> 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 
>> 0xB4, 0xD1 }
>>
>>  [PcdsPatchableInModule.common]
>> @@ -199,7 +201,13 @@ [Components.common]
>>MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
>>MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>> -  IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +  MdeModulePkg/Application/UiApp/UiApp.inf {
>> +
>> +  NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
>> +  NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
>> +  
>> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
>> +  }
>>
>>OvmfPkg/XenBusDxe/XenBusDxe.inf
>>OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
>> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
>> index 6586ce6be505..50e670254d52 100644
>> --- a/ArmVirtPkg/ArmVirtXen.fdf
>> +++ b/ArmVirtPkg/ArmVirtXen.fdf
>> @@ -177,7 +177,8 @@ [FV.FvMain]
>>INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
>>INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>> -  INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
>>
>>INF OvmfPkg/XenBusDxe/XenBusDxe.inf
>>INF OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
>>
>
> The patch looks fine, and I agree that the main thing that should decide
> about it is testing by Julien.
>
> Acked-by: Laszlo Ersek 
>

Pushed as 75e2d0e02f1c40a2e4971bd67399028e0b1681c8, after folding in
the changes that Julien tested.

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


Re: [edk2] [platforms: PATCH v2 4/4] Marvell/Drivers: MvPhyDxe: Cleanup the header

2017-12-04 Thread Leif Lindholm
On Mon, Dec 04, 2017 at 04:22:33PM +0100, Marcin Wojtas wrote:
> Hi Leif,
> 
> 
> 
> 2017-12-04 15:00 GMT+01:00 Leif Lindholm :
> > On Fri, Dec 01, 2017 at 04:35:07PM +0100, Marcin Wojtas wrote:
> >> This patch removes unused macros defined in MvPhyDxe.h, as well
> >> as improves the style and comments. Pick single definition
> >> of the autonegotiation timeout - two different macros were used
> >> for the same purpose.
> >>
> >> Contributed-under: TianoCore Contribution Agreement 1.1
> >> Signed-off-by: Marcin Wojtas 
> >> ---
> >>  Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c |   2 +-
> >>  Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h | 152 
> >> 
> >>  2 files changed, 31 insertions(+), 123 deletions(-)
> >>
> >> diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c 
> >> b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
> >> index e776a91..dd2edae 100644
> >> --- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
> >> +++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
> >> @@ -328,7 +328,7 @@ MvPhyInit1512 (
> >>
> >>  DEBUG((DEBUG_ERROR, "MvPhyDxe: Waiting for PHY auto negotiation... 
> >> "));
> >>  for (i = 0; !(Data & BMSR_ANEGCOMPLETE); i++) {
> >> -  if (i > PHY_ANEG_TIMEOUT) {
> >> +  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
> >
> > I think you've had a git accident somewhere:
> > The existing line upstream is still
> >  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
> > This hunk should have just dropped out.
> >
> 
> No, it's ok. It just turned out, there were two concurrent definitions
> of the same thing. Please take a look at what's available on top of
> the master branch:

Aah, that's not the same location as in your v1, is it? :)

*grumble*

Sure:
Reviewed-by: Leif Lindholm 

> Header:
> [...]
> #define PHY_ANEG_TIMEOUT 4000
> 
> #define PHY_INTERFACE_MODE_RGMII 0
> #define PHY_INTERFACE_MODE_RGMII_ID 1
> #define PHY_INTERFACE_MODE_RGMII_RXID 2
> #define PHY_INTERFACE_MODE_RGMII_TXID 3
> #define PHY_INTERFACE_MODE_SGMII 4
> #define PHY_INTERFACE_MODE_RTBI 5
> 
> #define PHY_AUTONEGOTIATE_TIMEOUT 5000
> [...]
> 
> Driver:
> ~Line 204:
> DEBUG((DEBUG_ERROR,"MvPhyDxe: Waiting for PHY realtime link"));
> while (!(Data & MIIM_88E1xxx_PHYSTAT_SPDDONE)) {
>   if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
> 
> ~Line 327:
> DEBUG((DEBUG_ERROR, "MvPhyDxe: Waiting for PHY auto negotiation... "));
> for (i = 0; !(Data & BMSR_ANEGCOMPLETE); i++) {
>   if (i > PHY_ANEG_TIMEOUT) {
> DEBUG((DEBUG_ERROR, "timeout\n"));
> 
> Best regards,
> Marcin
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH RFT] ArmVirtPkg/ArmVirtXen: move from Intel to generic BDS

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 16:08, Julien Grall  wrote:
> Hi Ard,
>
> On 04/12/17 15:55, Ard Biesheuvel wrote:
>>
>> On 4 December 2017 at 15:52, Ard Biesheuvel 
>> wrote:
>>>
>>> On 4 December 2017 at 15:19, Julien Grall 
>>> wrote:

 On 30/11/17 20:31, Ard Biesheuvel wrote:
>>
>> Hmm, looking again, what you tried should actually be equivalent.
>> Could you try a clean rebuild please? Thanks.
>
>
> I have applied your 2 patches and test a clean rebuild. I have seen no
> issue.
>
> Feel free to add my tested-by.
>

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


Re: [edk2] [PATCH RFT] ArmVirtPkg/ArmVirtXen: move from Intel to generic BDS

2017-12-04 Thread Julien Grall

Hi Ard,

On 04/12/17 15:55, Ard Biesheuvel wrote:

On 4 December 2017 at 15:52, Ard Biesheuvel  wrote:

On 4 December 2017 at 15:19, Julien Grall  wrote:

On 30/11/17 20:31, Ard Biesheuvel wrote:

Hmm, looking again, what you tried should actually be equivalent.
Could you try a clean rebuild please? Thanks.


I have applied your 2 patches and test a clean rebuild. I have seen no 
issue.


Feel free to add my tested-by.

Cheers,


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


Re: [edk2] [RFC v1 00/15] *** Proposal for StandaloneMmPkg ***

2017-12-04 Thread Supreeth Venkatesh
Thank you for reviewing it.
I agree with all your comments.
I will work on them and send the patch set out on the mailing list sometime in 
the first week of Jan.

Supreeth

-Original Message-
From: Yao, Jiewen [mailto:jiewen@intel.com]
Sent: Monday, December 4, 2017 12:36 AM
To: Supreeth Venkatesh ; edk2-devel@lists.01.org
Cc: leif.lindh...@linaro.org
Subject: RE: [edk2] [RFC v1 00/15] *** Proposal for StandaloneMmPkg ***

Thanks you very much.

Thanks for your patient. I have reviewed https://github.com/supven01/edk2.git 
(Branch: AArch64StandaloneMm)

Below is my thougth:
1) I do not have comment for ArmPkg related change. - I expect Arm expert can 
review that.

2) For "BaseTools/AutoGen: Update header file for MM modules."
I agree with you on that. (Reviewed-by: jiewen@intel.com) Would you please 
send separate patch for BaseTools owner to review?

3) For "MdePkg/Include: Add management mode FV file type and depex."
I agree with you on that. (Reviewed-by: jiewen@intel.com) Would you please 
send separate patch for MdePkg owner to review?

4) For "MdeModulePkg: Add application to test MM communication protocol."
Can we put UefiInfoApp to StandaloneMmPkg?
The gMmUefiInfoGuid is consumed by StandaloneMmPkg\Core\StandaloneMmCore.c, so 
I believe it more tights to StandaloneMmPkg.
I do not want to bother MdeModulePkg on that.

5) The rest are all StandaloneMmPkg.
5.1) For "StandaloneMmPkg: Add an AArch64 specific entry point library."
This seems not a generic lib.
Can we rename it to be: StandaloneMmCoreEntryPointArm?
If so, we do not need create Arm sub-folder there.

5.2) For "StandaloneMmPkg/HobLib: Add a common HOB Library for management mode."
This seems not a generic way to get the Hob.

Below API seems private one. It is not defined in HobLib. But a contract 
between StandaloneMmPkg\Library\StandaloneMmCoreEntryPoint\Arm\CreateHobList.c 
and StandaloneMmPkg\Library\HobLib\HobLib.c

EFI_HOB_HANDOFF_INFO_TABLE*
HobConstructor (
  IN VOID   *EfiMemoryBegin,
  IN UINTN  EfiMemoryLength,
  IN VOID   *EfiFreeMemoryBottom,
  IN VOID   *EfiFreeMemoryTop
  )

This is typically not encourage. I am not sure if we have better way to resolve 
the issue.
But if there is not, I prefer we move it to be ArmSpecific HobLib, such as 
HobLibArmStandaloneMm.

5.3) For "StandaloneMmPkg/FvLib: Add a common FV Library for management mode."
Looks good.

5.4) For "StandaloneMmPkg/MemLib: Instance of memory check library."
It seems a compatibility issue, that we rename SmmMemLib to MmMemLib.

Maybe, we can add MmMemLib.h API, and move SmmMemLib content to MmMemLib, then 
let SmmMemLib call MmMemLib.

5.5) For "StandaloneMmPkg/MemoryAllocationLib: Add MM memory allocation 
library."
May I know why you change " gSmst->SmmAllocatePool ();" to "MmAllocatePool ();"

An MM driver should not know the detail implementation of MmCore.

Can we just use gMmst->MmAllocatePool() here?

5.6) For "StandaloneMmPkg: MM driver entry point library."
Looks good.

5.7) For "StandaloneMmPkg/CpuMm: Add CPU driver suitable for ARM Platforms."
It seems Arm specific. Can we rename to ArmCpuMm?

5.8) For "StandaloneMmPkg/Core: Implementation of Standalone MM Core Module."
I have not gone through all detail.
It seems quite similar to my previous one. So it is good.

5.9) For "StandaloneMmPkg: Add handler to handle event received from 
"uefiinfo"."
Looks good.


Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Supreeth Venkatesh
> Sent: Friday, December 1, 2017 6:55 AM
> To: Yao, Jiewen ; edk2-devel@lists.01.org
> Cc: leif.lindh...@linaro.org
> Subject: Re: [edk2] [RFC v1 00/15] *** Proposal for StandaloneMmPkg
> ***
>
> On Tue, 2017-11-28 at 07:00 +, Yao, Jiewen wrote:
> > HI
> > I am sorry that I missed this mail before.
> >
> > I found only 0/15 and 13/15 are in my mail box. :-( I do not know
> > why others are filtered.
> This was deliberate as PATCH 13/15 implements MM core code.
> Rest of them are/were AARCH64 Specific excluding the MM libraries.
> >
> > Is that possible to post the whole patch to your private git?
> > As such, we can review it in more efficient way.
> I have created a github repo below to review it in more efficient way.
>
> EDK2
> https://github.com/supven01/edk2.git
> (Branch: AArch64StandaloneMm)
>
> EDK2-PLATFORMS
> https://github.com/supven01/edk2-platforms.git
> (Branch: master)
>
> Also, we are in the process of updating these changes into edk2
> Staging repository here:
> https://github.com/tianocore/edk2-staging/tree/AArch64StandaloneMm
>
> I will send out PATCH set once you/team completes the review and give
> feedback/comments.
>
> >
> > Basically, I think it is a good idea to have StandaloneMmPkg to hold
> > all these features.
> Thank you for acknowledging this.
>
> >
> > Thank you
> > Yao Jiewen
> >
> > >
> > > -Original Message-
> > > From: Supreeth Venkatesh 

Re: [edk2] [PATCH RFT] ArmVirtPkg/ArmVirtXen: move from Intel to generic BDS

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 15:52, Ard Biesheuvel  wrote:
> On 4 December 2017 at 15:19, Julien Grall  wrote:
>> Hi Ard,
>>
>> On 30/11/17 20:31, Ard Biesheuvel wrote:
>>> ArmVirtXen is the only remaining consumer of ArmPlatformPkg's
>>> PlatformIntelBdsLib implementation, which is tightly coupled to the
>>> deprecated Intel BDS. So move ArmVirtXen to the generic BDS as well,
>>> allowing us to get rid of PlatformIntelBdsLib entirely.
>>
>> It was in my list of UEFI part I wanted to look next :).
>> I tested it and hit the following assert:
>>
>> ASSERT [BdsDxe] 
>> /home/julieng/works/edk2/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c(502):
>>  0 == 4
>>
>> Looking at the ArmVirtQemu.dsc, I made the below modification.
>> When I tried the version protected by TTY_ENABLE, the ASSERT was
>> still present.
>>
>> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
>> index ae43d59901..bc76a780be 100644
>> --- a/ArmVirtPkg/ArmVirtXen.dsc
>> +++ b/ArmVirtPkg/ArmVirtXen.dsc
>> @@ -81,6 +81,10 @@
>># Size of the region used by UEFI in permanent memory (Reserved 64MB)
>>gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400
>>
>> +  ## Default Terminal Type^M
>> +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM^M
>> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4^M
>> +^M
>>#
>># ARM Virtual Architectural Timer
>>#
>>
>> My knowledge in UEFI is still limited, so I would appreciate any
>> feedbacks here.
>>
>
> My bad.
>
> Could you please try with this applied on top?
>
> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
> index 11e073287a84..5ddcfceef9dc 100644
> --- a/ArmVirtPkg/ArmVirtXen.dsc
> +++ b/ArmVirtPkg/ArmVirtXen.dsc
> @@ -88,6 +88,13 @@ [PcdsFixedAtBuild.common]
>gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83,
> 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52,
> 0x68, 0xD0, 0xB4, 0xD1 }
>
> +  ## Default Terminal Type
> +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
> +
> +  # Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
> +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91,
> 0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51,
> 0xef, 0x94}
> +
>  [PcdsPatchableInModule.common]
>#
># This will be overridden in the code
>
> (and don't bother with the -D TTY_TERMINAL, it will be the default anyway)


Hmm, looking again, what you tried should actually be equivalent.
Could you try a clean rebuild please? Thanks.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support for big-endian MMIO

2017-12-04 Thread Leif Lindholm
Hi Mike,

This separate library would only be necessary specifically because
an additional library to the default platform IoLib was needed.
So while it's another dependency, it would likely reduce image size.

Which is why I was leaning towards a wrapper.

This also means the actual hw-dependent bit gets abstracted away from
the portable and predictable byteswapping. Which always makes me
slightly more comfortable.

If you're OK with the concept, I can throw an RFC together.

Best Regards,

Leif

On Mon, Dec 04, 2017 at 03:31:10PM +, Kinney, Michael D wrote:
> Leif,
> 
> I may make more sense to add to MdePkg as a peer to IoLib.
> This minimizes the package dependencies for Si modules.
> 
> I am ok as a wrapper on top of IoLib.  Whatever reduces 
> code duplication and reduces maintenance.
> 
> Best regards,
> 
> Mike
> 
> > -Original Message-
> > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > Sent: Monday, December 4, 2017 4:36 AM
> > To: Kinney, Michael D 
> > Cc: Udit Kumar ; Meenakshi Aggarwal
> > ; Varun Sethi
> > ; edk2-devel@lists.01.org; Gao, Liming
> > ; Ard Biesheuvel
> > 
> > Subject: Re: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support
> > for big-endian MMIO
> > 
> > Mike,
> > 
> > In that case - do you think it should be added to
> > MdeModulePkg?
> > 
> > Should it be implemented simply as a wrapper on IoLib
> > (depending on
> > it)?
> > 
> > /
> > Leif
> > 
> > On Fri, Dec 01, 2017 at 10:41:26PM +, Kinney, Michael
> > D wrote:
> > > Udit,
> > >
> > > I agree with your concern.
> > >
> > > I am in favor of adding new APIs that perform the
> > > byte swap operations.
> > >
> > > Mike
> > >
> > > > -Original Message-
> > > > From: Udit Kumar [mailto:udit.ku...@nxp.com]
> > > > Sent: Friday, December 1, 2017 9:58 AM
> > > > To: Leif Lindholm ;
> > Meenakshi
> > > > Aggarwal ; Varun Sethi
> > > > 
> > > > Cc: Kinney, Michael D ;
> > edk2-
> > > > de...@lists.01.org; Gao, Liming
> > ;
> > > > Ard Biesheuvel 
> > > > Subject: RE: [edk2] [PATCH 1/1] MdePkg/IoLib: Add
> > support
> > > > for big-endian MMIO
> > > >
> > > > Thanks Leif,
> > > >
> > > > > It may require a little bit more of up-front work,
> > but
> > > > the end result will be a
> > > > > platform port that works with the intended edk2
> > design
> > > > principles rather than
> > > >
> > > > Yes, this will be re-design/code for us, breaking all
> > > > software pieces into
> > > > smaller blocks and exposing protocol from the same.
> > > > This could be managed.
> > > >
> > > > But how do you see,  if there is such dependency oN
> > lib.
> > > > Say a driver which is in BE mode, and is using
> > DebugLib
> > > > (BaseDebugLibSerialPort)
> > > > And DebugLib uses SerialPortLib, which is in LE mode
> > > >
> > > > Thanks
> > > > Udit
> > > >
> > > > > -Original Message-
> > > > > From: edk2-devel [mailto:edk2-devel-
> > > > boun...@lists.01.org] On Behalf Of Leif
> > > > > Lindholm
> > > > > Sent: Friday, December 01, 2017 4:28 PM
> > > > > To: Meenakshi Aggarwal 
> > > > > Cc: Kinney, Michael D ;
> > > > edk2-devel@lists.01.org;
> > > > > Gao, Liming ; Ard Biesheuvel
> > > > > 
> > > > > Subject: Re: [edk2] [PATCH 1/1] MdePkg/IoLib: Add
> > > > support for big-endian
> > > > > MMIO
> > > > >
> > > > > On Thu, Nov 30, 2017 at 04:15:38AM +, Meenakshi
> > > > Aggarwal wrote:
> > > > > > Hi Leif, Mike,
> > > > > >
> > > > > >
> > > > > > NXP boards, at present, have few controllers with
> > big
> > > > endian and other
> > > > > > with little endian memory access.
> > > > >
> > > > > Sure, this is not a problem.
> > > > >
> > > > > > Maximum controllers depend on SocLib library for
> > > > clock information and
> > > > > > endianness for SocLib and controllers is
> > different.
> > > > >
> > > > > OK, I see in SocLib you have something called a Gur
> > > > that is read once (and again
> > > > > does a special per-device Pcd dance for runtime
> > > > selection between
> > > > > byteswapping Mmio and plain Mmio).
> > > > >
> > > > > > So this option will not work for us,
> > > > > >   You would then just do (in your .dsc):
> > > > > >   Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf {
> > > > > >   IoLib|
> > > > > >   }
> > > > > >
> > > > > > Because all libraries included by WatchDog will
> > then
> > > > access BE mode Mmio
> > > > > APIs.
> > > > >
> > > > > Which libraries performing Mmio accesses are you
> > > > intending to include in your
> > > > > watchdog driver? You have submitted none as part of
> > > > this series.
> > > > >
> > > > > > And breaking code into separate modules with
> > > 

Re: [edk2] [PATCH RFT] ArmVirtPkg/ArmVirtXen: move from Intel to generic BDS

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 15:19, Julien Grall  wrote:
> Hi Ard,
>
> On 30/11/17 20:31, Ard Biesheuvel wrote:
>> ArmVirtXen is the only remaining consumer of ArmPlatformPkg's
>> PlatformIntelBdsLib implementation, which is tightly coupled to the
>> deprecated Intel BDS. So move ArmVirtXen to the generic BDS as well,
>> allowing us to get rid of PlatformIntelBdsLib entirely.
>
> It was in my list of UEFI part I wanted to look next :).
> I tested it and hit the following assert:
>
> ASSERT [BdsDxe] 
> /home/julieng/works/edk2/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c(502):
>  0 == 4
>
> Looking at the ArmVirtQemu.dsc, I made the below modification.
> When I tried the version protected by TTY_ENABLE, the ASSERT was
> still present.
>
> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
> index ae43d59901..bc76a780be 100644
> --- a/ArmVirtPkg/ArmVirtXen.dsc
> +++ b/ArmVirtPkg/ArmVirtXen.dsc
> @@ -81,6 +81,10 @@
># Size of the region used by UEFI in permanent memory (Reserved 64MB)
>gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400
>
> +  ## Default Terminal Type^M
> +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM^M
> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4^M
> +^M
>#
># ARM Virtual Architectural Timer
>#
>
> My knowledge in UEFI is still limited, so I would appreciate any
> feedbacks here.
>

My bad.

Could you please try with this applied on top?

diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 11e073287a84..5ddcfceef9dc 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -88,6 +88,13 @@ [PcdsFixedAtBuild.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83,
0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52,
0x68, 0xD0, 0xB4, 0xD1 }

+  ## Default Terminal Type
+  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
+  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
+
+  # Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
+  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91,
0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51,
0xef, 0x94}
+
 [PcdsPatchableInModule.common]
   #
   # This will be overridden in the code

(and don't bother with the -D TTY_TERMINAL, it will be the default anyway)
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 6/6] BaseTools/Conf: Add VS2017/ARM support

2017-12-04 Thread Gao, Liming
Pete:
 1. You add new build for ARM. I remember the reason is that --convert-hex 
can't be used by trim for ARM ASM file. Right?
 2. On tools_def.txt. Why introduce 
/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE option?

Thanks
Liming
> -Original Message-
> From: Pete Batard [mailto:p...@akeo.ie]
> Sent: Monday, December 4, 2017 9:12 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [PATCH 6/6] BaseTools/Conf: Add VS2017/ARM support
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Pete Batard 
> ---
>  BaseTools/Conf/build_rule.template | 30 
>  BaseTools/Conf/tools_def.template  | 28 ++
>  2 files changed, 58 insertions(+)
> 
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index 3e6aa8ff0f34..08c1df14af90 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -207,6 +207,36 @@
>  # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing 
> issues
>  "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
> 
> +[Assembly-Code-File.COMMON.ARM]
> +# Remove --convert-hex for ARM as it breaks MSFT assemblers
> +
> +?.asm, ?.Asm, ?.ASM
> +
> +
> +?.S, ?.s
> +
> +
> +$(MAKE_FILE)
> +
> +
> +$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
> +
> +
> +"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
> +Trim --source-code --convert-hex --trim-long -o 
> ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
> +"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) 
> ${d_path}(+)${s_base}.iii
> +
> +
> +"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
> +Trim --source-code --trim-long -o ${d_path}(+)${s_base}.iii 
> ${d_path}(+)${s_base}.i
> +"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) 
> ${d_path}(+)${s_base}.iii
> +
> +
> +"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
> +Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii 
> ${d_path}(+)${s_base}.i
> +# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing 
> issues
> +"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
> +
>  [Nasm-Assembly-Code-File.COMMON.COMMON]
>  
>  ?.nasm
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index 91b135c2e569..bea31f1660f2 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -79,6 +79,7 @@ DEFINE VS2017_HOST= x86
>  DEFINE VS2017_BIN_HOST= 
> DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\DEF(VS2017_HOST)
>  DEFINE VS2017_BIN_IA32= DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x86
>  DEFINE VS2017_BIN_X64 = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x64
> +DEFINE VS2017_BIN_ARM = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\arm
> 
>  DEFINE WINSDK_BIN   = ENV(WINSDK_PREFIX)
>  DEFINE WINSDKx86_BIN= ENV(WINSDKx86_PREFIX)
> @@ -4169,6 +4170,33 @@ NOOPT_VS2017_X64_NASM_FLAGS = -O0 -f win64 -g
>  RELEASE_VS2017_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4001 
> /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP
> /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL 
> /ENTRY:$(IMAGE_ENTRY_POINT)
> /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER 
> /MERGE:.rdata=.data
>  NOOPT_VS2017_X64_DLINK_FLAGS= /NOLOGO /NODEFAULTLIB /IGNORE:4001 
> /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32
> /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL 
> /ENTRY:$(IMAGE_ENTRY_POINT)
> /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
> 
> +#
> +# ARM definitions
> +#
> +*_VS2017_ARM_CC_PATH  = DEF(VS2017_BIN_ARM)\cl.exe
> +*_VS2017_ARM_VFRPP_PATH   = DEF(VS2017_BIN_ARM)\cl.exe
> +*_VS2017_ARM_SLINK_PATH   = DEF(VS2017_BIN_ARM)\lib.exe
> +*_VS2017_ARM_DLINK_PATH   = DEF(VS2017_BIN_ARM)\link.exe
> +*_VS2017_ARM_APP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
> +*_VS2017_ARM_PP_PATH  = DEF(VS2017_BIN_ARM)\cl.exe
> +*_VS2017_ARM_ASM_PATH = DEF(VS2017_BIN_ARM)\armasm.exe
> +*_VS2017_ARM_ASLCC_PATH   = DEF(VS2017_BIN_ARM)\cl.exe
> +*_VS2017_ARM_ASLPP_PATH   = DEF(VS2017_BIN_ARM)\cl.exe
> +*_VS2017_ARM_ASLDLINK_PATH= DEF(VS2017_BIN_ARM)\link.exe
> +
> +  *_VS2017_ARM_MAKE_FLAGS = /nologo
> +  DEBUG_VS2017_ARM_CC_FLAGS   = /nologo /c /WX /GS- /W4 /Gs32768 /D 
> UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR-
> /GF /Gy /Zi /Gm /Gw /Oi- /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
> +RELEASE_VS2017_ARM_CC_FLAGS   = /nologo /c /WX /GS- /W4 /Gs32768 /D 
> UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR-
> /GF /Gw /Oi- 

Re: [edk2] [PATCH] [edk2 EmbeddedPkg]:Adding secure boot and HTTP image download (Disaster recovery image) Applications for Linux based platforms

2017-12-04 Thread Kalyan Nagabhirava
sure Leif , we will address your review comments and send updated patches.

Regards,
kalyan.

On 4 December 2017 at 21:03, Leif Lindholm  wrote:

> Hi Kalyan,
>
> Am I right in assuming that since this is the output of your team, you
> have some time to look into reworking based on feedback (unlike the
> HiKey support)?
>
> A few high-level comments:
> 1) Please generate your patches with --stat=1000 --stat-graph-width=20
>as per https://github.com/tianocore/tianocore.github.io/wiki/
> Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers
> 2) I see at least 3 separate patches below:
>- Application/Dri
>- Application/DriSecureBoot
>- RdkBootManagerLib
> 3) List.h looks mostly to be reimplementing functionality that already
>exists in BaseLib.h.
>
> If you could address these three things and send out as a v2, then we
> would be in a much better position to review the contribution
> properly.
>
> Best Regards,
>
> Leif
>
> On Tue, Nov 28, 2017 at 12:57:58PM +0530, kalyan-nagabhirava wrote:
> > Linaro and RDK are  working on standardizing the boot process for RDK
> STB boxes using Uefi.
> > Added applications are reference implementation of RDK STB boot process
> on Arm platforms
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: kalyan-nagabhirava 
> > ---
> >  EmbeddedPkg/Application/Dri/Dri.c  |  26 +
> >  EmbeddedPkg/Application/Dri/Dri.inf|  56 ++
> >  .../Application/DriSecureBoot/DriSecureBoot.c  |  32 ++
> >  .../Application/DriSecureBoot/DriSecureBoot.inf|  57 ++
> >  EmbeddedPkg/Application/SecureBoot/SecureBoot.c|  30 ++
> >  EmbeddedPkg/Application/SecureBoot/SecureBoot.inf  |  57 ++
> >  EmbeddedPkg/Drivers/RdkDxe/RdkDxe.c|  97 
> >  EmbeddedPkg/Drivers/RdkDxe/RdkDxe.h|  14 +
> >  EmbeddedPkg/Drivers/RdkDxe/RdkDxe.inf  |  45 ++
> >  EmbeddedPkg/Library/RdkBootManagerLib/DiskIo.c | 536
> +++
> >  EmbeddedPkg/Library/RdkBootManagerLib/HttpBoot.c   | 315 +++
> >  .../Library/RdkBootManagerLib/Include/DiskIo.h |  20 +
> >  .../Library/RdkBootManagerLib/Include/HttpBoot.h   |   7 +
> >  .../Library/RdkBootManagerLib/Include/List.h   | 136 +
> >  .../RdkBootManagerLib/Include/RdkBootManagerLib.h  |  31 ++
> >  .../Library/RdkBootManagerLib/Include/RdkFile.h|  20 +
> >  .../Library/RdkBootManagerLib/Include/SecureBoot.h |  40 ++
> >  .../RdkBootManagerLib/RdkBootManagerLib.dec|  52 ++
> >  .../RdkBootManagerLib/RdkBootManagerLib.inf|  81 +++
> >  EmbeddedPkg/Library/RdkBootManagerLib/RdkFile.c| 259 +
> >  EmbeddedPkg/Library/RdkBootManagerLib/SecureBoot.c | 577
> +
> >  21 files changed, 2488 insertions(+)
> >  create mode 100644 EmbeddedPkg/Application/Dri/Dri.c
> >  create mode 100644 EmbeddedPkg/Application/Dri/Dri.inf
> >  create mode 100644 EmbeddedPkg/Application/
> DriSecureBoot/DriSecureBoot.c
> >  create mode 100644 EmbeddedPkg/Application/DriSecureBoot/DriSecureBoot.
> inf
> >  create mode 100644 EmbeddedPkg/Application/SecureBoot/SecureBoot.c
> >  create mode 100644 EmbeddedPkg/Application/SecureBoot/SecureBoot.inf
> >  create mode 100644 EmbeddedPkg/Drivers/RdkDxe/RdkDxe.c
> >  create mode 100644 EmbeddedPkg/Drivers/RdkDxe/RdkDxe.h
> >  create mode 100644 EmbeddedPkg/Drivers/RdkDxe/RdkDxe.inf
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/DiskIo.c
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/HttpBoot.c
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/
> DiskIo.h
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/
> HttpBoot.h
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/List.h
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/
> RdkBootManagerLib.h
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/
> RdkFile.h
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/
> SecureBoot.h
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/
> RdkBootManagerLib.dec
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/
> RdkBootManagerLib.inf
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/RdkFile.c
> >  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/SecureBoot.c
>



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


Re: [edk2] [PATCH 3/6] MdePkg/Library/BaseLib: Enable VS2017/ARM builds

2017-12-04 Thread Gao, Liming
Pete:
  Why override compiler option /GL- here?

> -Original Message-
> From: Pete Batard [mailto:p...@akeo.ie]
> Sent: Monday, December 4, 2017 9:12 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [PATCH 3/6] MdePkg/Library/BaseLib: Enable VS2017/ARM builds
> 
> Most of the RVCT assembly can be reused as is for MSFT except
> for CpuBreakpoint.asm, which we need to force to Arm mode.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Pete Batard 
> ---
>  MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm |  5 -
>  MdePkg/Library/BaseLib/BaseLib.inf   | 19 ---
>  2 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm 
> b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm
> index 8a8065159bf2..2e508d6f1ad8 100644
> --- a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm
> +++ b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm
> @@ -16,7 +16,10 @@
> 
>  EXPORT CpuBreakpoint
> 
> -  AREA Cpu_Breakpoint, CODE, READONLY
> +; Force ARM mode for this section, as MSFT assembler defaults to THUMB
> +  AREA Cpu_Breakpoint, CODE, READONLY, ARM
> +
> +ARM
> 
>  ;/**
>  ;  Generates a breakpoint on the CPU.
> diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
> b/MdePkg/Library/BaseLib/BaseLib.inf
> index 320ac457ea3d..4337a125d516 100644
> --- a/MdePkg/Library/BaseLib/BaseLib.inf
> +++ b/MdePkg/Library/BaseLib/BaseLib.inf
> @@ -821,8 +821,9 @@ [Sources.EBC]
>  [Sources.ARM]
>Arm/InternalSwitchStack.c
>Arm/Unaligned.c
> -  Math64.c   | RVCT
> -
> +  Math64.c   | RVCT
> +  Math64.c   | MSFT
> +
>Arm/SwitchStack.asm| RVCT
>Arm/SetJumpLongJump.asm| RVCT
>Arm/DisableInterrupts.asm  | RVCT
> @@ -831,7 +832,16 @@ [Sources.ARM]
>Arm/CpuPause.asm   | RVCT
>Arm/CpuBreakpoint.asm  | RVCT
>Arm/MemoryFence.asm| RVCT
> -
> +
> +  Arm/SwitchStack.asm| MSFT
> +  Arm/SetJumpLongJump.asm| MSFT
> +  Arm/DisableInterrupts.asm  | MSFT
> +  Arm/EnableInterrupts.asm   | MSFT
> +  Arm/GetInterruptsState.asm | MSFT
> +  Arm/CpuPause.asm   | MSFT
> +  Arm/CpuBreakpoint.asm  | MSFT
> +  Arm/MemoryFence.asm| MSFT
> +
>Arm/Math64.S  | GCC
>Arm/SwitchStack.S | GCC
>Arm/EnableInterrupts.S| GCC
> @@ -870,3 +880,6 @@ [Pcd]
> 
>  [FeaturePcd]
>gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList  ## CONSUMES
> +
> +[BuildOptions]
> +  MSFT:*_*_ARM_CC_FLAGS = /GL-
> --
> 2.9.3.windows.2

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


Re: [edk2] [PATCH 1/6] MdePkg: Disable some Level 4 warnings for VS2017/ARM

2017-12-04 Thread Gao, Liming
Pete:
  I suggest to align the disabled warning list to IA32/X64 arch. I find someone 
are not listed in IA32/X64 arch. Could you give the more detail on why disable 
them by default?

Thanks
Liming
> -Original Message-
> From: Pete Batard [mailto:p...@akeo.ie]
> Sent: Monday, December 4, 2017 9:12 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [PATCH 1/6] MdePkg: Disable some Level 4 warnings for VS2017/ARM
> 
> Warnings 4018, 4100, 4101, 4127, 4214, 4244, 4456, 4701 and 4703 are
> disabled as they were found to occur more than 5 times during QEMU
> firmware compilation.
> 
> Also create a dummy macro for PRESERVE8, as this is not supported by
> the Microsoft ARM assembler.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Pete Batard 
> ---
>  MdePkg/Include/Arm/ProcessorBind.h | 96 +++-
>  1 file changed, 75 insertions(+), 21 deletions(-)
> 
> diff --git a/MdePkg/Include/Arm/ProcessorBind.h 
> b/MdePkg/Include/Arm/ProcessorBind.h
> index dde1fd1152ba..00de80bafe0a 100644
> --- a/MdePkg/Include/Arm/ProcessorBind.h
> +++ b/MdePkg/Include/Arm/ProcessorBind.h
> @@ -1,15 +1,15 @@
>  /** @file
>Processor or Compiler specific defines and types for ARM.
> 
> -  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
> +  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
>Portions copyright (c) 2008 - 2009, Apple Inc. 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
> +  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.
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> 
>  **/
> 
> @@ -28,14 +28,63 @@
>  #pragma pack()
>  #endif
> 
> +#if defined(_MSC_EXTENSIONS)
> +
>  //
> -// RVCT does not support the __builtin_unreachable() macro
> +// Disable 'signed/unsigned mismatch' warnings.
>  //
> -#ifdef __ARMCC_VERSION
> +#pragma warning ( disable : 4018 )
> +
> +//
> +// Disable 'unreferenced formal parameter' warnings.
> +//
> +#pragma warning ( disable : 4100 )
> +
> +//
> +// Disable 'unreferenced local variable' warnings.
> +//
> +#pragma warning ( disable : 4101 )
> +
> +//
> +// Suppress warnings for ASSERT(FALSE) or while(TRUE).
> +//
> +#pragma warning ( disable : 4127 )
> +
> +//
> +// Disable bitfield type check warnings.
> +//
> +#pragma warning ( disable : 4214 )
> +
> +//
> +// Disable 'conversion from X to Y, possible loss of data' warnings
> +//
> +#pragma warning ( disable : 4244 )
> +
> +//
> +// Disable 'declaration of X hides previous local declaration' warnings
> +//
> +#pragma warning ( disable : 4456 )
> +
> +//
> +// Disable 'potentially uninitialized local variable X used' warnings
> +//
> +#pragma warning ( disable : 4701 )
> +
> +//
> +// Disable 'potentially uninitialized local pointer variable X used' warnings
> +//
> +#pragma warning ( disable : 4703 )
> +
> +#endif
> +
> +//
> +// RVCT and MSFT don't support the __builtin_unreachable() macro
> +//
> +#if defined(__ARMCC_VERSION) || defined(_MSC_EXTENSIONS)
>  #define UNREACHABLE()
>  #endif
> 
> -#if _MSC_EXTENSIONS
> +#if defined(_MSC_EXTENSIONS)
>//
>// use Microsoft* C compiler dependent integer width types
>//
> @@ -52,7 +101,7 @@
>typedef signed char INT8;
>  #else
>//
> -  // Assume standard ARM alignment.
> +  // Assume standard ARM alignment.
>// Need to check portability of long long
>//
>typedef unsigned long long  UINT64;
> @@ -121,7 +170,7 @@ typedef INT32   INTN;
>  // use the correct C calling convention. All protocol member functions and
>  // EFI intrinsics are required to modify their member functions with EFIAPI.
>  //
> -#define EFIAPI
> +#define EFIAPI
> 
>  // When compiling with Clang, we still use GNU as for the assembler, so we 
> still
>  // need to define the GCC_ASM* macros.
> @@ -142,34 +191,39 @@ typedef INT32   INTN;
> 
>  #define GCC_ASM_EXPORT(func__)  \
>   .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__);\
> - .type ASM_PFX(func__), %function
> + .type ASM_PFX(func__), %function
> 
>  #define GCC_ASM_IMPORT(func__)  \
>   .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
> -
> +
>#else
>  //
> -// 

Re: [edk2] [PATCH] [edk2 EmbeddedPkg]:Adding secure boot and HTTP image download (Disaster recovery image) Applications for Linux based platforms

2017-12-04 Thread Leif Lindholm
Hi Kalyan,

Am I right in assuming that since this is the output of your team, you
have some time to look into reworking based on feedback (unlike the
HiKey support)?

A few high-level comments:
1) Please generate your patches with --stat=1000 --stat-graph-width=20
   as per 
https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers
2) I see at least 3 separate patches below:
   - Application/Dri
   - Application/DriSecureBoot
   - RdkBootManagerLib
3) List.h looks mostly to be reimplementing functionality that already
   exists in BaseLib.h.

If you could address these three things and send out as a v2, then we
would be in a much better position to review the contribution
properly.

Best Regards,

Leif

On Tue, Nov 28, 2017 at 12:57:58PM +0530, kalyan-nagabhirava wrote:
> Linaro and RDK are  working on standardizing the boot process for RDK  STB 
> boxes using Uefi.
> Added applications are reference implementation of RDK STB boot process on 
> Arm platforms
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: kalyan-nagabhirava 
> ---
>  EmbeddedPkg/Application/Dri/Dri.c  |  26 +
>  EmbeddedPkg/Application/Dri/Dri.inf|  56 ++
>  .../Application/DriSecureBoot/DriSecureBoot.c  |  32 ++
>  .../Application/DriSecureBoot/DriSecureBoot.inf|  57 ++
>  EmbeddedPkg/Application/SecureBoot/SecureBoot.c|  30 ++
>  EmbeddedPkg/Application/SecureBoot/SecureBoot.inf  |  57 ++
>  EmbeddedPkg/Drivers/RdkDxe/RdkDxe.c|  97 
>  EmbeddedPkg/Drivers/RdkDxe/RdkDxe.h|  14 +
>  EmbeddedPkg/Drivers/RdkDxe/RdkDxe.inf  |  45 ++
>  EmbeddedPkg/Library/RdkBootManagerLib/DiskIo.c | 536 +++
>  EmbeddedPkg/Library/RdkBootManagerLib/HttpBoot.c   | 315 +++
>  .../Library/RdkBootManagerLib/Include/DiskIo.h |  20 +
>  .../Library/RdkBootManagerLib/Include/HttpBoot.h   |   7 +
>  .../Library/RdkBootManagerLib/Include/List.h   | 136 +
>  .../RdkBootManagerLib/Include/RdkBootManagerLib.h  |  31 ++
>  .../Library/RdkBootManagerLib/Include/RdkFile.h|  20 +
>  .../Library/RdkBootManagerLib/Include/SecureBoot.h |  40 ++
>  .../RdkBootManagerLib/RdkBootManagerLib.dec|  52 ++
>  .../RdkBootManagerLib/RdkBootManagerLib.inf|  81 +++
>  EmbeddedPkg/Library/RdkBootManagerLib/RdkFile.c| 259 +
>  EmbeddedPkg/Library/RdkBootManagerLib/SecureBoot.c | 577 
> +
>  21 files changed, 2488 insertions(+)
>  create mode 100644 EmbeddedPkg/Application/Dri/Dri.c
>  create mode 100644 EmbeddedPkg/Application/Dri/Dri.inf
>  create mode 100644 EmbeddedPkg/Application/DriSecureBoot/DriSecureBoot.c
>  create mode 100644 EmbeddedPkg/Application/DriSecureBoot/DriSecureBoot.inf
>  create mode 100644 EmbeddedPkg/Application/SecureBoot/SecureBoot.c
>  create mode 100644 EmbeddedPkg/Application/SecureBoot/SecureBoot.inf
>  create mode 100644 EmbeddedPkg/Drivers/RdkDxe/RdkDxe.c
>  create mode 100644 EmbeddedPkg/Drivers/RdkDxe/RdkDxe.h
>  create mode 100644 EmbeddedPkg/Drivers/RdkDxe/RdkDxe.inf
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/DiskIo.c
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/HttpBoot.c
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/DiskIo.h
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/HttpBoot.h
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/List.h
>  create mode 100644 
> EmbeddedPkg/Library/RdkBootManagerLib/Include/RdkBootManagerLib.h
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/RdkFile.h
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/Include/SecureBoot.h
>  create mode 100644 
> EmbeddedPkg/Library/RdkBootManagerLib/RdkBootManagerLib.dec
>  create mode 100644 
> EmbeddedPkg/Library/RdkBootManagerLib/RdkBootManagerLib.inf
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/RdkFile.c
>  create mode 100644 EmbeddedPkg/Library/RdkBootManagerLib/SecureBoot.c
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Enabling boot menu via serial & PXE boot in CorebootPayloadPkg

2017-12-04 Thread Cameron Craig
Hi Benjamin,

>Hi Cameron,
>
>> >I get serial output from edk2 with the release build and the debug build.
>> >However this serial output does not include the boot menu, I just get
>> >progress and error codes (and debug messages in debug mode).
>> >I have attached a runtime log of a recent debug build.
>
>From your log, I cannot see the below prompt message:
>
>"F2 or Down  to enter Boot Manager Menu.
>ENTER   to boot directly."
>
>With my system, there is above message shown in serial. When I press F2
>upon the message, the boot manager is shown.
>
>The message is printed in PlatformBootManagerAfterConsole() in
>CorebootPayloadPkg\Library\PlatformBootManagerLib\PlatformBootManage
>r.c.
>Not sure what went wrong, but you might add some debug message to trace
>the execution flow.
>
>Or, have you been able to boot to UEFI Shell? If yes, you may type "exit"
>from the Shell prompt, and boot manager should show up.
>
>Thanks,
>
>- ben

I managed to work out the problem.
Coreboot applies patches to the edk2 source after the git fetch, one of these 
changes the BdsDxe provider from MdeModulePkg to IntelFrameworkModulePkg [1].

Changing it back to MdeModulePkg fixed the issue.

[1] 
https://github.com/coreboot/coreboot/blob/master/payloads/external/tianocore/patches/02_CorebootPayloadPkg_bds.patch

Thanks again for your help,
Cameron


Cameron Craig | Graduate Software Engineer | Exterity Limited
tel: +44 1383 828 250 | fax:  | mobile:
e: cameron.cr...@exterity.com | w: www.exterity.com



__
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
__
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [platforms: PATCH v2 4/4] Marvell/Drivers: MvPhyDxe: Cleanup the header

2017-12-04 Thread Marcin Wojtas
Hi Leif,



2017-12-04 15:00 GMT+01:00 Leif Lindholm :
> On Fri, Dec 01, 2017 at 04:35:07PM +0100, Marcin Wojtas wrote:
>> This patch removes unused macros defined in MvPhyDxe.h, as well
>> as improves the style and comments. Pick single definition
>> of the autonegotiation timeout - two different macros were used
>> for the same purpose.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Marcin Wojtas 
>> ---
>>  Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c |   2 +-
>>  Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h | 152 
>> 
>>  2 files changed, 31 insertions(+), 123 deletions(-)
>>
>> diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c 
>> b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
>> index e776a91..dd2edae 100644
>> --- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
>> +++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
>> @@ -328,7 +328,7 @@ MvPhyInit1512 (
>>
>>  DEBUG((DEBUG_ERROR, "MvPhyDxe: Waiting for PHY auto negotiation... "));
>>  for (i = 0; !(Data & BMSR_ANEGCOMPLETE); i++) {
>> -  if (i > PHY_ANEG_TIMEOUT) {
>> +  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
>
> I think you've had a git accident somewhere:
> The existing line upstream is still
>  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
> This hunk should have just dropped out.
>

No, it's ok. It just turned out, there were two concurrent definitions
of the same thing. Please take a look at what's available on top of
the master branch:

Header:
[...]
#define PHY_ANEG_TIMEOUT 4000

#define PHY_INTERFACE_MODE_RGMII 0
#define PHY_INTERFACE_MODE_RGMII_ID 1
#define PHY_INTERFACE_MODE_RGMII_RXID 2
#define PHY_INTERFACE_MODE_RGMII_TXID 3
#define PHY_INTERFACE_MODE_SGMII 4
#define PHY_INTERFACE_MODE_RTBI 5

#define PHY_AUTONEGOTIATE_TIMEOUT 5000
[...]

Driver:
~Line 204:
DEBUG((DEBUG_ERROR,"MvPhyDxe: Waiting for PHY realtime link"));
while (!(Data & MIIM_88E1xxx_PHYSTAT_SPDDONE)) {
  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {

~Line 327:
DEBUG((DEBUG_ERROR, "MvPhyDxe: Waiting for PHY auto negotiation... "));
for (i = 0; !(Data & BMSR_ANEGCOMPLETE); i++) {
  if (i > PHY_ANEG_TIMEOUT) {
DEBUG((DEBUG_ERROR, "timeout\n"));

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


Re: [edk2] [PATCH RFT] ArmVirtPkg/ArmVirtXen: move from Intel to generic BDS

2017-12-04 Thread Julien Grall
Hi Ard,

On 30/11/17 20:31, Ard Biesheuvel wrote:
> ArmVirtXen is the only remaining consumer of ArmPlatformPkg's
> PlatformIntelBdsLib implementation, which is tightly coupled to the
> deprecated Intel BDS. So move ArmVirtXen to the generic BDS as well,
> allowing us to get rid of PlatformIntelBdsLib entirely.

It was in my list of UEFI part I wanted to look next :).
I tested it and hit the following assert:

ASSERT [BdsDxe] 
/home/julieng/works/edk2/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c(502):
 0 == 4

Looking at the ArmVirtQemu.dsc, I made the below modification.
When I tried the version protected by TTY_ENABLE, the ASSERT was
still present.

diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index ae43d59901..bc76a780be 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -81,6 +81,10 @@
   # Size of the region used by UEFI in permanent memory (Reserved 64MB)
   gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400
 
+  ## Default Terminal Type^M
+  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM^M
+  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4^M
+^M
   #
   # ARM Virtual Architectural Timer
   #

My knowledge in UEFI is still limited, so I would appreciate any
feedbacks here.

Cheers,

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


Re: [edk2] [platforms: PATCH v2 3/4] Marvell/Applications: FirmwareUpdate: Fix usage information

2017-12-04 Thread Marcin Wojtas
2017-12-04 14:52 GMT+01:00 Leif Lindholm :
> On Fri, Dec 01, 2017 at 04:35:06PM +0100, Marcin Wojtas wrote:
>> fupdate command's usage information referred to a deprecated
>> '-f' flag in 'examples' section. It was a residue from the
>> initial version of the application, removed during review
>> before merging to upstream branch. Correct the help information.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Marcin Wojtas 
>
> I boggled slightly at how the file with deleted content is larger than
> the original, so went to have a look, and what I see is:
>
> --- pre.txt 2017-12-04 13:43:32.985446108 +
> +++ post.txt2017-12-04 13:44:30.433120594 +
> @@ -50,10 +50,10 @@
>  ".SH EXAMPLES\r\n"
>  " \r\n"
>  "EXAMPLES:\r\n"
> -"Update firmware from file fs2:flash-image.bin\r\n"
> -"  fupdate -f fs2:flash-image.bin\r\n"
> +"Update firmware in SPI flash from file fs2:flash-image.bin\r\n"
> +"  fupdate fs2:flash-image.bin\r\n"
>  ".SH RETURNVALUES\r\n"
>  " \r\n"
>  "RETURN VALUES:\r\n"
>  "  SHELL_SUCCESS The action was completed as requested.\r\n"
> -"  SHELL_ABORTED Error while processing command\r\n"
> +"  SHELL_ABORTED Error while processing command\r\n"
>
>
> Now, I don't mind random format cleanup as much in .uni files as
> elsewhere, since we don't get sane diffs anyway. But that also makes
> detailed and accurate commit messages much more important.
>
> So please, add something about the rewording and the whitespace fixes.
>

Sure, will do.

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


Re: [edk2] [PATCH edk2-platforms] Silicon/SynQuacerI2CDxe: add missing __FUNCTION__ argument to %a specifier

2017-12-04 Thread Ard Biesheuvel
On 4 December 2017 at 14:48, Leif Lindholm  wrote:
> On Mon, Dec 04, 2017 at 01:33:08PM +, Ard Biesheuvel wrote:
>> The I2C driver prints a warning under DEBUG when a I2C transaction times
>> out. This will occur on the rev 0.1 DeveloperBox boards due to a board
>> level error in the I2C routing (unless the MCU has been lifted off the
>> bus).
>>
>> Currently, this will trigger a crash due to a missing __FUNCTION__
>> argument to a %a specifier in a DEBUG string, because instead, the code
>> will attempt to dereference a EFI_STATUS variable as a char pointer.
>>
>> So add the missing __FUNCTION__ argument.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ard Biesheuvel 
>
> Reviewed-by: Leif Lindholm 
>

Thanks. Pushed as 7511d626b318ae068d7773159eedf3c9fc4c7a5a

>> ---
>>  Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git 
>> a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c 
>> b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
>> index fb404b17f93c..c3703dfb6c33 100644
>> --- a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
>> +++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
>> @@ -330,7 +330,7 @@ SynQuacerI2cStartRequest (
>>  Status = WaitForInterrupt (I2c);
>>  if (EFI_ERROR (Status)) {
>>  BOOTTIME_DEBUG ((DEBUG_WARN, "%a: Timeout waiting for interrupt - 
>> %r\n",
>> -Status));
>> +  __FUNCTION__, Status));
>>break;
>>  }
>>
>> --
>> 2.11.0
>>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 0/2] quirks handling for SDHCI controllers

2017-12-04 Thread Ard Biesheuvel
On 30 November 2017 at 10:11, Ard Biesheuvel  wrote:
> Many SDHCI implementations exist that are almost spec complicant, and
> could be driven by the generic SD/MMC host controller driver except
> for some minimal necessary init time tweaks.
>
> Adding such tweaks to the generic driver is undesirable. On the other
> hand, forking the driver for every platform that has such a SDHCI
> controller is problematic when it comes to upstreaming and ongoing
> maintenance (which is arguably the point of upstreaming in the first
> place).
>
> So these patches propose a workaround that is minimally invasive on the
> EDK2 side, but gives platforms a lot of leeway when it comes to applying
> SDHCI quirks.
>
> Changes since RFC/v1:
> - add EFI_SD_MMC_PASS_THRU_PROTOCOL* member to override methods
> - use UINT64* not VOID* to pass capability structure (which is alwys 64 bits
>   in size)
>
> Ard Biesheuvel (2):
>   MdeModulePkg: introduce SD/MMC override protocol
>   MdeModulePkg/SdMmcPciHcDxe: allow HC capabilities to be overridden
>

Hao, Star,

Any comments?

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


Re: [edk2] [PATCH edk2-platforms] Silicon/SynQuacerI2CDxe: add missing __FUNCTION__ argument to %a specifier

2017-12-04 Thread Leif Lindholm
On Mon, Dec 04, 2017 at 01:33:08PM +, Ard Biesheuvel wrote:
> The I2C driver prints a warning under DEBUG when a I2C transaction times
> out. This will occur on the rev 0.1 DeveloperBox boards due to a board
> level error in the I2C routing (unless the MCU has been lifted off the
> bus).
> 
> Currently, this will trigger a crash due to a missing __FUNCTION__
> argument to a %a specifier in a DEBUG string, because instead, the code
> will attempt to dereference a EFI_STATUS variable as a char pointer.
> 
> So add the missing __FUNCTION__ argument.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

> ---
>  Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git 
> a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c 
> b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
> index fb404b17f93c..c3703dfb6c33 100644
> --- a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
> +++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
> @@ -330,7 +330,7 @@ SynQuacerI2cStartRequest (
>  Status = WaitForInterrupt (I2c);
>  if (EFI_ERROR (Status)) {
>  BOOTTIME_DEBUG ((DEBUG_WARN, "%a: Timeout waiting for interrupt - 
> %r\n",
> -Status));
> +  __FUNCTION__, Status));
>break;
>  }
>  
> -- 
> 2.11.0
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] [PATCH v3 2/9] Platform/NXP : Add support for Watchdog driver

2017-12-04 Thread Leif Lindholm
Mike, Liming, as MdePkg mainteiners - one question below:

On Mon, Nov 27, 2017 at 04:21:50PM +0530, Meenakshi Aggarwal wrote:
> diff --git a/Platform/NXP/Drivers/WatchDog/WatchDog.c 
> b/Platform/NXP/Drivers/WatchDog/WatchDog.c
> new file mode 100644
> index 000..a9c70ef
> --- /dev/null
> +++ b/Platform/NXP/Drivers/WatchDog/WatchDog.c
> @@ -0,0 +1,421 @@

...

> +/**
> +  This function registers the handler NotifyFunction so it is called every 
> time
> +  the watchdog timer expires.  It also passes the amount of time since the 
> last
> +  handler call to the NotifyFunction.
> +  If NotifyFunction is not NULL and a handler is not already registered,
> +  then the new handler is registered and EFI_SUCCESS is returned.
> +  If NotifyFunction is NULL, and a handler is already registered,
> +  then that handler is unregistered.
> +  If an attempt is made to register a handler when a handler is already 
> registered,
> +  then EFI_ALREADY_STARTED is returned.
> +  If an attempt is made to unregister a handler when a handler is not 
> registered,
> +  then EFI_INVALID_PARAMETER is returned.
> +
> +  @param  This The EFI_TIMER_ARCH_PROTOCOL instance.
> +  @param  NotifyFunction   The function to call when a timer interrupt 
> fires. This
> +   function executes at TPL_HIGH_LEVEL. The DXE Core 
> will
> +   register a handler for the timer interrupt, so it 
> can know
> +   how much time has passed. This information is 
> used to
> +   signal timer based events. NULL will unregister 
> the handler.
> +
> +  @retval EFI_SUCCESS   The watchdog timer handler was registered.
> +  @retval EFI_ALREADY_STARTED   NotifyFunction is not NULL, and a handler is 
> already
> +registered.
> +  @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not
> +previously registered.
> +
> +**/
> +STATIC
> +EFI_STATUS
> +EFIAPI
> +WdogRegisterHandler (
> +  IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL   *This,
> +  IN EFI_WATCHDOG_TIMER_NOTIFY  NotifyFunction
> +  )
> +{
> +  // ERROR: This function is not supported.
> +  // The hardware watchdog will reset the board
> +  return EFI_INVALID_PARAMETER;

Michael, Liming - what's your take on this?

Is EFI_WATCHDOG_TIMER_ARCH_PROTOCOL suitable for use with a pure-hw
watchdog such as this?

If so, what would be a suitable return code here?
EFI_INVALID_PARAMETER does not look ideal.

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


Re: [edk2] [platforms: PATCH v2 4/4] Marvell/Drivers: MvPhyDxe: Cleanup the header

2017-12-04 Thread Leif Lindholm
On Fri, Dec 01, 2017 at 04:35:07PM +0100, Marcin Wojtas wrote:
> This patch removes unused macros defined in MvPhyDxe.h, as well
> as improves the style and comments. Pick single definition
> of the autonegotiation timeout - two different macros were used
> for the same purpose.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 
> ---
>  Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c |   2 +-
>  Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h | 152 
> 
>  2 files changed, 31 insertions(+), 123 deletions(-)
> 
> diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c 
> b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
> index e776a91..dd2edae 100644
> --- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
> +++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c
> @@ -328,7 +328,7 @@ MvPhyInit1512 (
>  
>  DEBUG((DEBUG_ERROR, "MvPhyDxe: Waiting for PHY auto negotiation... "));
>  for (i = 0; !(Data & BMSR_ANEGCOMPLETE); i++) {
> -  if (i > PHY_ANEG_TIMEOUT) {
> +  if (i > PHY_AUTONEGOTIATE_TIMEOUT) {

I think you've had a git accident somewhere:
The existing line upstream is still
 if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
This hunk should have just dropped out.

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


Re: [edk2] [PATCH v3 07/11] ArmPkg/ArmExceptionLib: Add implementation of new API

2017-12-04 Thread Ard Biesheuvel
On 1 December 2017 at 02:37, Jian J Wang  wrote:
>> v3:
>>Newly added
>
> This patch add implementation of following new API introduced into
> CpuExceptionHandlerLib. Since this lib hasn't support Stack Guard
> and stack switch, the new method just calls original
> InitializeCpuExceptionHandlers.
>
>   EFI_STATUS
>   EFIAPI
>   InitializeCpuExceptionHandlersEx (
> IN EFI_VECTOR_HANDOFF_INFO*VectorInfo OPTIONAL,
> IN CPU_EXCEPTION_INIT_DATA_EX *InitDataEx OPTIONAL
> );
>
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Cc: Jiewen Yao 
> Suggested-by: Ayellet Wolman 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang 
> ---
>  ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c | 33 
> 
>  1 file changed, 33 insertions(+)
>
> diff --git a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c 
> b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> index e8ea1f159d..9fb4a05845 100644
> --- a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> +++ b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> @@ -320,3 +320,36 @@ CommonCExceptionHandler(
>
>DefaultExceptionHandler(ExceptionType, SystemContext);
>  }
> +
> +/**
> +  Initializes all CPU exceptions entries with optional extra initializations.
> +
> +  By default, this method should include all functionalities implemented by
> +  InitializeCpuExceptionHandlers(), plus extra initialization works, if any.
> +  This is could be done by calling InitializeCpuExceptionHandlers() directly
> +  in this method besides the extra works.
> +
> +  InitDataEx is optional and its use and content are processor arch 
> dependent.
> +  The typical usage of it is to convey resources which have to be reserved
> +  elsewhere and are necessary for the extra initializations of exception.
> +
> +  @param[in]  VectorInfoPointer to reserved vector list.
> +  @param[in]  InitDataExPointer to data optional for extra 
> initializations
> +of exception.
> +
> +  @retval EFI_SUCCESS The exceptions have been successfully
> +  initialized.
> +  @retval EFI_INVALID_PARAMETER   VectorInfo or InitDataEx contains invalid
> +  content.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +InitializeCpuExceptionHandlersEx (
> +  IN EFI_VECTOR_HANDOFF_INFO*VectorInfo OPTIONAL,
> +  IN CPU_EXCEPTION_INIT_DATA_EX *InitDataEx OPTIONAL
> +  )
> +{
> +  return InitializeCpuExceptionHandlers (VectorInfo);
> +}
> +

I would appreciate it if you could clean up the grammar in the comment block.

Other than that,

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


Re: [edk2] [platforms: PATCH v2 3/4] Marvell/Applications: FirmwareUpdate: Fix usage information

2017-12-04 Thread Leif Lindholm
On Fri, Dec 01, 2017 at 04:35:06PM +0100, Marcin Wojtas wrote:
> fupdate command's usage information referred to a deprecated
> '-f' flag in 'examples' section. It was a residue from the
> initial version of the application, removed during review
> before merging to upstream branch. Correct the help information.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 

I boggled slightly at how the file with deleted content is larger than
the original, so went to have a look, and what I see is:

--- pre.txt 2017-12-04 13:43:32.985446108 +
+++ post.txt2017-12-04 13:44:30.433120594 +
@@ -50,10 +50,10 @@
 ".SH EXAMPLES\r\n"
 " \r\n"
 "EXAMPLES:\r\n"
-"Update firmware from file fs2:flash-image.bin\r\n"
-"  fupdate -f fs2:flash-image.bin\r\n"
+"Update firmware in SPI flash from file fs2:flash-image.bin\r\n"
+"  fupdate fs2:flash-image.bin\r\n"
 ".SH RETURNVALUES\r\n"
 " \r\n"
 "RETURN VALUES:\r\n"
 "  SHELL_SUCCESS The action was completed as requested.\r\n"
-"  SHELL_ABORTED Error while processing command\r\n"
+"  SHELL_ABORTED Error while processing command\r\n"


Now, I don't mind random format cleanup as much in .uni files as
elsewhere, since we don't get sane diffs anyway. But that also makes
detailed and accurate commit messages much more important.

So please, add something about the rewording and the whitespace fixes.

/
Leif

> ---
>  Platform/Marvell/Applications/FirmwareUpdate/FUpdate.uni | Bin 5146 -> 5190 
> bytes
>  1 file changed, 0 insertions(+), 0 deletions(-)
> 
> diff --git a/Platform/Marvell/Applications/FirmwareUpdate/FUpdate.uni 
> b/Platform/Marvell/Applications/FirmwareUpdate/FUpdate.uni
> index 
> 9d52e590c6d239621d226a240a3f9755210f52fe..146f624737d96e2cd354857dbb63390ebe2f347e
>  100644
> GIT binary patch
> delta 56
> 

[edk2] [PATCH edk2-platforms] Silicon/SynQuacerI2CDxe: add missing __FUNCTION__ argument to %a specifier

2017-12-04 Thread Ard Biesheuvel
The I2C driver prints a warning under DEBUG when a I2C transaction times
out. This will occur on the rev 0.1 DeveloperBox boards due to a board
level error in the I2C routing (unless the MCU has been lifted off the
bus).

Currently, this will trigger a crash due to a missing __FUNCTION__
argument to a %a specifier in a DEBUG string, because instead, the code
will attempt to dereference a EFI_STATUS variable as a char pointer.

So add the missing __FUNCTION__ argument.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c 
b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
index fb404b17f93c..c3703dfb6c33 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
@@ -330,7 +330,7 @@ SynQuacerI2cStartRequest (
 Status = WaitForInterrupt (I2c);
 if (EFI_ERROR (Status)) {
 BOOTTIME_DEBUG ((DEBUG_WARN, "%a: Timeout waiting for interrupt - 
%r\n",
-Status));
+  __FUNCTION__, Status));
   break;
 }
 
-- 
2.11.0

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


Re: [edk2] [platforms: PATCH v2 1/4] Marvell/Armada: Switch to dynamic tftp command

2017-12-04 Thread Leif Lindholm
On Fri, Dec 01, 2017 at 04:35:04PM +0100, Marcin Wojtas wrote:
> After removal of the tftp library in EDK2, the tftp was
> disabled on Armada platform. Re-enable this functionality
> as a dynamic command on Armada 70x0 DB board. For this
> purpose add it as a build-time selectable option, depending
> on a new INCLUDE_TFTP_COMMAND parameter.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 
> ---
>  Platform/Marvell/Armada/Armada.dsc.inc | 4 
>  Platform/Marvell/Armada/Armada70x0.dsc | 1 +
>  Platform/Marvell/Armada/Armada70x0.fdf | 3 +++
>  3 files changed, 8 insertions(+)
> 
> diff --git a/Platform/Marvell/Armada/Armada.dsc.inc 
> b/Platform/Marvell/Armada/Armada.dsc.inc
> index 2a8a226..6040493 100644
> --- a/Platform/Marvell/Armada/Armada.dsc.inc
> +++ b/Platform/Marvell/Armada/Armada.dsc.inc
> @@ -525,6 +525,10 @@
>gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000
>}
>  
> +!ifdef $(INCLUDE_TFTP_COMMAND)
> +  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> +!endif #$(INCLUDE_TFTP_COMMAND)
> +
>  
> [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
>GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
>  
> diff --git a/Platform/Marvell/Armada/Armada70x0.dsc 
> b/Platform/Marvell/Armada/Armada70x0.dsc
> index 8e4cdb2..4e7d43c 100644
> --- a/Platform/Marvell/Armada/Armada70x0.dsc
> +++ b/Platform/Marvell/Armada/Armada70x0.dsc
> @@ -44,6 +44,7 @@
>BUILD_TARGETS  = DEBUG|RELEASE
>SKUID_IDENTIFIER   = DEFAULT
>FLASH_DEFINITION   = Platform/Marvell/Armada/Armada70x0.fdf
> +  DEFINE INCLUDE_TFTP_COMMAND= 1

This looks very much to me like it will always include the tftp
command, which is not what I wanted.

Then again, you have done _exactly_ what I requested in emulating
what the Hisilicon platforms do (and will shortly stop doing).

My thoughts were that, since this is a debug/development feature, it
would be enabled at build time by adding -D INCLUDE_TFTP_COMMAND to
the build command line.

As such, do you have any issues with me deleting this hunk before
pushing? If not:
Reviewed-by: Leif Lindholm 

>  
>  !include Armada.dsc.inc
>  
> diff --git a/Platform/Marvell/Armada/Armada70x0.fdf 
> b/Platform/Marvell/Armada/Armada70x0.fdf
> index ca92c60..c03bc42 100644
> --- a/Platform/Marvell/Armada/Armada70x0.fdf
> +++ b/Platform/Marvell/Armada/Armada70x0.fdf
> @@ -176,6 +176,9 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c
>  
># UEFI application (Shell Embedded Boot Loader)
>INF ShellPkg/Application/Shell/Shell.inf
> +!ifdef $(INCLUDE_TFTP_COMMAND)
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> +!endif #$(INCLUDE_TFTP_COMMAND)
>  
># Bds
>INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> -- 
> 2.7.4
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 6/6] BaseTools/Conf: Add VS2017/ARM support

2017-12-04 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 BaseTools/Conf/build_rule.template | 30 
 BaseTools/Conf/tools_def.template  | 28 ++
 2 files changed, 58 insertions(+)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index 3e6aa8ff0f34..08c1df14af90 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -207,6 +207,36 @@
 # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
 "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
 
+[Assembly-Code-File.COMMON.ARM]
+# Remove --convert-hex for ARM as it breaks MSFT assemblers
+
+?.asm, ?.Asm, ?.ASM
+
+
+?.S, ?.s
+
+
+$(MAKE_FILE)
+
+
+$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+
+
+"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+Trim --source-code --convert-hex --trim-long -o 
${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
+"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) 
${d_path}(+)${s_base}.iii
+
+
+"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+Trim --source-code --trim-long -o ${d_path}(+)${s_base}.iii 
${d_path}(+)${s_base}.i
+"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) 
${d_path}(+)${s_base}.iii
+
+
+"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii 
${d_path}(+)${s_base}.i
+# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
+"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
+
 [Nasm-Assembly-Code-File.COMMON.COMMON]
 
 ?.nasm
diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 91b135c2e569..bea31f1660f2 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -79,6 +79,7 @@ DEFINE VS2017_HOST= x86
 DEFINE VS2017_BIN_HOST= 
DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\DEF(VS2017_HOST)
 DEFINE VS2017_BIN_IA32= DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x86
 DEFINE VS2017_BIN_X64 = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x64
+DEFINE VS2017_BIN_ARM = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\arm
 
 DEFINE WINSDK_BIN   = ENV(WINSDK_PREFIX)
 DEFINE WINSDKx86_BIN= ENV(WINSDKx86_PREFIX)
@@ -4169,6 +4170,33 @@ NOOPT_VS2017_X64_NASM_FLAGS = -O0 -f win64 -g
 RELEASE_VS2017_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4001 
/IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D 
/SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) 
/SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER 
/MERGE:.rdata=.data
 NOOPT_VS2017_X64_DLINK_FLAGS= /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF 
/OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 
/LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER 
/SAFESEH:NO /BASE:0 /DRIVER /DEBUG
 
+#
+# ARM definitions
+#
+*_VS2017_ARM_CC_PATH  = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_VFRPP_PATH   = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_SLINK_PATH   = DEF(VS2017_BIN_ARM)\lib.exe
+*_VS2017_ARM_DLINK_PATH   = DEF(VS2017_BIN_ARM)\link.exe
+*_VS2017_ARM_APP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_PP_PATH  = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASM_PATH = DEF(VS2017_BIN_ARM)\armasm.exe
+*_VS2017_ARM_ASLCC_PATH   = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASLPP_PATH   = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASLDLINK_PATH= DEF(VS2017_BIN_ARM)\link.exe
+
+  *_VS2017_ARM_MAKE_FLAGS = /nologo
+  DEBUG_VS2017_ARM_CC_FLAGS   = /nologo /c /WX /GS- /W4 /Gs32768 /D 
UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Gw /Oi- 
/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
+RELEASE_VS2017_ARM_CC_FLAGS   = /nologo /c /WX /GS- /W4 /Gs32768 /D 
UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi- 
/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
+NOOPT_VS2017_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D 
UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Od /Oi- 
/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
+
+  DEBUG_VS2017_ARM_ASM_FLAGS  = /nologo /g
+RELEASE_VS2017_ARM_ASM_FLAGS  = /nologo
+NOOPT_VS2017_ARM_ASM_FLAGS= /nologo
+
+  DEBUG_VS2017_ARM_DLINK_FLAGS= /NOLOGO /NODEFAULTLIB /IGNORE:4001 
/OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM 
/LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER 
/SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2017_ARM_DLINK_FLAGS= /NOLOGO /NODEFAULTLIB /IGNORE:4001 

[edk2] [PATCH 4/6] ArmPkg/Library/CompilerIntrinsicsLib: Enable VS2017/ARM builds

2017-12-04 Thread Pete Batard
Introduce CRT assembly replacements for __rt_sdiv, __rt_udiv,
__rt_udiv64, __rt_sdiv64, __rt_srsh, memcpy and memset.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm | 255 

 ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtsrsh.asm|  45 
 ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf |  13 +-
 ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c   |  34 +++
 ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c   |  33 +++
 5 files changed, 378 insertions(+), 2 deletions(-)

diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm 
b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm
new file mode 100644
index ..096dc6317318
--- /dev/null
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm
@@ -0,0 +1,255 @@
+///** @file
+//
+//  This code provides replacement for MSVC CRT division functions
+//
+//  Copyright (c) 2017, Pete Batard. All rights reserved.
+//  Based on generated assembly of ReactOS' sdk/lib/crt/math/arm/__rt_###div.c,
+//  Copyright (c) Timo Kreuzer. 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.
+//
+//**/
+
+  EXPORT _fltused
+  EXPORT __brkdiv0
+
+  EXPORT __rt_sdiv
+  EXPORT __rt_udiv
+  EXPORT __rt_udiv64
+  EXPORT __rt_sdiv64
+
+  AREA  Math, CODE, READONLY
+
+_fltused
+dcd 0x9875
+
+__brkdiv0
+udf #249
+
+//
+// uint64_t __rt_udiv(uint32_t divisor, uint32_t dividend)
+//
+
+__rt_udiv
+  cmp r0, #0
+  beq __brkdiv0
+  push{r3-r5,lr}
+  mov r5,r0
+  mov r4,r1
+  cmp r5,r4
+  it  hi
+  movhi   r0,#0
+  bhi __rt_udiv_label3
+  clz r2,r5
+  clz r3,r4
+  subsr3,r2,r3
+  movsr1,#1
+  lsl r2,r5,r3
+  lsl r3,r1,r3
+  movsr0,#0
+__rt_udiv_label1
+  cmp r4,r2
+  bcc __rt_udiv_label2
+  orrsr0,r0,r3
+  subsr4,r4,r2
+__rt_udiv_label2
+  lsrsr2,r2,#1
+  lsrsr3,r3,#1
+  bne __rt_udiv_label1
+__rt_udiv_label3
+  mov r1,r4
+  pop {r3-r5,pc}
+
+//
+// uint64_t __rt_sdiv(int32_t divisor, int32_t dividend)
+//
+
+__rt_sdiv
+  cmp r0, #0
+  beq __brkdiv0
+  push{r4-r6,lr}
+  mov r4,r1
+  andsr6,r0,#0x8000
+  it  ne
+  rsbne   r4,r4,#0
+  mov r5,r0
+  rsbsr5,r5,#0
+  cmp r5,r4
+  it  hi
+  movhi   r0,#0
+  bhi __rt_sdiv_label3
+  clz r2,r5
+  clz r3,r4
+  subsr3,r2,r3
+  movsr1,#1
+  lsl r2,r5,r3
+  lsl r3,r1,r3
+  movsr0,#0
+__rt_sdiv_label1
+  cmp r4,r2
+  bcc __rt_sdiv_label2
+  orrsr0,r0,r3
+  subsr4,r4,r2
+__rt_sdiv_label2
+  lsrsr2,r2,#1
+  lsrsr3,r3,#1
+  bne __rt_sdiv_label1
+__rt_sdiv_label3
+  cbz r6,__rt_sdiv_label4
+  rsbsr4,r4,#0
+__rt_sdiv_label4
+  mov r1,r4
+  pop {r4-r6,pc}
+
+//
+// typedef struct {
+//   uint64_t quotient;
+//   uint64_t modulus;
+// } udiv64_result_t;
+//
+// void __rt_udiv64_internal(udiv64_result_t *result, uint64_t divisor, 
uint64_t dividend)
+//
+
+__rt_udiv64_internal
+  orrsr1,r2,r3
+  beq __brkdiv0
+  push{r4-r8,lr}
+  mov r7,r3
+  mov r6,r2
+  mov r4,r0
+  ldrdr0,r5,[sp,#0x18]
+  cmp r7,r5
+  bcc __rt_udiv64_internal_label2
+  bhi __rt_udiv64_internal_label1
+  cmp r6,r0
+  bls __rt_udiv64_internal_label2
+__rt_udiv64_internal_label1
+  movsr3,#0
+  strdr3,r3,[r4]
+  b   __rt_udiv64_internal_label8
+__rt_udiv64_internal_label2
+  clz r2,r7
+  cmp r2,#0x20
+  bne __rt_udiv64_internal_label3
+  clz r3,r6
+  add r2,r2,r3
+__rt_udiv64_internal_label3
+  clz r1,r5 ;
+  cmp r1,#0x20
+  bne __rt_udiv64_internal_label4
+  clz r3,r0
+  add r1,r1,r3
+__rt_udiv64_internal_label4
+  subsr1,r2,r1
+  rsb r3,r1,#0x20
+  lsr r3,r6,r3
+  lsl r2,r7,r1
+  orrsr2,r2,r3
+  sub r3,r1,#0x20
+  lsl r3,r6,r3
+  orrsr2,r2,r3
+  lsl r7,r6,r1
+  sub r3,r1,#0x20
+  movsr6,#1
+  lslsr6,r6,r3
+  movsr3,#1
+  mov lr,#0
+  lsl r1,r3,r1
+  mov r8,lr
+__rt_udiv64_internal_label5
+  cmp r5,r2
+  bcc 

[edk2] [PATCH 3/6] MdePkg/Library/BaseLib: Enable VS2017/ARM builds

2017-12-04 Thread Pete Batard
Most of the RVCT assembly can be reused as is for MSFT except
for CpuBreakpoint.asm, which we need to force to Arm mode.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm |  5 -
 MdePkg/Library/BaseLib/BaseLib.inf   | 19 ---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm 
b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm
index 8a8065159bf2..2e508d6f1ad8 100644
--- a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm
+++ b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm
@@ -16,7 +16,10 @@
 
 EXPORT CpuBreakpoint
 
-  AREA Cpu_Breakpoint, CODE, READONLY
+; Force ARM mode for this section, as MSFT assembler defaults to THUMB
+  AREA Cpu_Breakpoint, CODE, READONLY, ARM
+
+ARM
 
 ;/**
 ;  Generates a breakpoint on the CPU.
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.inf
index 320ac457ea3d..4337a125d516 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -821,8 +821,9 @@ [Sources.EBC]
 [Sources.ARM]
   Arm/InternalSwitchStack.c
   Arm/Unaligned.c
-  Math64.c   | RVCT 
-
+  Math64.c   | RVCT
+  Math64.c   | MSFT
+
   Arm/SwitchStack.asm| RVCT
   Arm/SetJumpLongJump.asm| RVCT
   Arm/DisableInterrupts.asm  | RVCT
@@ -831,7 +832,16 @@ [Sources.ARM]
   Arm/CpuPause.asm   | RVCT
   Arm/CpuBreakpoint.asm  | RVCT
   Arm/MemoryFence.asm| RVCT
- 
+
+  Arm/SwitchStack.asm| MSFT
+  Arm/SetJumpLongJump.asm| MSFT
+  Arm/DisableInterrupts.asm  | MSFT
+  Arm/EnableInterrupts.asm   | MSFT
+  Arm/GetInterruptsState.asm | MSFT
+  Arm/CpuPause.asm   | MSFT
+  Arm/CpuBreakpoint.asm  | MSFT
+  Arm/MemoryFence.asm| MSFT
+
   Arm/Math64.S  | GCC
   Arm/SwitchStack.S | GCC
   Arm/EnableInterrupts.S| GCC
@@ -870,3 +880,6 @@ [Pcd]
 
 [FeaturePcd]
   gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList  ## CONSUMES
+
+[BuildOptions]
+  MSFT:*_*_ARM_CC_FLAGS = /GL-
-- 
2.9.3.windows.2

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


[edk2] [PATCH 1/6] MdePkg: Disable some Level 4 warnings for VS2017/ARM

2017-12-04 Thread Pete Batard
Warnings 4018, 4100, 4101, 4127, 4214, 4244, 4456, 4701 and 4703 are
disabled as they were found to occur more than 5 times during QEMU
firmware compilation.

Also create a dummy macro for PRESERVE8, as this is not supported by
the Microsoft ARM assembler.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 MdePkg/Include/Arm/ProcessorBind.h | 96 +++-
 1 file changed, 75 insertions(+), 21 deletions(-)

diff --git a/MdePkg/Include/Arm/ProcessorBind.h 
b/MdePkg/Include/Arm/ProcessorBind.h
index dde1fd1152ba..00de80bafe0a 100644
--- a/MdePkg/Include/Arm/ProcessorBind.h
+++ b/MdePkg/Include/Arm/ProcessorBind.h
@@ -1,15 +1,15 @@
 /** @file
   Processor or Compiler specific defines and types for ARM.
 
-  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
   Portions copyright (c) 2008 - 2009, Apple Inc. 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   
 
+  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. 
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
@@ -28,14 +28,63 @@
 #pragma pack()
 #endif
 
+#if defined(_MSC_EXTENSIONS)
+
 //
-// RVCT does not support the __builtin_unreachable() macro
+// Disable 'signed/unsigned mismatch' warnings.
 //
-#ifdef __ARMCC_VERSION
+#pragma warning ( disable : 4018 )
+
+//
+// Disable 'unreferenced formal parameter' warnings.
+//
+#pragma warning ( disable : 4100 )
+
+//
+// Disable 'unreferenced local variable' warnings.
+//
+#pragma warning ( disable : 4101 )
+
+//
+// Suppress warnings for ASSERT(FALSE) or while(TRUE).
+//
+#pragma warning ( disable : 4127 )
+
+//
+// Disable bitfield type check warnings.
+//
+#pragma warning ( disable : 4214 )
+
+//
+// Disable 'conversion from X to Y, possible loss of data' warnings
+//
+#pragma warning ( disable : 4244 )
+
+//
+// Disable 'declaration of X hides previous local declaration' warnings
+//
+#pragma warning ( disable : 4456 )
+
+//
+// Disable 'potentially uninitialized local variable X used' warnings
+//
+#pragma warning ( disable : 4701 )
+
+//
+// Disable 'potentially uninitialized local pointer variable X used' warnings
+//
+#pragma warning ( disable : 4703 )
+
+#endif
+
+//
+// RVCT and MSFT don't support the __builtin_unreachable() macro
+//
+#if defined(__ARMCC_VERSION) || defined(_MSC_EXTENSIONS)
 #define UNREACHABLE()
 #endif
 
-#if _MSC_EXTENSIONS 
+#if defined(_MSC_EXTENSIONS)
   //
   // use Microsoft* C compiler dependent integer width types
   //
@@ -52,7 +101,7 @@
   typedef signed char INT8;
 #else
   //
-  // Assume standard ARM alignment. 
+  // Assume standard ARM alignment.
   // Need to check portability of long long
   //
   typedef unsigned long long  UINT64;
@@ -121,7 +170,7 @@ typedef INT32   INTN;
 // use the correct C calling convention. All protocol member functions and
 // EFI intrinsics are required to modify their member functions with EFIAPI.
 //
-#define EFIAPI
+#define EFIAPI
 
 // When compiling with Clang, we still use GNU as for the assembler, so we 
still
 // need to define the GCC_ASM* macros.
@@ -142,34 +191,39 @@ typedef INT32   INTN;
 
 #define GCC_ASM_EXPORT(func__)  \
  .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__);\
- .type ASM_PFX(func__), %function  
+ .type ASM_PFX(func__), %function
 
 #define GCC_ASM_IMPORT(func__)  \
  .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
- 
+
   #else
 //
-// .type not supported by Apple Xcode tools 
+// .type not supported by Apple Xcode tools
 //
-#define INTERWORK_FUNC(func__)  
+#define INTERWORK_FUNC(func__)
 
 #define GCC_ASM_EXPORT(func__)  \
  .globl  _CONCATENATE (__USER_LABEL_PREFIX__, func__)\
-  
-#define GCC_ASM_IMPORT(name)  
+
+#define GCC_ASM_IMPORT(name)
 
   #endif
+#elif defined(_MSC_EXTENSIONS)
+  //
+  // PRESERVE8 is not supported by the MSFT assembler.
+  //
+  #define PRESERVE8
 #endif
 
 /**
   Return the pointer to the first instruction of a function given a function 
pointer.
-  On ARM 

[edk2] [PATCH 5/6] MdePkg/Include: Add VA list support for VS2017/ARM

2017-12-04 Thread Pete Batard
VA_START, VA_END and VA_COPY are the same as the generic macros.
VA_ARG was reverse engineered from MS ARM assembly output.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 MdePkg/Include/Base.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index 02140a5ac2ee..f3467ecdc22f 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -631,6 +631,19 @@ struct _LIST_ENTRY {
 
 #define VA_COPY(Dest, Start)  __va_copy (Dest, Start)
 
+#elif defined(_M_ARM)
+//
+// MSFT ARM variable argument list support.
+// Same as the generic macros below, except for VA_ARG that needs extra 
adjustment.
+//
+
+typedef char* VA_LIST;
+
+#define VA_START(Marker, Parameter) (Marker = (VA_LIST) ((UINTN) & 
(Parameter) + _INT_SIZE_OF(Parameter)))
+#define VA_ARG(Marker, TYPE)(*(TYPE *) ((Marker += 
_INT_SIZE_OF(TYPE) + ((-(INTN)Marker) & (sizeof(TYPE) - 1))) - _INT_SIZE_OF 
(TYPE)))
+#define VA_END(Marker)  (Marker = (VA_LIST) 0)
+#define VA_COPY(Dest, Start)((void)((Dest) = (Start)))
+
 #elif defined(__GNUC__)
 
 #if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)
-- 
2.9.3.windows.2

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


  1   2   >