[edk2] [PATCH V2 2/2] SecurityPkg: SecureBootConfigDxe: SecureBoot UI for Customized SecureBoot Mode Add SecureBoot UI support for Customized SecureBoot Mode transition according to Mantis 1263. User

2015-12-02 Thread Zhang, Chao B
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang, Chao 
---
 .../SecureBootConfigDxe/SecureBootConfig.vfr   |  77 +++-
 .../SecureBootConfigDxe/SecureBootConfigImpl.c | 432 ++---
 .../SecureBootConfigDxe/SecureBootConfigNvData.h   |  11 +-
 .../SecureBootConfigStrings.uni| Bin 13086 -> 14876 bytes
 4 files changed, 464 insertions(+), 56 deletions(-)

diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
index 3c99431..1eb3599 100644
--- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
+++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
@@ -1,7 +1,7 @@
 /** @file
   VFR file used by the SecureBoot configuration component.
 
-Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2015, 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
@@ -33,6 +33,14 @@ formset
 
 subtitle text = STRING_TOKEN(STR_NULL);
 
+//
+// Display current secure boot mode(one of 
SetupMode/AuditMode/UserMode/DeployedMode)
+//
+text
+  help   = STRING_TOKEN(STR_CUR_SECURE_BOOT_MODE_HELP),
+  text   = STRING_TOKEN(STR_CUR_SECURE_BOOT_MODE_PROMPT),
+text   = STRING_TOKEN(STR_CUR_SECURE_BOOT_MODE_CONTENT);
+
 text
   help   = STRING_TOKEN(STR_SECURE_BOOT_STATE_HELP),
   text   = STRING_TOKEN(STR_SECURE_BOOT_STATE_PROMPT),
@@ -84,18 +92,18 @@ formset
   endoneof;
 
 //
-//
-// Display of 'Current Secure Boot Mode'
+// Display PK include page
 //
 suppressif questionref(SecureBootMode) == SECURE_BOOT_MODE_STANDARD;
-  grayoutif NOT ideqval SECUREBOOT_CONFIGURATION.PhysicalPresent == 1;
-  goto FORMID_SECURE_BOOT_OPTION_FORM,
-   prompt = STRING_TOKEN(STR_SECURE_BOOT_OPTION),
-   help   = STRING_TOKEN(STR_SECURE_BOOT_OPTION_HELP),
-   flags  = INTERACTIVE,
-   key= KEY_SECURE_BOOT_OPTION;
-  endif;
+grayoutif NOT ideqval SECUREBOOT_CONFIGURATION.PhysicalPresent == 1;
+goto FORMID_SECURE_BOOT_OPTION_FORM,
+ prompt = STRING_TOKEN(STR_SECURE_BOOT_OPTION),
+ help   = STRING_TOKEN(STR_SECURE_BOOT_OPTION_HELP),
+ flags  = INTERACTIVE,
+ key= KEY_SECURE_BOOT_OPTION;
+endif;
 endif;
+
   endform;
 
   //
@@ -106,6 +114,55 @@ formset
 
 subtitle text = STRING_TOKEN(STR_NULL);
 
+//
+// Display of SetupMode/UserMode/AuditMode/DeployedMode transition
+//
+disableif TRUE;
+  oneof varid  = SECUREBOOT_CONFIGURATION.TransSecureBootMode,
+prompt = STRING_TOKEN(STR_TRANS_SECURE_BOOT_MODE_PROMPT),
+help   = STRING_TOKEN(STR_TRANS_SECURE_BOOT_MODE_HELP),
+flags  = INTERACTIVE,
+  suppressif ideqval SECUREBOOT_CONFIGURATION.CurSecureBootMode == 
SECURE_BOOT_MODE_AUDIT_MODE
+  OR (ideqval SECUREBOOT_CONFIGURATION.CurSecureBootMode == 
SECURE_BOOT_MODE_DEPLOYED_MODE AND
+  ideqval SECUREBOOT_CONFIGURATION.PhysicalPresent == 0);
+option text = STRING_TOKEN(STR_USER_MODE), value = 
SECURE_BOOT_MODE_USER_MODE,   flags = 0;
+  endif
+  suppressif ideqval SECUREBOOT_CONFIGURATION.CurSecureBootMode == 
SECURE_BOOT_MODE_AUDIT_MODE;
+option text = STRING_TOKEN(STR_SETUP_MODE),value = 
SECURE_BOOT_MODE_SETUP_MODE,  flags = 0;
+  endif
+  suppressif ideqval SECUREBOOT_CONFIGURATION.CurSecureBootMode == 
SECURE_BOOT_MODE_DEPLOYED_MODE;
+option text = STRING_TOKEN(STR_AUDIT_MODE),value = 
SECURE_BOOT_MODE_AUDIT_MODE,  flags = 0;
+  endif
+  suppressif ideqval SECUREBOOT_CONFIGURATION.CurSecureBootMode == 
SECURE_BOOT_MODE_SETUP_MODE;
+option text = STRING_TOKEN(STR_DEPLOYED_MODE), value = 
SECURE_BOOT_MODE_DEPLOYED_MODE,  flags = 0;
+  endif
+option text = STRING_TOKEN(STR_DEPLOYED_MODE), value = 4,  flags = 
0;
+  endoneof;
+endif;
+  oneof name   = TransSecureBootMode,
+questionid = KEY_TRANS_SECURE_BOOT_MODE,
+prompt = STRING_TOKEN(STR_TRANS_SECURE_BOOT_MODE_PROMPT),
+help   = STRING_TOKEN(STR_TRANS_SECURE_BOOT_MODE_HELP),
+flags  = INTERACTIVE | NUMERIC_SIZE_1,
+  suppressif ideqval SECUREBOOT_CONFIGURATION.CurSecureBootMode == 
SECURE_BOOT_MODE_AUDIT_MODE 
+  OR (ideqval SECUREBOOT_CONFIGURATION.CurSecureBootMode == 
SECURE_BOOT_MODE_DEPLOYED_MODE AND
+  ideqval SECUREBOOT_CONFIGURATION.PhysicalPresent == 0);
+option text = STRING_TOKEN(STR_USER_MODE), value = 
SECURE_BOOT_MODE_USER_MODE,   flags = 0;
+  endif
+  suppressif

[edk2] [PATCH V2 1/2] SecurityPkg: AuthVariableLib: Customized SecureBoot Mode transition. Implement Customized SecureBoot Mode transition logic according to Mantis 1263, including AuditMode/DeployedM

2015-12-02 Thread Zhang, Chao B
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang, Chao 
---
 SecurityPkg/Library/AuthVariableLib/AuthService.c  | 1404 +---
 .../Library/AuthVariableLib/AuthServiceInternal.h  |   73 +
 .../Library/AuthVariableLib/AuthVariableLib.c  |  110 +-
 .../Library/AuthVariableLib/AuthVariableLib.inf|4 +
 .../DxeImageVerificationLib.c  |  670 +-
 5 files changed, 1935 insertions(+), 326 deletions(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c 
b/SecurityPkg/Library/AuthVariableLib/AuthService.c
index 1f9ba15..86ea04b 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
@@ -56,6 +56,56 @@ EFI_SIGNATURE_ITEM mSupportSigItem[] = {
   {EFI_CERT_X509_SHA512_GUID, 0,   80   }
 };
 
+//
+// Secure Boot Mode state machine
+//
+SECURE_BOOT_MODE mSecureBootState[SecureBootModeTypeMax] = {
+  // USER MODE
+  {
+  TRUE,  // IsPkExist
+  AUDIT_MODE_DISABLE,// AuditMode
+  FALSE, // IsAuditModeRO, AuditMode 
is RW
+  DEPLOYED_MODE_DISABLE, // DeployedMode
+  FALSE, // IsDeployedModeRO, 
DeployedMode is RW
+  SETUP_MODE_DISABLE,// SetupMode
+ // SetupMode is always RO
+  SECURE_BOOT_MODE_ENABLE// SecureBoot
+  },
+  // SETUP MODE
+  {
+  FALSE, // IsPkExist
+  AUDIT_MODE_DISABLE,// AuditMode
+  FALSE, // IsAuditModeRO, AuditMode 
is RW
+  DEPLOYED_MODE_DISABLE, // DeployedMode
+  TRUE,  // IsDeployedModeRO, 
DeployedMode is RO
+  SETUP_MODE_ENABLE, // SetupMode
+ // SetupMode is always RO
+  SECURE_BOOT_MODE_DISABLE   // SecureBoot
+  },
+  // AUDIT MODE
+  {
+  FALSE, // IsPkExist
+  AUDIT_MODE_ENABLE, // AuditMode
+  TRUE,  // AuditModeValAttr RO, 
AuditMode is RO
+  DEPLOYED_MODE_DISABLE, // DeployedMode
+  TRUE,  // DeployedModeValAttr RO, 
DeployedMode is RO
+  SETUP_MODE_ENABLE, // SetupMode
+ // SetupMode is always RO
+  SECURE_BOOT_MODE_DISABLE   // SecureBoot
+  },
+  // DEPLOYED MODE
+  {
+  TRUE,  // IsPkExist
+  AUDIT_MODE_DISABLE,// AuditMode, AuditMode is RO
+  TRUE,  // AuditModeValAttr RO
+  DEPLOYED_MODE_ENABLE,  // DeployedMode
+  TRUE,  // DeployedModeValAttr RO, 
DeployedMode is RO
+  SETUP_MODE_DISABLE,// SetupMode
+ // SetupMode is always RO
+  SECURE_BOOT_MODE_ENABLE// SecureBoot
+  }
+};
+
 /**
   Finds variable in storage blocks of volatile and non-volatile storage areas.
 
@@ -173,80 +223,988 @@ AuthServiceInternalUpdateVariableWithMonotonicCount (
   AuthVariableInfo.PubKeyIndex = KeyIndex;
   AuthVariableInfo.MonotonicCount = MonotonicCount;
 
-  return mAuthVarLibContextIn->UpdateVariable (
-   &AuthVariableInfo
-   );
+  return mAuthVarLibContextIn->UpdateVariable (
+   &AuthVariableInfo
+   );
+}
+
+/**
+  Update the variable region with Variable information.
+
+  @param[in] VariableName   Name of variable.
+  @param[in] VendorGuid Guid of variable.
+  @param[in] Data   Data pointer.
+  @param[in] DataSize   Size of Data.
+  @param[in] Attributes Attribute value of the variable.
+  @param[in] TimeStamp  Value of associated TimeStamp.
+
+  @retval EFI_SUCCESS   The update operation is success.
+  @retval EFI_INVALID_PARAMETER Invalid parameter.
+  @retval EFI_WRITE_PROTECTED   Variable is write-protected.
+  @retval EFI_OUT_OF_RESOURCES  There is not enough resource.
+
+**/
+EFI_STATUS
+AuthServiceInternalUpdateVariableWithTimeStamp (
+  IN CHAR16 *VariableName,
+  IN EFI_GUID   *VendorGuid,
+  IN VOID   *Data,
+  IN UINTN  DataSize,
+  IN UINT32 Attributes,
+  IN EFI_TIME   *TimeStamp
+  )
+{
+  EFI_STATUSFindStatus;
+  VOID  *OrgData;
+  UINTN OrgDataSize;
+  AUTH_VARIABLE_INFOAuthVariableInfo;
+
+  FindStatus = Au

[edk2] [PATCH V2 0/2] Customized Secure Boot implmentation

2015-12-02 Thread Zhang, Chao B
  Implement Customized Secure Boot feature accordingt to Mantis 1263. Patch 
includes 
Customized Secure Boot Mode transition, Secure Boot UI update and 
ImageVerificationLib
logic update in AuditMode. 

 https://mantis.uefi.org/mantis/view.php?id=1263
 

Zhang, Chao B (2):
  SecurityPkg: AuthVariableLib: Customized SecureBoot Mode transition.  
Implement Customized SecureBoot Mode transition logic according
to Mantis 1263, including AuditMode/DeployedMode/PK update
management.   Also implement image verification logic in
AuditMode. Image Certificate & Hash are recorded to EFI Image
Execution Table.  
https://mantis.uefi.org/mantis/view.php?id=1263
  SecurityPkg: SecureBootConfigDxe: SecureBoot UI for Customized
SecureBoot Mode   Add SecureBoot UI support for Customized
SecureBoot Mode transition according to Mantis 1263. User can do
secure boot mode transition through UI.  
https://mantis.uefi.org/mantis/view.php?id=1263

 SecurityPkg/Library/AuthVariableLib/AuthService.c  | 1404 +---
 .../Library/AuthVariableLib/AuthServiceInternal.h  |   73 +
 .../Library/AuthVariableLib/AuthVariableLib.c  |  110 +-
 .../Library/AuthVariableLib/AuthVariableLib.inf|4 +
 .../DxeImageVerificationLib.c  |  670 +-
 .../SecureBootConfigDxe/SecureBootConfig.vfr   |   77 +-
 .../SecureBootConfigDxe/SecureBootConfigImpl.c |  432 +-
 .../SecureBootConfigDxe/SecureBootConfigNvData.h   |   11 +-
 .../SecureBootConfigStrings.uni|  Bin 13086 -> 14876 bytes
 9 files changed, 2399 insertions(+), 382 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 v2 2/4] MdeModulePkg ScsiDiskDxe: Add BlockIO2 Support

2015-12-02 Thread Hao Wu
Together with EFI_BLOCK_IO_PROTOCOL, EFI_BLOCK_IO2_PROTOCOL is installed
as well in ScsiDiskDxe.

Block I/O 2 functions are implemented:
Reset
ReadBlocksEx
WriteBlocksEx
FlushBlocksEx

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c |4 +-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c  | 1403 -
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h  |  322 -
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf |6 +-
 4 files changed, 1717 insertions(+), 18 deletions(-)

diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c 
b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c
index 1790825..08b71d0 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Component Name(2) protocol implementation for SCSI disk driver.
 
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2015, 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
@@ -211,7 +211,7 @@ ScsiDiskComponentNameGetControllerName (
 return Status;
   }
 
-  ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (BlockIo);
+  ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO (BlockIo);
 
   return LookupUnicodeString2 (
Language,
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c 
b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index 282e9c2..4659454 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -239,6 +239,11 @@ ScsiDiskDriverBindingStart (
   ScsiDiskDevice->BlkIo.ReadBlocks = ScsiDiskReadBlocks;
   ScsiDiskDevice->BlkIo.WriteBlocks= ScsiDiskWriteBlocks;
   ScsiDiskDevice->BlkIo.FlushBlocks= ScsiDiskFlushBlocks;
+  ScsiDiskDevice->BlkIo2.Media = &ScsiDiskDevice->BlkIoMedia;
+  ScsiDiskDevice->BlkIo2.Reset = ScsiDiskResetEx;
+  ScsiDiskDevice->BlkIo2.ReadBlocksEx  = ScsiDiskReadBlocksEx;
+  ScsiDiskDevice->BlkIo2.WriteBlocksEx = ScsiDiskWriteBlocksEx;
+  ScsiDiskDevice->BlkIo2.FlushBlocksEx = ScsiDiskFlushBlocksEx;
   ScsiDiskDevice->Handle   = Controller;
 
   ScsiIo->GetDeviceType (ScsiIo, &(ScsiDiskDevice->DeviceType));
@@ -300,7 +305,8 @@ ScsiDiskDriverBindingStart (
   Status = ScsiDiskDetectMedia (ScsiDiskDevice, MustReadCapacity, &Temp);
   if (!EFI_ERROR (Status)) {
 //
-// Determine if Block IO should be produced on this controller handle
+// Determine if Block IO & Block IO2 should be produced on this controller
+// handle
 //
 if (DetermineInstallBlockIo(Controller)) {
   InitializeInstallDiskInfo(ScsiDiskDevice, Controller);
@@ -308,6 +314,8 @@ ScsiDiskDriverBindingStart (
   &Controller,
   &gEfiBlockIoProtocolGuid,
   &ScsiDiskDevice->BlkIo,
+  &gEfiBlockIo2ProtocolGuid,
+  &ScsiDiskDevice->BlkIo2,
   &gEfiDiskInfoProtocolGuid,
   &ScsiDiskDevice->DiskInfo,
   NULL
@@ -390,11 +398,13 @@ ScsiDiskDriverBindingStop (
 return Status;
   }
 
-  ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (BlkIo);
+  ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO (BlkIo);
   Status = gBS->UninstallMultipleProtocolInterfaces (
   Controller,
   &gEfiBlockIoProtocolGuid,
   &ScsiDiskDevice->BlkIo,
+  &gEfiBlockIo2ProtocolGuid,
+  &ScsiDiskDevice->BlkIo2,
   &gEfiDiskInfoProtocolGuid,
   &ScsiDiskDevice->DiskInfo,
   NULL
@@ -443,7 +453,7 @@ ScsiDiskReset (
 
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
 
-  ScsiDiskDevice  = SCSI_DISK_DEV_FROM_THIS (This);
+  ScsiDiskDevice  = SCSI_DISK_DEV_FROM_BLKIO (This);
 
   Status  = ScsiDiskDevice->ScsiIo->ResetDevice 
(ScsiDiskDevice->ScsiIo);
 
@@ -505,7 +515,7 @@ ScsiDiskReadBlocks (
 
   MediaChange= FALSE;
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-  ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This);
+  ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO (This);
 
   if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {
 
@@ -522,6 +532,12 @@ ScsiDiskReadBlocks (
 &ScsiDiskDevice->BlkIo,
 &ScsiDiskDevice->BlkIo
 );
+  gBS->ReinstallProtocolInterface (
+ ScsiDiskDevice->Handle,
+ &gEfiBlockIo2ProtocolGuid,
+ &ScsiDiskDevice->BlkIo2,
+ &ScsiDiskDevice->BlkIo2
+ );
   Status = EFI_MEDIA_CHANGED;
   goto Done;
 }
@@ -623,7 +639,7 @@ ScsiDiskWriteBlocks (
 
   MediaChange= FALSE;
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-  ScsiDiskDevice = SCSI_DI

[edk2] [PATCH v2 4/4] MdeModulePkg ScsiBusDxe: Fix caller event may nerver be signaled

2015-12-02 Thread Hao Wu
For function ScsiExecuteSCSICommand(), when the 'Event' parameter is not
NULL but the target SCSI device does not support non-blocking I/O, it will
execute a blocking I/O operation instead.

However, after the SCSI operation is done, the 'Event' is not signaled to
inform the caller.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c | 44 --
 1 file changed, 36 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c 
b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
index 3e49ffb..c443c1c 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
@@ -986,13 +986,34 @@ ScsiExecuteSCSICommand (
 
   if (ScsiIoDevice->ExtScsiSupport) {
 ExtRequestPacket = (EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *) Packet;
-Status = ScsiIoDevice->ExtScsiPassThru->PassThru (
-  ScsiIoDevice->ExtScsiPassThru,
-  Target,
-  ScsiIoDevice->Lun,
-  ExtRequestPacket,
-  Event
-  );
+
+if (((ScsiIoDevice->ExtScsiPassThru->Mode->Attributes & 
EFI_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO) != 0) && (Event !=  NULL)) {
+  Status = ScsiIoDevice->ExtScsiPassThru->PassThru (
+ScsiIoDevice->ExtScsiPassThru,
+Target,
+ScsiIoDevice->Lun,
+ExtRequestPacket,
+Event
+);
+} else {
+  //
+  // If there's no event or the SCSI Device doesn't support NON-BLOCKING,
+  // let the 'Event' parameter for PassThru() be NULL.
+  //
+  Status = ScsiIoDevice->ExtScsiPassThru->PassThru (
+ScsiIoDevice->ExtScsiPassThru,
+Target,
+ScsiIoDevice->Lun,
+ExtRequestPacket,
+NULL
+);
+  if (Event != NULL) {
+//
+// Signal Event to tell caller to pick up the SCSI IO Packet.
+//
+gBS->SignalEvent (Event);
+  }
+}
   } else {
 
 mWorkingBuffer = AllocatePool 
(sizeof(EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET));
@@ -1052,7 +1073,7 @@ ScsiExecuteSCSICommand (
   ScsiIoDevice->Pun.ScsiId.Scsi,
   ScsiIoDevice->Lun,
   mWorkingBuffer,
-  Event
+  NULL
   );
   if (EFI_ERROR(Status)) {
 FreePool(mWorkingBuffer);
@@ -1065,6 +1086,13 @@ ScsiExecuteSCSICommand (
   // free mWorkingBuffer.
   //
   FreePool(mWorkingBuffer);
+
+  //
+  // Signal Event to tell caller to pick up the SCSI IO Packet.
+  //
+  if (Event != NULL) {
+gBS->SignalEvent (Event);
+  }
 }
   }
   return Status;
-- 
1.9.5.msysgit.0

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


[edk2] [PATCH v2 3/4] MdeModulePkg UfsPassThruDxe: Add Non-blocking I/O Support

2015-12-02 Thread Hao Wu
Previously, UfsPassThruPassThru function does not handle the 'Event'
parameter and blocking read/write operations are always executed.

This commit enables non-blocking read/write feature for UFS devices.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |  49 +++-
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  |  58 -
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c| 288 ++---
 3 files changed, 355 insertions(+), 40 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c 
b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index 306fd37..e6b480d 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2015, 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
@@ -21,10 +21,7 @@ UFS_PASS_THRU_PRIVATE_DATA gUfsPassThruTemplate = {
   NULL,   // Handle  
   {   // ExtScsiPassThruMode
 0x,
-//
-// Note that the driver doesn't support ExtScsiPassThru non blocking I/O.
-//
-EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL | 
EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL,
+EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL | 
EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL | 
EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO,
 sizeof (UINTN)
   },
   {   // ExtScsiPassThru
@@ -64,6 +61,11 @@ UFS_PASS_THRU_PRIVATE_DATA gUfsPassThruTemplate = {
 },
 0x,   // By default don't expose any Luns.
 0x0
+  },
+  NULL,   // TimerEvent
+  {   // Queue
+NULL,
+NULL
   }
 };
 
@@ -212,7 +214,7 @@ UfsPassThruPassThru (
 return EFI_INVALID_PARAMETER;
   }
 
-  Status = UfsExecScsiCmds (Private, UfsLun, Packet);
+  Status = UfsExecScsiCmds (Private, UfsLun, Packet, Event);
 
   return Status;
 }
@@ -816,6 +818,7 @@ UfsPassThruDriverBindingStart (
   //
   Private = AllocateCopyPool (sizeof (UFS_PASS_THRU_PRIVATE_DATA), 
&gUfsPassThruTemplate);
   if (Private == NULL) {
+DEBUG ((EFI_D_ERROR, "Unable to allocate Ufs Pass Thru private data\n"));
 Status = EFI_OUT_OF_RESOURCES;
 goto Error;
   }
@@ -823,6 +826,7 @@ UfsPassThruDriverBindingStart (
   Private->ExtScsiPassThru.Mode = &Private->ExtScsiPassThruMode;
   Private->UfsHostController= UfsHc;
   Private->UfsHcBase= UfsHcBase;
+  InitializeListHead (&Private->Queue);
 
   //
   // Initialize UFS Host Controller H/W.
@@ -873,6 +877,31 @@ UfsPassThruDriverBindingStart (
 }
   }
 
+  //
+  // Start the asynchronous interrupt monitor
+  //
+  Status = gBS->CreateEvent (
+  EVT_TIMER | EVT_NOTIFY_SIGNAL,
+  TPL_CALLBACK,
+  ProcessAsyncTaskList,
+  Private,
+  &Private->TimerEvent
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "Ufs Create Async Tasks Event Error, Status = %r\n", 
Status));
+goto Error;
+  }
+
+  Status = gBS->SetTimer (
+  Private->TimerEvent,
+  TimerPeriodic,
+  UFS_HC_ASYNC_TIMER
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "Ufs Set Periodic Timer Error, Status = %r\n", 
Status));
+goto Error;
+  }
+
   Status = gBS->InstallProtocolInterface (
   &Controller,
   &gEfiExtScsiPassThruProtocolGuid,
@@ -899,6 +928,10 @@ Error:
   UfsHc->FreeBuffer (UfsHc, EFI_SIZE_TO_PAGES (Private->Nutrs * sizeof 
(UTP_TMRD)), Private->UtpTrlBase);
 }
 
+if (Private->TimerEvent != NULL) {
+  gBS->CloseEvent (Private->TimerEvent);
+}
+
 FreePool (Private);
   }
 
@@ -1002,6 +1035,10 @@ UfsPassThruDriverBindingStop (
 UfsHc->FreeBuffer (UfsHc, EFI_SIZE_TO_PAGES (Private->Nutrs * sizeof 
(UTP_TMRD)), Private->UtpTrlBase);
   }
 
+  if (Private->TimerEvent != NULL) {
+gBS->CloseEvent (Private->TimerEvent);
+  }
+
   FreePool (Private);
 
   //
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h 
b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index ce8066f..afcf7f6 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -50,6 +50,14 @@ typedef struct {
   UINT16   Rsvd:4;
 } UFS_EXPOSED_LUNS;
 
+//
+// Iterate through the doule linked list. This is delete-safe.
+// Do not touch NextEntry
+//
+#define EFI_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead)\
+  for(Entry = (ListHead)->ForwardLink, NextEntry = Entry

[edk2] [PATCH v2 0/4] Add BlockIO2 support for UFS

2015-12-02 Thread Hao Wu
Compared with v1, the following modifications have been made:
1. ScsiDiskDxe/ScsiDisk.c - In function ScsiDiskNotify(), fix typo passing
'Request->InBuffer' to ScsiDiskAsyncWrite10/16(). It should be
'Request->OutBuffer' instead.

2. UfsPassThruDxe/UfsPassThru.c - Close the timer event which polls the
result of asynchronous I/O in UfsPassThruDriverBindingStop().

Hao Wu (4):
  MdePkg UefiScsiLib: Add non-blocking support for SCSI Read/Write
command
  MdeModulePkg ScsiDiskDxe: Add BlockIO2 Support
  MdeModulePkg UfsPassThruDxe: Add Non-blocking I/O Support
  MdeModulePkg ScsiBusDxe: Fix caller event may nerver be signaled

 MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c |   44 +-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c  |4 +-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c   | 1403 +++-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h   |  322 -
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf  |6 +-
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |   49 +-
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  |   58 +-
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c|  288 +++-
 MdePkg/Include/Library/UefiScsiLib.h   |  360 +
 MdePkg/Library/UefiScsiLib/UefiScsiLib.c   |  776 +++
 MdePkg/Library/UefiScsiLib/UefiScsiLib.inf |4 +-
 11 files changed, 3247 insertions(+), 67 deletions(-)

-- 
1.9.5.msysgit.0

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


[edk2] [PATCH v2 1/4] MdePkg UefiScsiLib: Add non-blocking support for SCSI Read/Write command

2015-12-02 Thread Hao Wu
Four new functions are added to UefiScsiLib:
ScsiRead10CommandEx
ScsiWrite10CommandEx
ScsiRead16CommandEx
ScsiWrite16CommandEx

They support both blocking and non-blocking SCSI Read/Write operation
depending on the optional parameter 'Event' passed to those APIs.

When 'Event' is NULL, these four functions will call the non-EX version
couterparts to execute blocking SCSI I/O. When 'Event' is not NULL,
non-blocking I/O operation is executed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdePkg/Include/Library/UefiScsiLib.h   | 360 +
 MdePkg/Library/UefiScsiLib/UefiScsiLib.c   | 776 +
 MdePkg/Library/UefiScsiLib/UefiScsiLib.inf |   4 +-
 3 files changed, 1139 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Library/UefiScsiLib.h 
b/MdePkg/Include/Library/UefiScsiLib.h
index 26e4aa4..067acfd 100644
--- a/MdePkg/Include/Library/UefiScsiLib.h
+++ b/MdePkg/Include/Library/UefiScsiLib.h
@@ -818,4 +818,364 @@ ScsiWrite16Command (
   IN UINT32SectorSize
   );
 
+
+/**
+  Execute blocking/non-blocking Read(10) SCSI command on a specific SCSI
+  target.
+
+  Executes the SCSI Read(10) command on the SCSI target specified by ScsiIo.
+  When Event is NULL, blocking command will be executed. Otherwise non-blocking
+  command will be executed.
+  For blocking I/O, if Timeout is zero, this function will wait indefinitely
+  for the command to complete. If Timeout is greater than zero, then the
+  command is executed and will timeout after Timeout 100 ns units.
+  For non-blocking I/O, if Timeout is zero, Event will be signaled only after
+  the command to completes. If Timeout is greater than zero, Event will also be
+  signaled after Timeout 100 ns units.
+  The StartLba and SectorSize parameters are used to construct the CDB for this
+  SCSI command.
+
+  If ScsiIo is NULL, then ASSERT().
+  If SenseDataLength is NULL, then ASSERT().
+  If HostAdapterStatus is NULL, then ASSERT().
+  If TargetStatus is NULL, then ASSERT().
+  If DataLength is NULL, then ASSERT().
+
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet
+  buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise
+  EFI_INVALID_PARAMETER gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet
+  buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise
+  EFI_INVALID_PARAMETER gets returned.
+
+  @param[in]  ScsiIo   A pointer to SCSI IO protocol.
+  @param[in]  Timeout  The length of timeout period.
+  @param[in, out] SenseDataA pointer to output sense data.
+  @param[in, out] SenseDataLength  The length of output sense data.
+  @param[out] HostAdapterStatusThe status of Host Adapter.
+  @param[out] TargetStatus The status of the target.
+  @param[in, out] DataBuffer   Read 16 command data.
+  @param[in, out] DataLength   The length of data buffer.
+  @param[in]  StartLba The start address of LBA.
+  @param[in]  SectorSize   The number of contiguous logical blocks
+   of data that shall be transferred.
+  @param[in]  EventIf the SCSI target does not support
+   non-blocking I/O, then Event is ignored,
+   and blocking I/O is performed. If Event
+   is NULL, then blocking I/O is performed.
+   If Event is not NULL and non-blocking
+   I/O is supported, then non-blocking I/O
+   is performed, and Event will be signaled
+   when the SCSI Read(10) command
+   completes.
+
+  @retval  EFI_SUCCESS Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed,
+   but the entire DataBuffer could not be
+   transferred. The actual number of bytes
+   transferred is returned in DataLength.
+  @retval  EFI_NOT_READY   The SCSI Request Packet could not be
+   sent because there are too many SCSI
+   Command Packets already queued.
+  @retval  EFI_DEVICE_ERRORA device error occurred while attempting
+   to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED The command described by the SCSI
+   Request Packet is not supported by the
+   SCSI initiator(i.e., SCSI  Host
+   Controller)
+  @retval  EF

Re: [edk2] [PATCH 4/5] SecurityPkg: Enable Customized Secure Boot feature

2015-12-02 Thread Zhang, Chao B
Star & Qin:
  Thanks a lot for your comments. I agree with 1 - 8 & will provide updated 
patch.
For item 9, SecureBootEnble variable is not in Customized Secure Boot Mode 
transition scope. I prefer revisit it after this patch





Thanks & Best regards
Chao Zhang

-Original Message-
From: Zeng, Star 
Sent: Wednesday, December 02, 2015 11:54 AM
To: Zhang, Chao B; edk2-devel@lists.01.org
Cc: Zeng, Star; Long, Qin
Subject: Re: [edk2] [PATCH 4/5] SecurityPkg: Enable Customized Secure Boot 
feature

Hi Chao,

I have comments below to this patch about AuthVariableLib update.
1. Move SecureBootState to AuthService.c since it is only used by 
AuthService.c, and update the name to mSecureBootState.
2. Remove IsPkExist and SetupModeValAttr fields from SECURE_BOOT_MODE 
structure since only any place to use them.
3. Update AuditModeValAttr/DeployedModeValAttr to BOOLEAN type and the 
name to like AuditModeReadOnly/DeployedModeReadOnly.
4. Suggest to also move PK find logic from AuthVariableLibInitialize() 
to InitSecureBootVariables().
5. Move EFI_SECURE_MODE_NAME definition to be together with 
SECURE_BOOT_MODE. In fact, personally, I also suggest to update 
EFI_SECURE_MODE_NAME and gEfiSecureBootModeGuid to like 
EDKII_SECURE_BOOT_MODE_NAME and gEdkiiSecureBootModeGuid to reduce 
confusion.
6. The delete PK code in TransitionFromUserMode() uses wrong atrributes.
7. Remove "DEBUG((EFI_D_INFO, "TransitionFromDeployedMode is %x\n", 
SecureBootEnable));" in TransitionFromDeployedMode() since it is 
meaningless.
8. Some comments in TransitionFrom() are not aligned.
9. Could SECURE_BOOT_MODE have a field SecureBootEnable? Then 
TransitionFrom() could have no 
SECURE_BOOT_DISABLE/SECURE_BOOT_ENABLE hard code.

Thanks,
Star


On 2015/11/3 15:34, Zhang, Chao B wrote:
> Enable Secure Boot feature defined in UEFI2.5 ECR1263. Add
> AuthVariable implementation logic.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chao Zhang 
> ---
>   SecurityPkg/Library/AuthVariableLib/AuthService.c  | 1221 
> +---
>   .../Library/AuthVariableLib/AuthServiceInternal.h  |   73 ++
>   .../Library/AuthVariableLib/AuthVariableLib.c  |  153 ++-
>   .../Library/AuthVariableLib/AuthVariableLib.inf|4 +
>   .../DxeImageVerificationLib.c  |  669 ++-
>   5 files changed, 1859 insertions(+), 261 deletions(-)
>
> diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c 
> b/SecurityPkg/Library/AuthVariableLib/AuthService.c
> index 1f9ba15..86da34e 100644
> --- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
> +++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
> @@ -250,6 +250,898 @@ AuthServiceInternalUpdateVariableWithTimeStamp (
>   }
>
>   /**
> +  Initialize Secure Boot variables.
> +
> +  @param[in] IsPkPresentPk is present in system.
> +
> +  @retval EFI_SUCCESS   The initialization operation is success.
> +  @retval EFI_OUT_OF_RESOURCES  There is not enough resource.
> +
> +**/
> +EFI_STATUS
> +InitSecureBootVariables (
> +  IN BOOLEAN  IsPkPresent
> +  )
> +{
> +  EFI_STATUS Status;
> +  UINT8  *Data;
> +  UINTN  DataSize;
> +  UINT32 SecureBoot;
> +  UINT8  SecureBootEnable;
> +  SECURE_BOOT_MODE_TYPE  SecureBootMode;
> +
> +  //
> +  // Init "SecureBootMode" variable.
> +  // 1 Initial case
> +  //   SecureBootMode doesn't exist. Init it with PK state
> +  // 3 inconsistency cases need to sync
> +  //   3.1 Add PK -> system break -> update SecureBootMode Var
> +  //   3.2 Delete PK  -> system break -> update SecureBootMode Var
> +  //   3.3 Set AuditMode ->Delete PK  -> system break -> Update 
> SecureBootMode Var
> +  //
> +  Status = AuthServiceInternalFindVariable (EFI_SECURE_MODE_NAME, 
> &gEfiSecureBootModeGuid, (VOID **)&Data, &DataSize);
> +  if (EFI_ERROR(Status)) {
> +//
> +// Variable driver Initial Case
> +//
> +if (IsPkPresent) {
> +  SecureBootMode = SecureBootModeTypeUserMode;
> +} else {
> +  SecureBootMode = SecureBootModeTypeSetupMode;
> +}
> +  } else {
> +//
> +// 3 inconsistency cases need to sync
> +//
> +SecureBootMode = (SECURE_BOOT_MODE_TYPE)*Data;
> +ASSERT(SecureBootMode < SecureBootModeTypeMax);
> +
> +if (IsPkPresent) {
> +  //
> +  // 3.1 Add PK -> system break -> update SecureBootMode Var
> +  //
> +  if (SecureBootMode == SecureBootModeTypeSetupMode) {
> +SecureBootMode = SecureBootModeTypeUserMode;
> +  } else if (SecureBootMode == SecureBootModeTypeAuditMode) {
> +SecureBootMode = SecureBootModeTypeDeployedMode;
> +  }
> +} else {
> +  //
> +  // 3.2 Delete PK -> system break -> update SecureBootMode Var
> +  // 3.3 Set AuditMode ->Delete PK  -> system break -> Update 
> SecureBootMode Var. Reinit to be SetupMode
> +  //
> +  if (SecureBootMode == SecureBootModeTypeUserM

Re: [edk2] [Patch] MdePkg: Add Ipmi2.0 definitions head file.

2015-12-02 Thread Yao, Jiewen
Thanks. Reviewed-by: jiewen@intel.com


-Original Message-
From: Bu, Daocheng 
Sent: Wednesday, December 02, 2015 4:01 PM
To: edk2-devel@lists.01.org
Cc: Yao, Jiewen
Subject: [Patch] MdePkg: Add Ipmi2.0 definitions head file.

Add Ipmi2.0 definitions head file based on Ipmi category:
App, Storage and etc.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daocheng Bu 
CC: Jiewen Yao 
---
 MdePkg/Include/IndustryStandard/Ipmi.h |  29 +
 .../IndustryStandard/IpmiNetFnAppDefinitions.h | 647 +
 .../IndustryStandard/IpmiNetFnBridgeDefinitions.h  | 243 
 .../IndustryStandard/IpmiNetFnChassisDefinitions.h | 304 ++
 .../IpmiNetFnFirmwareDefinitions.h |  26 +
 .../IpmiNetFnGroupExtensionDefinitions.h   |  26 +
 .../IpmiNetFnSensorEventDefinitions.h  |  52 ++
 .../IndustryStandard/IpmiNetFnStorageDefinitions.h | 534 +
 .../IpmiNetFnTransportDefinitions.h| 556 ++
 9 files changed, 2417 insertions(+)
 create mode 100644 MdePkg/Include/IndustryStandard/Ipmi.h
 create mode 100644 MdePkg/Include/IndustryStandard/IpmiNetFnAppDefinitions.h
 create mode 100644 MdePkg/Include/IndustryStandard/IpmiNetFnBridgeDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnChassisDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnFirmwareDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnGroupExtensionDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnSensorEventDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnStorageDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnTransportDefinitions.h

diff --git a/MdePkg/Include/IndustryStandard/Ipmi.h 
b/MdePkg/Include/IndustryStandard/Ipmi.h
new file mode 100644
index 000..04e6807
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/Ipmi.h
@@ -0,0 +1,29 @@
+/** @file   
+  IPMI 2.0 definitions from the IPMI Specification Version 2.0, Revision 1.1.
+
+  See IPMI specification, Appendix G, Command Assignments
+  and Appendix H, Sub-function Assignments.
+
+  Copyright (c) 1999 - 2015, 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   
 
+
+  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 _IPMIDEFINITIONS_H_
+#define _IPMIDEFINITIONS_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#endif
diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnAppDefinitions.h 
b/MdePkg/Include/IndustryStandard/IpmiNetFnAppDefinitions.h
new file mode 100644
index 000..3e31b10
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/IpmiNetFnAppDefinitions.h
@@ -0,0 +1,647 @@
+/** @file   
+  IPMI 2.0 definitions from the IPMI Specification Version 2.0, Revision 1.1.
+
+  This file contains all NetFn App commands, including:
+IPM Device "Global" Commands (Chapter 20)
+Firmware Firewall & Command Discovery Commands (Chapter 21)
+BMC Watchdog Timer Commands (Chapter 27)
+IPMI Messaging Support Commands (Chapter 22)
+RMCP+ Support and Payload Commands (Chapter 24)
+
+  See IPMI specification, Appendix G, Command Assignments
+  and Appendix H, Sub-function Assignments.
+
+  Copyright (c) 1999 - 2015, 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   
 
+
+  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 _IPMINETFNAPPDEFINITIONS_H_
+#define _IPMINETFNAPPDEFINITIONS_H_
+
+#pragma pack(1)
+//
+// Net function definition for App command
+//
+#define IPMI_NETFN_APP  0x06
+
+//
+//  Below is Definitions for IPM Device "Global" Commands  (Chapter 20)
+//
+
+//
+//  Definitions for Get Device ID command   
+//
+#define IPMI_APP_GET_DEVICE_ID 0x1
+
+//
+//  Constants and Structure definitions for "Get Device ID" command to follow 
here
+//
+typedef struct {
+  UINT8   DeviceId;
+  UINT8   DeviceRevision : 4;
+  UINT8   Reserved : 3;
+  UINT8   DeviceSdr : 1;
+  UINT8   

Re: [edk2] [Patch 5/6] CryptoPkg: Disable VS2015 warning C4311 in OpensslLib

2015-12-02 Thread Long, Qin
Looks good. 
Reviewed-by: Qin Long 


Best Regards & Thanks,
LONG, Qin

> -Original Message-
> From: Gao, Liming
> Sent: Thursday, December 03, 2015 1:27 PM
> To: edk2-devel@lists.01.org
> Cc: Long, Qin
> Subject: [Patch 5/6] CryptoPkg: Disable VS2015 warning C4311 in OpensslLib
> 
> Warning C4311: pointer truncation from 'type' to 'type'.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao 
> Cc: Long Qin 
> ---
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> index 20200c3..a6d511e 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> +++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> @@ -865,9 +865,10 @@
># C4305: truncation from type1 to type2 of smaller size
># C4306: conversion from type1 to type2 of greater size
># C4702: Potentially uninitialized local variable name used
> +  # C4311: pointer truncation from 'type' to 'type'
>#
>MSFT:*_*_IA32_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER
> $(OPENSSL_FLAGS) /wd4244 /wd4701 /wd4702 /wd4706
> -  MSFT:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER
> $(OPENSSL_FLAGS) /wd4133 /wd4244 /wd4245 /wd4267 /wd4701 /wd4305
> /wd4306 /wd4702 /wd4706
> +  MSFT:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER
> $(OPENSSL_FLAGS) /wd4133 /wd4244 /wd4245 /wd4267 /wd4701 /wd4305
> /wd4306 /wd4702 /wd4706 /wd4311
>MSFT:*_*_IPF_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER
> $(OPENSSL_FLAGS) /wd4133 /wd4244 /wd4245 /wd4267 /wd4701 /wd4305
> /wd4306 /wd4702 /wd4706
> 
>INTEL:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC
> $(OPENSSL_FLAGS) /w
> --
> 1.9.5.msysgit.0

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


Re: [edk2] ifconfig command issue in edk2

2015-12-02 Thread Leekha Shaveta
Thanks Jiaxin!

Shell> ifconfig -s eth0 static 192.168.112 ifconfig -s eth0 static 
Shell> 192.169 con
'con' is not recognized as an internal or external command, operable program, 
or script file.

These were actually not the issues.

I have just quoted some examples, where we give incomplete parameters to 
ifconfig, still it doesn't hang.

Thanks and Regards,
Shaveta

-Original Message-
From: Wu, Jiaxin [mailto:jiaxin...@intel.com] 
Sent: Thursday, December 03, 2015 6:33 AM
To: Ye, Ting ; Leekha Shaveta-B20052 
; edk2-devel@lists.01.org
Cc: Sharma Bhupesh-B45370 
Subject: RE: ifconfig command issue in edk2

Hi Shaveta,
Thanks for your finding, we have rootcause the hang issue in ifconfig , and 
will fix it as soon as possible.

Thanks.
Jiaxin

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ye, Ting
Sent: Wednesday, December 2, 2015 9:21 AM
To: Leekha Shaveta; edk2-devel@lists.01.org
Cc: Sharma Bhupesh
Subject: Re: [edk2] ifconfig command issue in edk2

Hi Shaveta,

We will try to reproduce the ASSERT issue at first. We will investigate how to 
fix it as soon as we can reproduce this, or back to you once we fail to 
reproduce.

For below one, it seems you split the ifconfig command to two parts, and shell 
does not recognize the second part as 'con' is not a command.

Shell> ifconfig -s eth0 static 192.168.112 ifconfig -s eth0 static 
Shell> 192.169 con
'con' is not recognized as an internal or external command, operable program, 
or script file.

Best Regards,
Ye Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leekha 
Shaveta
Sent: Tuesday, December 01, 2015 7:53 PM
To: edk2-devel@lists.01.org
Cc: Sharma Bhupesh
Subject: [edk2] ifconfig command issue in edk2

Hi,

I am observing one issue while using "ifconfig" command.

When ifconfig command is used with incomplete parameters like below, it hangs 
the system by throwing an ASSERT:

Shell> ifconfig -s eth0 static 192.168.2.142
ASSERT 
/home/jenkins/ci/sdk/sdk-ls1043a/ls1043ardb/ls1043a-uefi/MdePkg/Library/BaseLib/String.c(173):
 ((UINTN) String & 0x0001) == 0


Whereas in some other cases, it simply returns to prompt:
Shell> ifconfig -s eth0 static 192.168.112 ifconfig -s eth0 static 
Shell> 192.169 con
'con' is not recognized as an internal or external command, operable program, 
or script file.
Shell>


Is this some known issue or any pointer why is this happening?

Regards,
Shaveta

-Original Message-
From: Leekha Shaveta-B20052
Sent: Thursday, September 24, 2015 1:17 PM
To: 'Ye, Ting' ; edk2-devel@lists.01.org
Subject: RE: Ping 1st packet reply missing

Hi Ye Ting

Ping issue is resolved now.

I found in some old edk2 mails that it was some issue in Ping command 
implementation(Snippet pasted below).
After making TxRing ready beforehand, this issue get resolved now.

But TFTP issue is the one, I am still facing, any pointers on that?

Thanks and Regards,
Shaveta

Snippet of that mail chain issue :

Re: [edk2] Missing Ping Reply
The reason that the reply is missing is because when the reply is received and 
"Ping6OnEchoReplyReceived" is called, it kicks out in the call to 
"Ping6MatchEchoReply". The reason that reply does not match because there is no 
entry in the TxList when reply is received. 
In the function "PingSendEchoRequest", the ICMP message is sent out first 
before the entry is inserted into TxList. The reply comes back before the call 
comes back from "Transmit" function of the IPV4 protocol. 

-Original Message-
From: Ye, Ting [mailto:ting...@intel.com]
Sent: Thursday, September 24, 2015 1:01 PM
To: Leekha Shaveta-B20052 ; edk2-devel@lists.01.org
Subject: RE: Ping 1st packet reply missing

We did not meet this error before. Could you please share your captured packet 
and network topology for analysis? 

Best Regards,
Ye Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leekha 
Shaveta
Sent: Thursday, September 24, 2015 1:45 PM
To: edk2-devel@lists.01.org
Subject: [edk2] Ping 1st packet reply missing


Hi,

My ping is working  with Intel's E1000 driver code.

But everytime 1st packet is not getting received successfully, is there some 
known issue here, or something to be set/missing?

Regards,
Shaveta

Ping Snippet:
===
Shell> ping 192.168.3.1ping 192.168.3.1 -n 16
InstallProtocolInterface: 41D94CD2-35B6-455A-8258-D4E51334AADD DF56EA60 Ping 
192.168.3.1 16 data bytes.
GigAdapter->cur_rx_ind: 0
GigAdapter->cur_rx_ind: 1
16 bytes from 192.168.3.1 : icmp_seq=2 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 2
16 bytes from 192.168.3.1 : icmp_seq=3 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 3
16 bytes from 192.168.3.1 : icmp_seq=4 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 4
16 bytes from 192.168.3.1 : icmp_seq=5 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 5
16 bytes from 192.168.3.1 : icmp_seq=6 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 6
16 b

[edk2] [PATCH] ShellPkg: Refine the code to reduce time cost of 'map -r'

2015-12-02 Thread Qiu Shumin
In some platform 'map -r' may cost more than 1 min. This patch filter the 
target handles by
BlockIO and SimpleFileSystem protocol to reduce the time cost.

Cc: Jaben Carsey 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin 
---
 .../Library/UefiShellCommandLib/ConsistMapping.c   | 40 --
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c 
b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
index 9bd7b2c..86e8dc5 100644
--- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
+++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
@@ -16,6 +16,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+
 
 typedef enum {
   MTDTypeUnknown,
@@ -1349,20 +1353,22 @@ ShellCommandConsistMappingInitialize (
   OUT EFI_DEVICE_PATH_PROTOCOL   ***Table
   )
 {
-  EFI_HANDLE*HandleBuffer;
-  UINTN HandleNum;
-  UINTN HandleLoop;
-  EFI_DEVICE_PATH_PROTOCOL  **TempTable;
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  EFI_DEVICE_PATH_PROTOCOL  *HIDevicePath;
-  UINTN Index;
-  EFI_STATUSStatus;
+  EFI_HANDLE  *HandleBuffer;
+  UINTN   HandleNum;
+  UINTN   HandleLoop;
+  EFI_DEVICE_PATH_PROTOCOL**TempTable;
+  EFI_DEVICE_PATH_PROTOCOL*DevicePath;
+  EFI_DEVICE_PATH_PROTOCOL*HIDevicePath;
+  EFI_BLOCK_IO_PROTOCOL   *BlockIo;
+  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
+  UINTN   Index;
+  EFI_STATUS  Status;
 
   HandleBuffer  = NULL;
 
   Status = gBS->LocateHandleBuffer (
-  AllHandles,
-  NULL,
+  ByProtocol,
+  &gEfiDevicePathProtocolGuid,
   NULL,
   &HandleNum,
   &HandleBuffer
@@ -1385,6 +1391,20 @@ ShellCommandConsistMappingInitialize (
   continue;
 }
 
+Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], 
+  &gEfiBlockIoProtocolGuid, 
+  (VOID **)&BlockIo
+  );
+if (EFI_ERROR(Status)) {
+  Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], 
+&gEfiSimpleFileSystemProtocolGuid, 
+(VOID **)&SimpleFileSystem
+);
+  if (EFI_ERROR(Status)) {
+continue;
+  }
+}
+
 for (Index = 0; TempTable[Index] != NULL; Index++) {
   if (DevicePathCompare (&TempTable[Index], &HIDevicePath) == 0) {
 FreePool (HIDevicePath);
-- 
1.9.5.msysgit.1

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


Re: [edk2] [Patch 3/6] MdeModulePkg: Fix VS2015 warning C4456 in RegularExpressionDxe

2015-12-02 Thread El-Haj-Mahmoud, Samer
I only reviewed this patch, not the entire series

Reviewed-By:  Samer El-Haj-Mahmoud 


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liming 
Gao
Sent: Wednesday, December 2, 2015 11:27 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch 3/6] MdeModulePkg: Fix VS2015 warning C4456 in 
RegularExpressionDxe

warning C4456: declaration of 'q' hides previous local declaration.
Update code to use the different local variable name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
Cc: El-Haj-Mahmoud Samer 
---
 .../Universal/RegularExpressionDxe/Oniguruma/regexec.c   | 16 
 .../Universal/RegularExpressionDxe/Oniguruma/regint.h|  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regexec.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regexec.c
index de5839a..5e3ffa1 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regexec.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regexec.c
@@ -1442,7 +1442,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
 case OP_EXACT1_IC:  MOP_IN(OP_EXACT1_IC);
   {
int len;
-   UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
+   UChar *q1, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
 
DATA_ENSURE(1);
len = ONIGENC_MBC_CASE_FOLD(encode,
@@ -1450,12 +1450,12 @@ match_at(regex_t* reg, const UChar* str, const UChar* 
end,
case_fold_flag,
&s, end, lowbuf);
DATA_ENSURE(0);
-   q = lowbuf;
+   q1 = lowbuf;
while (len-- > 0) {
- if (*p != *q) {
+ if (*p != *q1) {
 goto fail;
   }
- p++; q++;
+ p++; q1++;
}
   }
   MOP_OUT;
@@ -1531,7 +1531,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
 case OP_EXACTN_IC:  MOP_IN(OP_EXACTN_IC);
   {
int len;
-   UChar *q, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
+   UChar *qn, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
 
GET_LENGTH_INC(tlen, p);
endp = p + tlen;
@@ -1544,10 +1544,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* 
end,
  case_fold_flag,
  &s, end, lowbuf);
  DATA_ENSURE(0);
- q = lowbuf;
+ qn = lowbuf;
  while (len-- > 0) {
-   if (*p != *q) goto fail;
-   p++; q++;
+   if (*p != *qn) goto fail;
+   p++; qn++;
  }
}
   }
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
index 2db3b70..44589bf 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
@@ -329,8 +329,8 @@ typedef Bits*  BitSetRef;
 #define SIZE_BITSETsizeof(BitSet)
 
 #define BITSET_CLEAR(bs) do {\
-  int i;\
-  for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
+  int id;\
+  for (id = 0; id < (int )BITSET_SIZE; id++) { (bs)[id] = 0; } \
 } while (0)
 
 #define BS_ROOM(bs,pos)(bs)[pos / BITS_IN_ROOM]
-- 
1.9.5.msysgit.0

___
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] EDK2 and VS2015

2015-12-02 Thread Gao, Liming
Foster:
  VS2015 tool chain has been added into BaseTools\Conf\tools_def.template. You 
can pull the latest EDKII to get it. 

  And, I also send the patch to fix VS2015 warnings in EDKII packages. Please 
apply them, then do VS2015 build. 

Thanks
Liming
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
Fish
Sent: Thursday, December 03, 2015 4:11 AM
To: Foster, Matthew I
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] EDK2 and VS2015


> On Dec 2, 2015, at 11:47 AM, Foster, Matthew I  
> wrote:
> 
> Does anyone have any information about compiling EDK2 using Visual Studio 
> 2015? Is it supported?


Liming proposed a patch to the mailing list on 11/30/2105 to support VS2015. 

You can try applying that patch. You will need to remove your 
Conf/boots_def.txt file to get the BaseTools/Conf/tools_def.template file 
copied over by the edksetup script. 

Thanks,

Andrew Fish

> ___
> 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-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] ShellPkg: Make 'dh' support showing all spec defined protocols.

2015-12-02 Thread El-Haj-Mahmoud, Samer
Reviewed-By:  Samer El-Haj-Mahmoud 


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Qiu 
Shumin
Sent: Wednesday, December 2, 2015 9:25 PM
To: edk2-devel@lists.01.org
Cc: Jaben Carsey ; Qiu Shumin 
Subject: [edk2] [PATCH] ShellPkg: Make 'dh' support showing all spec defined 
protocols.

When using 'dh' to dump all protocols installed on a handle, some of them are 
shown as 'UnknownDevice'.
Device patch make 'dh' support all spec defined protocols.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey 
Reviewed-by: Qiu Shumin 
Reviewed-by: Ruiyu Ni 
---
 .../UefiHandleParsingLib/UefiHandleParsingLib.c| 123 +
 .../UefiHandleParsingLib/UefiHandleParsingLib.inf  | 115 +++  
.../UefiHandleParsingLib/UefiHandleParsingLib.uni  | Bin 32404 -> 48156 bytes
 3 files changed, 238 insertions(+)

diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c 
b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index b211de7..6f093ff 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -1026,6 +1026,124 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
   {STRING_TOKEN(STR_DISK_INFO), &gEfiDiskInfoProtocolGuid, 
   NULL},
 
 //
+// PI Spec 1.0
+//
+  {STRING_TOKEN(STR_BDS_ARCH),  &gEfiBdsArchProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_CPU_ARCH),  &gEfiCpuArchProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_MET_ARCH),  &gEfiMetronomeArchProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_MON_ARCH),  
&gEfiMonotonicCounterArchProtocolGuid,NULL},
+  {STRING_TOKEN(STR_RTC_ARCH),  
&gEfiRealTimeClockArchProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_RESET_ARCH),&gEfiResetArchProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_RT_ARCH),   &gEfiRuntimeArchProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_SEC_ARCH),  &gEfiSecurityArchProtocolGuid, 
   NULL},
+  {STRING_TOKEN(STR_TIMER_ARCH),&gEfiTimerArchProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_VAR_ARCH),  
&gEfiVariableWriteArchProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_V_ARCH),&gEfiVariableArchProtocolGuid, 
   NULL},
+  {STRING_TOKEN(STR_SECP),  &gEfiSecurityPolicyProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_WDT_ARCH),  
&gEfiWatchdogTimerArchProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_SCR),   
&gEfiStatusCodeRuntimeProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_SMB_HC),&gEfiSmbusHcProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_FV_2),  &gEfiFirmwareVolume2ProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_FV_BLOCK),  
&gEfiFirmwareVolumeBlockProtocolGuid, NULL},
+  {STRING_TOKEN(STR_CAP_ARCH),  &gEfiCapsuleArchProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_MP_SERVICE),&gEfiMpServiceProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_HBRAP), 
&gEfiPciHostBridgeResourceAllocationProtocolGuid, NULL},
+  {STRING_TOKEN(STR_PCIP),  &gEfiPciPlatformProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_PCIO),  &gEfiPciOverrideProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_PCIE),  
&gEfiPciEnumerationCompleteProtocolGuid,  NULL},
+  {STRING_TOKEN(STR_IPCID), 
&gEfiIncompatiblePciDeviceSupportProtocolGuid,NULL},
+  {STRING_TOKEN(STR_PCIHPI),&gEfiPciHotPlugInitProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_PCIHPR),
&gEfiPciHotPlugRequestProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_SMBIOS),&gEfiSmbiosProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_S3_SAVE),   &gEfiS3SaveStateProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_S3_S_SMM),  &gEfiS3SmmSaveStateProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_RSC),   &gEfiRscHandlerProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_S_RSC), &gEfiSmmRscHandlerProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_ACPI_SDT),  &gEfiAcpiSdtProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_SIO),   &gEfiSioProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_S_CPU2),&gEfiSmmCpuIo2ProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_S_BASE2),   &gEfiSmmBase2ProtocolGuid,

[edk2] [Patch 6/6] OvmfPkg: Fix VS2015 warning C4459 in XenBusDxe

2015-12-02 Thread Liming Gao
warning C4459: declaration of 'xs' hides global declaration.
Update code to rename local variable xs to xsp to be different.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
Cc: Justen Jordan 
---
 OvmfPkg/XenBusDxe/XenStore.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/XenBusDxe/XenStore.c b/OvmfPkg/XenBusDxe/XenStore.c
index 9850f1e..61976f9 100644
--- a/OvmfPkg/XenBusDxe/XenStore.c
+++ b/OvmfPkg/XenBusDxe/XenStore.c
@@ -992,9 +992,9 @@ NotifyEventChannelCheckForEvent (
   IN VOID *Context
   )
 {
-  XENSTORE_PRIVATE *xs;
-  xs = (XENSTORE_PRIVATE *)Context;
-  if (TestAndClearBit (xs->EventChannel, xs->Dev->SharedInfo->evtchn_pending)) 
{
+  XENSTORE_PRIVATE *xsp;
+  xsp = (XENSTORE_PRIVATE *)Context;
+  if (TestAndClearBit (xsp->EventChannel, 
xsp->Dev->SharedInfo->evtchn_pending)) {
 gBS->SignalEvent (Event);
   }
 }
@@ -1007,12 +1007,12 @@ NotifyEventChannelCheckForEvent (
 STATIC
 EFI_STATUS
 XenStoreInitComms (
-  XENSTORE_PRIVATE *xs
+  XENSTORE_PRIVATE *xsp
   )
 {
   EFI_STATUS Status;
   EFI_EVENT TimerEvent;
-  struct xenstore_domain_interface *XenStore = xs->XenStore;
+  struct xenstore_domain_interface *XenStore = xsp->XenStore;
 
   Status = gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &TimerEvent);
   Status = gBS->SetTimer (TimerEvent, TimerRelative,
@@ -1029,8 +1029,8 @@ XenStoreInitComms (
   gBS->CloseEvent (TimerEvent);
 
   Status = gBS->CreateEvent (EVT_NOTIFY_WAIT, TPL_NOTIFY,
- NotifyEventChannelCheckForEvent, xs,
- &xs->EventChannelEvent);
+ NotifyEventChannelCheckForEvent, xsp,
+ &xsp->EventChannelEvent);
   ASSERT_EFI_ERROR (Status);
 
   return Status;
-- 
1.9.5.msysgit.0

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


[edk2] [Patch 4/6] MdeModulePkg: Fix VS2015 warning C4311 & C4312 in RegularExpressionDxe

2015-12-02 Thread Liming Gao
warning C4311: pointer truncation from 'void *' to 'unsigned long'
warning C4312: conversion from 'unsigned long' to 'void *' of greater size
Update code to convert type to UINTN first, then convert it to other type.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
Cc: El-Haj-Mahmoud Samer 
---
 .../RegularExpressionDxe/Oniguruma/enc/unicode.c   | 22 ++---
 .../RegularExpressionDxe/Oniguruma/regexec.c   | 36 +++---
 .../RegularExpressionDxe/Oniguruma/regint.h|  4 +--
 .../RegularExpressionDxe/Oniguruma/regparse.c  | 16 +-
 4 files changed, 39 insertions(+), 39 deletions(-)

diff --git 
a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/enc/unicode.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/enc/unicode.c
index 70a1a52..a906670 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/enc/unicode.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/enc/unicode.c
@@ -10920,12 +10920,12 @@ static int init_case_fold_table(void)
   if (ONIG_IS_NULL(FoldTable)) return ONIGERR_MEMORY;
   for (i = 0; i < (int )(sizeof(CaseFold)/sizeof(CaseFold_11_Type)); i++) {
 p = &CaseFold[i];
-st_add_direct(FoldTable, (st_data_t )p->from, (st_data_t )&(p->to));
+st_add_direct(FoldTable, (st_data_t )p->from, (st_data_t )(UINTN)&(p->to));
   }
   for (i = 0; i < (int )(sizeof(CaseFold_Locale)/sizeof(CaseFold_11_Type));
i++) {
 p = &CaseFold_Locale[i];
-st_add_direct(FoldTable, (st_data_t )p->from, (st_data_t )&(p->to));
+st_add_direct(FoldTable, (st_data_t )p->from, (st_data_t )(UINTN)&(p->to));
   }
 
   Unfold1Table = st_init_numtable_with_size(1000);
@@ -10934,13 +10934,13 @@ static int init_case_fold_table(void)
   for (i = 0; i < (int )(sizeof(CaseUnfold_11)/sizeof(CaseUnfold_11_Type));
i++) {
 p1 = &CaseUnfold_11[i];
-st_add_direct(Unfold1Table, (st_data_t )p1->from, (st_data_t )&(p1->to));
+st_add_direct(Unfold1Table, (st_data_t )p1->from, (st_data_t 
)(UINTN)&(p1->to));
   }
   for (i = 0;
i < (int )(sizeof(CaseUnfold_11_Locale)/sizeof(CaseUnfold_11_Type));
i++) {
 p1 = &CaseUnfold_11_Locale[i];
-st_add_direct(Unfold1Table, (st_data_t )p1->from, (st_data_t )&(p1->to));
+st_add_direct(Unfold1Table, (st_data_t )p1->from, (st_data_t 
)(UINTN)&(p1->to));
   }
 
   Unfold2Table = st_init_table_with_size(&type_code2_hash, 200);
@@ -10949,13 +10949,13 @@ static int init_case_fold_table(void)
   for (i = 0; i < (int )(sizeof(CaseUnfold_12)/sizeof(CaseUnfold_12_Type));
i++) {
 p2 = &CaseUnfold_12[i];
-st_add_direct(Unfold2Table, (st_data_t )p2->from, (st_data_t )(&p2->to));
+st_add_direct(Unfold2Table, (st_data_t )(UINTN)p2->from, (st_data_t 
)(UINTN)(&p2->to));
   }
   for (i = 0;
i < (int )(sizeof(CaseUnfold_12_Locale)/sizeof(CaseUnfold_12_Type));
i++) {
 p2 = &CaseUnfold_12_Locale[i];
-st_add_direct(Unfold2Table, (st_data_t )p2->from, (st_data_t )(&p2->to));
+st_add_direct(Unfold2Table, (st_data_t )(UINTN)p2->from, (st_data_t 
)(UINTN)(&p2->to));
   }
 
   Unfold3Table = st_init_table_with_size(&type_code3_hash, 30);
@@ -10964,7 +10964,7 @@ static int init_case_fold_table(void)
   for (i = 0; i < (int )(sizeof(CaseUnfold_13)/sizeof(CaseUnfold_13_Type));
i++) {
 p3 = &CaseUnfold_13[i];
-st_add_direct(Unfold3Table, (st_data_t )p3->from, (st_data_t )(&p3->to));
+st_add_direct(Unfold3Table, (st_data_t )(UINTN)p3->from, (st_data_t 
)(UINTN)(&p3->to));
   }
 
 
@@ -11265,7 +11265,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding 
enc,
  }
}
 
-   if (onig_st_lookup(Unfold2Table, (st_data_t )to->code,
+   if (onig_st_lookup(Unfold2Table, (st_data_t )(UINTN)to->code,
   (void* )&z2) != 0) {
  for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
@@ -11291,7 +11291,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding 
enc,
  }
}
 
-   if (onig_st_lookup(Unfold3Table, (st_data_t )to->code,
+   if (onig_st_lookup(Unfold3Table, (st_data_t )(UINTN)to->code,
   (void* )&z2) != 0) {
  for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
@@ -11336,7 +11336,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding 
enc,
 
   clen = enclen(enc, p);
   len += clen;
-  if (onig_st_lookup(Unfold2Table, (st_data_t )codes, (void* )&z2) != 0) {
+  if (onig_st_lookup(Unfold2Table, (st_data_t )(UINTN)codes, (void* )&z2) 
!= 0) {
for (i = 0; i < z2->n; i++) {
  items[n].byte_len = len;
  items[n].code_len = 1;
@@ -11357,7 +11357,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding 
enc,
 
clen = enclen(enc, p);
len += clen;
-   if (onig_st_lookup(Unfold3Table, (st_data_t )codes,
+   if (onig_st_lookup(Unfold3Table, (st_data_t )(UINTN)codes,

[edk2] [Patch 5/6] CryptoPkg: Disable VS2015 warning C4311 in OpensslLib

2015-12-02 Thread Liming Gao
Warning C4311: pointer truncation from 'type' to 'type'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
Cc: Long Qin 
---
 CryptoPkg/Library/OpensslLib/OpensslLib.inf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 20200c3..a6d511e 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -865,9 +865,10 @@
   # C4305: truncation from type1 to type2 of smaller size
   # C4306: conversion from type1 to type2 of greater size
   # C4702: Potentially uninitialized local variable name used
+  # C4311: pointer truncation from 'type' to 'type'
   #
   MSFT:*_*_IA32_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4244 /wd4701 /wd4702 /wd4706
-  MSFT:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4133 /wd4244 /wd4245 /wd4267 /wd4701 /wd4305 /wd4306 /wd4702 /wd4706
+  MSFT:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4133 /wd4244 /wd4245 /wd4267 /wd4701 /wd4305 /wd4306 /wd4702 /wd4706 /wd4311
   MSFT:*_*_IPF_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4133 /wd4244 /wd4245 /wd4267 /wd4701 /wd4305 /wd4306 /wd4702 /wd4706
 
   INTEL:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC 
$(OPENSSL_FLAGS) /w
-- 
1.9.5.msysgit.0

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


[edk2] [Patch 3/6] MdeModulePkg: Fix VS2015 warning C4456 in RegularExpressionDxe

2015-12-02 Thread Liming Gao
warning C4456: declaration of 'q' hides previous local declaration.
Update code to use the different local variable name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
Cc: El-Haj-Mahmoud Samer 
---
 .../Universal/RegularExpressionDxe/Oniguruma/regexec.c   | 16 
 .../Universal/RegularExpressionDxe/Oniguruma/regint.h|  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regexec.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regexec.c
index de5839a..5e3ffa1 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regexec.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regexec.c
@@ -1442,7 +1442,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
 case OP_EXACT1_IC:  MOP_IN(OP_EXACT1_IC);
   {
int len;
-   UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
+   UChar *q1, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
 
DATA_ENSURE(1);
len = ONIGENC_MBC_CASE_FOLD(encode,
@@ -1450,12 +1450,12 @@ match_at(regex_t* reg, const UChar* str, const UChar* 
end,
case_fold_flag,
&s, end, lowbuf);
DATA_ENSURE(0);
-   q = lowbuf;
+   q1 = lowbuf;
while (len-- > 0) {
- if (*p != *q) {
+ if (*p != *q1) {
 goto fail;
   }
- p++; q++;
+ p++; q1++;
}
   }
   MOP_OUT;
@@ -1531,7 +1531,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
 case OP_EXACTN_IC:  MOP_IN(OP_EXACTN_IC);
   {
int len;
-   UChar *q, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
+   UChar *qn, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
 
GET_LENGTH_INC(tlen, p);
endp = p + tlen;
@@ -1544,10 +1544,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* 
end,
  case_fold_flag,
  &s, end, lowbuf);
  DATA_ENSURE(0);
- q = lowbuf;
+ qn = lowbuf;
  while (len-- > 0) {
-   if (*p != *q) goto fail;
-   p++; q++;
+   if (*p != *qn) goto fail;
+   p++; qn++;
  }
}
   }
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
index 2db3b70..44589bf 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
@@ -329,8 +329,8 @@ typedef Bits*  BitSetRef;
 #define SIZE_BITSETsizeof(BitSet)
 
 #define BITSET_CLEAR(bs) do {\
-  int i;\
-  for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
+  int id;\
+  for (id = 0; id < (int )BITSET_SIZE; id++) { (bs)[id] = 0; } \
 } while (0)
 
 #define BS_ROOM(bs,pos)(bs)[pos / BITS_IN_ROOM]
-- 
1.9.5.msysgit.0

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


[edk2] [Patch 2/6] MdeModulePkg: Fix VS2015 warning C4459 in DriverSampleDxe

2015-12-02 Thread Liming Gao
warning C4459: declaration of 'PrivateData' hides global declaration.
Update DriverSampleDxe to rename global variable name to be different.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 .../Universal/DriverSampleDxe/DriverSample.c   | 72 +++---
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c 
b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index 2f77d39..8ec1d4e 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -21,7 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 CHAR16 VariableName[] = L"MyIfrNVData";
 CHAR16 MyEfiVar[] = L"MyEfiVar";
 EFI_HANDLE  DriverHandle[2] = {NULL, NULL};
-DRIVER_SAMPLE_PRIVATE_DATA  *PrivateData = NULL;
+DRIVER_SAMPLE_PRIVATE_DATA  *mPrivateData = NULL;
 EFI_EVENT   mEvent;
 
 HII_VENDOR_DEVICE_PATH  mHiiVendorDevicePath0 = {
@@ -1895,17 +1895,17 @@ DriverSampleInit (
   //
   // Initialize driver private data
   //
-  PrivateData = AllocateZeroPool (sizeof (DRIVER_SAMPLE_PRIVATE_DATA));
-  if (PrivateData == NULL) {
+  mPrivateData = AllocateZeroPool (sizeof (DRIVER_SAMPLE_PRIVATE_DATA));
+  if (mPrivateData == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
 
-  PrivateData->Signature = DRIVER_SAMPLE_PRIVATE_SIGNATURE;
+  mPrivateData->Signature = DRIVER_SAMPLE_PRIVATE_SIGNATURE;
 
-  PrivateData->ConfigAccess.ExtractConfig = ExtractConfig;
-  PrivateData->ConfigAccess.RouteConfig = RouteConfig;
-  PrivateData->ConfigAccess.Callback = DriverCallback;
-  PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+  mPrivateData->ConfigAccess.ExtractConfig = ExtractConfig;
+  mPrivateData->ConfigAccess.RouteConfig = RouteConfig;
+  mPrivateData->ConfigAccess.Callback = DriverCallback;
+  mPrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
 
   //
   // Locate Hii Database protocol
@@ -1914,7 +1914,7 @@ DriverSampleInit (
   if (EFI_ERROR (Status)) {
 return Status;
   }
-  PrivateData->HiiDatabase = HiiDatabase;
+  mPrivateData->HiiDatabase = HiiDatabase;
 
   //
   // Locate HiiString protocol
@@ -1923,7 +1923,7 @@ DriverSampleInit (
   if (EFI_ERROR (Status)) {
 return Status;
   }
-  PrivateData->HiiString = HiiString;
+  mPrivateData->HiiString = HiiString;
 
   //
   // Locate Formbrowser2 protocol
@@ -1932,7 +1932,7 @@ DriverSampleInit (
   if (EFI_ERROR (Status)) {
 return Status;
   }
-  PrivateData->FormBrowser2 = FormBrowser2;
+  mPrivateData->FormBrowser2 = FormBrowser2;
 
   //
   // Locate ConfigRouting protocol
@@ -1941,7 +1941,7 @@ DriverSampleInit (
   if (EFI_ERROR (Status)) {
 return Status;
   }
-  PrivateData->HiiConfigRouting = HiiConfigRouting;
+  mPrivateData->HiiConfigRouting = HiiConfigRouting;
 
   //
   // Locate keyword handler protocol
@@ -1950,19 +1950,19 @@ DriverSampleInit (
   if (EFI_ERROR (Status)) {
 return Status;
   }
-  PrivateData->HiiKeywordHandler = HiiKeywordHandler;
+  mPrivateData->HiiKeywordHandler = HiiKeywordHandler;
 
   Status = gBS->InstallMultipleProtocolInterfaces (
   &DriverHandle[0],
   &gEfiDevicePathProtocolGuid,
   &mHiiVendorDevicePath0,
   &gEfiHiiConfigAccessProtocolGuid,
-  &PrivateData->ConfigAccess,
+  &mPrivateData->ConfigAccess,
   NULL
   );
   ASSERT_EFI_ERROR (Status);
 
-  PrivateData->DriverHandle[0] = DriverHandle[0];
+  mPrivateData->DriverHandle[0] = DriverHandle[0];
 
   //
   // Publish our HII data
@@ -1978,7 +1978,7 @@ DriverSampleInit (
 return EFI_OUT_OF_RESOURCES;
   }
 
-  PrivateData->HiiHandle[0] = HiiHandle[0];
+  mPrivateData->HiiHandle[0] = HiiHandle[0];
 
   //
   // Publish another Fromset
@@ -1988,12 +1988,12 @@ DriverSampleInit (
   &gEfiDevicePathProtocolGuid,
   &mHiiVendorDevicePath1,
   &gEfiHiiConfigAccessProtocolGuid,
-  &PrivateData->ConfigAccess,
+  &mPrivateData->ConfigAccess,
   NULL
   );
   ASSERT_EFI_ERROR (Status);
 
-  PrivateData->DriverHandle[1] = DriverHandle[1];
+  mPrivateData->DriverHandle[1] = DriverHandle[1];
 
   HiiHandle[1] = HiiAddPackages (
&gDriverSampleInventoryGuid,
@@ -2007,7 +2007,7 @@ DriverSampleInit (
 return EFI_OUT_OF_RESOURCES;
   }
 
-  PrivateData->HiiHandle[1] = HiiHandle[1];
+  mPrivateData->HiiHandle[1] = HiiHandle[1];
 
   //
   // Update the device path string.
@@ -2037,14 +2037,14 @@ DriverSampleInit (
   //
   // Initialize Name/Value name String ID
   //
-  PrivateData->NameStringId[0] = STR_NAME_VALUE_VAR_NAME0;
-  PrivateData->NameStringId[1] = STR_NAME_VALUE_VAR_NAME1;
-  PrivateData->NameStringId[2] = STR_NAME_VALUE_VAR_NAME2;
+

[edk2] [Patch 0/6] Fix VS2015 warnings in EDKII packages.

2015-12-02 Thread Liming Gao
VS2015 reports the following warnings in EDKII codes. 
1) warning C4701: potentially uninitialized local variable used. 
2) warning C4703: potentially uninitialized local pointer variable used. 
3) warning C4459: declaration of 'PrivateData' hides global declaration.
4) warning C4456: declaration of 'q' hides previous local declaration.
5) warning C4312: conversion from 'unsigned long' to 'void *' of greater size. 
6) warning C4311: pointer truncation from 'void *' to 'unsigned long'.

For warning C4701 & C4703, disable them in MdePkg because of the false report.
For warning C4459 & C4456, update MdeModulePkg and OvmfPkg to fix them.
For warning C4312 & C4311, update MdeModulePkg to fix them, and update 
CryptoPkg OpensslLib to disable them.

After apply those changes, MdePkg, MdeModulePkg, UefiCpuPkg, NetworkPkg,
SecurityPkg, ShellPkg, SourceLevelDebugPkg, PcAtChipsetPkg, PerformancePkg,
IntelFrameworkModulePkg, IntelFrameworkPkg, CryptoPkg, IntelFspPkg, 
IntelFspWrapperPkg and FatPkg can pass VS2015.
Ovmf can pass VS2015. Nt32 is failure in VS2015, still under investigation.

Other package owners can choose to fix or disable them in your own packages. 

Liming Gao (6):
  MdePkg: Disable VS2015 warning C4701 & C4703
  MdeModulePkg: Fix VS2015 warning C4459 in DriverSampleDxe
  MdeModulePkg: Fix VS2015 warning C4456 in RegularExpressionDxe
  MdeModulePkg: Fix VS2015 warning C4311 & C4312 in RegularExpressionDxe
  CryptoPkg: Disable VS2015 warning C4311 in OpensslLib
  OvmfPkg: Fix VS2015 warning C4459 in XenBusDxe

 CryptoPkg/Library/OpensslLib/OpensslLib.inf|  3 +-
 .../Universal/DriverSampleDxe/DriverSample.c   | 72 +++---
 .../RegularExpressionDxe/Oniguruma/enc/unicode.c   | 22 +++
 .../RegularExpressionDxe/Oniguruma/regexec.c   | 52 
 .../RegularExpressionDxe/Oniguruma/regint.h|  8 +--
 .../RegularExpressionDxe/Oniguruma/regparse.c  | 16 ++---
 MdePkg/Include/Ia32/ProcessorBind.h|  6 +-
 MdePkg/Include/X64/ProcessorBind.h |  6 +-
 OvmfPkg/XenBusDxe/XenStore.c   | 14 ++---
 9 files changed, 100 insertions(+), 99 deletions(-)

-- 
1.9.5.msysgit.0

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


[edk2] [Patch 1/6] MdePkg: Disable VS2015 warning C4701 & C4703

2015-12-02 Thread Liming Gao
C4701 & C4703 may cause false positive issues.
They have been disabled in VS2013.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 MdePkg/Include/Ia32/ProcessorBind.h | 6 +++---
 MdePkg/Include/X64/ProcessorBind.h  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/MdePkg/Include/Ia32/ProcessorBind.h 
b/MdePkg/Include/Ia32/ProcessorBind.h
index 22f07ca..458f7dd 100644
--- a/MdePkg/Include/Ia32/ProcessorBind.h
+++ b/MdePkg/Include/Ia32/ProcessorBind.h
@@ -93,7 +93,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 //
 #pragma warning ( disable : 4206 )
 
-#if _MSC_VER == 1800
+#if _MSC_VER == 1800 || _MSC_VER == 1900
 
 //
 // Disable these warnings for VS2013.
@@ -101,13 +101,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 //
 // This warning is for potentially uninitialized local variable, and it may 
cause false 
-// positive issues in VS2013 build
+// positive issues in VS2013 and VS2015 build
 //
 #pragma warning ( disable : 4701 )
   
 //
 // This warning is for potentially uninitialized local pointer variable, and 
it may cause 
-// false positive issues in VS2013 build
+// false positive issues in VS2013 and VS2015 build
 //
 #pragma warning ( disable : 4703 )
   
diff --git a/MdePkg/Include/X64/ProcessorBind.h 
b/MdePkg/Include/X64/ProcessorBind.h
index 81dbe18..705104a 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -94,7 +94,7 @@
 //
 #pragma warning ( disable : 4206 )
 
-#if _MSC_VER == 1800
+#if _MSC_VER == 1800 || _MSC_VER == 1900
 
 //
 // Disable these warnings for VS2013.
@@ -102,13 +102,13 @@
 
 //
 // This warning is for potentially uninitialized local variable, and it may 
cause false 
-// positive issues in VS2013 build
+// positive issues in VS2013 and VS2015 build
 //
 #pragma warning ( disable : 4701 )
   
 //
 // This warning is for potentially uninitialized local pointer variable, and 
it may cause 
-// false positive issues in VS2013 build
+// false positive issues in VS2013 and VS2015 build
 //
 #pragma warning ( disable : 4703 )
   
-- 
1.9.5.msysgit.0

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


Re: [edk2] [Patch 1/2] MdeModulePkg: Add PciSioSerialDxe driver

2015-12-02 Thread Tian, Feng
Suggest to use UINT64 for Offset field to be consistent with PciIo protocol 
definition.

Others look good to me

Reviewed-by: Feng Tian 

Thanks
Feng

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ni, Ruiyu
Sent: Monday, November 30, 2015 10:12
To: Kinney, Michael D
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] [Patch 1/2] MdeModulePkg: Add PciSioSerialDxe driver

Mike,
Could you please review whether the PCD structure defined as below is good?

+#pragma pack(1)
+///
+/// PcdPciSerialParameters contains zero or more instances of the below 
structure.
+/// If a PCI device contains multiple UARTs, PcdPciSerialParameters needs to 
contain
+/// two instances of the below structure, with the VendorId and DeviceId 
equals to the
+/// device ID and vendor ID of the device. If the PCI device uses the first 
two BARs
+/// to support multiple UARTs, BarIndex of first instance equals to 0 and 
BarIndex of
+/// second one equals to 1; if the PCI device uses the first BAR to support 
multiple
+/// UARTs, BarIndex of both instance equals to 0 and Offset of first instance 
equals
+/// to 0 while Offset of second one equals to some value bigger or equal to 8.
+/// For certain UART whose register needs to be accessed in DWORD aligned 
address,
+/// RegisterStride equals to 4.
+///
+typedef struct {
+  UINT16  VendorId;   ///< Vendor ID to match the PCI device, 0x 
terminates the entries
+  UINT16  DeviceId;   ///< Device ID to match the PCI device
+  UINT8   BarIndex;   ///< Which BAR to get the UART base address
+  UINT16  Offset; ///< The offset to the BAR 
+  UINT8   RegisterStride; ///< UART register stride, 0 to use 1 as register 
stride
+  UINT32  ClockRate;  ///< UART clock rate, 0 to use default clock rate 
1843200
+} PCI_SERIAL_PARAMETER;
+#pragma pack()

Regards,
Ray

-Original Message-
From: Ni, Ruiyu 
Sent: Wednesday, November 25, 2015 10:30 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Tian, Feng ; Kinney, 
Michael D 
Subject: [Patch 1/2] MdeModulePkg: Add PciSioSerialDxe driver

PciSioSerialDxe driver can manages UARTs on a SIO chip or a PCI/PCIE
card.
It manages the SIO instance whose last device path node is a ACPI
device path and the HID in the ACPI device path node equals to
EISA_PNP_ID (0x501).
It also manages the PCI IO instance whose class code is 7/0/2 (16550
UART). But when proper value is set to PcdPciSerialParameters, the
driver can also manage non-standard PCI serial cards by matching
the Vendor ID and Device ID specified in PcdPciSerialParameters.
The PCI BAR index, IO/MMIO offset, register stride, clock rate can
also be specified through the same PCD.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Feng Tian 
Cc: Michael Kinney 
---
 .../Bus/Pci/PciSioSerialDxe/ComponentName.c|  288 +
 .../Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf|   81 ++
 .../Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.uni|  Bin 0 -> 1940 bytes
 .../Pci/PciSioSerialDxe/PciSioSerialDxeExtra.uni   |  Bin 0 -> 1380 bytes
 MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c  | 1206 +++
 MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.h  |  787 +
 MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c| 1243 
 MdeModulePkg/MdeModulePkg.dec  |   34 +
 8 files changed, 3639 insertions(+)
 create mode 100644 MdeModulePkg/Bus/Pci/PciSioSerialDxe/ComponentName.c
 create mode 100644 MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf
 create mode 100644 MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.uni
 create mode 100644 
MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeExtra.uni
 create mode 100644 MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c
 create mode 100644 MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.h
 create mode 100644 MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c

diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/ComponentName.c 
b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/ComponentName.c
new file mode 100644
index 000..994dc84
--- /dev/null
+++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/ComponentName.c
@@ -0,0 +1,288 @@
+/** @file
+  UEFI Component Name and Name2 protocol for Isa serial driver.
+
+Copyright (c) 2006 - 2015, 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
+
+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 "Serial.h"
+
+//
+// EFI Component Name Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  
gPciSioSerialComponentName = {
+  SerialComponentNameGetDriverName,
+  SerialComponentNameGetControllerName,

[edk2] [PATCH] ShellPkg: Make 'dh' support showing all spec defined protocols.

2015-12-02 Thread Qiu Shumin
When using 'dh' to dump all protocols installed on a handle, some of them are 
shown as 'UnknownDevice'.
Device patch make 'dh' support all spec defined protocols.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey 
Reviewed-by: Qiu Shumin 
Reviewed-by: Ruiyu Ni 
---
 .../UefiHandleParsingLib/UefiHandleParsingLib.c| 123 +
 .../UefiHandleParsingLib/UefiHandleParsingLib.inf  | 115 +++
 .../UefiHandleParsingLib/UefiHandleParsingLib.uni  | Bin 32404 -> 48156 bytes
 3 files changed, 238 insertions(+)

diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c 
b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index b211de7..6f093ff 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -1026,6 +1026,124 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
   {STRING_TOKEN(STR_DISK_INFO), &gEfiDiskInfoProtocolGuid, 
   NULL},
 
 //
+// PI Spec 1.0
+//
+  {STRING_TOKEN(STR_BDS_ARCH),  &gEfiBdsArchProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_CPU_ARCH),  &gEfiCpuArchProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_MET_ARCH),  &gEfiMetronomeArchProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_MON_ARCH),  
&gEfiMonotonicCounterArchProtocolGuid,NULL},
+  {STRING_TOKEN(STR_RTC_ARCH),  
&gEfiRealTimeClockArchProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_RESET_ARCH),&gEfiResetArchProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_RT_ARCH),   &gEfiRuntimeArchProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_SEC_ARCH),  &gEfiSecurityArchProtocolGuid, 
   NULL},
+  {STRING_TOKEN(STR_TIMER_ARCH),&gEfiTimerArchProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_VAR_ARCH),  
&gEfiVariableWriteArchProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_V_ARCH),&gEfiVariableArchProtocolGuid, 
   NULL},
+  {STRING_TOKEN(STR_SECP),  &gEfiSecurityPolicyProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_WDT_ARCH),  
&gEfiWatchdogTimerArchProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_SCR),   
&gEfiStatusCodeRuntimeProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_SMB_HC),&gEfiSmbusHcProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_FV_2),  &gEfiFirmwareVolume2ProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_FV_BLOCK),  
&gEfiFirmwareVolumeBlockProtocolGuid, NULL},
+  {STRING_TOKEN(STR_CAP_ARCH),  &gEfiCapsuleArchProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_MP_SERVICE),&gEfiMpServiceProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_HBRAP), 
&gEfiPciHostBridgeResourceAllocationProtocolGuid, NULL},
+  {STRING_TOKEN(STR_PCIP),  &gEfiPciPlatformProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_PCIO),  &gEfiPciOverrideProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_PCIE),  
&gEfiPciEnumerationCompleteProtocolGuid,  NULL},
+  {STRING_TOKEN(STR_IPCID), 
&gEfiIncompatiblePciDeviceSupportProtocolGuid,NULL},
+  {STRING_TOKEN(STR_PCIHPI),&gEfiPciHotPlugInitProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_PCIHPR),
&gEfiPciHotPlugRequestProtocolGuid,   NULL},
+  {STRING_TOKEN(STR_SMBIOS),&gEfiSmbiosProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_S3_SAVE),   &gEfiS3SaveStateProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_S3_S_SMM),  &gEfiS3SmmSaveStateProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_RSC),   &gEfiRscHandlerProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_S_RSC), &gEfiSmmRscHandlerProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_ACPI_SDT),  &gEfiAcpiSdtProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_SIO),   &gEfiSioProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_S_CPU2),&gEfiSmmCpuIo2ProtocolGuid,
   NULL},
+  {STRING_TOKEN(STR_S_BASE2),   &gEfiSmmBase2ProtocolGuid, 
   NULL},
+  {STRING_TOKEN(STR_S_ACC_2),   &gEfiSmmAccess2ProtocolGuid,   
   NULL},
+  {STRING_TOKEN(STR_S_CON_2),   &gEfiSmmControl2ProtocolGuid,  
   NULL},
+  {STRING_TOKEN(STR_S_CONFIG),  &gEfiSmmConfigurationProtocolGuid, 
   NULL},
+  

Re: [edk2] [PATCH 1/1] BaseTools: sync BaseTools from main trunk r18579.

2015-12-02 Thread Fan, Jeff
Thanks. My compare tool skipped the build directory. I think I need to use git 
to sync all patches. :-)

Reviewed-By:  Jeff Fan 

-Original Message-
From: Mike Maslenkin [mailto:mike.maslen...@gmail.com] 
Sent: Wednesday, December 02, 2015 11:17 PM
To: edk2-de...@ml01.01.org
Cc: Mike Maslenkin; Fan, Jeff
Subject: [PATCH 1/1] BaseTools: sync BaseTools from main trunk r18579.

This patch fixes incomplete merge of multiple workspaces support.
Without this patch build fails with error similar to:

~/sources/edk2> build -p MdePkg/MdePkg.dsc -t GCC48 -a X64

Build environment: Linux-3.16.7-24-desktop-x86_64-with-SuSE-13.2-x86_64
Build start time: 17:15:43, Dec.02 2015

WORKSPACE= /home/user/sources/edk2
ECP_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EDK_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EFI_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EDK_TOOLS_PATH   = /home/user/sources/edk2/BaseTools

build.py...
 : error C0DE: Unknown fatal error when processing 
[/home/user/sources/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf]

(Please send email to edk2-de...@lists.sourceforge.net for help, attaching 
following call stack trace!)

(Python 2.7.8 on linux2) Traceback (most recent call last):
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 2033, in Main
MyBuild.Launch()
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 1788, in Launch
self._MultiThreadBuildPlatform()
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 1583, in _MultiThreadBuildPlatform
self.Progress
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 175, in __new__
if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, 
*args, **kwargs):
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 355, in _Init
Pkgs = list(PkgSet) + list(PGen.PackageList)
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1484, in _GetPackageList
for La in self.LibraryAutoGenList:
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1594, in _GetLibraryAutoGenList
self._GetAutoGenObjectList()
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1575, in _GetAutoGenObjectList
self.MetaFile
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 175, in __new__
if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, 
*args, **kwargs):
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 2199, in _Init
self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir)
  File 
"/home/user/sources/edk2/BaseTools/Source/Python/Common/MultipleWorkspace.py", 
line 94, in relpath
for Pkg in cls.PACKAGES_PATH:
TypeError: 'NoneType' object is not iterable

- Failed -
Build end time: 17:15:44, Dec.02 2015
Build total time: 00:00:01

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mike Maslenkin 
CC: Fan, Jeff 
---
 BaseTools/Source/Python/build/BuildReport.py |  5 +++--
 BaseTools/Source/Python/build/build.py   | 16 +++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 264607b00360..60e976c169a1 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -41,6 +41,7 @@ from Common.DataType import TAB_BRG_PCD  from Common.DataType 
import TAB_BRG_LIBRARY  from Common.DataType import TAB_BACK_SLASH  from 
Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
 
 ## Pattern to extract contents in EDK DXS files  gDxsDependencyPattern = 
re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL) @@ -1255,7 +1256,7 
@@ class FdRegionReport(object):
 for Pa in Wa.AutoGenObjectList:
 for ModuleKey in Pa.Platform.Modules:
 M = Pa.Platform.Modules[ModuleKey].M
-InfPath = os.path.join(Wa.WorkspaceDir, M.MetaFile.File)
+InfPath = mws.join(Wa.WorkspaceDir, M.MetaFile.File)
 self._GuidsDb[M.Guid.upper()] = "%s (%s)" % 
(M.Module.BaseName, InfPath)
 
 #
@@ -1277,7 +1278,7 @@ class FdRegionReport(object):
 Guid = 
GuidStructureByteArrayToGuidString(GuidValue).upper()
 for Section in Ffs.SectionList:
 try:
-ModuleSectFile = os.path.join(Wa.WorkspaceDir, 
Section.SectFileName)
+ModuleSectFile = mws.join(Wa.WorkspaceDir, 
+ Section.SectFileName)
 self.

[edk2] [PATCH] Add some ARM GICv3 init macros for ACPI 6.0

2015-12-02 Thread Dennis Chen
This patch adds some macros for initialization of GICv3 Distributor, cpu 
interface
and Redistributor components, plus a Distributor data strucure update according 
to
the ACPI 6.0 spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dennis Chen 
---
 EmbeddedPkg/Include/Library/AcpiLib.h| 20 
 MdePkg/Include/IndustryStandard/Acpi60.h |  3 ++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Include/Library/AcpiLib.h 
b/EmbeddedPkg/Include/Library/AcpiLib.h
index 42710fd..e88e57f 100644
--- a/EmbeddedPkg/Include/Library/AcpiLib.h
+++ b/EmbeddedPkg/Include/Library/AcpiLib.h
@@ -38,6 +38,12 @@
 GicDistHwId, GicDistBase, GicDistVector, EFI_ACPI_RESERVED_DWORD \
   }
 
+#define EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, 
GicDistVector, GicVersion) \
+  { \
+EFI_ACPI_6_0_GICD, sizeof (EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE), 
EFI_ACPI_RESERVED_WORD, \
+GicDistHwId, GicDistBase, GicDistVector, GicVersion \
+  }
+
 // Note the parking protocol is configured by UEFI if required
 #define EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, 
GicBase) \
   { \
@@ -54,12 +60,26 @@
 GsivId, GicRBase, Mpidr
  \
   }
 
+// Note the parking protocol is configured by UEFI if required
+#define EFI_ACPI_6_0_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, 
PmuIrq,\
+GicBase, GicVBase, GicHBase, GsivId, GicRBase) 
  \
+  {
  \
+EFI_ACPI_6_0_GIC, sizeof (EFI_ACPI_6_0_GIC_STRUCTURE), 
EFI_ACPI_RESERVED_WORD,   \
+GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase,   
  \
+GsivId, GicRBase, Mpidr
  \
+  }
+
 #define EFI_ACPI_6_0_GIC_MSI_FRAME_INIT(GicMsiFrameId, PhysicalBaseAddress, 
Flags, SPICount, SPIBase) \
   { \
 EFI_ACPI_6_0_GIC_MSI_FRAME, sizeof (EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE), 
EFI_ACPI_RESERVED_WORD, \
 GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase \
   }
 
+#define EFI_ACPI_6_0_GIC_REDISTRIBUTOR_INIT(RedisRegionAddr, RedisDiscLength) \
+  { \
+EFI_ACPI_6_0_GICR, sizeof (EFI_ACPI_6_0_GICR_STRUCTURE), 0, 
RedisRegionAddr, RedisDiscLength \
+  }
+
 //
 // SBSA Generic Watchdog
 //
diff --git a/MdePkg/Include/IndustryStandard/Acpi60.h 
b/MdePkg/Include/IndustryStandard/Acpi60.h
index 3dac316..b58574e 100644
--- a/MdePkg/Include/IndustryStandard/Acpi60.h
+++ b/MdePkg/Include/IndustryStandard/Acpi60.h
@@ -532,7 +532,8 @@ typedef struct {
   UINT32  GicId;
   UINT64  PhysicalBaseAddress;
   UINT32  SystemVectorBase;
-  UINT32  Reserved2;
+  UINT8   GicVersion;
+  UINT8   Reserved2[3];
 } EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE;
 
 ///
-- 
1.9.1

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


Re: [edk2] Where do I find the system table address for an EFI app ?

2015-12-02 Thread Kinney, Michael D
Shubha,

You can run the dmem command from the UEFI shell with no parameters, and it 
will show the UFI System Table address along with other standard table 
addresses.

Shell> dmem
Memory Address 0FD6E010 200 Bytes
  0FD6E010: 49 42 49 20 53 59 53 54-32 00 02 00 48 00 00 00  *IBI SYST2...H...*
. . .
  0FD6E200: AA AA 55 55 AA AA 55 55-55 55 AA AA 55 55 AA AA  *..UU....UU..*

Valid EFI Header at Address 0FD6E010
-
System: Table Structure size 0048 revision 00020032
ConIn (0F50A28C) ConOut (0F497054) StdErr (0F50A37C)
Runtime Services 0FD6EF90
Boot Services0F89B5C0
SAL System Table 
ACPI Table   0FCEE000
ACPI 2.0 Table   0FCEE014
MPS Table
SMBIOS Table 0FD63000

For a debugger, a platform can produce the EFI_DEBUG_IMAGE_INFO_TABLE.  UEFI 
Specification Section 17.4.2 describes how a debugger can find the UEFI System 
Table address from a structure that is on a 4MB boundary with a signature and a 
CRC.  This table also provides the list of LOADED_IMAGE_PROTOCOLs for PE/COFF 
images that have been loaded, so a debugger can load symbols.

Mike 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Carsey, Jaben
> Sent: Wednesday, December 2, 2015 9:42 AM
> To: Shubha Ramani ; edk2-devel@lists.01.org
> Cc: Carsey, Jaben 
> Subject: Re: [edk2] Where do I find the system table address for an EFI app ?
> 
> I am pretty sure it’s there in a shell app also.  What entry point lib are 
> you using to build your app?
> 
> -Jaben
> 
> From: Shubha Ramani [mailto:shubharam...@yahoo.com]
> Sent: Wednesday, December 02, 2015 9:11 AM
> To: Carsey, Jaben ; edk2-devel@lists.01.org
> Subject: Re: [edk2] Where do I find the system table address for an EFI app ?
> Importance: High
> 
> Not in a Shell App though. How do you answer to the debugger when it's asking 
> for the System Table address for a shell app ?
> 
> Thanks,
> 
> Shubha
> 
> Shubha D. Ramani
> shubharam...@gmail.com
> shubharam...@yahoo.com
> 
> 
> On Tuesday, December 1, 2015 8:39 AM, "Carsey, Jaben" 
> mailto:jaben.car...@intel.com>> wrote:
> 
> Its passed as a parameter to the "main" function when your app starts.
> 
> -Jaben
> 
> > -Original Message-
> > From: edk2-devel 
> > [mailto:edk2-devel-boun...@lists.01.org]
> >  On Behalf Of
> > Shubha Ramani
> > Sent: Tuesday, December 01, 2015 8:35 AM
> > To: edk2-devel@lists.01.org
> > Subject: Re: [edk2] Where do I find the system table address for an EFI app 
> > ?
> > Importance: High
> >
> >  I'm sorry but this was unclear. I meant where do I find the System Table
> > address for a UEFI Shell App ?The debugger is asking for it. I couldn't 
> > find it in
> > the generated *.map file.
> > Thanks
> > Shubha
> > Shubha D. ramanishubharam...@gmail.com
> > shubharam...@yahoo.com
> >
> >
> >On Monday, November 30, 2015 3:00 PM, Shubha Ramani
> > mailto:shubharam...@yahoo.com>> wrote:
> >
> >
> >  I'm trying to debug it using a debugger and the debugger is asking me this
> > question.
> > I looked at the *.map file which is generated and I could not locate the 
> > System
> > Table address.
> > Thanks,
> > Shubha Shubha D. 
> > ramanishubharam...@gmail.com
> > shubharam...@yahoo.com
> 
> >
> >
> > ___
> > 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-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] ShellPkg: Fix wrong return status for Ifconfig.c

2015-12-02 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Wednesday, December 02, 2015 4:54 PM
To: edk2-devel@lists.01.org
Cc: Carsey, Jaben; Ye, Ting; Cohen, Eugene
Subject: [edk2] [Patch] ShellPkg: Fix wrong return status for Ifconfig.c

The Ifconfig command handler tries to return an EFI_STATUS when the return type 
should be SHELL_STATUS.

Cc: Cohen, Eugene 
Cc: Carsey, Jaben 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 .../UefiShellNetwork1CommandsLib/Ifconfig.c| 102 ++---
 1 file changed, 69 insertions(+), 33 deletions(-)

diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c 
b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
index e16d46a..fb6f575 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
@@ -421,11 +421,11 @@ IfConfigGetInterfaceInfo (
   NULL,
   &HandleNum,
   &HandleBuffer
  );
   if (EFI_ERROR (Status) || (HandleNum == 0)) {
-return EFI_ABORTED;
+return Status;
   }
 
   //
   // Enumerate all handles that installed with ip4 service binding protocol.
   //
@@ -585,15 +585,15 @@ ON_ERROR:
 /**
   The list process of the ifconfig command.
 
   @param[in]   IfListThe pointer of IfList(interface list).
 
-  @retval EFI_SUCCESSThe ifconfig command list processed successfully.
+  @retval SHELL_SUCCESS  The ifconfig command list processed successfully.
   @retval others The ifconfig command list process failed.
 
 **/
-EFI_STATUS
+SHELL_STATUS
 IfConfigShowInterfaceInfo (
   IN LIST_ENTRY*IfList
   )
 {
   LIST_ENTRY   *Entry;
@@ -781,35 +781,37 @@ IfConfigShowInterfaceInfo (
 }
   }
   
   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_BREAK), 
gShellNetwork1HiiHandle);
 
-  return EFI_SUCCESS;
+  return SHELL_SUCCESS;
 }
 
 /**
   The clean process of the ifconfig command to clear interface info.
 
   @param[in]   IfListThe pointer of IfList(interface list).
 
-  @retval EFI_SUCCESSThe ifconfig command clean processed successfully.
+  @retval SHELL_SUCCESS  The ifconfig command clean processed successfully.
   @retval others The ifconfig command clean process failed.
 
 **/
-EFI_STATUS
+SHELL_STATUS
 IfConfigClearInterfaceInfo (
   IN LIST_ENTRY*IfList
   )
 {
-  EFI_STATUSStatus;
+  EFI_STATUSStatus;  
+  SHELL_STATUS  ShellStatus;
   LIST_ENTRY*Entry;
   LIST_ENTRY*Next;
   IFCONFIG_INTERFACE_CB *IfCb;
   EFI_IP4_CONFIG2_POLICYPolicy;
 
   Policy = Ip4Config2PolicyDhcp;
   Status = EFI_SUCCESS;
+  ShellStatus = SHELL_SUCCESS;
 
   if (IsListEmpty (IfList)) {
 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
   }
 
@@ -823,37 +825,37 @@ IfConfigClearInterfaceInfo (
 IfCb->IfCfg,
 Ip4Config2DataTypePolicy,
 sizeof (EFI_IP4_CONFIG2_POLICY),
 &Policy
 );
-
 if (EFI_ERROR (Status)) {
+  ShellStatus = SHELL_ACCESS_DENIED;
   break;
 }
   }
 
-  return Status;
+  return ShellStatus;
 }
 
 /**
   The set process of the ifconfig command.
 
   @param[in]   IfListThe pointer of IfList(interface list).
   @param[in]   VarArgThe pointer of ARG_LIST(Args with "-s" option).
 
-  @retval EFI_SUCCESSThe ifconfig command set processed successfully.
+  @retval SHELL_SUCCESS  The ifconfig command set processed successfully.
   @retval others The ifconfig command set process failed.
 
 **/
-EFI_STATUS
+SHELL_STATUS
 IfConfigSetInterfaceInfo (
   IN LIST_ENTRY*IfList,
   IN ARG_LIST  *VarArg
   )
 {
-
   EFI_STATUS   Status;
+  SHELL_STATUS ShellStatus;
   IFCONFIG_INTERFACE_CB*IfCb;
   VAR_CHECK_CODE   CheckCode;
   EFI_EVENTTimeOutEvt;
   EFI_EVENTMappedEvt;
   BOOLEAN  IsAddressOk;
@@ -870,18 +872,19 @@ IfConfigSetInterfaceInfo (
 
   Dns = NULL;
 
   if (IsListEmpty (IfList)) {
 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
-return EFI_INVALID_PARAMETER;
+return SHELL_INVALID_PARAMETER;
   }
   
   //
   // Make sure to set only one interface each time.
   //
   IfCb   = NET_LIST_USER_STRUCT (IfList->ForwardLink, IFCONFIG_INTERFACE_CB, 
Link);
   Status = EFI_SUCCESS;
+  ShellStatus = SHELL_SUCCESS;
 
   //
   // Initialize check list mechanism.
   //
   CheckCode = IfConfigRetriveCheckListByName( @@ -899,10 +902,11 @@ 
IfConfigSetInterfaceInfo (
   NULL,

Re: [edk2] MdeModulePkg: DebugAssert enhancement

2015-12-02 Thread Kinney, Michael D
Baranee,

I also think the following line could be changed for smaller code gen from:

+  ModuleNameSize   = AsciiStrLen("[") + AsciiStrLen (gEfiCallerBaseName) + 
AsciiStrLen("] ");

To:

+  //
+  // Compute string size of module name enclosed by []
+  //
+  ModuleNameSize   = 2 + AsciiStrSize (gEfiCallerBaseName);

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gao, 
> Liming
> Sent: Wednesday, December 2, 2015 6:07 PM
> To: Anbazhagan, Baraneedharan ; edk2-devel@lists.01.org
> Subject: Re: [edk2] MdeModulePkg: DebugAssert enhancement
> 
> Baranee:
>   Could you use CopyMem() to fill gEfiCallerBaseName instead of 
> AsciiSPrint()? This library instance is for size optimization. So, it uses
> CopyMem() to fill FileName and Description.
> 
> Thanks
> Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Anbazhagan, Baraneedharan
> Sent: Wednesday, December 02, 2015 11:42 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] MdeModulePkg: DebugAssert enhancement
> 
> If the assert happens in a library, then it's hard to determine which module 
> using that library is generating that assert.
> Use gEfiCallerBaseName in DebugAssert to display the module name.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Baraneedharan Anbazhagan 
> ---
>  .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 58 
> ++
>  .../PeiDxeDebugLibReportStatusCode.inf |  1 +
>  2 files changed, 39 insertions(+), 20 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
> b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
> index f1d9827..af369ea 100644
> --- a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
> +++ b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
> @@ -22,6 +22,7 @@
> 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include   #include  @@ 
> -261,6 +262,7 @@ DebugAssert (
>UINTN  HeaderSize;
>UINTN  TotalSize;
>CHAR8  *Temp;
> +  UINTN  ModuleNameSize;
>UINTN  FileNameSize;
>UINTN  DescriptionSize;
> 
> @@ -268,31 +270,37 @@ DebugAssert (
>// Get string size
>//
>HeaderSize   = sizeof (EFI_DEBUG_ASSERT_DATA);
> +  ModuleNameSize   = AsciiStrLen("[") + AsciiStrLen (gEfiCallerBaseName) + 
> AsciiStrLen("] ");
>FileNameSize = AsciiStrSize (FileName);
>DescriptionSize  = AsciiStrSize (Description);
> 
>//
>// Make sure it will all fit in the passed in buffer.
>//
> -  if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
> +  if (HeaderSize + ModuleNameSize + FileNameSize + DescriptionSize >
> + sizeof (Buffer)) {
>  //
> -// FileName + Description is too long to be filled into buffer.
> +// remove module name if it's too long to be filled into buffer
>  //
> -if (HeaderSize + FileNameSize < sizeof (Buffer)) {
> +ModuleNameSize = 0;
> +if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer))
> + {
>//
> -  // Description has enough buffer to be truncated.
> +  // FileName + Description is too long to be filled into buffer.
>//
> -  DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
> -} else {
> -  //
> -  // FileName is too long to be filled into buffer.
> -  // FileName will be truncated. Reserved one byte for Description NULL 
> terminator.
> -  //
> -  DescriptionSize = 1;
> -  FileNameSize= sizeof (Buffer) - HeaderSize - DescriptionSize;
> +  if (HeaderSize + FileNameSize < sizeof (Buffer)) {
> +//
> +// Description has enough buffer to be truncated.
> +//
> +DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
> +  } else {
> +//
> +// FileName is too long to be filled into buffer.
> +// FileName will be truncated. Reserved one byte for Description 
> NULL terminator.
> +//
> +DescriptionSize = 1;
> +FileNameSize= sizeof (Buffer) - HeaderSize - DescriptionSize;
> +  }
>  }
>}
> -
>//
>// Fill in EFI_DEBUG_ASSERT_DATA
>//
> @@ -300,17 +308,27 @@ DebugAssert (
>AssertData->LineNumber = (UINT32)LineNumber;
>TotalSize  = sizeof (EFI_DEBUG_ASSERT_DATA);
> 
> -  //
> -  // Copy Ascii FileName including NULL terminator.
> -  //
> -  Temp = CopyMem (AssertData + 1, FileName, FileNameSize);
> -  Temp[FileNameSize - 1] = 0;
> -  TotalSize += FileNameSize;
> +  Temp = (CHAR8 *)(AssertData + 1);
> +  if (ModuleNameSize != 0) {
> +//
> +// Copy Ascii ModuleName & FileName including NULL terminator
> +//
> +AsciiSPrint(Temp, ModuleNameSize + FileNameSize, "[%a] %a", 
> gEfiCallerBaseName, FileName);
> +TotalSize += (ModuleNameSize + FileNam

Re: [edk2] MdeModulePkg: DebugAssert enhancement

2015-12-02 Thread Gao, Liming
Baranee:
  Could you use CopyMem() to fill gEfiCallerBaseName instead of AsciiSPrint()? 
This library instance is for size optimization. So, it uses CopyMem() to fill 
FileName and Description.

Thanks
Liming
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Anbazhagan, Baraneedharan
Sent: Wednesday, December 02, 2015 11:42 PM
To: edk2-devel@lists.01.org
Subject: [edk2] MdeModulePkg: DebugAssert enhancement

If the assert happens in a library, then it's hard to determine which module 
using that library is generating that assert.
Use gEfiCallerBaseName in DebugAssert to display the module name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Baraneedharan Anbazhagan 
---
 .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 58 ++
 .../PeiDxeDebugLibReportStatusCode.inf |  1 +
 2 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c 
b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index f1d9827..af369ea 100644
--- a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
+++ b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include   #include  @@ 
-261,6 +262,7 @@ DebugAssert (
   UINTN  HeaderSize;
   UINTN  TotalSize;
   CHAR8  *Temp;
+  UINTN  ModuleNameSize;
   UINTN  FileNameSize;
   UINTN  DescriptionSize;
 
@@ -268,31 +270,37 @@ DebugAssert (
   // Get string size
   //
   HeaderSize   = sizeof (EFI_DEBUG_ASSERT_DATA);
+  ModuleNameSize   = AsciiStrLen("[") + AsciiStrLen (gEfiCallerBaseName) + 
AsciiStrLen("] ");
   FileNameSize = AsciiStrSize (FileName);
   DescriptionSize  = AsciiStrSize (Description);
 
   //
   // Make sure it will all fit in the passed in buffer.
   //
-  if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
+  if (HeaderSize + ModuleNameSize + FileNameSize + DescriptionSize > 
+ sizeof (Buffer)) {
 //
-// FileName + Description is too long to be filled into buffer. 
+// remove module name if it's too long to be filled into buffer
 //
-if (HeaderSize + FileNameSize < sizeof (Buffer)) {
+ModuleNameSize = 0;
+if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) 
+ {
   //
-  // Description has enough buffer to be truncated. 
+  // FileName + Description is too long to be filled into buffer. 
   //
-  DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
-} else {
-  //
-  // FileName is too long to be filled into buffer.
-  // FileName will be truncated. Reserved one byte for Description NULL 
terminator.
-  //
-  DescriptionSize = 1;
-  FileNameSize= sizeof (Buffer) - HeaderSize - DescriptionSize;
+  if (HeaderSize + FileNameSize < sizeof (Buffer)) {
+//
+// Description has enough buffer to be truncated. 
+//
+DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
+  } else {
+//
+// FileName is too long to be filled into buffer.
+// FileName will be truncated. Reserved one byte for Description NULL 
terminator.
+//
+DescriptionSize = 1;
+FileNameSize= sizeof (Buffer) - HeaderSize - DescriptionSize;
+  }
 }
   }
- 
   //
   // Fill in EFI_DEBUG_ASSERT_DATA
   //
@@ -300,17 +308,27 @@ DebugAssert (
   AssertData->LineNumber = (UINT32)LineNumber;
   TotalSize  = sizeof (EFI_DEBUG_ASSERT_DATA);
 
-  //
-  // Copy Ascii FileName including NULL terminator.
-  //
-  Temp = CopyMem (AssertData + 1, FileName, FileNameSize);
-  Temp[FileNameSize - 1] = 0;
-  TotalSize += FileNameSize;
+  Temp = (CHAR8 *)(AssertData + 1);
+  if (ModuleNameSize != 0) {
+//
+// Copy Ascii ModuleName & FileName including NULL terminator
+//
+AsciiSPrint(Temp, ModuleNameSize + FileNameSize, "[%a] %a", 
gEfiCallerBaseName, FileName);
+TotalSize += (ModuleNameSize + FileNameSize);  } else {
+//
+// Copy Ascii FileName including NULL terminator.
+//
+Temp = CopyMem (Temp, FileName, FileNameSize);
+Temp[FileNameSize - 1] = 0;
+TotalSize += FileNameSize;
+  }
+  
 
   //
   // Copy Ascii Description include NULL terminator.
   //
-  Temp = CopyMem (Temp + FileNameSize, Description, DescriptionSize);
+  Temp = CopyMem (Temp + ModuleNameSize + FileNameSize, Description, 
DescriptionSize);
   Temp[DescriptionSize - 1] = 0;
   TotalSize += DescriptionSize;
 
diff --git 
a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
index 5544667..50f60c7 100644
--- 
a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
+++ 
b/

Re: [edk2] [PATCH 1/5] IntelFrameworkModulePkg: remove unreachable code

2015-12-02 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Thursday, December 03, 2015 1:03 AM
To: edk2-devel@lists.01.org; ler...@redhat.com; Gao, Liming; Zhang, Chao B; 
Carsey, Jaben; Qiu, Shumin; Fan, Jeff; Tian, Feng
Cc: Ard Biesheuvel
Subject: [PATCH 1/5] IntelFrameworkModulePkg: remove unreachable code

Some compilers (like RVCT) are finicky about unreachable code, so remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c 
b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
index eefec0642a70..1020e84c3d64 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
@@ -869,7 +869,6 @@ ConvertBmpToGopBlt (
   *GopBlt = NULL;
 }
 return EFI_UNSUPPORTED;
-break;
   };
 
 }
--
1.9.1

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


Re: [edk2] [PATCH 2/5] MdeModulePkg: remove unreachable code

2015-12-02 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Thursday, December 03, 2015 1:03 AM
To: edk2-devel@lists.01.org; ler...@redhat.com; Gao, Liming; Zhang, Chao B; 
Carsey, Jaben; Qiu, Shumin; Fan, Jeff; Tian, Feng
Cc: Ard Biesheuvel
Subject: [PATCH 2/5] MdeModulePkg: remove unreachable code

Some compilers (like RVCT) are finicky about unreachable code, so remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c   | 3 ---
 MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c | 1 -
 MdeModulePkg/Universal/SetupBrowserDxe/Expression.c  | 1 -
 3 files changed, 5 deletions(-)

diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
index daa8c124..732dd2f3de7a 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
@@ -229,7 +229,6 @@ ReadString (
 return EFI_DEVICE_ERROR;
   }
 
-  break;
 
 case CHAR_BACKSPACE:
   if (StringPtr[0] != CHAR_NULL && CurrentCursor != 0) { @@ -881,7 +880,6 
@@ TheKey2:
 }
 
 goto EnterCarriageReturn;
-break;
 
   case SCAN_UP:
   case SCAN_DOWN:
@@ -982,7 +980,6 @@ EnterCarriageReturn:
   }
 
   return EFI_SUCCESS;
-  break;
 
 case CHAR_BACKSPACE:
   if (ManualInput) {
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
index c074f4b4a39a..bb2faf3244d4 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
@@ -568,7 +568,6 @@ PrintFormattedNumber (
 
   default:
 return EFI_UNSUPPORTED;
-break;
   }
 
   UnicodeSPrint (FormattedNumber, BufferSize, Format, Value); diff --git 
a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
index 688a1d66cb40..9a18dec5c03b 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
@@ -3170,7 +3170,6 @@ EvaluateExpression (
   //
   Status = EFI_UNSUPPORTED;
   goto Done;
-  break;
 }
   } else {
 //
--
1.9.1

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


Re: [edk2] [PATCH] BaseTools PatchCheck.py: Support binary diff

2015-12-02 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jordan 
Justen
Sent: Wednesday, December 02, 2015 8:24 AM
To: edk2-devel@lists.01.org
Cc: Justen, Jordan L; Gao, Liming
Subject: [edk2] [PATCH] BaseTools PatchCheck.py: Support binary diff

This allows a patch with binary data that is generated with --binary to be 
parsed by the PatchCheck.py script.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Yonghong Zhu 
Cc: Liming Gao 
---
 BaseTools/Scripts/PatchCheck.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py 
index 340a997..455c130 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -285,6 +285,10 @@ class GitDiffCheck:
 self.set_filename(line[6:].rstrip())
 if line.startswith('@@ '):
 self.state = PATCH
+self.binary = False
+elif line.startswith('GIT binary patch'):
+self.state = PATCH
+self.binary = True
 else:
 ok = False
 for pfx in self.pre_patch_prefixes:
@@ -294,6 +298,8 @@ class GitDiffCheck:
 self.format_error("didn't find diff hunk marker (@@)")
 self.line_num += 1
 elif self.state == PATCH:
+if self.binary:
+pass
 if line.startswith('-'):
 pass
 elif line.startswith('+'):
--
2.6.2

___
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 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py script

2015-12-02 Thread Kinney, Michael D
Jordan,

Good.  I was hoping it did not add the BOM...because that would still be a 
binary file I think.

I really appreciate you working on the reverse conversion.  

Mike

> -Original Message-
> From: Justen, Jordan L
> Sent: Wednesday, December 2, 2015 4:25 PM
> To: Kinney, Michael D ; edk2-devel@lists.01.org; 
> Kinney, Michael D 
> Cc: Carsey, Jaben ; Gao, Liming 
> Subject: RE: [edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py 
> script
> 
> On 2015-12-02 15:30:42, Kinney, Michael D wrote:
> > Jordan,
> >
> > Do the UTF-8 files generated include a BOM?
> 
> https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
> 
> "The UTF-8 representation of the BOM is the byte sequence
>  0xEF,0xBB,0xBF."
> 
>  ...
> 
> "The Unicode Standard permits the BOM in UTF-8, but does not require
>  or recommend its use."
> 
> This conversion script does not add a BOM to the files. I think the
> BOM might be rarely used, so I wouldn't be surprised if there were
> some applications that might be confused by it.
> 
> > Just in case someone depends on UNI files in UTF-16LE format, do you
> > think it makes sense for this script to support conversion to from
> > UTF-8 to UTF-16LE too? Or add a second script to that conversion?
> 
> I don't think the BOM issue should prevent converting back to utf-16.
> (We can look for the lack of the UTF-16 BOM.)
> 
> I considered if the script should handle both conversions, but I'm not
> too interested in the utf-8 => utf-16 conversion, so I figured I'd
> take the easy path. :)
> 
> Do I need to do the other conversion to let this change proceed? Or
> can someone on your team handle that? (If it is actually needed...)
> 
> I can also rename the script to ConvertUni.py and add a --utf-8 switch
> for now. Then we could later add --utf-16 to the same script. (Darn,
> now I've thought about it enough that I'll probably just add the other
> conversion. :)
> 
> -Jordan
> 
> >
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> > > Jordan Justen
> > > Sent: Wednesday, December 2, 2015 2:17 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Carsey, Jaben ; Justen, Jordan L 
> > > ; Gao, Liming 
> > > Subject: [edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py 
> > > script
> > >
> > > This script uses python codecs to convert .uni string files from
> > > utf-16 to utf-8.
> > >
> > > The advantages of utf-8 data:
> > >  * Generally smaller files
> > >  * More commonly supported by editors
> > >  * Not treated as binary data in patch files
> > >
> > > Cc: Yonghong Zhu 
> > > Cc: Liming Gao 
> > > Cc: Jaben Carsey 
> > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > Signed-off-by: Jordan Justen 
> > > ---
> > >  BaseTools/Scripts/ConvertUtf16ToUtf8.py | 123 
> > > 
> > >  1 file changed, 123 insertions(+)
> > >  create mode 100755 BaseTools/Scripts/ConvertUtf16ToUtf8.py
> > >
> > > diff --git a/BaseTools/Scripts/ConvertUtf16ToUtf8.py 
> > > b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> > > new file mode 100755
> > > index 000..5f54603
> > > --- /dev/null
> > > +++ b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> > > @@ -0,0 +1,123 @@
> > > +## @file
> > > +#  Check a patch for various format issues
> > > +#
> > > +#  Copyright (c) 2015, 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
> > > +#
> > > +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > > +#  BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > > +#  EXPRESS OR IMPLIED.
> > > +#
> > > +
> > > +from __future__ import print_function
> > > +
> > > +VersionNumber = '0.1'
> > > +__copyright__ = "Copyright (c) 2015, Intel Corporation  All rights 
> > > reserved."
> > > +
> > > +import argparse
> > > +import codecs
> > > +import os
> > > +import sys
> > > +
> > > +try:
> > > +from io import StringIO
> > > +except ImportError:
> > > +from StringIO import StringIO
> > > +
> > > +class ConvertOneArg:
> > > +"""Converts utf-16 to utf-8 for one command line argument.
> > > +
> > > +   This could be a single file, or a directory.
> > > +"""
> > > +
> > > +def __init__(self, source):
> > > +self.source = source
> > > +
> > > +self.ok = True
> > > +
> > > +if not os.path.exists(source):
> > > +self.ok = False
> > > +elif os.path.isdir(source):
> > > +for (root, dirs, files) in os.walk(source):
> > > +files = filter(lambda a: a.endswith('.uni'), files)
> > > +for filename in files:
> > > +path = os.path.join(root, filename)
> > > +self.ok &= self.

Re: [edk2] ifconfig command issue in edk2

2015-12-02 Thread Wu, Jiaxin
Hi Shaveta,
Thanks for your finding, we have rootcause the hang issue in ifconfig , and 
will fix it as soon as possible.

Thanks.
Jiaxin

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ye, Ting
Sent: Wednesday, December 2, 2015 9:21 AM
To: Leekha Shaveta; edk2-devel@lists.01.org
Cc: Sharma Bhupesh
Subject: Re: [edk2] ifconfig command issue in edk2

Hi Shaveta,

We will try to reproduce the ASSERT issue at first. We will investigate how to 
fix it as soon as we can reproduce this, or back to you once we fail to 
reproduce.

For below one, it seems you split the ifconfig command to two parts, and shell 
does not recognize the second part as 'con' is not a command.

Shell> ifconfig -s eth0 static 192.168.112 ifconfig -s eth0 static 
Shell> 192.169 con
'con' is not recognized as an internal or external command, operable program, 
or script file.

Best Regards,
Ye Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leekha 
Shaveta
Sent: Tuesday, December 01, 2015 7:53 PM
To: edk2-devel@lists.01.org
Cc: Sharma Bhupesh
Subject: [edk2] ifconfig command issue in edk2

Hi,

I am observing one issue while using "ifconfig" command.

When ifconfig command is used with incomplete parameters like below, it hangs 
the system by throwing an ASSERT:

Shell> ifconfig -s eth0 static 192.168.2.142
ASSERT 
/home/jenkins/ci/sdk/sdk-ls1043a/ls1043ardb/ls1043a-uefi/MdePkg/Library/BaseLib/String.c(173):
 ((UINTN) String & 0x0001) == 0


Whereas in some other cases, it simply returns to prompt:
Shell> ifconfig -s eth0 static 192.168.112 ifconfig -s eth0 static 
Shell> 192.169 con
'con' is not recognized as an internal or external command, operable program, 
or script file.
Shell>


Is this some known issue or any pointer why is this happening?

Regards,
Shaveta

-Original Message-
From: Leekha Shaveta-B20052
Sent: Thursday, September 24, 2015 1:17 PM
To: 'Ye, Ting' ; edk2-devel@lists.01.org
Subject: RE: Ping 1st packet reply missing

Hi Ye Ting

Ping issue is resolved now.

I found in some old edk2 mails that it was some issue in Ping command 
implementation(Snippet pasted below).
After making TxRing ready beforehand, this issue get resolved now.

But TFTP issue is the one, I am still facing, any pointers on that?

Thanks and Regards,
Shaveta

Snippet of that mail chain issue :

Re: [edk2] Missing Ping Reply
The reason that the reply is missing is because when the reply is received and 
"Ping6OnEchoReplyReceived" is called, it kicks out in the call to 
"Ping6MatchEchoReply". The reason that reply does not match because there is no 
entry in the TxList when reply is received. 
In the function "PingSendEchoRequest", the ICMP message is sent out first 
before the entry is inserted into TxList. The reply comes back before the call 
comes back from "Transmit" function of the IPV4 protocol. 

-Original Message-
From: Ye, Ting [mailto:ting...@intel.com]
Sent: Thursday, September 24, 2015 1:01 PM
To: Leekha Shaveta-B20052 ; edk2-devel@lists.01.org
Subject: RE: Ping 1st packet reply missing

We did not meet this error before. Could you please share your captured packet 
and network topology for analysis? 

Best Regards,
Ye Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leekha 
Shaveta
Sent: Thursday, September 24, 2015 1:45 PM
To: edk2-devel@lists.01.org
Subject: [edk2] Ping 1st packet reply missing


Hi,

My ping is working  with Intel's E1000 driver code.

But everytime 1st packet is not getting received successfully, is there some 
known issue here, or something to be set/missing?

Regards,
Shaveta

Ping Snippet:
===
Shell> ping 192.168.3.1ping 192.168.3.1 -n 16
InstallProtocolInterface: 41D94CD2-35B6-455A-8258-D4E51334AADD DF56EA60 Ping 
192.168.3.1 16 data bytes.
GigAdapter->cur_rx_ind: 0
GigAdapter->cur_rx_ind: 1
16 bytes from 192.168.3.1 : icmp_seq=2 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 2
16 bytes from 192.168.3.1 : icmp_seq=3 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 3
16 bytes from 192.168.3.1 : icmp_seq=4 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 4
16 bytes from 192.168.3.1 : icmp_seq=5 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 5
16 bytes from 192.168.3.1 : icmp_seq=6 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 6
16 bytes from 192.168.3.1 : icmp_seq=7 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 7
16 bytes from 192.168.3.1 : icmp_seq=8 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 0
16 bytes from 192.168.3.1 : icmp_seq=9 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 1
16 bytes from 192.168.3.1 : icmp_seq=10 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 2
16 bytes from 192.168.3.1 : icmp_seq=11 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 3
16 bytes from 192.168.3.1 : icmp_seq=12 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 4
16 bytes from 192.168.3.1 : icmp_seq=13 ttl=0 time=1ms
GigAdapter->cur_rx_ind: 5
16 bytes from 192.168.3.1 : icmp_seq=14 ttl=0 time=1ms
GigAdapter

Re: [edk2] [PATCH] MdeModulePkg: allow DxeIpl to load without permanent memory to enable S3 resume from temporary memory

2015-12-02 Thread Zeng, Star

On 2015/12/3 2:58, Cohen, Eugene wrote:

Star,


Do you have the patch tested on your real platforms (with and without
InstallPeiMemory()?


Yes, we've been running this way for a couple years.  I had it on my list of 
changes to upstream and forgot about it until now.  The only other requirement 
for this to work correctly is for the memory intiialization driver to not call 
InstallPeiMemory on S3 resume.


Thanks for the information.




Current code will install Decompress and Extraction PPI for both normal and
S3 path in entry point, but Decompress and Extraction PPI need to use
AllocatePages() that only works after memory discovered as PI spec
describes.
Then should the code be also updated to install Decompress and Extraction
PPI in memory discovered ppi notify with
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH?


This makes sense to me - don't publish a service that cannot be handled.  So as 
long as S3 resume doesn't require section extraction (which seems unlikely) 
then DXE IPL can just expose the reduced set of PPIs.  Do you want to propose 
something or shall I?


S3 still need the PPIs in case platform have InstallPeiMemory() call and 
compressed PEIM even at S3 path. So the code can't to do not install the 
PPIs at S3 path.

Please go to propose the code change.

Thanks,
Star



Thanks,

Eugene



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


Re: [edk2] [Patch 2/2] ShellPkg/mm: Fix mm to support multiple root bridge platform

2015-12-02 Thread Ni, Ruiyu
Jaben,
you mean to change
  VERSION_STRING = 1.0
to 
  VERSION_STRING = 1.1
?
Regards,
Ray


-Original Message-
From: Carsey, Jaben 
Sent: Thursday, December 3, 2015 1:27 AM
To: Ni, Ruiyu ; edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Qiu, Shumin ; Carsey, 
Jaben 
Subject: RE: [edk2] [Patch 2/2] ShellPkg/mm: Fix mm to support multiple root 
bridge platform

I propose to rev the version of the library + 0.1 in the INF file?

Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ruiyu Ni
> Sent: Tuesday, December 01, 2015 9:54 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Qiu, Shumin 
> Subject: [edk2] [Patch 2/2] ShellPkg/mm: Fix mm to support multiple root
> bridge platform
> Importance: High
> 
> In multiple root bridge platforms, different root bridges may
> share the same segment but occupy different range of buses,
> or may occupy different segments.
> The fix is to find the correct root bridge IO instance by
> comparing not only the segment but also the bus ranges.
> Directly use Cpu Io for MMIO and IO accesses because some MMIO
> or IO is not occupied by PCI devices so it doesn't make sense
> to use root bridge IO to access them.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni 
> Cc: Shumin Qiu 
> ---
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c   | 329 +++-
> -
>  .../UefiShellDebug1CommandsLib.h   |   3 +-
>  .../UefiShellDebug1CommandsLib.inf |   1 +
>  .../UefiShellDebug1CommandsLib.uni | Bin 139696 -> 139768 
> bytes
>  4 files changed, 181 insertions(+), 152 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> index ca64f2c..fa1451c 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> @@ -2,7 +2,7 @@
>Main file for Mm shell Debug1 function.
> 
>(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
> -  Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.
> +  Copyright (c) 2005 - 2015, 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
> @@ -19,12 +19,30 @@
>  #include 
> 
>  typedef enum {
> -  EfiMemory,
> -  EFIMemoryMappedIo,
> -  EfiIo,
> -  EfiPciConfig,
> -  EfiPciEConfig
> -} EFI_ACCESS_TYPE;
> +  ShellMmMemory,
> +  ShellMmMemoryMappedIo,
> +  ShellMmIo,
> +  ShellMmPci,
> +  ShellMmPciExpress
> +} SHELL_MM_ACCESS_TYPE;
> +
> +typedef struct {
> +  UINT64 Register : 12;
> +  UINT64 Function : 8;
> +  UINT64 Device : 8;
> +  UINT64 Bus : 8;
> +  UINT64 Segment : 8;
> +  UINT64 Reserved : 20;
> +} SHELL_MM_PCIE_ADDRESS;
> +
> +typedef struct {
> +  UINT64 Register : 8;
> +  UINT64 Function : 8;
> +  UINT64 Device : 8;
> +  UINT64 Bus : 8;
> +  UINT64 Segment : 8;
> +  UINT64 Reserved : 24;
> +} SHELL_MM_PCI_ADDRESS;
> 
>  STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
>{L"-mmio", TypeFlag},
> @@ -37,7 +55,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
>{NULL, TypeMax}
>};
> 
> -STATIC CONST UINT64 MaxNum[9]  = { 0xff, 0x, 0x,
> 0xULL };
> +STATIC CONST UINT64 mShellMmMaxNumber[9]  = { 0xff, 0x, 0x,
> 0xULL };
> 
>  /**
>Read some data into a buffer from memory.
> @@ -176,22 +194,43 @@ GetHex (
>  }
> 
>  /**
> -  Get the PCI-E Address from a PCI address format 0xssbbddffrrr
> -  where ss is SEGMENT, bb is BUS, dd is DEVICE, ff is FUNCTION
> -  and rrr is REGISTER (extension format for PCI-E).
> -
> -  @param[in] InputAddress   PCI address format on input.
> -  @param[out]PciEAddressPCI-E address extention format.
> +  Extract the PCI segment, bus, device, function, register from
> +  from a SHELL_MM_PCI or SHELL_MM_PCIE format of address..
> +
> +  @param[in]  AccessType Access type.
> +  @param[in]  AddressSHELL_MM_PCI or SHELL_MM_PCIE address.
> +  @param[out] SegmentPCI segment number.
> +  @param[out] BusPCI bus number.
> +  @param[out] Device PCI device number.
> +  @param[out] Function   PCI function number.
> +  @param[out] Register   PCI register offset.
>  **/
>  VOID
>  EFIAPI
> -GetPciEAddressFromInputAddress (
> -  IN UINT64 InputAddress,
> -  OUT UINT64*PciEAddress
> +ShellMmDecodePciAddress (
> +  IN SHELL_MM_ACCESS_TYPE   AccessType,
> +  IN UINT64 Address,
> +  OUT UINT32*Segment,
> +  OUT UINT8 *Bus,
> +  OUT UINT8 *Device,
> +  OUT UINT8 *Function,
> +  O

Re: [edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py script

2015-12-02 Thread Jordan Justen
On 2015-12-02 15:30:42, Kinney, Michael D wrote:
> Jordan,
> 
> Do the UTF-8 files generated include a BOM?

https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8

"The UTF-8 representation of the BOM is the byte sequence
 0xEF,0xBB,0xBF."

 ...

"The Unicode Standard permits the BOM in UTF-8, but does not require
 or recommend its use."

This conversion script does not add a BOM to the files. I think the
BOM might be rarely used, so I wouldn't be surprised if there were
some applications that might be confused by it.

> Just in case someone depends on UNI files in UTF-16LE format, do you
> think it makes sense for this script to support conversion to from
> UTF-8 to UTF-16LE too? Or add a second script to that conversion?

I don't think the BOM issue should prevent converting back to utf-16.
(We can look for the lack of the UTF-16 BOM.)

I considered if the script should handle both conversions, but I'm not
too interested in the utf-8 => utf-16 conversion, so I figured I'd
take the easy path. :)

Do I need to do the other conversion to let this change proceed? Or
can someone on your team handle that? (If it is actually needed...)

I can also rename the script to ConvertUni.py and add a --utf-8 switch
for now. Then we could later add --utf-16 to the same script. (Darn,
now I've thought about it enough that I'll probably just add the other
conversion. :)

-Jordan

> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> > Jordan Justen
> > Sent: Wednesday, December 2, 2015 2:17 PM
> > To: edk2-devel@lists.01.org
> > Cc: Carsey, Jaben ; Justen, Jordan L 
> > ; Gao, Liming 
> > Subject: [edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py 
> > script
> > 
> > This script uses python codecs to convert .uni string files from
> > utf-16 to utf-8.
> > 
> > The advantages of utf-8 data:
> >  * Generally smaller files
> >  * More commonly supported by editors
> >  * Not treated as binary data in patch files
> > 
> > Cc: Yonghong Zhu 
> > Cc: Liming Gao 
> > Cc: Jaben Carsey 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Jordan Justen 
> > ---
> >  BaseTools/Scripts/ConvertUtf16ToUtf8.py | 123 
> > 
> >  1 file changed, 123 insertions(+)
> >  create mode 100755 BaseTools/Scripts/ConvertUtf16ToUtf8.py
> > 
> > diff --git a/BaseTools/Scripts/ConvertUtf16ToUtf8.py 
> > b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> > new file mode 100755
> > index 000..5f54603
> > --- /dev/null
> > +++ b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> > @@ -0,0 +1,123 @@
> > +## @file
> > +#  Check a patch for various format issues
> > +#
> > +#  Copyright (c) 2015, 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
> > +#
> > +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > +#  BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > +#  EXPRESS OR IMPLIED.
> > +#
> > +
> > +from __future__ import print_function
> > +
> > +VersionNumber = '0.1'
> > +__copyright__ = "Copyright (c) 2015, Intel Corporation  All rights 
> > reserved."
> > +
> > +import argparse
> > +import codecs
> > +import os
> > +import sys
> > +
> > +try:
> > +from io import StringIO
> > +except ImportError:
> > +from StringIO import StringIO
> > +
> > +class ConvertOneArg:
> > +"""Converts utf-16 to utf-8 for one command line argument.
> > +
> > +   This could be a single file, or a directory.
> > +"""
> > +
> > +def __init__(self, source):
> > +self.source = source
> > +
> > +self.ok = True
> > +
> > +if not os.path.exists(source):
> > +self.ok = False
> > +elif os.path.isdir(source):
> > +for (root, dirs, files) in os.walk(source):
> > +files = filter(lambda a: a.endswith('.uni'), files)
> > +for filename in files:
> > +path = os.path.join(root, filename)
> > +self.ok &= self.convert_one_file(path)
> > +if not self.ok:
> > +break
> > +
> > +if not self.ok:
> > +break
> > +else:
> > +self.ok &= self.convert_one_file(source)
> > +
> > +def convert_one_file(self, source):
> > +#
> > +# Read file
> > +#
> > +utf16_file = open(source, mode='rb')
> > +file_content = utf16_file.read()
> > +utf16_file.close()
> > +
> > +#
> > +# Detect UTF-16 Byte Order Mark at beginning of file.
> > +#
> > +if not (file_content.startswith(codecs.BOM_UTF16_BE) or
> > +file_content.startswith(codecs.BOM_UTF16_LE)

Re: [edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py script

2015-12-02 Thread Kinney, Michael D
Jordan,

Do the UTF-8 files generated include a BOM?

Just in case someone depends on UNI files in UTF-16LE format, do you think it 
makes sense for this script to support conversion to from UTF-8 to UTF-16LE 
too?  Or add a second script to that conversion?

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jordan 
> Justen
> Sent: Wednesday, December 2, 2015 2:17 PM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Justen, Jordan L 
> ; Gao, Liming 
> Subject: [edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py 
> script
> 
> This script uses python codecs to convert .uni string files from
> utf-16 to utf-8.
> 
> The advantages of utf-8 data:
>  * Generally smaller files
>  * More commonly supported by editors
>  * Not treated as binary data in patch files
> 
> Cc: Yonghong Zhu 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> ---
>  BaseTools/Scripts/ConvertUtf16ToUtf8.py | 123 
> 
>  1 file changed, 123 insertions(+)
>  create mode 100755 BaseTools/Scripts/ConvertUtf16ToUtf8.py
> 
> diff --git a/BaseTools/Scripts/ConvertUtf16ToUtf8.py 
> b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> new file mode 100755
> index 000..5f54603
> --- /dev/null
> +++ b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> @@ -0,0 +1,123 @@
> +## @file
> +#  Check a patch for various format issues
> +#
> +#  Copyright (c) 2015, 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
> +#
> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> +#  BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> +#  EXPRESS OR IMPLIED.
> +#
> +
> +from __future__ import print_function
> +
> +VersionNumber = '0.1'
> +__copyright__ = "Copyright (c) 2015, Intel Corporation  All rights reserved."
> +
> +import argparse
> +import codecs
> +import os
> +import sys
> +
> +try:
> +from io import StringIO
> +except ImportError:
> +from StringIO import StringIO
> +
> +class ConvertOneArg:
> +"""Converts utf-16 to utf-8 for one command line argument.
> +
> +   This could be a single file, or a directory.
> +"""
> +
> +def __init__(self, source):
> +self.source = source
> +
> +self.ok = True
> +
> +if not os.path.exists(source):
> +self.ok = False
> +elif os.path.isdir(source):
> +for (root, dirs, files) in os.walk(source):
> +files = filter(lambda a: a.endswith('.uni'), files)
> +for filename in files:
> +path = os.path.join(root, filename)
> +self.ok &= self.convert_one_file(path)
> +if not self.ok:
> +break
> +
> +if not self.ok:
> +break
> +else:
> +self.ok &= self.convert_one_file(source)
> +
> +def convert_one_file(self, source):
> +#
> +# Read file
> +#
> +utf16_file = open(source, mode='rb')
> +file_content = utf16_file.read()
> +utf16_file.close()
> +
> +#
> +# Detect UTF-16 Byte Order Mark at beginning of file.
> +#
> +if not (file_content.startswith(codecs.BOM_UTF16_BE) or
> +file_content.startswith(codecs.BOM_UTF16_LE)):
> +print(source + ": already utf-8")
> +return True
> +
> +#
> +# Decode utf-16 string data
> +#
> +str_content = file_content.decode('utf-16', 'ignore')
> +
> +#
> +# Encode string data to utf-8
> +#
> +utf8_content = str_content.encode('utf-8', 'ignore')
> +
> +#
> +# Write converted utf-8 data back to file
> +#
> +utf8_file = open(source, mode='wb')
> +utf8_file.write(utf8_content)
> +utf8_file.close()
> +
> +print(source + ": converted, size", len(file_content), '=>', 
> len(utf8_content))
> +return True
> +
> +
> +class ConvertUtf16ToUtf8App:
> +"""Converts files to utf-8 based on the command line arguments."""
> +
> +def __init__(self):
> +self.parse_options()
> +sources = self.args.source
> +
> +self.ok = True
> +for patch in sources:
> +self.process_one_arg(patch)
> +
> +if self.ok:
> +self.retval = 0
> +else:
> +self.retval = -1
> +
> +def process_one_arg(self, arg):
> +self.ok &= ConvertOneArg(arg).ok
> +
> +def parse_options(self):
> +parser = argparse.ArgumentParser(description=__copyright__)
> +parser.add_argument('--vers

Re: [edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py script

2015-12-02 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Jordan Justen
> Sent: Wednesday, December 02, 2015 2:17 PM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Justen, Jordan L
> ; Gao, Liming 
> Subject: [edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py
> script
> Importance: High
> 
> This script uses python codecs to convert .uni string files from
> utf-16 to utf-8.
> 
> The advantages of utf-8 data:
>  * Generally smaller files
>  * More commonly supported by editors
>  * Not treated as binary data in patch files
> 
> Cc: Yonghong Zhu 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> ---
>  BaseTools/Scripts/ConvertUtf16ToUtf8.py | 123
> 
>  1 file changed, 123 insertions(+)
>  create mode 100755 BaseTools/Scripts/ConvertUtf16ToUtf8.py
> 
> diff --git a/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> new file mode 100755
> index 000..5f54603
> --- /dev/null
> +++ b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
> @@ -0,0 +1,123 @@
> +## @file
> +#  Check a patch for various format issues
> +#
> +#  Copyright (c) 2015, 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
> +#
> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> +#  BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> +#  EXPRESS OR IMPLIED.
> +#
> +
> +from __future__ import print_function
> +
> +VersionNumber = '0.1'
> +__copyright__ = "Copyright (c) 2015, Intel Corporation  All rights reserved."
> +
> +import argparse
> +import codecs
> +import os
> +import sys
> +
> +try:
> +from io import StringIO
> +except ImportError:
> +from StringIO import StringIO
> +
> +class ConvertOneArg:
> +"""Converts utf-16 to utf-8 for one command line argument.
> +
> +   This could be a single file, or a directory.
> +"""
> +
> +def __init__(self, source):
> +self.source = source
> +
> +self.ok = True
> +
> +if not os.path.exists(source):
> +self.ok = False
> +elif os.path.isdir(source):
> +for (root, dirs, files) in os.walk(source):
> +files = filter(lambda a: a.endswith('.uni'), files)
> +for filename in files:
> +path = os.path.join(root, filename)
> +self.ok &= self.convert_one_file(path)
> +if not self.ok:
> +break
> +
> +if not self.ok:
> +break
> +else:
> +self.ok &= self.convert_one_file(source)
> +
> +def convert_one_file(self, source):
> +#
> +# Read file
> +#
> +utf16_file = open(source, mode='rb')
> +file_content = utf16_file.read()
> +utf16_file.close()
> +
> +#
> +# Detect UTF-16 Byte Order Mark at beginning of file.
> +#
> +if not (file_content.startswith(codecs.BOM_UTF16_BE) or
> +file_content.startswith(codecs.BOM_UTF16_LE)):
> +print(source + ": already utf-8")
> +return True
> +
> +#
> +# Decode utf-16 string data
> +#
> +str_content = file_content.decode('utf-16', 'ignore')
> +
> +#
> +# Encode string data to utf-8
> +#
> +utf8_content = str_content.encode('utf-8', 'ignore')
> +
> +#
> +# Write converted utf-8 data back to file
> +#
> +utf8_file = open(source, mode='wb')
> +utf8_file.write(utf8_content)
> +utf8_file.close()
> +
> +print(source + ": converted, size", len(file_content), '=>',
> len(utf8_content))
> +return True
> +
> +
> +class ConvertUtf16ToUtf8App:
> +"""Converts files to utf-8 based on the command line arguments."""
> +
> +def __init__(self):
> +self.parse_options()
> +sources = self.args.source
> +
> +self.ok = True
> +for patch in sources:
> +self.process_one_arg(patch)
> +
> +if self.ok:
> +self.retval = 0
> +else:
> +self.retval = -1
> +
> +def process_one_arg(self, arg):
> +self.ok &= ConvertOneArg(arg).ok
> +
> +def parse_options(self):
> +parser = argparse.ArgumentParser(description=__copyright__)
> +parser.add_argument('--version', action='version',
> +version='%(prog)s ' + VersionNumber)
> +parser.add_argument('source', nargs='+',
> +help='[uni file | directory]')
> +self.args = pars

[edk2] [PATCH 3/3] MdePkg: Example diff with utf-8 data

2015-12-02 Thread Jordan Justen
This patch is not intended to be checked in.

Cc: Jaben Carsey 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
---
 MdePkg/MdePkg.uni | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni
index 6c9ddad..ace9949 100644
--- a/MdePkg/MdePkg.uni
+++ b/MdePkg/MdePkg.uni
@@ -18,6 +18,11 @@
 // **/
 
 
+//
+// Example diff with utf-8 data. (Will not be checked in.)
+//
+// Unicode char 0x2200: ∀
+//
 #string STR_PACKAGE_ABSTRACT#language en-US "This Package provides 
all definitions, library classes and libraries instances."
 
 #string STR_PACKAGE_DESCRIPTION #language en-US "It also provides the 
definitions(including PPIs/PROTOCOLs/GUIDs) of EFI1.10/UEFI2.4/PI1.3 and some 
Industry Standards."
-- 
2.6.2

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


[edk2] [PATCH 2/3] MdePkg: Convert all .uni files to utf-8

2015-12-02 Thread Jordan Justen
To convert these files I ran:

$ python3 BaseTools/Scripts/ConvertUtf16ToUtf8.py MdePkg

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
---
 .../BaseCacheMaintenanceLib.uni | Bin 2434 -> 1216 bytes
 MdePkg/Library/BaseCpuLib/BaseCpuLib.uni| Bin 2304 -> 1151 bytes
 .../Library/BaseDebugLibNull/BaseDebugLibNull.uni   | Bin 1638 -> 818 bytes
 .../BaseDebugLibSerialPort.uni  | Bin 1902 -> 950 bytes
 .../BaseDebugPrintErrorLevelLib.uni | Bin 1918 -> 958 bytes
 .../BaseExtractGuidedSectionLib.uni | Bin 3712 -> 1855 bytes
 .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.uni   | Bin 2546 -> 1272 bytes
 MdePkg/Library/BaseLib/BaseLib.uni  | Bin 1882 -> 940 bytes
 MdePkg/Library/BaseMemoryLib/BaseMemoryLib.uni  | Bin 1730 -> 864 bytes
 .../Library/BaseMemoryLibMmx/BaseMemoryLibMmx.uni   | Bin 1938 -> 968 bytes
 .../BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.uni | Bin 2036 -> 1017 bytes
 .../BaseMemoryLibOptPei/BaseMemoryLibOptPei.uni | Bin 2154 -> 1076 bytes
 .../BaseMemoryLibRepStr/BaseMemoryLibRepStr.uni | Bin 2078 -> 1038 bytes
 .../Library/BaseMemoryLibSse2/BaseMemoryLibSse2.uni | Bin 1834 -> 916 bytes
 .../BaseOrderedCollectionRedBlackTreeLib.uni| Bin 2640 -> 1319 bytes
 MdePkg/Library/BasePalLibNull/BasePalLibNull.uni| Bin 1758 -> 878 bytes
 MdePkg/Library/BasePcdLibNull/BasePcdLibNull.uni| Bin 2210 -> 1104 bytes
 MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.uni  | Bin 2126 -> 1062 bytes
 .../Library/BasePciExpressLib/BasePciExpressLib.uni | Bin 2230 -> 1114 bytes
 MdePkg/Library/BasePciLibCf8/BasePciLibCf8.uni  | Bin 2086 -> 1042 bytes
 .../BasePciLibPciExpress/BasePciLibPciExpress.uni   | Bin 2124 -> 1061 bytes
 .../PeCoffExtraActionLibNull.uni| Bin 1878 -> 938 bytes
 .../BasePeCoffGetEntryPointLib.uni  | Bin 1702 -> 850 bytes
 MdePkg/Library/BasePeCoffLib/BasePeCoffLib.uni  | Bin 3514 -> 1756 bytes
 .../BasePerformanceLibNull.uni  | Bin 1782 -> 890 bytes
 .../BasePostCodeLibDebug/BasePostCodeLibDebug.uni   | Bin 2018 -> 1008 bytes
 .../BasePostCodeLibPort80/BasePostCodeLibPort80.uni | Bin 1814 -> 906 bytes
 MdePkg/Library/BasePrintLib/BasePrintLib.uni| Bin 1590 -> 794 bytes
 .../BaseReportStatusCodeLibNull.uni | Bin 1742 -> 870 bytes
 MdePkg/Library/BaseRngLib/BaseRngLib.uni| Bin 1878 -> 938 bytes
 .../BaseS3BootScriptLibNull.uni | Bin 2292 -> 1145 bytes
 MdePkg/Library/BaseS3IoLib/BaseS3IoLib.uni  | Bin 2100 -> 1049 bytes
 MdePkg/Library/BaseS3PciLib/BaseS3PciLib.uni| Bin 2132 -> 1065 bytes
 MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.uni| Bin 2132 -> 1065 bytes
 MdePkg/Library/BaseS3StallLib/BaseS3StallLib.uni| Bin 2060 -> 1029 bytes
 .../BaseSerialPortLibNull/BaseSerialPortLibNull.uni | Bin 1822 -> 910 bytes
 .../Library/BaseSmbusLibNull/BaseSmbusLibNull.uni   | Bin 1688 -> 843 bytes
 .../Library/BaseStackCheckLib/BaseStackCheckLib.uni | Bin 1478 -> 738 bytes
 .../BaseSynchronizationLib.uni  | Bin 1862 -> 930 bytes
 .../BaseTimerLibNullTemplate.uni| Bin 2828 -> 1413 bytes
 .../BaseUefiDecompressLib/BaseUefiDecompressLib.uni | Bin 1670 -> 834 bytes
 .../Library/DxeCoreEntryPoint/DxeCoreEntryPoint.uni | Bin 1678 -> 838 bytes
 MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.uni  | Bin 2042 -> 1020 bytes
 .../Library/DxeExtendedSalLib/DxeExtendedSalLib.uni | Bin 2010 -> 1004 bytes
 .../DxeExtractGuidedSectionLib.uni  | Bin 1894 -> 946 bytes
 MdePkg/Library/DxeHobLib/DxeHobLib.uni  | Bin 2106 -> 1052 bytes
 MdePkg/Library/DxeHstiLib/DxeHstiLib.uni| Bin 1612 -> 805 bytes
 MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.uni| Bin 1920 -> 959 bytes
 MdePkg/Library/DxeIoLibEsal/DxeIoLibEsal.uni| Bin 1984 -> 991 bytes
 MdePkg/Library/DxePalLibEsal/DxePalLibEsal.uni  | Bin 1848 -> 923 bytes
 MdePkg/Library/DxePcdLib/DxePcdLib.uni  | Bin 3336 -> 1667 bytes
 MdePkg/Library/DxePciLibEsal/DxePciLibEsal.uni  | Bin 1916 -> 957 bytes
 .../DxePciSegmentLibEsal/DxePciSegementLibEsal.uni  | Bin 1964 -> 981 bytes
 .../DxeRuntimeExtendedSalLib.uni| Bin 2068 -> 1033 bytes
 .../DxeRuntimePciExpressLib.uni | Bin 2922 -> 1460 bytes
 MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.uni  | Bin 1930 -> 964 bytes
 MdePkg/Library/DxeServicesLib/DxeServicesLib.uni| Bin 2594 -> 1296 bytes
 .../DxeServicesTableLib/DxeServicesTableLib.uni | Bin 2076 -> 1037 bytes
 MdePkg/Library/DxeSmbusLib/DxeSmbusLib.uni  | Bin 1798 -> 898 bytes
 MdePkg/Library/DxeTimerLibEsal/DxeTimerLibEsal.uni  | Bin 2020 -> 1009 bytes
 .../Library/PeiCoreEntryPoint/PeiCoreEntryPoint.uni | Bin 1678 -> 838 bytes
 .../PeiDxePostCodeLibReportStatusCode.uni   | 

[edk2] [PATCH 1/3] BaseTools/Scripts: Add ConvertUtf16ToUtf8.py script

2015-12-02 Thread Jordan Justen
This script uses python codecs to convert .uni string files from
utf-16 to utf-8.

The advantages of utf-8 data:
 * Generally smaller files
 * More commonly supported by editors
 * Not treated as binary data in patch files

Cc: Yonghong Zhu 
Cc: Liming Gao 
Cc: Jaben Carsey 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
---
 BaseTools/Scripts/ConvertUtf16ToUtf8.py | 123 
 1 file changed, 123 insertions(+)
 create mode 100755 BaseTools/Scripts/ConvertUtf16ToUtf8.py

diff --git a/BaseTools/Scripts/ConvertUtf16ToUtf8.py 
b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
new file mode 100755
index 000..5f54603
--- /dev/null
+++ b/BaseTools/Scripts/ConvertUtf16ToUtf8.py
@@ -0,0 +1,123 @@
+## @file
+#  Check a patch for various format issues
+#
+#  Copyright (c) 2015, 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
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
+#  BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
+#  EXPRESS OR IMPLIED.
+#
+
+from __future__ import print_function
+
+VersionNumber = '0.1'
+__copyright__ = "Copyright (c) 2015, Intel Corporation  All rights reserved."
+
+import argparse
+import codecs
+import os
+import sys
+
+try:
+from io import StringIO
+except ImportError:
+from StringIO import StringIO
+
+class ConvertOneArg:
+"""Converts utf-16 to utf-8 for one command line argument.
+
+   This could be a single file, or a directory.
+"""
+
+def __init__(self, source):
+self.source = source
+
+self.ok = True
+
+if not os.path.exists(source):
+self.ok = False
+elif os.path.isdir(source):
+for (root, dirs, files) in os.walk(source):
+files = filter(lambda a: a.endswith('.uni'), files)
+for filename in files:
+path = os.path.join(root, filename)
+self.ok &= self.convert_one_file(path)
+if not self.ok:
+break
+
+if not self.ok:
+break
+else:
+self.ok &= self.convert_one_file(source)
+
+def convert_one_file(self, source):
+#
+# Read file
+#
+utf16_file = open(source, mode='rb')
+file_content = utf16_file.read()
+utf16_file.close()
+
+#
+# Detect UTF-16 Byte Order Mark at beginning of file.
+#
+if not (file_content.startswith(codecs.BOM_UTF16_BE) or
+file_content.startswith(codecs.BOM_UTF16_LE)):
+print(source + ": already utf-8")
+return True
+
+#
+# Decode utf-16 string data
+#
+str_content = file_content.decode('utf-16', 'ignore')
+
+#
+# Encode string data to utf-8
+#
+utf8_content = str_content.encode('utf-8', 'ignore')
+
+#
+# Write converted utf-8 data back to file
+#
+utf8_file = open(source, mode='wb')
+utf8_file.write(utf8_content)
+utf8_file.close()
+
+print(source + ": converted, size", len(file_content), '=>', 
len(utf8_content))
+return True
+
+
+class ConvertUtf16ToUtf8App:
+"""Converts files to utf-8 based on the command line arguments."""
+
+def __init__(self):
+self.parse_options()
+sources = self.args.source
+
+self.ok = True
+for patch in sources:
+self.process_one_arg(patch)
+
+if self.ok:
+self.retval = 0
+else:
+self.retval = -1
+
+def process_one_arg(self, arg):
+self.ok &= ConvertOneArg(arg).ok
+
+def parse_options(self):
+parser = argparse.ArgumentParser(description=__copyright__)
+parser.add_argument('--version', action='version',
+version='%(prog)s ' + VersionNumber)
+parser.add_argument('source', nargs='+',
+help='[uni file | directory]')
+self.args = parser.parse_args()
+
+if __name__ == "__main__":
+sys.exit(ConvertUtf16ToUtf8App().retval)
-- 
2.6.2

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


Re: [edk2] EDK2 and VS2015

2015-12-02 Thread Andrew Fish

> On Dec 2, 2015, at 11:47 AM, Foster, Matthew I  
> wrote:
> 
> Does anyone have any information about compiling EDK2 using Visual Studio 
> 2015? Is it supported?


Liming proposed a patch to the mailing list on 11/30/2105 to support VS2015. 

You can try applying that patch. You will need to remove your 
Conf/boots_def.txt file to get the BaseTools/Conf/tools_def.template file 
copied over by the edksetup script. 

Thanks,

Andrew Fish

> ___
> 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] EDK2 and VS2015

2015-12-02 Thread Foster, Matthew I
Does anyone have any information about compiling EDK2 using Visual Studio 2015? 
Is it supported?
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] asm/S assembler files

2015-12-02 Thread Ard Biesheuvel
On 2 December 2015 at 19:50, Michael Zimmermann
 wrote:
>> But, I believe -- I could be wrong -- that for ARM/AARCH64 the assembly
>> syntax has been uniquely determined anyway. (If this is not the case, I
>> hope I'll be corrected.)
>
> Unfortunately not. From ArmPlatformPkg/PrePi/Arm/ to ./Library/ArmLib -
> there are always both asm and S files.
>

The .asm files are only there for ARM: the proprietary 32-bit
toolchain RVCT has its own syntax that is different from what GNU
binutils uses.

Fortunately, for AARCH64, there is only one asm syntax to support. The
proprietary 64-bit toolchain is clang-based, which uses a syntax that
is compatible with binutils/gas for AArch64.

-- 
Ard.

> On Wed, Dec 2, 2015 at 7:34 PM, Laszlo Ersek  wrote:
>
>> On 12/02/15 18:37, Michael Zimmermann wrote:
>> > Does NASM support ARM and AARCH64? because according to Wikipedia it
>> > doesn't.
>>
>> It doesn't.
>>
>> But, I believe -- I could be wrong -- that for ARM/AARCH64 the assembly
>> syntax has been uniquely determined anyway. (If this is not the case, I
>> hope I'll be corrected.)
>>
>> Thanks
>> Laszlo
>>
>> >> Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I
>> > would also point out that the inline assembly will optimize better as the
>> > compiler will always call the .S function, but the optimizer can inline
>> the
>> > C function if needed.
>> >
>> > Are you sure assembly never get's inlined? I'd expect optimizers to work
>> on
>> > assembly/bytecode level and at least GCC's O3 function enables -finline.
>> >
>> > On Wed, Dec 2, 2015 at 6:32 PM, Andrew Fish  wrote:
>> >
>> >>
>> >>> On Dec 2, 2015, at 8:44 AM, Michael Zimmermann <
>> sigmaepsilo...@gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> sorry if this is documented somewhere but I've always wondered what
>> this
>> >>> whole assembler file situation in EDKII is about.
>> >>> What I mean is that there are two versions of every assembler file -
>> for
>> >> VS
>> >>> and GCC compilers I guess.
>> >>>
>> >>> What I've noticed though is that most of these files are almost
>> identical
>> >>> except for minor differences like different export macros and comment
>> >>> characters.
>> >>>
>> >>> I think (I hope I'm wrong) that there even are some projects where one
>> >>> version of these files is outdated/not maintained.
>> >>>
>> >>> If I'm right and the differences really are that small, couldn't we
>> just
>> >>> write some kind of converter so we can remove all this duplicate code?
>> >>>
>> >>
>> >> I think the longer term direction is to move to nasm. There are still
>> some
>> >> issues of nasm working with Xcode as the DWARF info does not get placed
>> >> into the Mach-O files.
>> >>
>> >> The MdePkg Libraries are designed so that you don't need to write
>> >> assembler. On an ARM based system you may also need some help from the
>> >> ArmPkg. So the general answer don't write assembler. You can usually use
>> >> the BaseLib to do what you need to do.
>> >>
>> >> On the x86 side there are a few exceptions:
>> >> 1) Reset - You start in real mode with no stack
>> >> 2) Interrupts - You need to save state.
>> >> 3) Mode Switches - PEI is 32-bit (No place to store the page tables) and
>> >> DXE is 64-bit
>> >> 4) SMM - More strange mode switching
>> >> 5) Optimization - Usually not needed (MdePkg has optimized CopyMem etc.)
>> >>
>> >> Now I would say an issue I've seen is that the Silicon folks like to
>> >> "reinvent the wheel".
>> >>> find . -iname '*.S'
>> >> ...
>> >>
>> >>
>> ./Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/Ia32/Stack.S
>> >> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/IA32/CpuIA32.S
>> >> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/X64/Cpu.S
>> >>
>> >> If you look at these files you will see that MdePkg has SwitchStack
>> >> functions, and the CpuIA32Lib is the old EDK names for functions that
>> exist
>> >> in the MdePkg BaseLib. So this is an example of unneeded assembly code
>> in
>> >> the tree.
>> >>
>> >>
>> >>
>> #--
>> >> #  UINT64
>> >> #  EfiReadMsr (
>> >> #IN   UINT32  Index,  // rcx
>> >> #)
>> >>
>> >>
>> #--
>> >> ASM_PFX(EfiReadMsr):
>> >>   rdmsr
>> >>   shl$0x20,%rdx
>> >>   or %rdx,%rax
>> >>   retq
>> >>
>> >>
>> >> Looks a lot like:
>> >>
>> >> UINT64
>> >> EFIAPI
>> >> AsmReadMsr64 (
>> >>   IN  UINT32Index
>> >>   )
>> >> {
>> >>   UINT32 LowData;
>> >>   UINT32 HighData;
>> >>
>> >>   __asm__ __volatile__ (
>> >> "rdmsr"
>> >> : "=a" (LowData),   // %0
>> >>   "=d" (HighData)   // %1
>> >> : "c"  (Index)  // %2
>> >> );
>> >>
>> >>   return (((UINT64)HighData) << 32) | LowData;
>> >> }
>> >>
>> >> Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I
>> >> would also point out that the inline assembly will optimize better as
>>

Re: [edk2] [PATCH 3/3] ArmPkg: update RVCT assembly functions to use new RVCT_ASM_EXPORT macro

2015-12-02 Thread Cohen, Eugene
Ard,

I just ran into this as well yesterday - I agree that the solution here is to 
back out the changes from the ExceptionSupport assembly or even the entire 
CpuDxe driver.  The benefit here is for libraries containing unrelated 
functions and this case is neither a library (it's a driver) nor unrelated 
functions (the exception handling is all used together).

The reason these files got hit was because my script was aggressively finding 
assembly in ArmPkg.  Although I reviewed the changes I didn't spot this one in 
time.

Eugene

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Wednesday, December 02, 2015 9:42 AM
> To: Cohen, Eugene 
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH 3/3] ArmPkg: update RVCT assembly functions to
> use new RVCT_ASM_EXPORT macro
> 
> On 25 November 2015 at 20:11, Cohen, Eugene  wrote:
> > This has the effect of splitting assembly functions into their own sections 
> > so
> the linker can remove unused ones to save space.
> >
> > This has been tested to build with ArmPkg.dsc with RVCT 4.
> >
> > The majority of the conversion was performed with the attached python
> script.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Eugene Cohen 
> 
> This patch breaks ArmVirtQemu-ARM for me:
> 
> ASSERT /home/ard/build/uefi-
> next/ArmPkg/Drivers/CpuDxe/ArmV6/Exception.c(214): 0
> 
> This is because you are removing the ALIGN=5 from the area .asm file that
> contains the vector table, presumably this one:
> ArmPkg/Drivers/CpuDxe/ArmV6/ExceptionSupport.asm
> 
> I also wonder if it makes sense in the first place to split the vector table 
> into
> discardable sections, so perhaps we should just drop those hunks?
> 
> 
> 
> 
> > ---
> >  .../ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm |   5 +-
> >  ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.asm   |  26 ++---
> >  ArmPkg/Drivers/CpuDxe/ArmV4/ExceptionSupport.asm   |  14 +--
> >  ArmPkg/Drivers/CpuDxe/ArmV6/ExceptionSupport.asm   |  14 +--
> >  ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.asm|   5 +-
> >  ArmPkg/Library/ArmLib/ArmV7/ArmLibSupportV7.asm|  46 +++--
> >  .../Library/ArmLib/ArmV7/ArmV7ArchTimerSupport.asm |  64 +---
> >  ArmPkg/Library/ArmLib/ArmV7/ArmV7Support.asm   | 109 +++-
> -
> >  ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.asm |  84 ++--
> 
> >  ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.asm|   5 +-
> >  ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.asm|   5 +-
> >  ArmPkg/Library/BaseMemoryLibStm/Arm/CopyMem.asm|   5 +-
> >  ArmPkg/Library/BaseMemoryLibStm/Arm/SetMem.asm |   5 +-
> >  .../Library/BaseMemoryLibStm/BaseMemoryLibStm.inf  |   1 +
> >  ArmPkg/Library/BaseMemoryLibVstm/Arm/CopyMem.asm   |   5 +-
> >  ArmPkg/Library/BaseMemoryLibVstm/Arm/SetMem.asm|   5 +-
> >  .../BaseMemoryLibVstm/BaseMemoryLibVstm.inf|   1 +
> >  ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.asm   |  14 +--
> >  ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm  |   5 +-
> >  .../Library/CompilerIntrinsicsLib/Arm/ldivmod.asm  |   5 +-
> >  ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm  |   5 +-
> >  ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm  |   5 +-
> >  .../Library/CompilerIntrinsicsLib/Arm/memcpy.asm   |   5 +-
> >  .../Library/CompilerIntrinsicsLib/Arm/memcpy4.asm  |   5 +-
> >  .../Library/CompilerIntrinsicsLib/Arm/memmove.asm  |   5 +-
> >  .../Library/CompilerIntrinsicsLib/Arm/memset.asm   |  11 +--
> >  ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm |   8 +-
> >  .../Library/CompilerIntrinsicsLib/Arm/switch.asm   |   5 +-
> >  ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm |   5 +-
> >  ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.asm |   8 +-
> >  .../Library/CompilerIntrinsicsLib/Arm/uwrite.asm   |   8 +-
> >  .../CompilerIntrinsicsLib.inf  |   1 +
> >  32 files changed, 178 insertions(+), 316 deletions(-)
> >
> > diff --git
> > a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm
> > b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm
> > index 7150834..1417c9a 100644
> > ---
> a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm
> > +++
> b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm
> > @@ -15,16 +15,15 @@
> >  #include 
> >  #include 
> >
> > +  INCLUDE AsmMacroExport.inc
> >INCLUDE AsmMacroIoLib.inc
> >
> > -  EXPORT  ArmGetScuBaseAddress
> >
> >PRESERVE8
> > -  AREAArmCortexA9Helper, CODE, READONLY
> >
> >  // IN None
> >  // OUT r0 = SCU Base Address
> > -ArmGetScuBaseAddress
> > + RVCT_ASM_EXPORT ArmGetScuBaseAddress
> >// Read Configuration Base Address Register. ArmCBar cannot be called to
> get
> >// the Configuration BAR as a stack is not necessary setup. The SCU is at
> the
> >// offset 0x from the Private Memory Region.
> > diff --git a/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.asm
> > b/ArmPkg/Drivers/ArmGic/GicV3/Arm/Ar

Re: [edk2] [PATCH] MdeModulePkg: allow DxeIpl to load without permanent memory to enable S3 resume from temporary memory

2015-12-02 Thread Cohen, Eugene
Star,

> Do you have the patch tested on your real platforms (with and without
> InstallPeiMemory()?

Yes, we've been running this way for a couple years.  I had it on my list of 
changes to upstream and forgot about it until now.  The only other requirement 
for this to work correctly is for the memory intiialization driver to not call 
InstallPeiMemory on S3 resume.

> Current code will install Decompress and Extraction PPI for both normal and
> S3 path in entry point, but Decompress and Extraction PPI need to use
> AllocatePages() that only works after memory discovered as PI spec
> describes.
> Then should the code be also updated to install Decompress and Extraction
> PPI in memory discovered ppi notify with
> EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH?

This makes sense to me - don't publish a service that cannot be handled.  So as 
long as S3 resume doesn't require section extraction (which seems unlikely) 
then DXE IPL can just expose the reduced set of PPIs.  Do you want to propose 
something or shall I?

Thanks,

Eugene



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


Re: [edk2] asm/S assembler files

2015-12-02 Thread Michael Zimmermann
> But, I believe -- I could be wrong -- that for ARM/AARCH64 the assembly
> syntax has been uniquely determined anyway. (If this is not the case, I
> hope I'll be corrected.)

Unfortunately not. From ArmPlatformPkg/PrePi/Arm/ to ./Library/ArmLib -
there are always both asm and S files.

On Wed, Dec 2, 2015 at 7:34 PM, Laszlo Ersek  wrote:

> On 12/02/15 18:37, Michael Zimmermann wrote:
> > Does NASM support ARM and AARCH64? because according to Wikipedia it
> > doesn't.
>
> It doesn't.
>
> But, I believe -- I could be wrong -- that for ARM/AARCH64 the assembly
> syntax has been uniquely determined anyway. (If this is not the case, I
> hope I'll be corrected.)
>
> Thanks
> Laszlo
>
> >> Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I
> > would also point out that the inline assembly will optimize better as the
> > compiler will always call the .S function, but the optimizer can inline
> the
> > C function if needed.
> >
> > Are you sure assembly never get's inlined? I'd expect optimizers to work
> on
> > assembly/bytecode level and at least GCC's O3 function enables -finline.
> >
> > On Wed, Dec 2, 2015 at 6:32 PM, Andrew Fish  wrote:
> >
> >>
> >>> On Dec 2, 2015, at 8:44 AM, Michael Zimmermann <
> sigmaepsilo...@gmail.com>
> >> wrote:
> >>>
> >>> Hi,
> >>>
> >>> sorry if this is documented somewhere but I've always wondered what
> this
> >>> whole assembler file situation in EDKII is about.
> >>> What I mean is that there are two versions of every assembler file -
> for
> >> VS
> >>> and GCC compilers I guess.
> >>>
> >>> What I've noticed though is that most of these files are almost
> identical
> >>> except for minor differences like different export macros and comment
> >>> characters.
> >>>
> >>> I think (I hope I'm wrong) that there even are some projects where one
> >>> version of these files is outdated/not maintained.
> >>>
> >>> If I'm right and the differences really are that small, couldn't we
> just
> >>> write some kind of converter so we can remove all this duplicate code?
> >>>
> >>
> >> I think the longer term direction is to move to nasm. There are still
> some
> >> issues of nasm working with Xcode as the DWARF info does not get placed
> >> into the Mach-O files.
> >>
> >> The MdePkg Libraries are designed so that you don't need to write
> >> assembler. On an ARM based system you may also need some help from the
> >> ArmPkg. So the general answer don't write assembler. You can usually use
> >> the BaseLib to do what you need to do.
> >>
> >> On the x86 side there are a few exceptions:
> >> 1) Reset - You start in real mode with no stack
> >> 2) Interrupts - You need to save state.
> >> 3) Mode Switches - PEI is 32-bit (No place to store the page tables) and
> >> DXE is 64-bit
> >> 4) SMM - More strange mode switching
> >> 5) Optimization - Usually not needed (MdePkg has optimized CopyMem etc.)
> >>
> >> Now I would say an issue I've seen is that the Silicon folks like to
> >> "reinvent the wheel".
> >>> find . -iname '*.S'
> >> ...
> >>
> >>
> ./Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/Ia32/Stack.S
> >> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/IA32/CpuIA32.S
> >> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/X64/Cpu.S
> >>
> >> If you look at these files you will see that MdePkg has SwitchStack
> >> functions, and the CpuIA32Lib is the old EDK names for functions that
> exist
> >> in the MdePkg BaseLib. So this is an example of unneeded assembly code
> in
> >> the tree.
> >>
> >>
> >>
> #--
> >> #  UINT64
> >> #  EfiReadMsr (
> >> #IN   UINT32  Index,  // rcx
> >> #)
> >>
> >>
> #--
> >> ASM_PFX(EfiReadMsr):
> >>   rdmsr
> >>   shl$0x20,%rdx
> >>   or %rdx,%rax
> >>   retq
> >>
> >>
> >> Looks a lot like:
> >>
> >> UINT64
> >> EFIAPI
> >> AsmReadMsr64 (
> >>   IN  UINT32Index
> >>   )
> >> {
> >>   UINT32 LowData;
> >>   UINT32 HighData;
> >>
> >>   __asm__ __volatile__ (
> >> "rdmsr"
> >> : "=a" (LowData),   // %0
> >>   "=d" (HighData)   // %1
> >> : "c"  (Index)  // %2
> >> );
> >>
> >>   return (((UINT64)HighData) << 32) | LowData;
> >> }
> >>
> >> Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I
> >> would also point out that the inline assembly will optimize better as
> the
> >> compiler will always call the .S function, but the optimizer can inline
> the
> >> C function if needed.
> >>
> >> Thanks,
> >>
> >> Andrew Fish
> >>
> >>
> >>> Michael
> >>> ___
> >>> 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 0/2] Fix Shell mm command bugs

2015-12-02 Thread Carsey, Jaben
For the series (I made a tiny comment on the INF in the other patch email)

Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ruiyu Ni
> Sent: Tuesday, December 01, 2015 9:54 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu 
> Subject: [edk2] [Patch 0/2] Fix Shell mm command bugs
> Importance: High
> 
> The patches fix shell mm command help message and let it support
> multiple root bridge platforms.
> 
> Ruiyu Ni (2):
>   ShellPkg/mm: Fix the help message of mm to align to implementation.
>   ShellPkg/mm: Fix mm to support multiple root bridge platform
> 
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c   | 329 +++-
> -
>  .../UefiShellDebug1CommandsLib.h   |   3 +-
>  .../UefiShellDebug1CommandsLib.inf |   1 +
>  .../UefiShellDebug1CommandsLib.uni | Bin 140676 -> 139768 
> bytes
>  4 files changed, 181 insertions(+), 152 deletions(-)
> 
> --
> 1.9.5.msysgit.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] asm/S assembler files

2015-12-02 Thread Laszlo Ersek
On 12/02/15 18:37, Michael Zimmermann wrote:
> Does NASM support ARM and AARCH64? because according to Wikipedia it
> doesn't.

It doesn't.

But, I believe -- I could be wrong -- that for ARM/AARCH64 the assembly
syntax has been uniquely determined anyway. (If this is not the case, I
hope I'll be corrected.)

Thanks
Laszlo

>> Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I
> would also point out that the inline assembly will optimize better as the
> compiler will always call the .S function, but the optimizer can inline the
> C function if needed.
> 
> Are you sure assembly never get's inlined? I'd expect optimizers to work on
> assembly/bytecode level and at least GCC's O3 function enables -finline.
> 
> On Wed, Dec 2, 2015 at 6:32 PM, Andrew Fish  wrote:
> 
>>
>>> On Dec 2, 2015, at 8:44 AM, Michael Zimmermann 
>> wrote:
>>>
>>> Hi,
>>>
>>> sorry if this is documented somewhere but I've always wondered what this
>>> whole assembler file situation in EDKII is about.
>>> What I mean is that there are two versions of every assembler file - for
>> VS
>>> and GCC compilers I guess.
>>>
>>> What I've noticed though is that most of these files are almost identical
>>> except for minor differences like different export macros and comment
>>> characters.
>>>
>>> I think (I hope I'm wrong) that there even are some projects where one
>>> version of these files is outdated/not maintained.
>>>
>>> If I'm right and the differences really are that small, couldn't we just
>>> write some kind of converter so we can remove all this duplicate code?
>>>
>>
>> I think the longer term direction is to move to nasm. There are still some
>> issues of nasm working with Xcode as the DWARF info does not get placed
>> into the Mach-O files.
>>
>> The MdePkg Libraries are designed so that you don't need to write
>> assembler. On an ARM based system you may also need some help from the
>> ArmPkg. So the general answer don't write assembler. You can usually use
>> the BaseLib to do what you need to do.
>>
>> On the x86 side there are a few exceptions:
>> 1) Reset - You start in real mode with no stack
>> 2) Interrupts - You need to save state.
>> 3) Mode Switches - PEI is 32-bit (No place to store the page tables) and
>> DXE is 64-bit
>> 4) SMM - More strange mode switching
>> 5) Optimization - Usually not needed (MdePkg has optimized CopyMem etc.)
>>
>> Now I would say an issue I've seen is that the Silicon folks like to
>> "reinvent the wheel".
>>> find . -iname '*.S'
>> ...
>>
>> ./Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/Ia32/Stack.S
>> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/IA32/CpuIA32.S
>> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/X64/Cpu.S
>>
>> If you look at these files you will see that MdePkg has SwitchStack
>> functions, and the CpuIA32Lib is the old EDK names for functions that exist
>> in the MdePkg BaseLib. So this is an example of unneeded assembly code in
>> the tree.
>>
>>
>> #--
>> #  UINT64
>> #  EfiReadMsr (
>> #IN   UINT32  Index,  // rcx
>> #)
>>
>> #--
>> ASM_PFX(EfiReadMsr):
>>   rdmsr
>>   shl$0x20,%rdx
>>   or %rdx,%rax
>>   retq
>>
>>
>> Looks a lot like:
>>
>> UINT64
>> EFIAPI
>> AsmReadMsr64 (
>>   IN  UINT32Index
>>   )
>> {
>>   UINT32 LowData;
>>   UINT32 HighData;
>>
>>   __asm__ __volatile__ (
>> "rdmsr"
>> : "=a" (LowData),   // %0
>>   "=d" (HighData)   // %1
>> : "c"  (Index)  // %2
>> );
>>
>>   return (((UINT64)HighData) << 32) | LowData;
>> }
>>
>> Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I
>> would also point out that the inline assembly will optimize better as the
>> compiler will always call the .S function, but the optimizer can inline the
>> C function if needed.
>>
>> Thanks,
>>
>> Andrew Fish
>>
>>
>>> Michael
>>> ___
>>> 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-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Could not add PCI device with big memory to aarch64 VMs

2015-12-02 Thread Laszlo Ersek
On 12/02/15 18:28, liang yan wrote:
> Hi, Laszlo,
> 
> On 11/30/2015 06:45 PM, Laszlo Ersek wrote:
>> On 12/01/15 01:46, liang yan wrote:
>>> Hello, Laszlo,
>>>
>>> On 11/30/2015 03:05 PM, Laszlo Ersek wrote:
>> [snip]
>>
 If you need more room (with large alignments), then there's no way
 around supporting QEMU's 64 bit aperture, VIRT_PCIE_MMIO_HIGH (see my
 earlier email).
>>> I checked the function create_pcie form pathtoqemu/hw/arm/virt.c, it has
>>> a flag value use_highmem(which has default "true" value).
>>>
>>> It set base_mmio_high and size_mmio_high to device tree by function
>>> below,
>>>
>>>  qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "ranges",
>>>   1, FDT_PCI_RANGE_IOPORT, 2, 0,
>>>   2, base_pio, 2, size_pio,
>>>   1, FDT_PCI_RANGE_MMIO, 2,
>>> base_mmio,
>>>   2, base_mmio, 2, size_mmio,
>>>   1, FDT_PCI_RANGE_MMIO_64BIT,
>>>   2, base_mmio_high,
>>>   2, base_mmio_high, 2,
>>> size_mmio_high);
>>>
>>> So basically, I need to add two UINT64 variables like mmio_high_base and
>>> mmio_high_size to PCD under function ProcessPciHost(VirtFdtDxe.c),
>>> and try to use this high base address and size as new aperture.
>>>
>>> Is this correct?
>> It is correct, but that's only part of the story.
>>
>> Parsing the 64-bit aperture from the DTB into new PCDs in
>> ArmVirtPkg/VirtFdtDxe is the easy part.
>>
>> The hard part is modifying ArmVirtPkg/PciHostBridgeDxe, so that BAR
>> allocation requests (submitted by the platform independent PCI bus
>> driver that resides in "MdeModulePkg/Bus/Pci/PciBusDxe") are actually
>> serviced from this high aperture too.
>>
 Unfortunately I can't readily help with that in the
 "ArmVirtPkg/PciHostBridgeDxe" driver; there's no such (open-source)
 example in the edk2 tree. Of course, I could experiment with it myself
 -- only not right now.
>>> If possible, I do want to finish this part or help you finish it. I just
>>> work on UEFI recently, and thank you so much for your patient and detail
>>> explanation. I really appreciate it.
 I guess copying and adapting the TypeMem32 logic to TypeMem64
 (currently
 short-circuited with EFI_ABORTED) could work.
>>> Is the 32 or 64 bit determined by BAR(2-3bit) or by the PCI device
>>> memory size? Is there an option from QEMU?
>> I can't tell. :)
>>
>>> Does TypeMem32 still keep  "VIRT_PCIE_MMIO" aperture and TypeMem64 use
>>> "VIRT_PCIE_MMIO_HIGH" aperture? or It's more like device property
>>> controlled from QEMU device simulation?
>> Good question. I don't know. I think in order to answer this question,
>> we should understand the whole dance between the PCI root bridge / host
>> bridge driver and the generic PCI bus driver.
>>
>> The documentation I know of is in the Platform Init spec, version 1.4,
>> Volume 5, Chapter 10 "PCI Host Bridge". I've taken multiple stabs at
>> that chapter earlier, but I've always given up.
>>
>> Sorry I can't help more, but this is new area for me as well.
> No, already a big help, Really appreciate your generous sharing.
> 
> I also have a problem from guest vm kernel side.
> 
> Even we change the UEFI side, should the guest kernel still need to modify?

No, if the guest UEFI side is fully fixed / enhanced, then the guest
kernel won't need any changes. (Shouldn't.)

> Because, I noticed that the kernel will do rescan.  use the example of
> 256M below.
> 
> UEFI side, has two setup, not sure which is the real one.

Both of these are "real".

The first snippet bears witness to the enumeration / discovery of the
single PCI device 00:01.0:

> PciBus: Discovered PCI @ [00|01|00]
>BAR[0]: Type =  Mem32; Alignment = 0xFFF;Length = 0x100; Offset =
> 0x10
>BAR[1]: Type =  Mem32; Alignment = 0xFFF;Length = 0x1000; Offset
> = 0x14
>BAR[2]: Type = PMem64; Alignment = 0xFFF;Length =
> 0x1000;Offset = 0x18
>  = PMem64 here

Whereas the second snippet is the cumulative resource map for the root
bridge that the device is behind.

You get similar resource maps near the end of enumeration for PCI-to-PCI
bridges as well, if you have them. The bridge's resource map depends on
the devices behind it. In this case it could be confusing because you
have only one device (I guess).

> PciBus: Resource Map for Root Bridge PciRoot(0x0)
> Type =  Mem32; Base = 0x2000;Length = 0x1010; Alignment =
> 0xFFF
>Base = 0x2000;Length = 0x1000;Alignment =
> 0xFFF;Owner = PCI [00|01|00:18]; Type = PMem32
> >Mem32 here
>Base = 0x3000;Length = 0x1000;Alignment = 0xFFF; Owner =
> PCI [00|01|00:14]
>Base = 0x30001000;Length = 0x100;Alignment = 0xFFF; Owner =
> PCI [00|01|00:10]

So the 

Re: [edk2] asm/S assembler files

2015-12-02 Thread Andrew Fish

> On Dec 2, 2015, at 9:37 AM, Michael Zimmermann  
> wrote:
> 
> Does NASM support ARM and AARCH64? because according to Wikipedia it doesn't.
> 
> > Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I 
> > would also point out that the inline assembly will optimize better as the 
> > compiler will always call the .S function, but the optimizer can inline the 
> > C function if needed.
> 
> Are you sure assembly never get's inlined? I'd expect optimizers to work on 
> assembly/bytecode level and at least GCC's O3 function enables -finline.
> 

Well I can't speak for all assemblers, but I'm not sure they all emit bitcode. 
At least on the Xcode side the compiler compiles to bitcode, the assembler 
compiles to native so it is harder to optimize. With bitcode the inline 
assembly is part of the bitcode, so when the native code generation happens it 
is very easy for the compiler to optimize. 

Thanks,

Andrew Fish

~/work/Compiler>cat bit.c
#define IN

typedef unsigned int  UINT32;
typedef unsigned long long UINT64;

UINT64
AsmReadMsr64 (
  IN  UINT32Index
  )
{
  UINT32 LowData;
  UINT32 HighData;

  __asm__ __volatile__ (
"rdmsr"
: "=a" (LowData),   // %0
  "=d" (HighData)   // %1
: "c"  (Index)  // %2
);

  return (((UINT64)HighData) << 32) | LowData;
}

~/work/Compiler>clang -S bit.c -Os -flto
~/work/Compiler>cat bit.S
; ModuleID = 'bit.c'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"

; Function Attrs: nounwind optsize ssp uwtable
define i64 @AsmReadMsr64(i32 %Index) #0 {
  %1 = tail call { i32, i32 } asm sideeffect "rdmsr", 
"={ax},={dx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %Index) #1, !srcloc !1
  %2 = extractvalue { i32, i32 } %1, 0
  %3 = extractvalue { i32, i32 } %1, 1
  %4 = zext i32 %3 to i64
  %5 = shl nuw i64 %4, 32
  %6 = zext i32 %2 to i64
  %7 = or i64 %5, %6
  ret i64 %7
}

attributes #0 = { nounwind optsize ssp uwtable "less-precise-fpmad"="false" 
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" 
"no-infs-fp-math"="false" "no-nans-fp-math"="false" 
"stack-protector-buffer-size"="8" "unsafe-fp-math"="false" 
"use-soft-float"="false" }
attributes #1 = { nounwind }

!llvm.ident = !{!0}

!0 = metadata !{metadata !"Apple LLVM version 6.1.0 (clang-602.0.53) (based on 
LLVM 3.6.0svn)"}
!1 = metadata !{i32 217}




> On Wed, Dec 2, 2015 at 6:32 PM, Andrew Fish  > wrote:
> 
> > On Dec 2, 2015, at 8:44 AM, Michael Zimmermann  > > wrote:
> >
> > Hi,
> >
> > sorry if this is documented somewhere but I've always wondered what this
> > whole assembler file situation in EDKII is about.
> > What I mean is that there are two versions of every assembler file - for VS
> > and GCC compilers I guess.
> >
> > What I've noticed though is that most of these files are almost identical
> > except for minor differences like different export macros and comment
> > characters.
> >
> > I think (I hope I'm wrong) that there even are some projects where one
> > version of these files is outdated/not maintained.
> >
> > If I'm right and the differences really are that small, couldn't we just
> > write some kind of converter so we can remove all this duplicate code?
> >
> 
> I think the longer term direction is to move to nasm. There are still some 
> issues of nasm working with Xcode as the DWARF info does not get placed into 
> the Mach-O files.
> 
> The MdePkg Libraries are designed so that you don't need to write assembler. 
> On an ARM based system you may also need some help from the ArmPkg. So the 
> general answer don't write assembler. You can usually use the BaseLib to do 
> what you need to do.
> 
> On the x86 side there are a few exceptions:
> 1) Reset - You start in real mode with no stack
> 2) Interrupts - You need to save state.
> 3) Mode Switches - PEI is 32-bit (No place to store the page tables) and DXE 
> is 64-bit
> 4) SMM - More strange mode switching
> 5) Optimization - Usually not needed (MdePkg has optimized CopyMem etc.)
> 
> Now I would say an issue I've seen is that the Silicon folks like to 
> "reinvent the wheel".
> >find . -iname '*.S'
> ...
> ./Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/Ia32/Stack.S
> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/IA32/CpuIA32.S
> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/X64/Cpu.S
> 
> If you look at these files you will see that MdePkg has SwitchStack 
> functions, and the CpuIA32Lib is the old EDK names for functions that exist 
> in the MdePkg BaseLib. So this is an example of unneeded assembly code in the 
> tree.
> 
> #--
> #  UINT64
> #  EfiReadMsr (
> #IN   UINT32  Index,  // rcx
> #)
> #--
> ASM_PFX(EfiReadMsr):
>   rdmsr
>   shl$0x20,%rdx
>   or %rdx,%rax
>   retq

Re: [edk2] [Patch] ShellPkg: Fix wrong return status for Ifconfig.c

2015-12-02 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Jiaxin Wu
> Sent: Wednesday, December 02, 2015 12:54 AM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Ye, Ting ;
> Cohen, Eugene 
> Subject: [edk2] [Patch] ShellPkg: Fix wrong return status for Ifconfig.c
> Importance: High
> 
> The Ifconfig command handler tries to return an EFI_STATUS when
> the return type should be SHELL_STATUS.
> 
> Cc: Cohen, Eugene 
> Cc: Carsey, Jaben 
> Cc: Ye Ting 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu 
> ---
>  .../UefiShellNetwork1CommandsLib/Ifconfig.c| 102 ++
> ---
>  1 file changed, 69 insertions(+), 33 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> index e16d46a..fb6f575 100644
> --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> @@ -421,11 +421,11 @@ IfConfigGetInterfaceInfo (
>NULL,
>&HandleNum,
>&HandleBuffer
>   );
>if (EFI_ERROR (Status) || (HandleNum == 0)) {
> -return EFI_ABORTED;
> +return Status;
>}
> 
>//
>// Enumerate all handles that installed with ip4 service binding protocol.
>//
> @@ -585,15 +585,15 @@ ON_ERROR:
>  /**
>The list process of the ifconfig command.
> 
>@param[in]   IfListThe pointer of IfList(interface list).
> 
> -  @retval EFI_SUCCESSThe ifconfig command list processed successfully.
> +  @retval SHELL_SUCCESS  The ifconfig command list processed successfully.
>@retval others The ifconfig command list process failed.
> 
>  **/
> -EFI_STATUS
> +SHELL_STATUS
>  IfConfigShowInterfaceInfo (
>IN LIST_ENTRY*IfList
>)
>  {
>LIST_ENTRY   *Entry;
> @@ -781,35 +781,37 @@ IfConfigShowInterfaceInfo (
>  }
>}
> 
>ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_BREAK),
> gShellNetwork1HiiHandle);
> 
> -  return EFI_SUCCESS;
> +  return SHELL_SUCCESS;
>  }
> 
>  /**
>The clean process of the ifconfig command to clear interface info.
> 
>@param[in]   IfListThe pointer of IfList(interface list).
> 
> -  @retval EFI_SUCCESSThe ifconfig command clean processed successfully.
> +  @retval SHELL_SUCCESS  The ifconfig command clean processed
> successfully.
>@retval others The ifconfig command clean process failed.
> 
>  **/
> -EFI_STATUS
> +SHELL_STATUS
>  IfConfigClearInterfaceInfo (
>IN LIST_ENTRY*IfList
>)
>  {
> -  EFI_STATUSStatus;
> +  EFI_STATUSStatus;
> +  SHELL_STATUS  ShellStatus;
>LIST_ENTRY*Entry;
>LIST_ENTRY*Next;
>IFCONFIG_INTERFACE_CB *IfCb;
>EFI_IP4_CONFIG2_POLICYPolicy;
> 
>Policy = Ip4Config2PolicyDhcp;
>Status = EFI_SUCCESS;
> +  ShellStatus = SHELL_SUCCESS;
> 
>if (IsListEmpty (IfList)) {
>  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
>}
> 
> @@ -823,37 +825,37 @@ IfConfigClearInterfaceInfo (
>  IfCb->IfCfg,
>  Ip4Config2DataTypePolicy,
>  sizeof (EFI_IP4_CONFIG2_POLICY),
>  &Policy
>  );
> -
>  if (EFI_ERROR (Status)) {
> +  ShellStatus = SHELL_ACCESS_DENIED;
>break;
>  }
>}
> 
> -  return Status;
> +  return ShellStatus;
>  }
> 
>  /**
>The set process of the ifconfig command.
> 
>@param[in]   IfListThe pointer of IfList(interface list).
>@param[in]   VarArgThe pointer of ARG_LIST(Args with "-s" option).
> 
> -  @retval EFI_SUCCESSThe ifconfig command set processed successfully.
> +  @retval SHELL_SUCCESS  The ifconfig command set processed successfully.
>@retval others The ifconfig command set process failed.
> 
>  **/
> -EFI_STATUS
> +SHELL_STATUS
>  IfConfigSetInterfaceInfo (
>IN LIST_ENTRY*IfList,
>IN ARG_LIST  *VarArg
>)
>  {
> -
>EFI_STATUS   Status;
> +  SHELL_STATUS ShellStatus;
>IFCONFIG_INTERFACE_CB*IfCb;
>VAR_CHECK_CODE   CheckCode;
>EFI_EVENTTimeOutEvt;
>EFI_EVENTMappedEvt;
>BOOLEAN  IsAddressOk;
> @@ -870,18 +872,19 @@ IfConfigSetInterfaceInfo (
> 
>Dns = NULL;
> 
>if (IsListEmpty (IfList)) {
>  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
> -return EFI_INVALID_PARAMETER;
> +return SHELL_INVALID_PARAMETER;
>}
> 
>//
>// Make sure to set only one interface each time.
>//
>

Re: [edk2] Where do I find the system table address for an EFI app ?

2015-12-02 Thread Carsey, Jaben
I am pretty sure it’s there in a shell app also.  What entry point lib are you 
using to build your app?

-Jaben

From: Shubha Ramani [mailto:shubharam...@yahoo.com]
Sent: Wednesday, December 02, 2015 9:11 AM
To: Carsey, Jaben ; edk2-devel@lists.01.org
Subject: Re: [edk2] Where do I find the system table address for an EFI app ?
Importance: High

Not in a Shell App though. How do you answer to the debugger when it's asking 
for the System Table address for a shell app ?

Thanks,

Shubha

Shubha D. Ramani
shubharam...@gmail.com
shubharam...@yahoo.com


On Tuesday, December 1, 2015 8:39 AM, "Carsey, Jaben" 
mailto:jaben.car...@intel.com>> wrote:

Its passed as a parameter to the "main" function when your app starts.

-Jaben

> -Original Message-
> From: edk2-devel 
> [mailto:edk2-devel-boun...@lists.01.org]
>  On Behalf Of
> Shubha Ramani
> Sent: Tuesday, December 01, 2015 8:35 AM
> To: edk2-devel@lists.01.org
> Subject: Re: [edk2] Where do I find the system table address for an EFI app ?
> Importance: High
>
>  I'm sorry but this was unclear. I meant where do I find the System Table
> address for a UEFI Shell App ?The debugger is asking for it. I couldn't find 
> it in
> the generated *.map file.
> Thanks
> Shubha
> Shubha D. ramanishubharam...@gmail.com
> shubharam...@yahoo.com
>
>
>On Monday, November 30, 2015 3:00 PM, Shubha Ramani
> mailto:shubharam...@yahoo.com>> wrote:
>
>
>  I'm trying to debug it using a debugger and the debugger is asking me this
> question.
> I looked at the *.map file which is generated and I could not locate the 
> System
> Table address.
> Thanks,
> Shubha Shubha D. 
> ramanishubharam...@gmail.com
> shubharam...@yahoo.com

>
>
> ___
> 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] asm/S assembler files

2015-12-02 Thread Michael Zimmermann
Does NASM support ARM and AARCH64? because according to Wikipedia it
doesn't.

> Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I
would also point out that the inline assembly will optimize better as the
compiler will always call the .S function, but the optimizer can inline the
C function if needed.

Are you sure assembly never get's inlined? I'd expect optimizers to work on
assembly/bytecode level and at least GCC's O3 function enables -finline.

On Wed, Dec 2, 2015 at 6:32 PM, Andrew Fish  wrote:

>
> > On Dec 2, 2015, at 8:44 AM, Michael Zimmermann 
> wrote:
> >
> > Hi,
> >
> > sorry if this is documented somewhere but I've always wondered what this
> > whole assembler file situation in EDKII is about.
> > What I mean is that there are two versions of every assembler file - for
> VS
> > and GCC compilers I guess.
> >
> > What I've noticed though is that most of these files are almost identical
> > except for minor differences like different export macros and comment
> > characters.
> >
> > I think (I hope I'm wrong) that there even are some projects where one
> > version of these files is outdated/not maintained.
> >
> > If I'm right and the differences really are that small, couldn't we just
> > write some kind of converter so we can remove all this duplicate code?
> >
>
> I think the longer term direction is to move to nasm. There are still some
> issues of nasm working with Xcode as the DWARF info does not get placed
> into the Mach-O files.
>
> The MdePkg Libraries are designed so that you don't need to write
> assembler. On an ARM based system you may also need some help from the
> ArmPkg. So the general answer don't write assembler. You can usually use
> the BaseLib to do what you need to do.
>
> On the x86 side there are a few exceptions:
> 1) Reset - You start in real mode with no stack
> 2) Interrupts - You need to save state.
> 3) Mode Switches - PEI is 32-bit (No place to store the page tables) and
> DXE is 64-bit
> 4) SMM - More strange mode switching
> 5) Optimization - Usually not needed (MdePkg has optimized CopyMem etc.)
>
> Now I would say an issue I've seen is that the Silicon folks like to
> "reinvent the wheel".
> >find . -iname '*.S'
> ...
>
> ./Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/Ia32/Stack.S
> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/IA32/CpuIA32.S
> ./Vlv2TbltDevicePkg/Library/CpuIA32Lib/X64/Cpu.S
>
> If you look at these files you will see that MdePkg has SwitchStack
> functions, and the CpuIA32Lib is the old EDK names for functions that exist
> in the MdePkg BaseLib. So this is an example of unneeded assembly code in
> the tree.
>
>
> #--
> #  UINT64
> #  EfiReadMsr (
> #IN   UINT32  Index,  // rcx
> #)
>
> #--
> ASM_PFX(EfiReadMsr):
>   rdmsr
>   shl$0x20,%rdx
>   or %rdx,%rax
>   retq
>
>
> Looks a lot like:
>
> UINT64
> EFIAPI
> AsmReadMsr64 (
>   IN  UINT32Index
>   )
> {
>   UINT32 LowData;
>   UINT32 HighData;
>
>   __asm__ __volatile__ (
> "rdmsr"
> : "=a" (LowData),   // %0
>   "=d" (HighData)   // %1
> : "c"  (Index)  // %2
> );
>
>   return (((UINT64)HighData) << 32) | LowData;
> }
>
> Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I
> would also point out that the inline assembly will optimize better as the
> compiler will always call the .S function, but the optimizer can inline the
> C function if needed.
>
> Thanks,
>
> Andrew Fish
>
>
> > Michael
> > ___
> > 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] asm/S assembler files

2015-12-02 Thread Andrew Fish

> On Dec 2, 2015, at 8:44 AM, Michael Zimmermann  
> wrote:
> 
> Hi,
> 
> sorry if this is documented somewhere but I've always wondered what this
> whole assembler file situation in EDKII is about.
> What I mean is that there are two versions of every assembler file - for VS
> and GCC compilers I guess.
> 
> What I've noticed though is that most of these files are almost identical
> except for minor differences like different export macros and comment
> characters.
> 
> I think (I hope I'm wrong) that there even are some projects where one
> version of these files is outdated/not maintained.
> 
> If I'm right and the differences really are that small, couldn't we just
> write some kind of converter so we can remove all this duplicate code?
> 

I think the longer term direction is to move to nasm. There are still some 
issues of nasm working with Xcode as the DWARF info does not get placed into 
the Mach-O files. 

The MdePkg Libraries are designed so that you don't need to write assembler. On 
an ARM based system you may also need some help from the ArmPkg. So the general 
answer don't write assembler. You can usually use the BaseLib to do what you 
need to do. 

On the x86 side there are a few exceptions:
1) Reset - You start in real mode with no stack
2) Interrupts - You need to save state. 
3) Mode Switches - PEI is 32-bit (No place to store the page tables) and DXE is 
64-bit
4) SMM - More strange mode switching
5) Optimization - Usually not needed (MdePkg has optimized CopyMem etc.) 

Now I would say an issue I've seen is that the Silicon folks like to "reinvent 
the wheel". 
>find . -iname '*.S'
...
./Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/Ia32/Stack.S
./Vlv2TbltDevicePkg/Library/CpuIA32Lib/IA32/CpuIA32.S
./Vlv2TbltDevicePkg/Library/CpuIA32Lib/X64/Cpu.S

If you look at these files you will see that MdePkg has SwitchStack functions, 
and the CpuIA32Lib is the old EDK names for functions that exist in the MdePkg 
BaseLib. So this is an example of unneeded assembly code in the tree. 

#--
#  UINT64
#  EfiReadMsr (
#IN   UINT32  Index,  // rcx
#)
#--
ASM_PFX(EfiReadMsr):
  rdmsr
  shl$0x20,%rdx
  or %rdx,%rax
  retq


Looks a lot like:

UINT64
EFIAPI
AsmReadMsr64 (
  IN  UINT32Index
  )
{
  UINT32 LowData;
  UINT32 HighData;
  
  __asm__ __volatile__ (
"rdmsr"
: "=a" (LowData),   // %0
  "=d" (HighData)   // %1
: "c"  (Index)  // %2
);

  return (((UINT64)HighData) << 32) | LowData;
}

Not sure why the Vlv2TbltDevicePkg needed to add that assembly code? I would 
also point out that the inline assembly will optimize better as the compiler 
will always call the .S function, but the optimizer can inline the C function 
if needed. 

Thanks,

Andrew Fish


> Michael
> ___
> 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] Could not add PCI device with big memory to aarch64 VMs

2015-12-02 Thread liang yan

Hi, Laszlo,

On 11/30/2015 06:45 PM, Laszlo Ersek wrote:

On 12/01/15 01:46, liang yan wrote:

Hello, Laszlo,

On 11/30/2015 03:05 PM, Laszlo Ersek wrote:

[snip]


If you need more room (with large alignments), then there's no way
around supporting QEMU's 64 bit aperture, VIRT_PCIE_MMIO_HIGH (see my
earlier email).

I checked the function create_pcie form pathtoqemu/hw/arm/virt.c, it has
a flag value use_highmem(which has default "true" value).

It set base_mmio_high and size_mmio_high to device tree by function below,

 qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "ranges",
  1, FDT_PCI_RANGE_IOPORT, 2, 0,
  2, base_pio, 2, size_pio,
  1, FDT_PCI_RANGE_MMIO, 2, base_mmio,
  2, base_mmio, 2, size_mmio,
  1, FDT_PCI_RANGE_MMIO_64BIT,
  2, base_mmio_high,
  2, base_mmio_high, 2, size_mmio_high);

So basically, I need to add two UINT64 variables like mmio_high_base and
mmio_high_size to PCD under function ProcessPciHost(VirtFdtDxe.c),
and try to use this high base address and size as new aperture.

Is this correct?

It is correct, but that's only part of the story.

Parsing the 64-bit aperture from the DTB into new PCDs in
ArmVirtPkg/VirtFdtDxe is the easy part.

The hard part is modifying ArmVirtPkg/PciHostBridgeDxe, so that BAR
allocation requests (submitted by the platform independent PCI bus
driver that resides in "MdeModulePkg/Bus/Pci/PciBusDxe") are actually
serviced from this high aperture too.


Unfortunately I can't readily help with that in the
"ArmVirtPkg/PciHostBridgeDxe" driver; there's no such (open-source)
example in the edk2 tree. Of course, I could experiment with it myself
-- only not right now.

If possible, I do want to finish this part or help you finish it. I just
work on UEFI recently, and thank you so much for your patient and detail
explanation. I really appreciate it.

I guess copying and adapting the TypeMem32 logic to TypeMem64 (currently
short-circuited with EFI_ABORTED) could work.

Is the 32 or 64 bit determined by BAR(2-3bit) or by the PCI device
memory size? Is there an option from QEMU?

I can't tell. :)


Does TypeMem32 still keep  "VIRT_PCIE_MMIO" aperture and TypeMem64 use
"VIRT_PCIE_MMIO_HIGH" aperture? or It's more like device property
controlled from QEMU device simulation?

Good question. I don't know. I think in order to answer this question,
we should understand the whole dance between the PCI root bridge / host
bridge driver and the generic PCI bus driver.

The documentation I know of is in the Platform Init spec, version 1.4,
Volume 5, Chapter 10 "PCI Host Bridge". I've taken multiple stabs at
that chapter earlier, but I've always given up.

Sorry I can't help more, but this is new area for me as well.

No, already a big help, Really appreciate your generous sharing.

I also have a problem from guest vm kernel side.

Even we change the UEFI side, should the guest kernel still need to modify?
Because, I noticed that the kernel will do rescan.  use the example of 
256M below.


UEFI side, has two setup, not sure which is the real one.

PciBus: Discovered PCI @ [00|01|00]
   BAR[0]: Type =  Mem32; Alignment = 0xFFF;Length = 0x100; Offset 
= 0x10
   BAR[1]: Type =  Mem32; Alignment = 0xFFF;Length = 0x1000; Offset 
= 0x14
   BAR[2]: Type = PMem64; Alignment = 0xFFF;Length = 
0x1000;Offset = 0x18

 = PMem64 here


PciBus: Resource Map for Root Bridge PciRoot(0x0)
Type =  Mem32; Base = 0x2000;Length = 0x1010; Alignment = 
0xFFF
   Base = 0x2000;Length = 0x1000;Alignment = 
0xFFF;Owner = PCI [00|01|00:18]; Type = PMem32 
>Mem32 here
   Base = 0x3000;Length = 0x1000;Alignment = 0xFFF; Owner = 
PCI [00|01|00:14]
   Base = 0x30001000;Length = 0x100;Alignment = 0xFFF; Owner = 
PCI [00|01|00:10]



but kernel side: it becomes 64bit pref

[3.005355] pci_bus :00: root bus resource [mem 
0x1000-0x3efe window]

[3.006028] pci_bus :00: root bus resource [bus 00-0f]
.
.
.
[3.135847] pci :00:01.0: BAR 2: assigned [mem 
0x1000-0x1fff 64bit pref]

[3.137099] pci :00:01.0: BAR 1: assigned [mem 0x2000-0x2fff]
[3.137382] pci :00:01.0: BAR 0: assigned [mem 0x20001000-0x200010ff]



Also, I found that [mem 0x80 window] was ignored,

[2.769608] PCI ECAM: ECAM for domain  [bus 00-0f] at [mem 
0x3f00-0x3fff] (base 0x3f00)

[2.962930] ACPI: PCI Root Bridge [PCI0] (domain  [bus 00-0f])
[2.965787] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM 
ClockPM Segments MSI]
[2.990794] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME 
AER PCIeCapability]
[2.994520] acpi PNP0A08:00: host bridge 

Re: [edk2] [Patch 2/2] ShellPkg/mm: Fix mm to support multiple root bridge platform

2015-12-02 Thread Carsey, Jaben
I propose to rev the version of the library + 0.1 in the INF file?

Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ruiyu Ni
> Sent: Tuesday, December 01, 2015 9:54 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Qiu, Shumin 
> Subject: [edk2] [Patch 2/2] ShellPkg/mm: Fix mm to support multiple root
> bridge platform
> Importance: High
> 
> In multiple root bridge platforms, different root bridges may
> share the same segment but occupy different range of buses,
> or may occupy different segments.
> The fix is to find the correct root bridge IO instance by
> comparing not only the segment but also the bus ranges.
> Directly use Cpu Io for MMIO and IO accesses because some MMIO
> or IO is not occupied by PCI devices so it doesn't make sense
> to use root bridge IO to access them.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni 
> Cc: Shumin Qiu 
> ---
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c   | 329 +++-
> -
>  .../UefiShellDebug1CommandsLib.h   |   3 +-
>  .../UefiShellDebug1CommandsLib.inf |   1 +
>  .../UefiShellDebug1CommandsLib.uni | Bin 139696 -> 139768 
> bytes
>  4 files changed, 181 insertions(+), 152 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> index ca64f2c..fa1451c 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> @@ -2,7 +2,7 @@
>Main file for Mm shell Debug1 function.
> 
>(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
> -  Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.
> +  Copyright (c) 2005 - 2015, 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
> @@ -19,12 +19,30 @@
>  #include 
> 
>  typedef enum {
> -  EfiMemory,
> -  EFIMemoryMappedIo,
> -  EfiIo,
> -  EfiPciConfig,
> -  EfiPciEConfig
> -} EFI_ACCESS_TYPE;
> +  ShellMmMemory,
> +  ShellMmMemoryMappedIo,
> +  ShellMmIo,
> +  ShellMmPci,
> +  ShellMmPciExpress
> +} SHELL_MM_ACCESS_TYPE;
> +
> +typedef struct {
> +  UINT64 Register : 12;
> +  UINT64 Function : 8;
> +  UINT64 Device : 8;
> +  UINT64 Bus : 8;
> +  UINT64 Segment : 8;
> +  UINT64 Reserved : 20;
> +} SHELL_MM_PCIE_ADDRESS;
> +
> +typedef struct {
> +  UINT64 Register : 8;
> +  UINT64 Function : 8;
> +  UINT64 Device : 8;
> +  UINT64 Bus : 8;
> +  UINT64 Segment : 8;
> +  UINT64 Reserved : 24;
> +} SHELL_MM_PCI_ADDRESS;
> 
>  STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
>{L"-mmio", TypeFlag},
> @@ -37,7 +55,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
>{NULL, TypeMax}
>};
> 
> -STATIC CONST UINT64 MaxNum[9]  = { 0xff, 0x, 0x,
> 0xULL };
> +STATIC CONST UINT64 mShellMmMaxNumber[9]  = { 0xff, 0x, 0x,
> 0xULL };
> 
>  /**
>Read some data into a buffer from memory.
> @@ -176,22 +194,43 @@ GetHex (
>  }
> 
>  /**
> -  Get the PCI-E Address from a PCI address format 0xssbbddffrrr
> -  where ss is SEGMENT, bb is BUS, dd is DEVICE, ff is FUNCTION
> -  and rrr is REGISTER (extension format for PCI-E).
> -
> -  @param[in] InputAddress   PCI address format on input.
> -  @param[out]PciEAddressPCI-E address extention format.
> +  Extract the PCI segment, bus, device, function, register from
> +  from a SHELL_MM_PCI or SHELL_MM_PCIE format of address..
> +
> +  @param[in]  AccessType Access type.
> +  @param[in]  AddressSHELL_MM_PCI or SHELL_MM_PCIE address.
> +  @param[out] SegmentPCI segment number.
> +  @param[out] BusPCI bus number.
> +  @param[out] Device PCI device number.
> +  @param[out] Function   PCI function number.
> +  @param[out] Register   PCI register offset.
>  **/
>  VOID
>  EFIAPI
> -GetPciEAddressFromInputAddress (
> -  IN UINT64 InputAddress,
> -  OUT UINT64*PciEAddress
> +ShellMmDecodePciAddress (
> +  IN SHELL_MM_ACCESS_TYPE   AccessType,
> +  IN UINT64 Address,
> +  OUT UINT32*Segment,
> +  OUT UINT8 *Bus,
> +  OUT UINT8 *Device,
> +  OUT UINT8 *Function,
> +  OUT UINT32*Register
>)
>  {
> -  *PciEAddress = RShiftU64(InputAddress & ~(UINT64) 0xFFF, 4);
> -  *PciEAddress += LShiftU64((UINT16) InputAddress & 0x0FFF, 32);
> +  ASSERT ((AccessType == ShellMmPci) || (AccessType ==
> ShellMmPciExpress));
> +  if (AccessType == ShellMmPci) {
> +*Segment = (UINT32) ((SHELL_MM_PCI_ADDRESS *) (&Address))-
> >Segment;
> +*Bus = (UIN

Re: [edk2] asm/S assembler files

2015-12-02 Thread Laszlo Ersek
On 12/02/15 17:44, Michael Zimmermann wrote:
> Hi,
> 
> sorry if this is documented somewhere but I've always wondered what this
> whole assembler file situation in EDKII is about.
> What I mean is that there are two versions of every assembler file - for VS
> and GCC compilers I guess.
> 
> What I've noticed though is that most of these files are almost identical
> except for minor differences like different export macros and comment
> characters.
> 
> I think (I hope I'm wrong) that there even are some projects where one
> version of these files is outdated/not maintained.
> 
> If I'm right and the differences really are that small, couldn't we just
> write some kind of converter so we can remove all this duplicate code?

The duplication exists because the Microsoft toolchains and the gcc (GNU
binutils) toolchains use different assembly syntaxes.

A few months (?) back Jordan (and others?) added support for NASM.
(Can't recall the minimum required version; it is documented somewhere.)
NASM is available on both Windows and GNU/Linux, so it enables us to
unify the assembly sources (there's also a new set of file suffixes for
NASM source files, *.nasm* as I recall). It's just that the existing
files have not yet been unified.

NASM brings other benefits too; for example it allows one to write
mixed-mode code (16-bit, 32-bit, 64-bit) within the same source file,
without ugly DB macros. This is useful for mode switching.

Thanks
Laszlo

> 
> Michael
> ___
> 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] Where do I find the system table address for an EFI app ?

2015-12-02 Thread Shubha Ramani
Not in a Shell App though. How do you answer to the debugger when it's asking 
for the System Table address for a shell app ?
Thanks,
Shubha Shubha D. ramanishubharam...@gmail.com
shubharam...@yahoo.com 


On Tuesday, December 1, 2015 8:39 AM, "Carsey, Jaben" 
 wrote:
 

 Its passed as a parameter to the "main" function when your app starts.

-Jaben

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Shubha Ramani
> Sent: Tuesday, December 01, 2015 8:35 AM
> To: edk2-devel@lists.01.org
> Subject: Re: [edk2] Where do I find the system table address for an EFI app ?
> Importance: High
> 
>  I'm sorry but this was unclear. I meant where do I find the System Table
> address for a UEFI Shell App ?The debugger is asking for it. I couldn't find 
> it in
> the generated *.map file.
> Thanks
> Shubha
> Shubha D. ramanishubharam...@gmail.com
> shubharam...@yahoo.com
> 
> 
>    On Monday, November 30, 2015 3:00 PM, Shubha Ramani
>  wrote:
> 
> 
>  I'm trying to debug it using a debugger and the debugger is asking me this
> question.
> I looked at the *.map file which is generated and I could not locate the 
> System
> Table address.
> Thanks,
> Shubha Shubha D. ramanishubharam...@gmail.com
> shubharam...@yahoo.com
> 
> 
> ___
> 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 5/5] ArmVirtPkg: use explicit KERNEL_BLOB_TYPE cast

2015-12-02 Thread Laszlo Ersek
On 12/02/15 18:02, Ard Biesheuvel wrote:
> The ARM RVCT compiler does not allow implicit casts between enumerated
> types and integer types. In this particular case, the STUB_FILE::Position
> member is overloaded as a KERNEL_BLOB_TYPE identifier, so it does not
> hurt to make that cast explicit.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c 
> b/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
> index b882dd2713c1..c48f4767ad8f 100644
> --- a/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
> +++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
> @@ -413,7 +413,9 @@ StubFileRead (
>return EFI_SUCCESS;
>  }
>  
> -Status = ConvertKernelBlobTypeToFileInfo (StubFile->Position, BufferSize,
> +Status = ConvertKernelBlobTypeToFileInfo (
> +   (KERNEL_BLOB_TYPE)StubFile->Position,
> +   BufferSize,
> Buffer);
>  if (EFI_ERROR (Status)) {
>return Status;
> 

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


Re: [edk2] [PATCH 4/5] ShellPkg: add missing SHELL_STATUS cast

2015-12-02 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Wednesday, December 02, 2015 9:03 AM
> To: edk2-devel@lists.01.org; ler...@redhat.com; Gao, Liming
> ; Zhang, Chao B ; Carsey,
> Jaben ; Qiu, Shumin ; Fan,
> Jeff ; Tian, Feng 
> Cc: Ard Biesheuvel 
> Subject: [PATCH 4/5] ShellPkg: add missing SHELL_STATUS cast
> Importance: High
> 
> The prototype of ShellCommandRunIfconfig() indicates that it returns
> a SHELL_STATUS, so returning a EFI_STATUS requires an explicit cast.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> index e16d46a8ec4d..2347aab9e96e 100644
> --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> @@ -1384,5 +1384,5 @@ ON_EXIT:
>  IfConfigCleanup (Private);
>}
> 
> -  return Status;
> +  return (SHELL_STATUS)Status;
>  }
> --
> 1.9.1

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


[edk2] [PATCH 0/5] coding style/whitespace/cast fixes for RVCT

2015-12-02 Thread Ard Biesheuvel
This fixes a couple of coding style and white space issues and missing casts 
that
the RVCT warns about, which means they are breaking the build in 
warnings-as-errors
mode.

Ard Biesheuvel (5):
  IntelFrameworkModulePkg: remove unreachable code
  MdeModulePkg: remove unreachable code
  SecurityPkg: put missing empty lines at the end of some header files
  ShellPkg: add missing SHELL_STATUS cast
  ArmVirtPkg: use explicit KERNEL_BLOB_TYPE cast

 ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
| 4 +++-
 IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c 
| 1 -
 MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c 
| 3 ---
 MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c   
| 1 -
 MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
| 1 -
 SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h  
| 2 +-
 SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h   
| 2 +-
 SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h 
| 2 +-
 ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c   
| 2 +-
 9 files changed, 7 insertions(+), 11 deletions(-)

-- 
1.9.1

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


[edk2] [PATCH 5/5] ArmVirtPkg: use explicit KERNEL_BLOB_TYPE cast

2015-12-02 Thread Ard Biesheuvel
The ARM RVCT compiler does not allow implicit casts between enumerated
types and integer types. In this particular case, the STUB_FILE::Position
member is overloaded as a KERNEL_BLOB_TYPE identifier, so it does not
hurt to make that cast explicit.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c 
b/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
index b882dd2713c1..c48f4767ad8f 100644
--- a/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
+++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
@@ -413,7 +413,9 @@ StubFileRead (
   return EFI_SUCCESS;
 }
 
-Status = ConvertKernelBlobTypeToFileInfo (StubFile->Position, BufferSize,
+Status = ConvertKernelBlobTypeToFileInfo (
+   (KERNEL_BLOB_TYPE)StubFile->Position,
+   BufferSize,
Buffer);
 if (EFI_ERROR (Status)) {
   return Status;
-- 
1.9.1

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


[edk2] [PATCH 3/5] SecurityPkg: put missing empty lines at the end of some header files

2015-12-02 Thread Ard Biesheuvel
Some compilers (like RVCT) reject input files that do not end in a
newline. So add missing newlines to some SecurityPkg header files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h  
| 2 +-
 SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h   
| 2 +-
 SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h 
| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h 
b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
index b09ef8afd3e1..cff6076368b5 100644
--- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
+++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
@@ -204,4 +204,4 @@ typedef struct {
   HASH_FINAL   HashFinal;
 } HASH_TABLE;
 
-#endif
\ No newline at end of file
+#endif
diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
index 228f44bde814..bcb1c12e2314 100644
--- 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
+++ 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
@@ -621,4 +621,4 @@ GuidToString (
   IN  UINTN BufferSize
   );
 
-#endif
\ No newline at end of file
+#endif
diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h
 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h
index b628bcb1f532..7aebc1f99e85 100644
--- 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h
+++ 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h
@@ -133,4 +133,4 @@ typedef struct {
   EFI_HII_TIME RevocationTime; // The revocation time of the certificate
 } SECUREBOOT_CONFIGURATION;
 
-#endif
\ No newline at end of file
+#endif
-- 
1.9.1

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


[edk2] [PATCH 4/5] ShellPkg: add missing SHELL_STATUS cast

2015-12-02 Thread Ard Biesheuvel
The prototype of ShellCommandRunIfconfig() indicates that it returns
a SHELL_STATUS, so returning a EFI_STATUS requires an explicit cast.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c 
b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
index e16d46a8ec4d..2347aab9e96e 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
@@ -1384,5 +1384,5 @@ ON_EXIT:
 IfConfigCleanup (Private);
   }
 
-  return Status;
+  return (SHELL_STATUS)Status;
 }
-- 
1.9.1

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


[edk2] [PATCH 2/5] MdeModulePkg: remove unreachable code

2015-12-02 Thread Ard Biesheuvel
Some compilers (like RVCT) are finicky about unreachable code,
so remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c   | 3 ---
 MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c | 1 -
 MdeModulePkg/Universal/SetupBrowserDxe/Expression.c  | 1 -
 3 files changed, 5 deletions(-)

diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
index daa8c124..732dd2f3de7a 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
@@ -229,7 +229,6 @@ ReadString (
 return EFI_DEVICE_ERROR;
   }
 
-  break;
 
 case CHAR_BACKSPACE:
   if (StringPtr[0] != CHAR_NULL && CurrentCursor != 0) {
@@ -881,7 +880,6 @@ TheKey2:
 }
 
 goto EnterCarriageReturn;
-break;
 
   case SCAN_UP:
   case SCAN_DOWN:
@@ -982,7 +980,6 @@ EnterCarriageReturn:
   }
 
   return EFI_SUCCESS;
-  break;
 
 case CHAR_BACKSPACE:
   if (ManualInput) {
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
index c074f4b4a39a..bb2faf3244d4 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
@@ -568,7 +568,6 @@ PrintFormattedNumber (
 
   default:
 return EFI_UNSUPPORTED;
-break;
   }
 
   UnicodeSPrint (FormattedNumber, BufferSize, Format, Value);
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
index 688a1d66cb40..9a18dec5c03b 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
@@ -3170,7 +3170,6 @@ EvaluateExpression (
   //
   Status = EFI_UNSUPPORTED;
   goto Done;
-  break;
 }
   } else {
 //
-- 
1.9.1

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


[edk2] [PATCH 1/5] IntelFrameworkModulePkg: remove unreachable code

2015-12-02 Thread Ard Biesheuvel
Some compilers (like RVCT) are finicky about unreachable code,
so remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c 
b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
index eefec0642a70..1020e84c3d64 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
@@ -869,7 +869,6 @@ ConvertBmpToGopBlt (
   *GopBlt = NULL;
 }
 return EFI_UNSUPPORTED;
-break;
   };
 
 }
-- 
1.9.1

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


[edk2] asm/S assembler files

2015-12-02 Thread Michael Zimmermann
Hi,

sorry if this is documented somewhere but I've always wondered what this
whole assembler file situation in EDKII is about.
What I mean is that there are two versions of every assembler file - for VS
and GCC compilers I guess.

What I've noticed though is that most of these files are almost identical
except for minor differences like different export macros and comment
characters.

I think (I hope I'm wrong) that there even are some projects where one
version of these files is outdated/not maintained.

If I'm right and the differences really are that small, couldn't we just
write some kind of converter so we can remove all this duplicate code?

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


Re: [edk2] [PATCH 3/3] ArmPkg: update RVCT assembly functions to use new RVCT_ASM_EXPORT macro

2015-12-02 Thread Ard Biesheuvel
On 25 November 2015 at 20:11, Cohen, Eugene  wrote:
> This has the effect of splitting assembly functions into their own sections 
> so the linker can remove unused ones to save space.
>
> This has been tested to build with ArmPkg.dsc with RVCT 4.
>
> The majority of the conversion was performed with the attached python script.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Eugene Cohen 

This patch breaks ArmVirtQemu-ARM for me:

ASSERT /home/ard/build/uefi-next/ArmPkg/Drivers/CpuDxe/ArmV6/Exception.c(214): 0

This is because you are removing the ALIGN=5 from the area .asm file
that contains the vector table, presumably this one:
ArmPkg/Drivers/CpuDxe/ArmV6/ExceptionSupport.asm

I also wonder if it makes sense in the first place to split the vector
table into discardable sections, so perhaps we should just drop those
hunks?




> ---
>  .../ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm |   5 +-
>  ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.asm   |  26 ++---
>  ArmPkg/Drivers/CpuDxe/ArmV4/ExceptionSupport.asm   |  14 +--
>  ArmPkg/Drivers/CpuDxe/ArmV6/ExceptionSupport.asm   |  14 +--
>  ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.asm|   5 +-
>  ArmPkg/Library/ArmLib/ArmV7/ArmLibSupportV7.asm|  46 +++--
>  .../Library/ArmLib/ArmV7/ArmV7ArchTimerSupport.asm |  64 +---
>  ArmPkg/Library/ArmLib/ArmV7/ArmV7Support.asm   | 109 
> +++--
>  ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.asm |  84 ++--
>  ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.asm|   5 +-
>  ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.asm|   5 +-
>  ArmPkg/Library/BaseMemoryLibStm/Arm/CopyMem.asm|   5 +-
>  ArmPkg/Library/BaseMemoryLibStm/Arm/SetMem.asm |   5 +-
>  .../Library/BaseMemoryLibStm/BaseMemoryLibStm.inf  |   1 +
>  ArmPkg/Library/BaseMemoryLibVstm/Arm/CopyMem.asm   |   5 +-
>  ArmPkg/Library/BaseMemoryLibVstm/Arm/SetMem.asm|   5 +-
>  .../BaseMemoryLibVstm/BaseMemoryLibVstm.inf|   1 +
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.asm   |  14 +--
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm  |   5 +-
>  .../Library/CompilerIntrinsicsLib/Arm/ldivmod.asm  |   5 +-
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm  |   5 +-
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm  |   5 +-
>  .../Library/CompilerIntrinsicsLib/Arm/memcpy.asm   |   5 +-
>  .../Library/CompilerIntrinsicsLib/Arm/memcpy4.asm  |   5 +-
>  .../Library/CompilerIntrinsicsLib/Arm/memmove.asm  |   5 +-
>  .../Library/CompilerIntrinsicsLib/Arm/memset.asm   |  11 +--
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm |   8 +-
>  .../Library/CompilerIntrinsicsLib/Arm/switch.asm   |   5 +-
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm |   5 +-
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.asm |   8 +-
>  .../Library/CompilerIntrinsicsLib/Arm/uwrite.asm   |   8 +-
>  .../CompilerIntrinsicsLib.inf  |   1 +
>  32 files changed, 178 insertions(+), 316 deletions(-)
>
> diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm 
> b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm
> index 7150834..1417c9a 100644
> --- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm
> +++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.asm
> @@ -15,16 +15,15 @@
>  #include 
>  #include 
>
> +  INCLUDE AsmMacroExport.inc
>INCLUDE AsmMacroIoLib.inc
>
> -  EXPORT  ArmGetScuBaseAddress
>
>PRESERVE8
> -  AREAArmCortexA9Helper, CODE, READONLY
>
>  // IN None
>  // OUT r0 = SCU Base Address
> -ArmGetScuBaseAddress
> + RVCT_ASM_EXPORT ArmGetScuBaseAddress
>// Read Configuration Base Address Register. ArmCBar cannot be called to 
> get
>// the Configuration BAR as a stack is not necessary setup. The SCU is at 
> the
>// offset 0x from the Private Memory Region.
> diff --git a/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.asm 
> b/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.asm
> index 92c3236..4228fb5 100644
> --- a/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.asm
> +++ b/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.asm
> @@ -13,23 +13,15 @@
>
>  // For the moment we assume this will run in SVC mode on ARMv7
>
> -EXPORT  ArmGicV3GetControlSystemRegisterEnable
> -EXPORT  ArmGicV3SetControlSystemRegisterEnable
> -EXPORT  ArmGicV3EnableInterruptInterface
> -EXPORT  ArmGicV3DisableInterruptInterface
> -EXPORT  ArmGicV3EndOfInterrupt
> -EXPORT  ArmGicV3AcknowledgeInterrupt
> -EXPORT  ArmGicV3SetPriorityMask
> -EXPORT  ArmGicV3SetBinaryPointer
>
> -AREA ArmGicV3, CODE, READONLY
> +INCLUDE AsmMacroExport.inc
>
>  //UINT32
>  //EFIAPI
>  //ArmGicGetControlSystemRegisterEnable (
>  //  VOID
>  //  );
> -ArmGicV3GetControlSystemRegisterEnable
> + RVCT_ASM_EXPORT ArmGicV3GetControlSystemRegisterEnable
>  mrc p15, 0, r0, c12, c12, 5 // ICC_SRE
>  bx  lr
>
> @@ -38,7 +30,7 @@ ArmGicV3GetControlSystemRegisterEnable
>  //ArmGicSet

Re: [edk2] [PATCH 2/3] ArmPkg: create RVCT assembler macro to centralize EXPORT, AREA, and function label definition

2015-12-02 Thread Ard Biesheuvel
On 25 November 2015 at 20:08, Cohen, Eugene  wrote:
> In response to Leifs request earlier, this adds a new RVCT assembler macro to 
> centralize the exporting of assembly functions including the EXPORT directive 
> (so the linker can see it), the AREA directive (so it's in its own section 
> for code size reasons) and the function label itself.
>
> This patch is just the macro, PATCH 3/3 contains the assembly source changes.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Eugene Cohen 
>

Reviewed-by: Ard Biesheuvel 

Committed as SVN r19098 (after fixing up the commit log)

Thanks,
Ard.


> ---
>  ArmPkg/Include/AsmMacroExport.inc | 29 +
>  1 file changed, 29 insertions(+)
>  create mode 100644 ArmPkg/Include/AsmMacroExport.inc
>
> diff --git a/ArmPkg/Include/AsmMacroExport.inc 
> b/ArmPkg/Include/AsmMacroExport.inc
> new file mode 100644
> index 000..818d6b2
> --- /dev/null
> +++ b/ArmPkg/Include/AsmMacroExport.inc
> @@ -0,0 +1,29 @@
> +;%HEADER%
> +;/** @file
> +;  Macros to centralize the EXPORT, AREA, and definition of an assembly
> +;  function.  The AREA prefix is required to put the function in its own
> +;  section so that removal of unused functions in the final link is 
> performed.
> +;  This provides  equivalent functionality to the compiler's --split-sections
> +;  option.
> +;
> +;  Copyright (c) 2015 HP Development Company, L.P.
> +;
> +;  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.
> +;
> +;**/
> +
> +
> +  MACRO
> +  RVCT_ASM_EXPORT $func
> +EXPORT  $func
> +AREA s_$func, CODE, READONLY
> +$func
> +  MEND
> +
> +  END
> --
> 1.9.5.msysgit.0
>
> ___
> 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 1/3] BaseTools: add include for AutoGen.h when invoking the preprocessor with RVCT

2015-12-02 Thread Ard Biesheuvel
On 25 November 2015 at 20:06, Cohen, Eugene  wrote:
> Ensure that AutoGen.h is force-included when the RVCT preprocessor is invoked.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Eugene Cohen 

Reviewed-by: Ard Biesheuvel 

Committed as SVN r19097

Thanks,
Ard.

>
> ---
>  BaseTools/Conf/tools_def.template | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index db08e25..a2127b4 100644
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -6641,7 +6641,7 @@ RELEASE_RVCT_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) 
> DEF(RVCT_ALL_DLINK_FLAGS)
>
>
>  *_RVCT_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> DEF(RVCT_ALL_ASM_FLAGS)
> -*_RVCT_ARM_PP_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E
> +*_RVCT_ARM_PP_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E 
> --preinclude AutoGen.h
>  *_RVCT_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E  
> -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
>  *_RVCT_ARM_MAKE_PATH   = nmake /NOLOGO
>  *_RVCT_ARM_SLINK_FLAGS = --partial -o
> --
> 1.9.5.msysgit.0
>
> ___
> 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 v3 2/3] BaseTools/GenFw RVCT: fix relocation processing of PT_DYNAMIC sections

2015-12-02 Thread Ard Biesheuvel
Unlike GNU ld, which can be instructed to emit symbol based static
relocations into fully linked binaries using the --emit-relocs command
line switch, the RVCT armlink tool can only emit dynamic relocations
into the PT_DYNAMIC segment.

This has two consequences
. we can only identify absolute relocations, so there is no way to fix
  up relative relocations between sections, or check their validity in
  the PE/COFF layout
. the r_offset fields of the PT_DYNAMIC DT_REL entries are relative
  either to the base of the image or to any of its segments but *not* to
  the base of the input section that contains the location they refer
  to, and converting them to PE/COFF image offsets is non-trivial unless
  the sections are laid out in the same way in the ELF and PE/COFF
  versions of the binary.

There is really only one way to deal with this, and that is to require
that the ELF and PE/COFF versions of the binary are identical in memory.
So enforce that in the code.

Also, fix the utterly broken relocation fixup code that dereferences
ELF32_R_SYM(r_info) both as a 1-based program header index and a 0-based
section header index. If this code ever produced working binaries, it
was purely by chance.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Source/C/GenFw/Elf32Convert.c | 36 ++--
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c 
b/BaseTools/Source/C/GenFw/Elf32Convert.c
index 469394540e6a..eede64576940 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -804,9 +804,7 @@ WriteRelocations32 (
   UINTNRelSize;
   UINTNRelOffset;
   UINTNK;
-  UINT8*Targ;
   Elf32_Phdr   *DynamicSegment;
-  Elf32_Phdr   *TargetSegment;
 
   for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) {
 Elf_Shdr *RelShdr = GetShdrByIndex(Index);
@@ -957,6 +955,31 @@ WriteRelocations32 (
   Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations.", 
mInImageName);
 }
 
+for (Index = 0; Index < mEhdr->e_shnum; Index++) {
+  Elf_Shdr *shdr = GetShdrByIndex(Index);
+
+  //
+  // The PT_DYNAMIC section contains DT_REL relocations whose r_offset
+  // field is relative to the base of a segment (or the entire image),
+  // and not to the base of an ELF input section as is the case for
+  // SHT_REL sections. This means that we cannot fix up such 
relocations
+  // unless we cross-reference ELF sections and segments, considering
+  // that the output placement recorded in mCoffSectionsOffset[] is
+  // section based, not segment based.
+  //
+  // Fortunately, there is a simple way around this: we require that 
the
+  // in-memory layout of the ELF and PE/COFF versions of the binary is
+  // identical. That way, r_offset will retain its validity as a 
PE/COFF
+  // image offset, and we can record it in the COFF fixup table
+  // unmodified.
+  //
+  if (shdr->sh_addr != mCoffSectionsOffset[Index]) {
+Error (NULL, 0, 3000,
+  "Invalid", "%s: PT_DYNAMIC relocations require identical ELF and 
PE/COFF section offsets.",
+  mInImageName);
+  }
+}
+
 for (K = 0; K < RelSize; K += RelElementSize) {
 
   if (DynamicSegment->p_paddr == 0) {
@@ -973,14 +996,7 @@ WriteRelocations32 (
 break;
 
   case  R_ARM_RABS32:
-TargetSegment = GetPhdrByIndex (ELF32_R_SYM (Rel->r_info) - 1);
-
-// Note: r_offset in a memory address.  Convert it to a pointer in 
the coff file.
-Targ = mCoffFile + mCoffSectionsOffset[ ELF32_R_SYM( Rel->r_info ) 
] + Rel->r_offset - TargetSegment->p_vaddr;
-
-*(UINT32 *)Targ = *(UINT32 *)Targ + mCoffSectionsOffset 
[ELF32_R_SYM( Rel->r_info )];
-
-CoffAddFixup (mCoffSectionsOffset[ELF32_R_SYM (Rel->r_info)] + 
(Rel->r_offset - TargetSegment->p_vaddr), EFI_IMAGE_REL_BASED_HIGHLOW);
+CoffAddFixup (Rel->r_offset, EFI_IMAGE_REL_BASED_HIGHLOW);
 break;
   
   default:
-- 
1.9.1

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


[edk2] [PATCH v3 1/3] BaseTools RVCT: use scatter file to enforce minimum section alignment

2015-12-02 Thread Ard Biesheuvel
Up until SVN r18540, GenFw created invalid PE/COFF binaries for the ARM
architecture, by allowing PE/COFF .data sections to appear at offsets
that were not aligned to the global PE/COFF section alignment. The
reason for this was that the relocation metadata emitted by RVCT's
armlink only contains dynamic absolute relocations, so it is impossible
to recalculate relative relocations between .text and .data, and so the
relative offset between the two needs to be preserved.

Since r18540, we do align .data to the PE/COFF section alignment,
resulting in potentially corrupt PE/COFF binaries unless .data happens
to appear at a 32-byte aligned offset. So let's introduce a RVCT scatter
file that sets this alignment for the ELF .data section (and subsequent
.bss section).

At the same time, set the start offset to 0x220 bytes (which is the size
of our 32-bit PE/COFF header) so that the memory layouts are identical
between ELF and PE/COFF. Also add a 4 KB aligned version that can be
used to build DXE_RUNTIME_DRIVER modules with runtime memory protection
enabled.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Eugene Cohen 
Reviewed-by: Liming Gao 
---
 BaseTools/Conf/tools_def.template  |  2 +-
 BaseTools/Scripts/Rvct-Align32.sct | 25 
 BaseTools/Scripts/Rvct-Align4K.sct | 25 
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index db08e252d2b9..4449ddf1b6ec 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -6617,7 +6617,7 @@ RELEASE_XCODE5_X64_CC_FLAGS   = -target 
x86_64-pc-win32-macho -c-Os   -W
 
 DEFINE RVCT_ALL_ASM_FLAGS   = --diag_suppress=1786 --diag_error=warning --apcs 
/interwork
 DEFINE RVCT_ALL_CC_FLAGS= --c90 -c --no_autoinline --asm --gnu --apcs 
/interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int 
--preinclude AutoGen.h --diag_suppress=186 --diag_warning 167 
--diag_error=warning --diag_style=ide --protect_stack
-DEFINE RVCT_ALL_DLINK_FLAGS = --ro-base 0 --no_scanlib --reloc --no_exceptions 
--datacompressor off --strict --symbols --diag_style=ide --no_legacyalign
+DEFINE RVCT_ALL_DLINK_FLAGS = --no_scanlib --no_exceptions --datacompressor 
off --strict --symbols --diag_style=ide --no_legacyalign --scatter 
$(EDK_TOOLS_PATH)/Scripts/Rvct-Align32.sct
 
 

 #
diff --git a/BaseTools/Scripts/Rvct-Align32.sct 
b/BaseTools/Scripts/Rvct-Align32.sct
new file mode 100644
index ..4f29ad416b82
--- /dev/null
+++ b/BaseTools/Scripts/Rvct-Align32.sct
@@ -0,0 +1,25 @@
+/** @file
+
+  Copyright (c) 2015, 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 that 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.
+
+**/
+
+REGION 0x220 RELOC {
+  ER_RO +0 ALIGN 32 {
+* (+RO)
+  }
+  ER_RW +0 ALIGN 32 {
+* (+RW)
+  }
+  ER_ZI +0 {
+* (+ZI)
+  }
+}
diff --git a/BaseTools/Scripts/Rvct-Align4K.sct 
b/BaseTools/Scripts/Rvct-Align4K.sct
new file mode 100644
index ..83f5a0d5e4cd
--- /dev/null
+++ b/BaseTools/Scripts/Rvct-Align4K.sct
@@ -0,0 +1,25 @@
+/** @file
+
+  Copyright (c) 2015, 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 that 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.
+
+**/
+
+REGION 0x1000 RELOC {
+  ER_RO +0 ALIGN 4096 {
+* (+RO)
+  }
+  ER_RW +0 ALIGN 4096 {
+* (+RW)
+  }
+  ER_ZI +0 {
+* (+ZI)
+  }
+}
-- 
1.9.1

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


[edk2] [PATCH v3 0/3] ARM: RVCT: fix ELF to PE/COFF conversion

2015-12-02 Thread Ard Biesheuvel
Recent fixes for correctness in GenFw have resulted in build problems
under RVCT. These patches fix this by introducing linker scripts (scatter
files in ARM speak) and updating GenFw to enforce identical memory layouts
between ELF and PE/COFF as we do for GCC. Patch #3 illustrates how we can
now enable 4 KB section alignment for DXE_RUNTIME_DRIVER modules.

Ard Biesheuvel (3):
  BaseTools RVCT: use scatter file to enforce minimum section alignment
  BaseTools/GenFw RVCT: fix relocation processing of PT_DYNAMIC sections
  ArmVirtPkg RVCT: build DXE_RUNTIME_DRIVER modules with 4 KB alignment

 ArmVirtPkg/ArmVirt.dsc.inc  |  1 +
 BaseTools/Conf/tools_def.template   |  2 +-
 BaseTools/Scripts/Rvct-Align32.sct  | 25 ++
 BaseTools/Scripts/Rvct-Align4K.sct  | 25 ++
 BaseTools/Source/C/GenFw/Elf32Convert.c | 36 ++--
 5 files changed, 78 insertions(+), 11 deletions(-)
 create mode 100644 BaseTools/Scripts/Rvct-Align32.sct
 create mode 100644 BaseTools/Scripts/Rvct-Align4K.sct

-- 
1.9.1

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


[edk2] [PATCH v3 3/3] ArmVirtPkg RVCT: build DXE_RUNTIME_DRIVER modules with 4 KB alignment

2015-12-02 Thread Ard Biesheuvel
This adds the RVCT armlink command line switches to build modules of type
DXE_RUNTIME_DRIVER with 4 KB PE/COFF section alignment, allowing the OS
to apply stricter permissions to the .text and .data sections.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
Acked-by: Laszlo Ersek 
---
 ArmVirtPkg/ArmVirt.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 9a6098b2abcd..49e4264ee8a4 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -20,6 +20,7 @@ [Defines]
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   GCC:*_*_ARM_DLINK_FLAGS = -z common-page-size=0x1000
   GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x1
+  RVCT:*_*_ARM_DLINK_FLAGS = --scatter 
$(EDK_TOOLS_PATH)/Scripts/Rvct-Align4K.sct
 
 [LibraryClasses.common]
 !if $(TARGET) == RELEASE
-- 
1.9.1

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


[edk2] IntelFrameworkModulePkg: DebugAssert enhancement

2015-12-02 Thread Anbazhagan, Baraneedharan
If the assert happens in a library, then it's hard to determine which
module using that library is generating that assert.
Use gEfiCallerBaseName in DebugAssert to display the module name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Baraneedharan Anbazhagan 
---
 .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 58 ++
 .../PeiDxeDebugLibReportStatusCode.inf |  1 +
 2 files changed, 39 insertions(+), 20 deletions(-)

diff --git 
a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c 
b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index cfdd2f5..0435a6f 100644
--- a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
+++ b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -268,6 +269,7 @@ DebugAssert (
   UINTN  HeaderSize;
   UINTN  TotalSize;
   CHAR8  *Temp;
+  UINTN  ModuleNameSize;
   UINTN  FileNameSize;
   UINTN  DescriptionSize;
 
@@ -275,31 +277,37 @@ DebugAssert (
   // Get string size
   //
   HeaderSize   = sizeof (EFI_DEBUG_ASSERT_DATA);
+  ModuleNameSize   = AsciiStrLen("[") + AsciiStrLen (gEfiCallerBaseName) + 
AsciiStrLen("] ");
   FileNameSize = AsciiStrSize (FileName);
   DescriptionSize  = AsciiStrSize (Description);
 
   //
   // Make sure it will all fit in the passed in buffer.
   //
-  if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
+  if (HeaderSize + ModuleNameSize + FileNameSize + DescriptionSize > sizeof 
(Buffer)) {
 //
-// FileName + Description is too long to be filled into buffer. 
+// remove module name if it's too long to be filled into buffer
 //
-if (HeaderSize + FileNameSize < sizeof (Buffer)) {
+ModuleNameSize = 0;
+if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
   //
-  // Description has enough buffer to be truncated. 
+  // FileName + Description is too long to be filled into buffer. 
   //
-  DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
-} else {
-  //
-  // FileName is too long to be filled into buffer.
-  // FileName will be truncated. Reserved one byte for Description NULL 
terminator.
-  //
-  DescriptionSize = 1;
-  FileNameSize= sizeof (Buffer) - HeaderSize - DescriptionSize;
+  if (HeaderSize + FileNameSize < sizeof (Buffer)) {
+//
+// Description has enough buffer to be truncated. 
+//
+DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
+  } else {
+//
+// FileName is too long to be filled into buffer.
+// FileName will be truncated. Reserved one byte for Description NULL 
terminator.
+//
+DescriptionSize = 1;
+FileNameSize= sizeof (Buffer) - HeaderSize - DescriptionSize;
+  }
 }
   }
- 
   //
   // Fill in EFI_DEBUG_ASSERT_DATA
   //
@@ -307,17 +315,27 @@ DebugAssert (
   AssertData->LineNumber = (UINT32)LineNumber;
   TotalSize  = sizeof (EFI_DEBUG_ASSERT_DATA);
 
-  //
-  // Copy Ascii FileName including NULL terminator.
-  //
-  Temp = CopyMem (AssertData + 1, FileName, FileNameSize);
-  Temp[FileNameSize - 1] = 0;
-  TotalSize += FileNameSize;
+  Temp = (CHAR8 *)(AssertData + 1);
+  if (ModuleNameSize != 0) {
+//
+// Copy Ascii ModuleName & FileName including NULL terminator
+//
+AsciiSPrint(Temp, ModuleNameSize + FileNameSize, "[%a] %a", 
gEfiCallerBaseName, FileName);
+TotalSize += (ModuleNameSize + FileNameSize);
+  } else {
+//
+// Copy Ascii FileName including NULL terminator.
+//
+Temp = CopyMem (Temp, FileName, FileNameSize);
+Temp[FileNameSize - 1] = 0;
+TotalSize += FileNameSize;
+  }
+  
 
   //
   // Copy Ascii Description include NULL terminator.
   //
-  Temp = CopyMem (Temp + FileNameSize, Description, DescriptionSize);
+  Temp = CopyMem (Temp + ModuleNameSize + FileNameSize, Description, 
DescriptionSize);
   Temp[DescriptionSize - 1] = 0;
   TotalSize += DescriptionSize;
 
diff --git 
a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
index 5544667..50f60c7 100644
--- 
a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
+++ 
b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
@@ -43,6 +43,7 @@
   BaseMemoryLib
   BaseLib
   DebugPrintErrorLevelLib
+  PrintLib
 
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue  ## SOMETIMES_CONSUMES
-- 
2.6.3.windows.1

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

[edk2] MdeModulePkg: DebugAssert enhancement

2015-12-02 Thread Anbazhagan, Baraneedharan
If the assert happens in a library, then it's hard to determine which
module using that library is generating that assert.
Use gEfiCallerBaseName in DebugAssert to display the module name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Baraneedharan Anbazhagan 
---
 .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 58 ++
 .../PeiDxeDebugLibReportStatusCode.inf |  1 +
 2 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c 
b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index f1d9827..af369ea 100644
--- a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
+++ b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -261,6 +262,7 @@ DebugAssert (
   UINTN  HeaderSize;
   UINTN  TotalSize;
   CHAR8  *Temp;
+  UINTN  ModuleNameSize;
   UINTN  FileNameSize;
   UINTN  DescriptionSize;
 
@@ -268,31 +270,37 @@ DebugAssert (
   // Get string size
   //
   HeaderSize   = sizeof (EFI_DEBUG_ASSERT_DATA);
+  ModuleNameSize   = AsciiStrLen("[") + AsciiStrLen (gEfiCallerBaseName) + 
AsciiStrLen("] ");
   FileNameSize = AsciiStrSize (FileName);
   DescriptionSize  = AsciiStrSize (Description);
 
   //
   // Make sure it will all fit in the passed in buffer.
   //
-  if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
+  if (HeaderSize + ModuleNameSize + FileNameSize + DescriptionSize > sizeof 
(Buffer)) {
 //
-// FileName + Description is too long to be filled into buffer. 
+// remove module name if it's too long to be filled into buffer
 //
-if (HeaderSize + FileNameSize < sizeof (Buffer)) {
+ModuleNameSize = 0;
+if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
   //
-  // Description has enough buffer to be truncated. 
+  // FileName + Description is too long to be filled into buffer. 
   //
-  DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
-} else {
-  //
-  // FileName is too long to be filled into buffer.
-  // FileName will be truncated. Reserved one byte for Description NULL 
terminator.
-  //
-  DescriptionSize = 1;
-  FileNameSize= sizeof (Buffer) - HeaderSize - DescriptionSize;
+  if (HeaderSize + FileNameSize < sizeof (Buffer)) {
+//
+// Description has enough buffer to be truncated. 
+//
+DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
+  } else {
+//
+// FileName is too long to be filled into buffer.
+// FileName will be truncated. Reserved one byte for Description NULL 
terminator.
+//
+DescriptionSize = 1;
+FileNameSize= sizeof (Buffer) - HeaderSize - DescriptionSize;
+  }
 }
   }
- 
   //
   // Fill in EFI_DEBUG_ASSERT_DATA
   //
@@ -300,17 +308,27 @@ DebugAssert (
   AssertData->LineNumber = (UINT32)LineNumber;
   TotalSize  = sizeof (EFI_DEBUG_ASSERT_DATA);
 
-  //
-  // Copy Ascii FileName including NULL terminator.
-  //
-  Temp = CopyMem (AssertData + 1, FileName, FileNameSize);
-  Temp[FileNameSize - 1] = 0;
-  TotalSize += FileNameSize;
+  Temp = (CHAR8 *)(AssertData + 1);
+  if (ModuleNameSize != 0) {
+//
+// Copy Ascii ModuleName & FileName including NULL terminator
+//
+AsciiSPrint(Temp, ModuleNameSize + FileNameSize, "[%a] %a", 
gEfiCallerBaseName, FileName);
+TotalSize += (ModuleNameSize + FileNameSize);
+  } else {
+//
+// Copy Ascii FileName including NULL terminator.
+//
+Temp = CopyMem (Temp, FileName, FileNameSize);
+Temp[FileNameSize - 1] = 0;
+TotalSize += FileNameSize;
+  }
+  
 
   //
   // Copy Ascii Description include NULL terminator.
   //
-  Temp = CopyMem (Temp + FileNameSize, Description, DescriptionSize);
+  Temp = CopyMem (Temp + ModuleNameSize + FileNameSize, Description, 
DescriptionSize);
   Temp[DescriptionSize - 1] = 0;
   TotalSize += DescriptionSize;
 
diff --git 
a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
index 5544667..50f60c7 100644
--- 
a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
+++ 
b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
@@ -43,6 +43,7 @@
   BaseMemoryLib
   BaseLib
   DebugPrintErrorLevelLib
+  PrintLib
 
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue  ## SOMETIMES_CONSUMES
-- 
2.6.3.windows.1

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


Re: [edk2] MdePkg: DebugAssert enhancement

2015-12-02 Thread Anbazhagan, Baraneedharan
Thanks. Will send a separate patch for those packages.

> -Original Message-
> From: Gao, Liming [mailto:liming@intel.com]
> Sent: Tuesday, December 01, 2015 6:32 PM
> To: Anbazhagan, Baraneedharan; edk2-devel@lists.01.org; Carsey, Jaben; Kinney,
> Michael D
> Subject: RE: MdePkg: DebugAssert enhancement
> 
> Good enhancement. Reviewed-by: Liming Gao 
> 
> Could you help also update
> MdeModulePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStat
> usCode.inf and
> IntelFrameworkModulePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLi
> bReportStatusCode.inf?
> 
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Anbazhagan, Baraneedharan
> Sent: Wednesday, December 02, 2015 7:26 AM
> To: edk2-devel@lists.01.org; Carsey, Jaben; Gao, Liming; Kinney, Michael D
> Subject: Re: [edk2] MdePkg: DebugAssert enhancement
> 
> MdePkg: DebugAssert enhancement
> 
> If the assert happens in a library, then it's hard to determine which module 
> using that
> library is generating that assert.  Use gEfiCallerBaseName in DebugAssert to 
> display
> the module name.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Baraneedharan Anbazhagan 
> 
> 
>  MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c| 2 +-
>  MdePkg/Library/UefiDebugLibConOut/DebugLib.c| 3 ++-
>  MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c | 3 ++-
>  MdePkg/Library/UefiDebugLibStdErr/DebugLib.c| 3 ++-
>  4 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
> b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
> index 6fa235c..8ab0847 100644
> --- a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
> +++ b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
> @@ -133,7 +133,7 @@ DebugAssert (
>//
>// Generate the ASSERT() message in Ascii format
>//
> -  AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %a(%d): %a\n", FileName, 
> LineNumber,
> Description);
> +  AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT [%a] %a(%d): %a\n",
> + gEfiCallerBaseName, FileName, LineNumber, Description);
> 
>//
>// Send the print string to the Console Output device diff --git
> a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
> b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
> index 2ac2204..0bc112f 100644
> --- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
> +++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
> @@ -121,7 +121,8 @@ DebugAssert (
>UnicodeSPrintAsciiFormat (
>  Buffer,
>  sizeof (Buffer),
> -"ASSERT %a(%d): %a\n",
> +"ASSERT [%a] %a(%d): %a\n",
> +gEfiCallerBaseName,
>  FileName,
>  LineNumber,
>  Description
> diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
> b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
> index 10d3e34..0e95046 100644
> --- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
> +++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
> @@ -175,7 +175,8 @@ DebugAssert (
>AsciiSPrint (
>  Buffer,
>  sizeof (Buffer),
> -"ASSERT %a(%d): %a\n",
> +"ASSERT [%a] %a(%d): %a\n",
> +gEfiCallerBaseName,
>  FileName,
>  LineNumber,
>  Description
> diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
> b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
> index bbd6d94..cacb90a 100644
> --- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
> +++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
> @@ -122,7 +122,8 @@ DebugAssert (
>UnicodeSPrintAsciiFormat (
>  Buffer,
>  sizeof (Buffer),
> -"ASSERT %a(%d): %a\n",
> +"ASSERT [%a] %a(%d): %a\n",
> +gEfiCallerBaseName,
>  FileName,
>  LineNumber,
>  Description
> 
> > -Original Message-
> > From: Carsey, Jaben [mailto:jaben.car...@intel.com]
> > Sent: Tuesday, December 01, 2015 3:05 PM
> > To: Anbazhagan, Baraneedharan
> > Cc: Carsey, Jaben
> > Subject: RE: MdePkg: DebugAssert enhancement
> >
> > You need to send this with your attestation and signed off by lines.
> > Please resubmit with those things.
> >
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
> > > Of Anbazhagan, Baraneedharan
> > > Sent: Tuesday, December 01, 2015 1:02 PM
> > > To: edk2-devel@lists.01.org; Gao, Liming ;
> > > Kinney, Michael D 
> > > Subject: [edk2] MdePkg: DebugAssert enhancement
> > >
> > > Hi,
> > > Current DebugAssert function prints the file name and line number.
> > > If the assert happens in a library, then it's hard to determine
> > > which module using that library is generating that assert.  Can we
> > > add gEfiCallerBaseName to display the module name as well?
> > >
> > > -Baranee
> > >
> > > diff --git a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
> > > b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
> > > index 6fa235c..8ab0847 100644
> > > --- a/MdePkg/Library/BaseDebugLibSerial

Re: [edk2] [PATCH 1/1] BaseTools: sync BaseTools from main trunk r18579.

2015-12-02 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Mike 
Maslenkin
Sent: Wednesday, December 02, 2015 11:17 PM
To: edk2-de...@ml01.01.org
Cc: Fan, Jeff
Subject: [edk2] [PATCH 1/1] BaseTools: sync BaseTools from main trunk r18579.

This patch fixes incomplete merge of multiple workspaces support.
Without this patch build fails with error similar to:

~/sources/edk2> build -p MdePkg/MdePkg.dsc -t GCC48 -a X64

Build environment: Linux-3.16.7-24-desktop-x86_64-with-SuSE-13.2-x86_64
Build start time: 17:15:43, Dec.02 2015

WORKSPACE= /home/user/sources/edk2
ECP_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EDK_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EFI_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EDK_TOOLS_PATH   = /home/user/sources/edk2/BaseTools

build.py...
 : error C0DE: Unknown fatal error when processing 
[/home/user/sources/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf]

(Please send email to edk2-de...@lists.sourceforge.net for help, attaching 
following call stack trace!)

(Python 2.7.8 on linux2) Traceback (most recent call last):
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 2033, in Main
MyBuild.Launch()
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 1788, in Launch
self._MultiThreadBuildPlatform()
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 1583, in _MultiThreadBuildPlatform
self.Progress
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 175, in __new__
if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, 
*args, **kwargs):
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 355, in _Init
Pkgs = list(PkgSet) + list(PGen.PackageList)
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1484, in _GetPackageList
for La in self.LibraryAutoGenList:
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1594, in _GetLibraryAutoGenList
self._GetAutoGenObjectList()
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1575, in _GetAutoGenObjectList
self.MetaFile
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 175, in __new__
if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, 
*args, **kwargs):
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 2199, in _Init
self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir)
  File 
"/home/user/sources/edk2/BaseTools/Source/Python/Common/MultipleWorkspace.py", 
line 94, in relpath
for Pkg in cls.PACKAGES_PATH:
TypeError: 'NoneType' object is not iterable

- Failed -
Build end time: 17:15:44, Dec.02 2015
Build total time: 00:00:01

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mike Maslenkin 
CC: Fan, Jeff 
---
 BaseTools/Source/Python/build/BuildReport.py |  5 +++--
 BaseTools/Source/Python/build/build.py   | 16 +++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 264607b00360..60e976c169a1 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -41,6 +41,7 @@ from Common.DataType import TAB_BRG_PCD  from Common.DataType 
import TAB_BRG_LIBRARY  from Common.DataType import TAB_BACK_SLASH  from 
Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
 
 ## Pattern to extract contents in EDK DXS files  gDxsDependencyPattern = 
re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL) @@ -1255,7 +1256,7 
@@ class FdRegionReport(object):
 for Pa in Wa.AutoGenObjectList:
 for ModuleKey in Pa.Platform.Modules:
 M = Pa.Platform.Modules[ModuleKey].M
-InfPath = os.path.join(Wa.WorkspaceDir, M.MetaFile.File)
+InfPath = mws.join(Wa.WorkspaceDir, M.MetaFile.File)
 self._GuidsDb[M.Guid.upper()] = "%s (%s)" % 
(M.Module.BaseName, InfPath)
 
 #
@@ -1277,7 +1278,7 @@ class FdRegionReport(object):
 Guid = 
GuidStructureByteArrayToGuidString(GuidValue).upper()
 for Section in Ffs.SectionList:
 try:
-ModuleSectFile = os.path.join(Wa.WorkspaceDir, 
Section.SectFileName)
+ModuleSectFile = mws.join(Wa.WorkspaceDir, 
+ Section.SectFileName)
 self._GuidsDb[Guid] = ModuleSectFile
 except AttributeError:
   

[edk2] [PATCH 1/1] BaseTools: sync BaseTools from main trunk r18579.

2015-12-02 Thread Mike Maslenkin
This patch fixes incomplete merge of multiple workspaces
support.
Without this patch build fails with error similar to:

~/sources/edk2> build -p MdePkg/MdePkg.dsc -t GCC48 -a X64

Build environment: Linux-3.16.7-24-desktop-x86_64-with-SuSE-13.2-x86_64
Build start time: 17:15:43, Dec.02 2015

WORKSPACE= /home/user/sources/edk2
ECP_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EDK_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EFI_SOURCE   = /home/user/sources/edk2/EdkCompatibilityPkg
EDK_TOOLS_PATH   = /home/user/sources/edk2/BaseTools

build.py...
 : error C0DE: Unknown fatal error when processing 
[/home/user/sources/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf]

(Please send email to edk2-de...@lists.sourceforge.net for help, attaching 
following call stack trace!)

(Python 2.7.8 on linux2) Traceback (most recent call last):
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 2033, in Main
MyBuild.Launch()
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 1788, in Launch
self._MultiThreadBuildPlatform()
  File 
"/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
 line 1583, in _MultiThreadBuildPlatform
self.Progress
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 175, in __new__
if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, 
*args, **kwargs):
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 355, in _Init
Pkgs = list(PkgSet) + list(PGen.PackageList)
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1484, in _GetPackageList
for La in self.LibraryAutoGenList:
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1594, in _GetLibraryAutoGenList
self._GetAutoGenObjectList()
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 1575, in _GetAutoGenObjectList
self.MetaFile
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 175, in __new__
if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, 
*args, **kwargs):
  File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", 
line 2199, in _Init
self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir)
  File 
"/home/user/sources/edk2/BaseTools/Source/Python/Common/MultipleWorkspace.py", 
line 94, in relpath
for Pkg in cls.PACKAGES_PATH:
TypeError: 'NoneType' object is not iterable

- Failed -
Build end time: 17:15:44, Dec.02 2015
Build total time: 00:00:01

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mike Maslenkin 
CC: Fan, Jeff 
---
 BaseTools/Source/Python/build/BuildReport.py |  5 +++--
 BaseTools/Source/Python/build/build.py   | 16 +++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 264607b00360..60e976c169a1 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -41,6 +41,7 @@ from Common.DataType import TAB_BRG_PCD
 from Common.DataType import TAB_BRG_LIBRARY
 from Common.DataType import TAB_BACK_SLASH
 from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
 
 ## Pattern to extract contents in EDK DXS files
 gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", 
re.DOTALL)
@@ -1255,7 +1256,7 @@ class FdRegionReport(object):
 for Pa in Wa.AutoGenObjectList:
 for ModuleKey in Pa.Platform.Modules:
 M = Pa.Platform.Modules[ModuleKey].M
-InfPath = os.path.join(Wa.WorkspaceDir, M.MetaFile.File)
+InfPath = mws.join(Wa.WorkspaceDir, M.MetaFile.File)
 self._GuidsDb[M.Guid.upper()] = "%s (%s)" % 
(M.Module.BaseName, InfPath)
 
 #
@@ -1277,7 +1278,7 @@ class FdRegionReport(object):
 Guid = 
GuidStructureByteArrayToGuidString(GuidValue).upper()
 for Section in Ffs.SectionList:
 try:
-ModuleSectFile = os.path.join(Wa.WorkspaceDir, 
Section.SectFileName)
+ModuleSectFile = mws.join(Wa.WorkspaceDir, 
Section.SectFileName)
 self._GuidsDb[Guid] = ModuleSectFile
 except AttributeError:
 pass
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 33b45ba26717..e85df1eebfd8 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -41,6 +41,7 @@ from Common.BuildVersion import gBUI

Re: [edk2] [PATCH v2 3/3] ArmVirtPkg RVCT: build DXE_RUNTIME_DRIVER modules with 4 KB alignment

2015-12-02 Thread Laszlo Ersek
On 12/01/15 18:38, Ard Biesheuvel wrote:
> This adds the RVCT armlink command line switches to build modules of type
> DXE_RUNTIME_DRIVER with 4 KB PE/COFF section alignment, allowing the OS
> to apply stricter permissions to the .text and .data sections.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  ArmVirtPkg/ArmVirt.dsc.inc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index 9a6098b2abcd..49e4264ee8a4 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -20,6 +20,7 @@ [Defines]
>  [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
>GCC:*_*_ARM_DLINK_FLAGS = -z common-page-size=0x1000
>GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x1
> +  RVCT:*_*_ARM_DLINK_FLAGS = --scatter 
> $(EDK_TOOLS_PATH)/Scripts/Rvct-Align4K.sct
>  
>  [LibraryClasses.common]
>  !if $(TARGET) == RELEASE
> 

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


Re: [edk2] [Patch] BaseTools: Enhance GenFv Tool to report error message

2015-12-02 Thread Laszlo Ersek
Meta-comment: when formatting a patch series with "git format-patch",
please pass the "--numbered" and "--cover-letter" options to the
utility. See also
.

(No need to resend this series just because of that, of course.)

Thanks
Laszlo

On 12/02/15 09:45, Yonghong Zhu wrote:
> When two vtf files in one FV image, no FV file can be generated, but it
> report the stack trace info. so we enhance the tool to report error
> message directly but not the stack trace info.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu 
> ---
>  Source/C/GenFv/GenFvInternalLib.c | 23 +++--
>  Source/Python/GenFds/Fv.py| 43 
> +--
>  2 files changed, 35 insertions(+), 31 deletions(-)
> 
> diff --git a/Source/C/GenFv/GenFvInternalLib.c 
> b/Source/C/GenFv/GenFvInternalLib.c
> index 6d2d5d1..10bb88b 100644
> --- a/Source/C/GenFv/GenFvInternalLib.c
> +++ b/Source/C/GenFv/GenFvInternalLib.c
> @@ -2852,21 +2852,22 @@ Returns:
>  // close file
>  //
>  fclose (fpin);
>  
>  if (FvInfoPtr->IsPiFvImage) {
> - //
> - // Check whether this ffs file is vtf file
> - //
> - if (IsVtfFile (&FfsHeader)) {
> -   if (VtfFileFlag) {
> - //
> - // One Fv image can't have two vtf files.
> - //
> - return EFI_ABORTED;
> -   }
> -   VtfFileFlag = TRUE;
> +//
> +// Check whether this ffs file is vtf file
> +//
> +if (IsVtfFile (&FfsHeader)) {
> +  if (VtfFileFlag) {
> +//
> +// One Fv image can't have two vtf files.
> +//
> +Error (NULL, 0, 3000,"Invalid", "One Fv image can't have two vtf 
> files.");
> +return EFI_ABORTED;
> +  }
> +  VtfFileFlag = TRUE;
>  VtfFileSize = FfsFileSize;
>  continue;
>}
>  
>//
> diff --git a/Source/Python/GenFds/Fv.py b/Source/Python/GenFds/Fv.py
> index 163ccd3..df97ccb 100644
> --- a/Source/Python/GenFds/Fv.py
> +++ b/Source/Python/GenFds/Fv.py
> @@ -179,34 +179,37 @@ class FV (FvClassObject):
>  )
>  
>  #
>  # Write the Fv contents to Buffer
>  #
> -FvFileObj = open ( FvOutputFile,'r+b')
> +if os.path.isfile(FvOutputFile):
> +FvFileObj = open ( FvOutputFile,'r+b')
>  
> -GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV Successfully" 
> %self.UiFvName)
> -GenFdsGlobalVariable.SharpCounter = 0
> +GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV 
> Successfully" %self.UiFvName)
> +GenFdsGlobalVariable.SharpCounter = 0
>  
> -Buffer.write(FvFileObj.read())
> -FvFileObj.seek(0)
> -# PI FvHeader is 0x48 byte
> -FvHeaderBuffer = FvFileObj.read(0x48)
> -# FV alignment position.
> -FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
> -# FvAlignmentValue is larger than or equal to 1K
> -if FvAlignmentValue >= 0x400:
> -if FvAlignmentValue >= 0x1:
> -#The max alignment supported by FFS is 64K.
> -self.FvAlignment = "64K"
> +Buffer.write(FvFileObj.read())
> +FvFileObj.seek(0)
> +# PI FvHeader is 0x48 byte
> +FvHeaderBuffer = FvFileObj.read(0x48)
> +# FV alignment position.
> +FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
> +# FvAlignmentValue is larger than or equal to 1K
> +if FvAlignmentValue >= 0x400:
> +if FvAlignmentValue >= 0x1:
> +#The max alignment supported by FFS is 64K.
> +self.FvAlignment = "64K"
> +else:
> +self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
>  else:
> -self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
> +# FvAlignmentValue is less than 1K
> +self.FvAlignment = str (FvAlignmentValue)
> +FvFileObj.close()
> +GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
> +GenFdsGlobalVariable.LargeFileInFvFlags.pop()
>  else:
> -# FvAlignmentValue is less than 1K
> -self.FvAlignment = str (FvAlignmentValue)
> -FvFileObj.close()
> -GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
> -GenFdsGlobalVariable.LargeFileInFvFlags.pop()
> +GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV 
> file." %self.UiFvName)
>  return FvOutputFile
>  
>  ## _GetBlockSize()
>  #
>  #   Calculate FV's block size
> 

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

Re: [edk2] [PATCH] MdeModulePkg: allow DxeIpl to load without permanent memory to enable S3 resume from temporary memory

2015-12-02 Thread Zeng, Star

Hi Eugene,

On 2015/12/1 21:16, Cohen, Eugene wrote:

This is a patch that enables the S3 Resume path from PEI without permanent 
memory installed.  There is not a strict requirement that we can see to have 
permanent memory installed for S3 resume.  We have platforms that hold PEI code 
(not just data) in cache-as-ram and these require S3 Resume from temporary 
memory.


Do you have the patch tested on your real platforms (with and without 
InstallPeiMemory()?


>

This change does the following:

1. Relax the ASSERT in PEI core for permanent memory before launching IPL so 
that it only enforces this in non-S3 Resume boot modes
2. Remove the gEfiPeiMemoryDiscoveredPpiGuid depex for DXE IPL so it can load 
before permanent memory.  Since DXE IPL is really driven by the IPL PPI this is 
generally harmless.  This may cause IPL to be loaded pre-memory in a normal 
boot and be shadowed to permanent memory
3.  Add a check in DXE IPL that permanent memory is present for boot paths that 
load the DXE core (e.g. normal)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen 
---
  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf |  3 ++-
  MdeModulePkg/Core/DxeIplPeim/DxeLoad.c  | 11 +++
  MdeModulePkg/Core/Pei/PeiMain/PeiMain.c |  6 --
  3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf 
b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
index 04ad928..9623f96 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
@@ -93,6 +93,7 @@
## SOMETIMES_CONSUMES
## UNDEFINED # HOB
gEfiVectorHandoffInfoPpiGuid
+  gEfiPeiMemoryDiscoveredPpiGuid## SOMETIMES_CONSUMES # Consumed on normal 
path

  [Guids]
## SOMETIMES_CONSUMES ## Variable:L"MemoryTypeInformation"
@@ -115,7 +116,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack   ## 
SOMETIMES_CONSUMES

  [Depex]
-  gEfiPeiMemoryDiscoveredPpiGuid AND gEfiPeiLoadFilePpiGuid AND 
gEfiPeiMasterBootModePpiGuid
+  gEfiPeiLoadFilePpiGuid AND gEfiPeiMasterBootModePpiGuid


Since the depex gEfiPeiMemoryDiscoveredPpiGuid is removed from inf. The 
DxeLoad may be dispatched earlier than before.


Current code will install Decompress and Extraction PPI for both normal 
and S3 path in entry point, but Decompress and Extraction PPI need to 
use AllocatePages() that only works after memory discovered as PI spec 
describes.
Then should the code be also updated to install Decompress and 
Extraction PPI in memory discovered ppi notify with 
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH?


Thanks,
Star



  #
  # [BootMode]
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c 
b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
index d7d693f..888a710 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
@@ -193,6 +193,7 @@ DxeLoadCore (
)
  {
EFI_STATUSStatus;
+  VOID  *Dummy;
EFI_FV_FILE_INFO  DxeCoreFileInfo;
EFI_PHYSICAL_ADDRESS  DxeCoreAddress;
UINT64DxeCoreSize;
@@ -273,6 +274,16 @@ DxeLoadCore (
  //
}

+  // DXE core load requires permanent memory
+  Status = PeiServicesLocatePpi (
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&Dummy
+ );
+  ASSERT_EFI_ERROR (Status);
+  if( EFI_ERROR(Status)) return Status;
+
if (GetFirstGuidHob ((CONST EFI_GUID *)&gEfiMemoryTypeInformationGuid) == 
NULL) {
  //
  // Don't build GuidHob if GuidHob has been installed.
diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c 
b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index d36f89c..8f2dfa3 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -421,9 +421,11 @@ PeiCore (
PeiDispatcher (SecCoreData, &PrivateData);

//
-  // Check if InstallPeiMemory service was called.
+  // If we're not doing S3 resume then we require permanent memory
//
-  ASSERT(PrivateData.PeiMemoryInstalled == TRUE);
+  if(PrivateData.HobList.HandoffInformationTable->BootMode != 
BOOT_ON_S3_RESUME) {
+ASSERT(PrivateData.PeiMemoryInstalled == TRUE);
+  }

//
// Measure PEI Core execution time.



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


[edk2] [Patch] ShellPkg: Fix wrong return status for Ifconfig.c

2015-12-02 Thread Jiaxin Wu
The Ifconfig command handler tries to return an EFI_STATUS when
the return type should be SHELL_STATUS.

Cc: Cohen, Eugene 
Cc: Carsey, Jaben 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 .../UefiShellNetwork1CommandsLib/Ifconfig.c| 102 ++---
 1 file changed, 69 insertions(+), 33 deletions(-)

diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c 
b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
index e16d46a..fb6f575 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
@@ -421,11 +421,11 @@ IfConfigGetInterfaceInfo (
   NULL,
   &HandleNum,
   &HandleBuffer
  );
   if (EFI_ERROR (Status) || (HandleNum == 0)) {
-return EFI_ABORTED;
+return Status;
   }
 
   //
   // Enumerate all handles that installed with ip4 service binding protocol.
   //
@@ -585,15 +585,15 @@ ON_ERROR:
 /**
   The list process of the ifconfig command.
 
   @param[in]   IfListThe pointer of IfList(interface list).
 
-  @retval EFI_SUCCESSThe ifconfig command list processed successfully.
+  @retval SHELL_SUCCESS  The ifconfig command list processed successfully.
   @retval others The ifconfig command list process failed.
 
 **/
-EFI_STATUS
+SHELL_STATUS
 IfConfigShowInterfaceInfo (
   IN LIST_ENTRY*IfList
   )
 {
   LIST_ENTRY   *Entry;
@@ -781,35 +781,37 @@ IfConfigShowInterfaceInfo (
 }
   }
   
   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_BREAK), 
gShellNetwork1HiiHandle);
 
-  return EFI_SUCCESS;
+  return SHELL_SUCCESS;
 }
 
 /**
   The clean process of the ifconfig command to clear interface info.
 
   @param[in]   IfListThe pointer of IfList(interface list).
 
-  @retval EFI_SUCCESSThe ifconfig command clean processed successfully.
+  @retval SHELL_SUCCESS  The ifconfig command clean processed successfully.
   @retval others The ifconfig command clean process failed.
 
 **/
-EFI_STATUS
+SHELL_STATUS
 IfConfigClearInterfaceInfo (
   IN LIST_ENTRY*IfList
   )
 {
-  EFI_STATUSStatus;
+  EFI_STATUSStatus;  
+  SHELL_STATUS  ShellStatus;
   LIST_ENTRY*Entry;
   LIST_ENTRY*Next;
   IFCONFIG_INTERFACE_CB *IfCb;
   EFI_IP4_CONFIG2_POLICYPolicy;
 
   Policy = Ip4Config2PolicyDhcp;
   Status = EFI_SUCCESS;
+  ShellStatus = SHELL_SUCCESS;
 
   if (IsListEmpty (IfList)) {
 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
   }
 
@@ -823,37 +825,37 @@ IfConfigClearInterfaceInfo (
 IfCb->IfCfg,
 Ip4Config2DataTypePolicy,
 sizeof (EFI_IP4_CONFIG2_POLICY),
 &Policy
 );
-
 if (EFI_ERROR (Status)) {
+  ShellStatus = SHELL_ACCESS_DENIED;
   break;
 }
   }
 
-  return Status;
+  return ShellStatus;
 }
 
 /**
   The set process of the ifconfig command.
 
   @param[in]   IfListThe pointer of IfList(interface list).
   @param[in]   VarArgThe pointer of ARG_LIST(Args with "-s" option).
 
-  @retval EFI_SUCCESSThe ifconfig command set processed successfully.
+  @retval SHELL_SUCCESS  The ifconfig command set processed successfully.
   @retval others The ifconfig command set process failed.
 
 **/
-EFI_STATUS
+SHELL_STATUS
 IfConfigSetInterfaceInfo (
   IN LIST_ENTRY*IfList,
   IN ARG_LIST  *VarArg
   )
 {
-
   EFI_STATUS   Status;
+  SHELL_STATUS ShellStatus;
   IFCONFIG_INTERFACE_CB*IfCb;
   VAR_CHECK_CODE   CheckCode;
   EFI_EVENTTimeOutEvt;
   EFI_EVENTMappedEvt;
   BOOLEAN  IsAddressOk;
@@ -870,18 +872,19 @@ IfConfigSetInterfaceInfo (
 
   Dns = NULL;
 
   if (IsListEmpty (IfList)) {
 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
-return EFI_INVALID_PARAMETER;
+return SHELL_INVALID_PARAMETER;
   }
   
   //
   // Make sure to set only one interface each time.
   //
   IfCb   = NET_LIST_USER_STRUCT (IfList->ForwardLink, IFCONFIG_INTERFACE_CB, 
Link);
   Status = EFI_SUCCESS;
+  ShellStatus = SHELL_SUCCESS;
 
   //
   // Initialize check list mechanism.
   //
   CheckCode = IfConfigRetriveCheckListByName(
@@ -899,10 +902,11 @@ IfConfigSetInterfaceInfo (
   NULL,
   NULL,
   &TimeOutEvt
   );
   if (EFI_ERROR (Status)) {
+ShellStatus = SHELL_ACCESS_DENIED;
 goto ON_EXIT;
   }
 
   Status = gBS->CreateEvent (
   EVT_NOTIFY_SIGNAL,
@@ -910,10 +914,11 @@ IfConfigSetInterfaceInfo (
   IfConfigMan

[edk2] [Patch] BaseTools: Enhance GenFv Tool to report error message

2015-12-02 Thread Yonghong Zhu
When two vtf files in one FV image, no FV file can be generated, but it
report the stack trace info. so we enhance the tool to report error
message directly but not the stack trace info.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 Source/C/GenFv/GenFvInternalLib.c | 23 +++--
 Source/Python/GenFds/Fv.py| 43 +--
 2 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/Source/C/GenFv/GenFvInternalLib.c 
b/Source/C/GenFv/GenFvInternalLib.c
index 6d2d5d1..10bb88b 100644
--- a/Source/C/GenFv/GenFvInternalLib.c
+++ b/Source/C/GenFv/GenFvInternalLib.c
@@ -2852,21 +2852,22 @@ Returns:
 // close file
 //
 fclose (fpin);
 
 if (FvInfoPtr->IsPiFvImage) {
-   //
-   // Check whether this ffs file is vtf file
-   //
-   if (IsVtfFile (&FfsHeader)) {
- if (VtfFileFlag) {
-   //
-   // One Fv image can't have two vtf files.
-   //
-   return EFI_ABORTED;
- }
- VtfFileFlag = TRUE;
+//
+// Check whether this ffs file is vtf file
+//
+if (IsVtfFile (&FfsHeader)) {
+  if (VtfFileFlag) {
+//
+// One Fv image can't have two vtf files.
+//
+Error (NULL, 0, 3000,"Invalid", "One Fv image can't have two vtf 
files.");
+return EFI_ABORTED;
+  }
+  VtfFileFlag = TRUE;
 VtfFileSize = FfsFileSize;
 continue;
   }
 
   //
diff --git a/Source/Python/GenFds/Fv.py b/Source/Python/GenFds/Fv.py
index 163ccd3..df97ccb 100644
--- a/Source/Python/GenFds/Fv.py
+++ b/Source/Python/GenFds/Fv.py
@@ -179,34 +179,37 @@ class FV (FvClassObject):
 )
 
 #
 # Write the Fv contents to Buffer
 #
-FvFileObj = open ( FvOutputFile,'r+b')
+if os.path.isfile(FvOutputFile):
+FvFileObj = open ( FvOutputFile,'r+b')
 
-GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV Successfully" 
%self.UiFvName)
-GenFdsGlobalVariable.SharpCounter = 0
+GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV 
Successfully" %self.UiFvName)
+GenFdsGlobalVariable.SharpCounter = 0
 
-Buffer.write(FvFileObj.read())
-FvFileObj.seek(0)
-# PI FvHeader is 0x48 byte
-FvHeaderBuffer = FvFileObj.read(0x48)
-# FV alignment position.
-FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
-# FvAlignmentValue is larger than or equal to 1K
-if FvAlignmentValue >= 0x400:
-if FvAlignmentValue >= 0x1:
-#The max alignment supported by FFS is 64K.
-self.FvAlignment = "64K"
+Buffer.write(FvFileObj.read())
+FvFileObj.seek(0)
+# PI FvHeader is 0x48 byte
+FvHeaderBuffer = FvFileObj.read(0x48)
+# FV alignment position.
+FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
+# FvAlignmentValue is larger than or equal to 1K
+if FvAlignmentValue >= 0x400:
+if FvAlignmentValue >= 0x1:
+#The max alignment supported by FFS is 64K.
+self.FvAlignment = "64K"
+else:
+self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
 else:
-self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
+# FvAlignmentValue is less than 1K
+self.FvAlignment = str (FvAlignmentValue)
+FvFileObj.close()
+GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
+GenFdsGlobalVariable.LargeFileInFvFlags.pop()
 else:
-# FvAlignmentValue is less than 1K
-self.FvAlignment = str (FvAlignmentValue)
-FvFileObj.close()
-GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
-GenFdsGlobalVariable.LargeFileInFvFlags.pop()
+GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV file." 
%self.UiFvName)
 return FvOutputFile
 
 ## _GetBlockSize()
 #
 #   Calculate FV's block size
-- 
2.6.1.windows.1

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


[edk2] [Patch] BaseTools: process the files by the priority in BUILDRULEORDER

2015-12-02 Thread Yonghong Zhu
By the BUILDRULEORDER feature to process files listed in INF [Sources]
sections in priority order, if a filename is listed with multiple
extensions, the tools will use only the file that matches the first
extension in the space separated list.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 Source/Python/AutoGen/AutoGen.py | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/Source/Python/AutoGen/AutoGen.py b/Source/Python/AutoGen/AutoGen.py
index fe56574..263224b 100644
--- a/Source/Python/AutoGen/AutoGen.py
+++ b/Source/Python/AutoGen/AutoGen.py
@@ -2711,13 +2711,40 @@ class ModuleAutoGen(AutoGen):
 
 # add the file path into search path list for file including
 if F.Dir not in self.IncludePathList and self.AutoGenVersion 
>= 0x00010005:
 self.IncludePathList.insert(0, F.Dir)
 self._SourceFileList.append(F)
+
+self._MatchBuildRuleOrder(self._SourceFileList)
+
+for F in self._SourceFileList:
 self._ApplyBuildRule(F, TAB_UNKNOWN_FILE)
 return self._SourceFileList
 
+def _MatchBuildRuleOrder(self, FileList):
+Order_Dict = {}
+self._GetModuleBuildOption()
+for SingleFile in FileList:
+if self.BuildRuleOrder and SingleFile.Ext in self.BuildRuleOrder:
+key = SingleFile.Path.split(SingleFile.Ext)[0]
+if key in Order_Dict:
+Order_Dict[key].append(SingleFile.Ext)
+else:
+Order_Dict[key] = [SingleFile.Ext]
+
+RemoveList = []
+for F in Order_Dict:
+if len(Order_Dict[F]) > 1:
+Order_Dict[F].sort(key=lambda i: self.BuildRuleOrder.index(i))
+for Ext in Order_Dict[F][1:]:
+RemoveList.append(F + Ext)
+   
+for item in RemoveList:
+FileList.remove(item)
+
+return FileList
+
 ## Return the list of unicode files
 def _GetUnicodeFileList(self):
 if self._UnicodeFileList == None:
 if TAB_UNICODE_FILE in self.FileTypes:
 self._UnicodeFileList = self.FileTypes[TAB_UNICODE_FILE]
-- 
2.6.1.windows.1

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


[edk2] [Patch] BaseTools: Fix a bug in the VPD report generation

2015-12-02 Thread Yonghong Zhu
Changed the if condition to check whether current Region is FD VPD region
to fix a bug in the VPD report generation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 Source/Python/build/BuildReport.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Source/Python/build/BuildReport.py 
b/Source/Python/build/BuildReport.py
index 38e55f3..d376244 100644
--- a/Source/Python/build/BuildReport.py
+++ b/Source/Python/build/BuildReport.py
@@ -1387,15 +1387,15 @@ class FdReport(object):
 self.BaseAddress = Fd.BaseAddress
 self.Size = Fd.Size
 self.FdRegionList = [FdRegionReport(FdRegion, Wa) for FdRegion in 
Fd.RegionList]
 self.FvPath = os.path.join(Wa.BuildDir, "FV")
 self.VpdFilePath = os.path.join(self.FvPath, "%s.map" % 
Wa.Platform.VpdToolGuid)
-VpdPcdToken = 'gEfiMdeModulePkgTokenSpaceGuid'
-VpdPcdName = 'PcdVpdBaseAddress'
+self.VPDBaseAddress = 0
+self.VPDSize = 0
 self.VPDInfoList = []
 for index, FdRegion in enumerate(Fd.RegionList):
-if (VpdPcdName, VpdPcdToken) == FdRegion.PcdOffset:
+if str(FdRegion.RegionType) is 'FILE' and Wa.Platform.VpdToolGuid 
in str(FdRegion.RegionDataList):
 self.VPDBaseAddress = self.FdRegionList[index].BaseAddress
 self.VPDSize = self.FdRegionList[index].Size
 break
 
 if os.path.isfile(self.VpdFilePath):
-- 
2.6.1.windows.1

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


[edk2] [Patch] MdePkg: Add Ipmi2.0 definitions head file.

2015-12-02 Thread Daocheng Bu
Add Ipmi2.0 definitions head file based on Ipmi category:
App, Storage and etc.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daocheng Bu 
CC: Jiewen Yao 
---
 MdePkg/Include/IndustryStandard/Ipmi.h |  29 +
 .../IndustryStandard/IpmiNetFnAppDefinitions.h | 647 +
 .../IndustryStandard/IpmiNetFnBridgeDefinitions.h  | 243 
 .../IndustryStandard/IpmiNetFnChassisDefinitions.h | 304 ++
 .../IpmiNetFnFirmwareDefinitions.h |  26 +
 .../IpmiNetFnGroupExtensionDefinitions.h   |  26 +
 .../IpmiNetFnSensorEventDefinitions.h  |  52 ++
 .../IndustryStandard/IpmiNetFnStorageDefinitions.h | 534 +
 .../IpmiNetFnTransportDefinitions.h| 556 ++
 9 files changed, 2417 insertions(+)
 create mode 100644 MdePkg/Include/IndustryStandard/Ipmi.h
 create mode 100644 MdePkg/Include/IndustryStandard/IpmiNetFnAppDefinitions.h
 create mode 100644 MdePkg/Include/IndustryStandard/IpmiNetFnBridgeDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnChassisDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnFirmwareDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnGroupExtensionDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnSensorEventDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnStorageDefinitions.h
 create mode 100644 
MdePkg/Include/IndustryStandard/IpmiNetFnTransportDefinitions.h

diff --git a/MdePkg/Include/IndustryStandard/Ipmi.h 
b/MdePkg/Include/IndustryStandard/Ipmi.h
new file mode 100644
index 000..04e6807
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/Ipmi.h
@@ -0,0 +1,29 @@
+/** @file   
+  IPMI 2.0 definitions from the IPMI Specification Version 2.0, Revision 1.1.
+
+  See IPMI specification, Appendix G, Command Assignments
+  and Appendix H, Sub-function Assignments.
+
+  Copyright (c) 1999 - 2015, 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   
 
+
+  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 _IPMIDEFINITIONS_H_
+#define _IPMIDEFINITIONS_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#endif
diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnAppDefinitions.h 
b/MdePkg/Include/IndustryStandard/IpmiNetFnAppDefinitions.h
new file mode 100644
index 000..3e31b10
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/IpmiNetFnAppDefinitions.h
@@ -0,0 +1,647 @@
+/** @file   
+  IPMI 2.0 definitions from the IPMI Specification Version 2.0, Revision 1.1.
+
+  This file contains all NetFn App commands, including:
+IPM Device "Global" Commands (Chapter 20)
+Firmware Firewall & Command Discovery Commands (Chapter 21)
+BMC Watchdog Timer Commands (Chapter 27)
+IPMI Messaging Support Commands (Chapter 22)
+RMCP+ Support and Payload Commands (Chapter 24)
+
+  See IPMI specification, Appendix G, Command Assignments
+  and Appendix H, Sub-function Assignments.
+
+  Copyright (c) 1999 - 2015, 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   
 
+
+  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 _IPMINETFNAPPDEFINITIONS_H_
+#define _IPMINETFNAPPDEFINITIONS_H_
+
+#pragma pack(1)
+//
+// Net function definition for App command
+//
+#define IPMI_NETFN_APP  0x06
+
+//
+//  Below is Definitions for IPM Device "Global" Commands  (Chapter 20)
+//
+
+//
+//  Definitions for Get Device ID command   
+//
+#define IPMI_APP_GET_DEVICE_ID 0x1
+
+//
+//  Constants and Structure definitions for "Get Device ID" command to follow 
here
+//
+typedef struct {
+  UINT8   DeviceId;
+  UINT8   DeviceRevision : 4;
+  UINT8   Reserved : 3;
+  UINT8   DeviceSdr : 1;
+  UINT8   MajorFirmwareRev : 7;
+  UINT8   UpdateMode : 1;
+  UINT8   MinorFirmwareRev;
+  UINT8   SpecificationVersion;
+  UINT8   SensorDeviceSupport : 1;
+  UINT8   SdrRepositorySupport : 1;
+  UINT8   SelDeviceSupport : 1;
+  UINT8   FruInventor