[edk2] [PATCH] MdePkg Cper.h: Add missing structure for 'Processor Error Record'

2016-03-22 Thread Hao Wu
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdePkg/Include/Guid/Cper.h | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Guid/Cper.h b/MdePkg/Include/Guid/Cper.h
index d6223df..183ddaa 100644
--- a/MdePkg/Include/Guid/Cper.h
+++ b/MdePkg/Include/Guid/Cper.h
@@ -1,7 +1,7 @@
 /** @file
   GUIDs and definitions used for Common Platform Error Record.
 
-  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -347,6 +347,15 @@ typedef struct {
 ///@}
 
 ///
+/// IA32/X64 Processor Error Record
+///
+typedef struct {
+  UINT64 ValidFields;
+  UINT64 ApicId;
+  UINT8  CpuIdInfo[48];
+} EFI_IA32_X64_PROCESSOR_ERROR_RECORD;
+
+///
 /// The validation bit mask indicates which fields in the Cache Check structure
 /// are valid.
 ///@{
-- 
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 v2 0/3] Adaptively set serial terminal polling rate

2016-03-22 Thread Ni, Ruiyu
For 1/3 and 2/3:

Reviewed-by: Ruiyu Ni 


I will have comments for 3/3.

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Heyi Guo
>Sent: Thursday, March 17, 2016 10:37 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu ; Tian, Feng ; Gao, 
>Liming ; Heyi Guo
>; Kinney, Michael D ; Zeng, 
>Star 
>Subject: [edk2] [PATCH v2 0/3] Adaptively set serial terminal polling rate
>
>The serial terminal polling interval is now fixed by macro:
>
>#define KEYBOARD_TIMER_INTERVAL 20  // 0.02s
>
>However, this may cause fast input to be truncated on some platforms. For 
>example, we have a serial console with below
>features:
>1. Baud rate: 115200
>2. FIFO depth of UART device: 32
>
>If we want to capture all input, we need to poll with the interval of 32 / 
>(115200 / (8 + 1 + 1)) = 2.8 ms, 8 + 1 + 1 for data bits +
>start bit + stop bit. Due to UEFI event potential delay, we will need even 
>shorter polling interval than the ideal calculation
>result.
>
>These patches are to set serial terminal polling rate adaptively.
>
>Heyi Guo (3):
>  MdePkg: Add PCD for UART default receive FIFO depth
>  MdeModulePkg/SerialDxe: Set FIFO depth with PCD
>  MdeModulePkg/TerminalDxe: Set polling rate by serial IO mode
>
> .../Universal/Console/TerminalDxe/Terminal.c   |  5 +-
> .../Universal/Console/TerminalDxe/Terminal.h   | 27 -
> .../Universal/Console/TerminalDxe/TerminalConIn.c  | 68 ++
> MdeModulePkg/Universal/SerialDxe/SerialDxe.inf |  9 +--
> MdeModulePkg/Universal/SerialDxe/SerialIo.c|  3 +-
> MdePkg/MdePkg.dec  |  4 ++
> 6 files changed, 109 insertions(+), 7 deletions(-)
>
>Cc: Michael D Kinney 
>Cc: Liming Gao 
>Cc: Ruiyu Ni 
>Cc: Feng Tian 
>Cc: Star Zeng 
>--
>2.7.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] ShellPkg: Modify the 'dh' Shell command to dump the Firmware Management Protocol Image Descriptor Information.

2016-03-22 Thread Qiu, Shumin
Reviewed-by: Qiu Shumin 

From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Carsey, 
Jaben
Sent: Saturday, March 19, 2016 1:13 AM
To: Tapan Shah; edk2-devel@lists.01.org
Cc: Carsey, Jaben
Subject: Re: [edk2] [PATCH] ShellPkg: Modify the 'dh' Shell command to dump the 
Firmware Management Protocol Image Descriptor Information.

Looks good to me.  I will let Shumin check also.

Reviewed-by: Jaben Carsey 
>

> -Original Message-
> From: Tapan Shah [mailto:tapands...@hpe.com]
> Sent: Friday, March 18, 2016 9:32 AM
> To: edk2-devel@lists.01.org
> Cc: samer.el-haj-mahm...@hpe.com; 
> Carsey, Jaben
> >; Tapan Shah 
> >
> Subject: [PATCH] ShellPkg: Modify the 'dh' Shell command to dump the
> Firmware Management Protocol Image Descriptor Information.
> Importance: High
>
> Modify 'dh' shell command to dump FirmwareManagement Protocol
> information.
> Add FirmwareManagement image descriptor V1 and V2 structure definition
> in UefiHandleParsingLib.h to support decoding V1/V2 revisions.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Tapan Shah >
> ---
>  .../UefiHandleParsingLib/UefiHandleParsingLib.c| 405
> -
>  .../UefiHandleParsingLib/UefiHandleParsingLib.h| 118 +-
>  .../UefiHandleParsingLib/UefiHandleParsingLib.uni  |  53 +++
>  3 files changed, 573 insertions(+), 3 deletions(-)
>
> diff --git
> a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
> b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
> index 4c46e5e..22d778b 100644
> --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
> +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
> @@ -3,7 +3,7 @@
>
>Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
>(C) Copyright 2013-2015 Hewlett-Packard Development Company,
> L.P.
> -  (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development
> + LP
>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 @@ -823,6 +823,407 @@ ERROR_EXIT:
>SHELL_FREE_NON_NULL (InformationBlock);
>return NULL;
>  }
> +
> +/**
> +  Function to dump information about
> EFI_FIRMWARE_MANAGEMENT_PROTOCOL Protocol.
> +
> +  @param[in] TheHandle  The handle that has the protocol installed.
> +  @param[in] VerboseTRUE for additional information, FALSE otherwise.
> +
> +  @retval A pointer to a string containing the information.
> +**/
> +CHAR16*
> +EFIAPI
> +FirmwareManagementDumpInformation (
> +  IN CONST EFI_HANDLE TheHandle,
> +  IN CONST BOOLEANVerbose
> +  )
> +{
> +  EFI_STATUS  Status;
> +  EFI_FIRMWARE_MANAGEMENT_PROTOCOL*EfiFwMgmtProtocol;
> +  EFI_FIRMWARE_IMAGE_DESCRIPTOR   *ImageInfo;
> +  EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1*ImageInfoV1;
> +  EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2*ImageInfoV2;
> +  UINT64  AttributeSetting;
> +  UINTN   ImageInfoSize;
> +  UINTN   DescriptorSize;
> +  UINT32  DescriptorVersion;
> +  UINT32  PackageVersion;
> +  UINT8   DescriptorCount;
> +  UINT8   Index;
> +  UINT8   Index1;
> +  UINT8   ImageCount;
> +  CHAR16  *PackageVersionName;
> +  CHAR16  *TempStr;
> +  CHAR16  *RetVal;
> +  CHAR16  *TempRetVal;
> +  CHAR16  *AttributeSettingStr;
> +  BOOLEAN Found;
> +  BOOLEAN AttributeSupported;
> +
> +  //
> +  // Initialize local variables
> +  //
> +  ImageCount = 0;
> +  ImageInfoSize  = 1;
> +  AttributeSetting   = 0;
> +  Found  = FALSE;
> +  AttributeSupported = FALSE;
> +  ImageInfo  = NULL;
> +  ImageInfoV1= NULL;
> +  ImageInfoV2= NULL;
> +  PackageVersionName = NULL;
> +  RetVal = NULL;
> +  TempRetVal = NULL;
> +  TempStr= NULL;
> +  AttributeSettingStr= NULL;
> +
> +  if (!Verbose) {
> +return (CatSPrint(NULL, L"FirmwareManagement"));  }
> +
> +  Status = gBS->OpenProtocol (
> +  (EFI_HANDLE) (TheHandle),
> +  ,
> +  (VOID **) ,
> 

Re: [edk2] [PATCH v2 0/3] Adaptively set serial terminal polling rate

2016-03-22 Thread Ni, Ruiyu


Reviewed-by: Ruiyu Ni 

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Heyi Guo
>Sent: Thursday, March 17, 2016 10:37 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu ; Tian, Feng ; Gao, 
>Liming ; Heyi Guo
>; Kinney, Michael D ; Zeng, 
>Star 
>Subject: [edk2] [PATCH v2 0/3] Adaptively set serial terminal polling rate
>
>The serial terminal polling interval is now fixed by macro:
>
>#define KEYBOARD_TIMER_INTERVAL 20  // 0.02s
>
>However, this may cause fast input to be truncated on some platforms. For 
>example, we have a serial console with below
>features:
>1. Baud rate: 115200
>2. FIFO depth of UART device: 32
>
>If we want to capture all input, we need to poll with the interval of 32 / 
>(115200 / (8 + 1 + 1)) = 2.8 ms, 8 + 1 + 1 for data bits +
>start bit + stop bit. Due to UEFI event potential delay, we will need even 
>shorter polling interval than the ideal calculation
>result.
>
>These patches are to set serial terminal polling rate adaptively.
>
>Heyi Guo (3):
>  MdePkg: Add PCD for UART default receive FIFO depth
>  MdeModulePkg/SerialDxe: Set FIFO depth with PCD
>  MdeModulePkg/TerminalDxe: Set polling rate by serial IO mode
>
> .../Universal/Console/TerminalDxe/Terminal.c   |  5 +-
> .../Universal/Console/TerminalDxe/Terminal.h   | 27 -
> .../Universal/Console/TerminalDxe/TerminalConIn.c  | 68 ++
> MdeModulePkg/Universal/SerialDxe/SerialDxe.inf |  9 +--
> MdeModulePkg/Universal/SerialDxe/SerialIo.c|  3 +-
> MdePkg/MdePkg.dec  |  4 ++
> 6 files changed, 109 insertions(+), 7 deletions(-)
>
>Cc: Michael D Kinney 
>Cc: Liming Gao 
>Cc: Ruiyu Ni 
>Cc: Feng Tian 
>Cc: Star Zeng 
>--
>2.7.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] signedness of CHAR8

2016-03-22 Thread Gao, Liming
Andrew:
  Those tests are very helpful. I change my mind. I agree to keep CHAR8 
definition without change.

Thanks
Liming
From: af...@apple.com [mailto:af...@apple.com]
Sent: Wednesday, March 23, 2016 1:47 AM
To: Gao, Liming 
Cc: Kinney, Michael D ; edk2-devel 
(edk2-devel@lists.01.org) ; Rothman, Michael A 
; Laszlo Ersek ; Leif Lindholm 

Subject: Re: [edk2] signedness of CHAR8


> On Mar 21, 2016, at 10:23 PM, Gao, Liming wrote:
>
> Andrew:
> Thanks for your point. I verify this change with VS2015 and GCC49 on IA32 
> arch. There is no warning report. So, I think the compiler option is not 
> required for all tool chains and all archs. But, this is not true for CLANG. 
> It may not be true for ARM. So, I suggest we add option -funsigned-char for 
> every tool chain and every arch to ensure char is unsigned. For VS tool 
> chain, /J (Default char Type Is unsigned) option. can be used. And, we also 
> update CHAR8 definition with unsigned char to clearly follow UEFI spec.
>

Liming,

It looks like clang warns if you assume a string literal has a specific sign. 
The -funsigned-char flag does not change this behavior.

~/work/Compiler>cat string.c

unsigned char *a = "a test";
signed char *b = "b test";
char *c = "c test";

~/work/Compiler>clang string.c -S -funsigned-char
string.c:2:16: warning: initializing 'unsigned char *' with an expression of 
type 'char [7]' converts between pointers to integer
types with different sign [-Wpointer-sign]
unsigned char *a = "a test";
^ 
string.c:3:16: warning: initializing 'signed char *' with an expression of type 
'char [7]' converts between pointers to integer types
with different sign [-Wpointer-sign]
signed char *b = "b test";
^ 
2 warnings generated.

~/work/Compiler>clang string.c -S
string.c:2:16: warning: initializing 'unsigned char *' with an expression of 
type 'char [7]' converts between pointers to integer
types with different sign [-Wpointer-sign]
unsigned char *a = "a test";
^ 
string.c:3:16: warning: initializing 'signed char *' with an expression of type 
'char [7]' converts between pointers to integer types
with different sign [-Wpointer-sign]
signed char *b = "b test";
^ 
2 warnings generated.
~/work/Compiler>

It looks like clang's -Wpointer-sign will warn if you write code that assumes 
the sign of string literals. I assume this is to enforce portability. It looks 
like you need to cast between char * and (signed char *or unsigned char *) to 
make the compiler happy.

If we try to force CHAR8 to be signed or unsigned explicitly (type unsigned 
char), then we will have to cast all string literals to (CHAR8 *)

~/work/Compiler>cat string.c

unsigned char *a = (unsigned char *)"a test";
signed char *b = (signed char *)"b test";
char *c = "c test";

~/work/Compiler>clang string.c -S -funsigned-char
~/work/Compiler>clang string.c -S

I think this is why CHAR8 is defined as a char in all the processor bindings.

Thanks,

Andrew Fish

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


Re: [edk2] [patch 3/4] MdePkg/IndustryStandard: Add SD/EMMC common definitions

2016-03-22 Thread Tian, Feng
Thanks for raising this issue, I will update it.

Thanks
Feng

-Original Message-
From: Yao, Jiewen 
Sent: Wednesday, March 23, 2016 10:55 AM
To: Tian, Feng ; edk2-devel@lists.01.org
Cc: Wu, Hao A ; Zeng, Star 
Subject: RE: [edk2] [patch 3/4] MdePkg/IndustryStandard: Add SD/EMMC common 
definitions

Hi Feng
Can we add EMMC_ prefix to avoid name space conflict?

+//
+// EMMC command index
+//
+#define  GO_IDLE_STATE   0
+#define  SEND_OP_COND1
+#define  ALL_SEND_CID2
+#define  SET_RELATIVE_ADDR   3
+#define  SET_DSR 4
+#define  SLEEP_AWAKE 5
+#define  SWITCH  6
+#define  SELECT_DESELECT_CARD7
+#define  SEND_EXT_CSD8
+#define  SEND_CSD9
+#define  SEND_CID10
+#define  STOP_TRANSMISSION   12
+#define  SEND_STATUS 13
+#define  BUSTEST_R   14
+#define  GO_INACTIVE_STATE   15
+#define  SET_BLOCKLEN16
+#define  READ_SINGLE_BLOCK   17
+#define  READ_MULTIPLE_BLOCK 18
+#define  BUSTEST_W   19
+#define  SEND_TUNING_BLOCK   21
+#define  SET_BLOCK_COUNT 23
+#define  WRITE_BLOCK 24
+#define  WRITE_MULTIPLE_BLOCK25
+#define  PROGRAM_CID 26
+#define  PROGRAM_CSD 27
+#define  SET_WRITE_PROT  28
+#define  CLR_WRITE_PROT  29
+#define  SEND_WRITE_PROT 30
+#define  SEND_WRITE_PROT_TYPE31
+#define  ERASE_GROUP_START   35
+#define  ERASE_GROUP_END 36
+#define  ERASE   38
+#define  FAST_IO 39
+#define  GO_IRQ_STATE40
+#define  LOCK_UNLOCK 42
+#define  SET_TIME49
+#define  PROTOCOL_RD 53
+#define  PROTOCOL_WR 54
+#define  APP_CMD 55
+#define  GEN_CMD 56

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng Tian
Sent: Wednesday, March 23, 2016 10:51 AM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A; Zeng, Star
Subject: [edk2] [patch 3/4] MdePkg/IndustryStandard: Add SD/EMMC common 
definitions

These definitions are defined in SD physical layer simplified spec and eMMC 
electrical standard spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdePkg/Include/IndustryStandard/Emmc.h | 297 +
 MdePkg/Include/IndustryStandard/Sd.h   | 181 
 2 files changed, 478 insertions(+)
 create mode 100644 MdePkg/Include/IndustryStandard/Emmc.h
 create mode 100644 MdePkg/Include/IndustryStandard/Sd.h

diff --git a/MdePkg/Include/IndustryStandard/Emmc.h 
b/MdePkg/Include/IndustryStandard/Emmc.h
new file mode 100644
index 000..b17bee6
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/Emmc.h
@@ -0,0 +1,297 @@
+/** @file
+  Header file for eMMC support.
+
+  This header file contains some definitions defined in EMMC4.5/EMMC5.0 spec.
+
+  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.
+
+**/
+
+#ifndef __EMMC_H__
+#define __EMMC_H__
+
+//
+// EMMC command index
+//
+#define  GO_IDLE_STATE   0
+#define  SEND_OP_COND1
+#define  ALL_SEND_CID2
+#define  SET_RELATIVE_ADDR   3
+#define  SET_DSR 4
+#define  SLEEP_AWAKE 5
+#define  SWITCH  6
+#define  SELECT_DESELECT_CARD7
+#define  SEND_EXT_CSD8
+#define  SEND_CSD9
+#define  SEND_CID10
+#define  STOP_TRANSMISSION   12
+#define  SEND_STATUS 13
+#define  BUSTEST_R   14
+#define  GO_INACTIVE_STATE   15
+#define  SET_BLOCKLEN16
+#define  READ_SINGLE_BLOCK   17
+#define  READ_MULTIPLE_BLOCK 18
+#define  BUSTEST_W   19
+#define  SEND_TUNING_BLOCK   21
+#define  SET_BLOCK_COUNT 23
+#define  WRITE_BLOCK 24
+#define  WRITE_MULTIPLE_BLOCK25
+#define  PROGRAM_CID 26
+#define  PROGRAM_CSD 27
+#define  SET_WRITE_PROT  28
+#define  CLR_WRITE_PROT  29
+#define  SEND_WRITE_PROT 30
+#define  SEND_WRITE_PROT_TYPE31
+#define  ERASE_GROUP_START   35
+#define  ERASE_GROUP_END 36
+#define  ERASE   38
+#define  FAST_IO 39
+#define  GO_IRQ_STATE40
+#define  LOCK_UNLOCK 42
+#define  SET_TIME49
+#define  PROTOCOL_RD 

Re: [edk2] [patch 3/4] MdePkg/IndustryStandard: Add SD/EMMC common definitions

2016-03-22 Thread Yao, Jiewen
Hi Feng
Can we add EMMC_ prefix to avoid name space conflict?

+//
+// EMMC command index
+//
+#define  GO_IDLE_STATE   0
+#define  SEND_OP_COND1
+#define  ALL_SEND_CID2
+#define  SET_RELATIVE_ADDR   3
+#define  SET_DSR 4
+#define  SLEEP_AWAKE 5
+#define  SWITCH  6
+#define  SELECT_DESELECT_CARD7
+#define  SEND_EXT_CSD8
+#define  SEND_CSD9
+#define  SEND_CID10
+#define  STOP_TRANSMISSION   12
+#define  SEND_STATUS 13
+#define  BUSTEST_R   14
+#define  GO_INACTIVE_STATE   15
+#define  SET_BLOCKLEN16
+#define  READ_SINGLE_BLOCK   17
+#define  READ_MULTIPLE_BLOCK 18
+#define  BUSTEST_W   19
+#define  SEND_TUNING_BLOCK   21
+#define  SET_BLOCK_COUNT 23
+#define  WRITE_BLOCK 24
+#define  WRITE_MULTIPLE_BLOCK25
+#define  PROGRAM_CID 26
+#define  PROGRAM_CSD 27
+#define  SET_WRITE_PROT  28
+#define  CLR_WRITE_PROT  29
+#define  SEND_WRITE_PROT 30
+#define  SEND_WRITE_PROT_TYPE31
+#define  ERASE_GROUP_START   35
+#define  ERASE_GROUP_END 36
+#define  ERASE   38
+#define  FAST_IO 39
+#define  GO_IRQ_STATE40
+#define  LOCK_UNLOCK 42
+#define  SET_TIME49
+#define  PROTOCOL_RD 53
+#define  PROTOCOL_WR 54
+#define  APP_CMD 55
+#define  GEN_CMD 56

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng Tian
Sent: Wednesday, March 23, 2016 10:51 AM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A; Zeng, Star
Subject: [edk2] [patch 3/4] MdePkg/IndustryStandard: Add SD/EMMC common 
definitions

These definitions are defined in SD physical layer simplified spec and eMMC 
electrical standard spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdePkg/Include/IndustryStandard/Emmc.h | 297 +
 MdePkg/Include/IndustryStandard/Sd.h   | 181 
 2 files changed, 478 insertions(+)
 create mode 100644 MdePkg/Include/IndustryStandard/Emmc.h
 create mode 100644 MdePkg/Include/IndustryStandard/Sd.h

diff --git a/MdePkg/Include/IndustryStandard/Emmc.h 
b/MdePkg/Include/IndustryStandard/Emmc.h
new file mode 100644
index 000..b17bee6
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/Emmc.h
@@ -0,0 +1,297 @@
+/** @file
+  Header file for eMMC support.
+
+  This header file contains some definitions defined in EMMC4.5/EMMC5.0 spec.
+
+  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.
+
+**/
+
+#ifndef __EMMC_H__
+#define __EMMC_H__
+
+//
+// EMMC command index
+//
+#define  GO_IDLE_STATE   0
+#define  SEND_OP_COND1
+#define  ALL_SEND_CID2
+#define  SET_RELATIVE_ADDR   3
+#define  SET_DSR 4
+#define  SLEEP_AWAKE 5
+#define  SWITCH  6
+#define  SELECT_DESELECT_CARD7
+#define  SEND_EXT_CSD8
+#define  SEND_CSD9
+#define  SEND_CID10
+#define  STOP_TRANSMISSION   12
+#define  SEND_STATUS 13
+#define  BUSTEST_R   14
+#define  GO_INACTIVE_STATE   15
+#define  SET_BLOCKLEN16
+#define  READ_SINGLE_BLOCK   17
+#define  READ_MULTIPLE_BLOCK 18
+#define  BUSTEST_W   19
+#define  SEND_TUNING_BLOCK   21
+#define  SET_BLOCK_COUNT 23
+#define  WRITE_BLOCK 24
+#define  WRITE_MULTIPLE_BLOCK25
+#define  PROGRAM_CID 26
+#define  PROGRAM_CSD 27
+#define  SET_WRITE_PROT  28
+#define  CLR_WRITE_PROT  29
+#define  SEND_WRITE_PROT 30
+#define  SEND_WRITE_PROT_TYPE31
+#define  ERASE_GROUP_START   35
+#define  ERASE_GROUP_END 36
+#define  ERASE   38
+#define  FAST_IO 39
+#define  GO_IRQ_STATE40
+#define  LOCK_UNLOCK 42
+#define  SET_TIME49
+#define  PROTOCOL_RD 53
+#define  PROTOCOL_WR 54
+#define  APP_CMD 55
+#define  GEN_CMD 56
+
+typedef enum {
+  EmmcPartitionUserData  = 0,
+  EmmcPartitionBoot1 = 1,
+  EmmcPartitionBoot2 = 2,
+  EmmcPartitionRPMB  = 3,
+  EmmcPartitionGP1   = 4,
+  EmmcPartitionGP2   

[edk2] [patch 0/4] Add EDKII SD/MMC stack to manage SD/EMMC device

2016-03-22 Thread Feng Tian
The EDKII SD/MMC stack includes:
1. Dxe phase support by:
   i.  SdMmcPciHcDxe driver to consume PciIo and produce SdMmcPassThru
   ii. SdDxe driver to consume SdMmcPassThru to produce BlkIo1/BlkIo2
   iii.EmmcDxe driver to consume SdMmcPassThru to produce BlkIo1/BlkIo2/SSP

2. Pei phase support
   i.  SdBlockIoPei driver to consume SdMmcHostController Ppi and produce 
VirutalBlkIo1&2
   ii. EmmcBlockIoPei driver to consume SdMmcHostController Ppi and produce 
VirutalBlkIo1&2
   iii.SdMmcPciHcPei driver to produce SdMmcHostController Ppi

Feng Tian (4):
  MdePkg: Add EFI_SD_MMC_PASS_THRU_PROTOCOL definition
  MdePkg/DevicePath: Add EMMC device path definition
  MdePkg/IndustryStandard: Add SD/EMMC common definitions
  MdeModulePkg/SdMmc: Add EDKII SD/MMC stack

 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/ComponentName.c |  211 ++
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c| 1096 
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c  | 1166 
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 1154 
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h |  775 ++
 .../Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf|   72 +
 .../Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.uni|  Bin 0 -> 2216 bytes
 .../Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxeExtra.uni   |  Bin 0 -> 1348 bytes
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c   | 1879 +
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h   |  544 
 MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.c |  175 ++
 MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.h |   86 +
 .../Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.inf|   56 +
 .../Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.uni|  Bin 0 -> 2096 bytes
 .../Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPeiExtra.uni   |  Bin 0 -> 1378 bytes
 .../Bus/Sd/EmmcBlockIoPei/EmmcBlockIoPei.c |  779 ++
 .../Bus/Sd/EmmcBlockIoPei/EmmcBlockIoPei.h |  381 +++
 .../Bus/Sd/EmmcBlockIoPei/EmmcBlockIoPei.inf   |   62 +
 .../Bus/Sd/EmmcBlockIoPei/EmmcBlockIoPei.uni   |  Bin 0 -> 1696 bytes
 .../Bus/Sd/EmmcBlockIoPei/EmmcBlockIoPeiExtra.uni  |  Bin 0 -> 1362 bytes
 MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHcMem.c |  455 
 MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHcMem.h |   61 +
 MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c   | 2780 +++
 MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.h   |  345 +++
 MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c|  241 ++
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c  | 1591 +++
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.h  |  466 
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c  | 1176 
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h  |  495 
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.inf|   66 +
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.uni|  Bin 0 -> 2020 bytes
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxeExtra.uni   |  Bin 0 -> 1306 bytes
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c|  610 +
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.h|  377 +++
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.inf  |   62 +
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.uni  |  Bin 0 -> 1748 bytes
 .../Bus/Sd/SdBlockIoPei/SdBlockIoPeiExtra.uni  |  Bin 0 -> 1354 bytes
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.c |  455 
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.h |   61 +
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c   | 2869 
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.h   |  354 +++
 MdeModulePkg/Bus/Sd/SdDxe/ComponentName.c  |  240 ++
 MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c  |  971 +++
 MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.h  |  221 ++
 MdeModulePkg/Bus/Sd/SdDxe/SdDxe.c  |  883 ++
 MdeModulePkg/Bus/Sd/SdDxe/SdDxe.h  |  469 
 MdeModulePkg/Bus/Sd/SdDxe/SdDxe.inf|   65 +
 MdeModulePkg/Bus/Sd/SdDxe/SdDxe.uni|  Bin 0 -> 2024 bytes
 MdeModulePkg/Bus/Sd/SdDxe/SdDxeExtra.uni   |  Bin 0 -> 2036 bytes
 MdeModulePkg/Include/Ppi/SdMmcHostController.h |   64 +
 MdeModulePkg/MdeModulePkg.dec  |9 +
 MdeModulePkg/MdeModulePkg.dsc  |6 +
 MdePkg/Include/IndustryStandard/Emmc.h |  297 ++
 MdePkg/Include/IndustryStandard/Sd.h   |  181 ++
 MdePkg/Include/Protocol/DevicePath.h   |   11 +
 MdePkg/Include/Protocol/SdMmcPassThru.h|  264 ++
 .../Library/UefiDevicePathLib/DevicePathFromText.c |   29 +
 .../Library/UefiDevicePathLib/DevicePathToText.c   |   32 +
 MdePkg/MdePkg.dec  |3 +
 59 files changed, 24645 insertions(+)
 create mode 100644 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/ComponentName.c
 create mode 100644 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
 create mode 100644 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
 create mode 100644 

[edk2] [patch 2/4] MdePkg/DevicePath: Add EMMC device path definition

2016-03-22 Thread Feng Tian
This device path node is introduced in UEFI2.6 spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdePkg/Include/Protocol/DevicePath.h   | 11 
 .../Library/UefiDevicePathLib/DevicePathFromText.c | 29 
 .../Library/UefiDevicePathLib/DevicePathToText.c   | 32 ++
 3 files changed, 72 insertions(+)

diff --git a/MdePkg/Include/Protocol/DevicePath.h 
b/MdePkg/Include/Protocol/DevicePath.h
index 631136be..9a9ad2c 100644
--- a/MdePkg/Include/Protocol/DevicePath.h
+++ b/MdePkg/Include/Protocol/DevicePath.h
@@ -855,6 +855,15 @@ typedef struct {
 } SD_DEVICE_PATH;
 
 ///
+/// EMMC (Embedded MMC) Device Path SubType.
+///
+#define MSG_EMMC_DP 0x1D
+typedef struct {
+  EFI_DEVICE_PATH_PROTOCOLHeader;
+  UINT8   SlotNumber;
+} EMMC_DEVICE_PATH;
+
+///
 /// iSCSI Device Path SubType
 ///
 #define MSG_ISCSI_DP  0x13
@@ -1239,6 +1248,7 @@ typedef union {
   WIFI_DEVICE_PATH   WiFi;
   UFS_DEVICE_PATHUfs;
   SD_DEVICE_PATH Sd;
+  EMMC_DEVICE_PATH   Emmc;
   HARDDRIVE_DEVICE_PATH  HardDrive;
   CDROM_DEVICE_PATH  CD;
 
@@ -1295,6 +1305,7 @@ typedef union {
   WIFI_DEVICE_PATH   *WiFi;
   UFS_DEVICE_PATH*Ufs;
   SD_DEVICE_PATH *Sd;
+  EMMC_DEVICE_PATH   *Emmc;
   HARDDRIVE_DEVICE_PATH  *HardDrive;
   CDROM_DEVICE_PATH  *CD;
 
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index 6a9b389..961ccb5 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -1903,6 +1903,34 @@ DevPathFromTextSd (
 }
 
 /**
+  Converts a text device path node to EMMC (Embedded MMC) device path 
structure.
+
+  @param TextDeviceNode  The input Text device path node.
+
+  @return A pointer to the newly-created EMMC device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextEmmc (
+  IN CHAR16 *TextDeviceNode
+  )
+{
+  CHAR16*SlotNumberStr;
+  EMMC_DEVICE_PATH  *Emmc;
+
+  SlotNumberStr = GetNextParamStr ();
+  Emmc  = (EMMC_DEVICE_PATH *) CreateDeviceNode (
+   MESSAGING_DEVICE_PATH,
+   MSG_EMMC_DP,
+   (UINT16) sizeof (EMMC_DEVICE_PATH)
+   );
+
+  Emmc->SlotNumber = (UINT8) Strtoi (SlotNumberStr);
+
+  return (EFI_DEVICE_PATH_PROTOCOL *) Emmc;
+}
+
+/**
   Converts a text device path node to Debug Port device path structure.
 
   @param TextDeviceNode  The input Text device path node.
@@ -3501,6 +3529,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE 
mUefiDevicePathLibDevP
   {L"NVMe",DevPathFromTextNVMe},
   {L"UFS", DevPathFromTextUfs },
   {L"SD",  DevPathFromTextSd  },
+  {L"Emmc",DevPathFromTextEmmc},
   {L"DebugPort",   DevPathFromTextDebugPort   },
   {L"MAC", DevPathFromTextMAC },
   {L"IPv4",DevPathFromTextIPv4},
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index 363830b..92db3b1 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -823,6 +823,37 @@ DevPathToTextSd (
 }
 
 /**
+  Converts a EMMC (Embedded MMC) device path structure to its string 
representative.
+
+  @param Str The string representative of input device.
+  @param DevPath The input device path structure.
+  @param DisplayOnly If DisplayOnly is TRUE, then the shorter text 
representation
+ of the display node is used, where applicable. If 
DisplayOnly
+ is FALSE, then the longer text representation of the 
display node
+ is used.
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of 
text
+ representation for a device node can be used, where 
applicable.
+
+**/
+VOID
+DevPathToTextEmmc (
+  IN OUT POOL_PRINT  *Str,
+  IN VOID*DevPath,
+  IN BOOLEAN DisplayOnly,
+  IN BOOLEAN AllowShortcuts
+  )
+{
+  EMMC_DEVICE_PATH *Emmc;
+
+  Emmc = DevPath;
+  UefiDevicePathLibCatPrint (
+Str,
+L"Emmc(0x%x)",
+Emmc->SlotNumber
+);
+}
+
+/**
   Converts a 1394 device path 

Re: [edk2] [PATCH v2 1/1] MdePkg: Move SMBIOS data into the IndustryStandard header.

2016-03-22 Thread Zeng, Star

On 2016/3/22 22:53, Marvin Häuser wrote:

As the SMBIOS table types belong to the SMBIOS standard, they were
moved from the SMBIOS Protocol header into the SMBIOS
IndustryStandard header without the EFI_-prefix. Defines with the
EFI_-prefix have been kept in the Protocol header for
backwards-compatibility, resolving to the IndustryStandard defines.
The same has been done with the C types.

The SMBIOS table header structure had been duplicated -
SMBIOS_STRUCTURE in the IndustryStandard header and
EFI_SMBIOS_TABLE_HEADER in the Protocol file - and thus the
Protocol type was replaced with a typedef to the InudstryStandard's.
This doesn't only make it easier to maintain, but it also prevents
potential future issues as the Protocol type has been aligned, while
the standard and the IndustryStandard header declare it as
byte-packed.
This has worked well till now only because the members of the
structure do not require alignment yet.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser 


Reviewed-by: Star Zeng 


---
  MdePkg/Include/IndustryStandard/SmBios.h |  84 +++-
  MdePkg/Include/Protocol/Smbios.h | 139 
  2 files changed, 133 insertions(+), 90 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/SmBios.h 
b/MdePkg/Include/IndustryStandard/SmBios.h
index b7c54f2fac12..c66422fc3af4 100644
--- a/MdePkg/Include/IndustryStandard/SmBios.h
+++ b/MdePkg/Include/IndustryStandard/SmBios.h
@@ -51,6 +51,53 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
  //
  #define SMBIOS_3_0_TABLE_MAX_LENGTH 0x

+//
+// SMBIOS type macros which is according to SMBIOS 2.7 specification.
+//
+#define SMBIOS_TYPE_BIOS_INFORMATION 0
+#define SMBIOS_TYPE_SYSTEM_INFORMATION   1
+#define SMBIOS_TYPE_BASEBOARD_INFORMATION2
+#define SMBIOS_TYPE_SYSTEM_ENCLOSURE 3
+#define SMBIOS_TYPE_PROCESSOR_INFORMATION4
+#define SMBIOS_TYPE_MEMORY_CONTROLLER_INFORMATION5
+#define SMBIOS_TYPE_MEMORY_MODULE_INFORMATON 6
+#define SMBIOS_TYPE_CACHE_INFORMATION7
+#define SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION   8
+#define SMBIOS_TYPE_SYSTEM_SLOTS 9
+#define SMBIOS_TYPE_ONBOARD_DEVICE_INFORMATION   10
+#define SMBIOS_TYPE_OEM_STRINGS  11
+#define SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS 12
+#define SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION13
+#define SMBIOS_TYPE_GROUP_ASSOCIATIONS   14
+#define SMBIOS_TYPE_SYSTEM_EVENT_LOG 15
+#define SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY16
+#define SMBIOS_TYPE_MEMORY_DEVICE17
+#define SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION   18
+#define SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS  19
+#define SMBIOS_TYPE_MEMORY_DEVICE_MAPPED_ADDRESS 20
+#define SMBIOS_TYPE_BUILT_IN_POINTING_DEVICE 21
+#define SMBIOS_TYPE_PORTABLE_BATTERY 22
+#define SMBIOS_TYPE_SYSTEM_RESET 23
+#define SMBIOS_TYPE_HARDWARE_SECURITY24
+#define SMBIOS_TYPE_SYSTEM_POWER_CONTROLS25
+#define SMBIOS_TYPE_VOLTAGE_PROBE26
+#define SMBIOS_TYPE_COOLING_DEVICE   27
+#define SMBIOS_TYPE_TEMPERATURE_PROBE28
+#define SMBIOS_TYPE_ELECTRICAL_CURRENT_PROBE 29
+#define SMBIOS_TYPE_OUT_OF_BAND_REMOTE_ACCESS30
+#define SMBIOS_TYPE_BOOT_INTEGRITY_SERVICE   31
+#define SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION  32
+#define SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION   33
+#define SMBIOS_TYPE_MANAGEMENT_DEVICE34
+#define SMBIOS_TYPE_MANAGEMENT_DEVICE_COMPONENT  35
+#define SMBIOS_TYPE_MANAGEMENT_DEVICE_THRESHOLD_DATA 36
+#define SMBIOS_TYPE_MEMORY_CHANNEL   37
+#define SMBIOS_TYPE_IPMI_DEVICE_INFORMATION  38
+#define SMBIOS_TYPE_SYSTEM_POWER_SUPPLY  39
+#define SMBIOS_TYPE_ADDITIONAL_INFORMATION   40
+#define SMBIOS_TYPE_ONBOARD_DEVICES_EXTENDED_INFORMATION 41
+#define SMBIOS_TYPE_MANAGEMENT_CONTROLLER_HOST_INTERFACE 42
+
  ///
  /// Inactive type is added from SMBIOS 2.2. Reference SMBIOS 2.6, chapter 
3.3.43.
  /// Upper-level software that interprets the SMBIOS structure-table should 
bypass an
@@ -64,6 +111,27 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
  ///
  #define SMBIOS_TYPE_END_OF_TABLE 0x007F

+#define SMBIOS_OEM_BEGIN 128
+#define SMBIOS_OEM_END   255
+
+///
+/// Types 0 through 127 (7Fh) are reserved for and defined by this
+/// specification. Types 128 through 256 (80h to FFh) are available for 
system- and OEM-specific information.
+///
+typedef UINT8  

Re: [edk2] [Patch] BaseTools: replace not defined macro to ' ' when generate response file

2016-03-22 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, March 22, 2016 11:50 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] BaseTools: replace not defined macro to ' ' when 
generate response file

In last Nmake patch, when we generate the response file, we would replace
all the Macros in the make file. Once there have no definition macro
used, the tool direct report error. But for make tool, if there
have no definition macro, it will ignore this macro. so this patch change
the behavior to replace the not defined macro to ' ', but not report error.

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

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 59ac2e8..a43d158 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -676,18 +676,27 @@ cleanlib:
 if Tool:
 SingleCommandLength += 
len(self._AutoGenObject._BuildOption[Tool]['PATH'])
 for item in SingleCommandList[1:]:
 if FlagDict[Tool]['Macro'] in item:
 Str = 
self._AutoGenObject._BuildOption[Tool]['FLAGS']
+for Option in 
self._AutoGenObject.BuildOption.keys():
+for Attr in 
self._AutoGenObject.BuildOption[Option]:
+if Str.find(Option + '_' + Attr) 
!= -1:
+Str = Str.replace('$(' + 
Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
 while(Str.find('$(') != -1):
 for macro in 
self._AutoGenObject.Macros.keys():
 MacroName = '$('+ macro + ')'
 if (Str.find(MacroName) != -1):
 Str = Str.replace(MacroName, 
self._AutoGenObject.Macros[macro])
 break
 else:
-EdkLogger.error("build", 
AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, 
ExtraData="[%s]" % str(self._AutoGenObject))
+# if the Macro definition cannot 
be found, replace the Macro to ' '
+while(Str.find('$(') != -1):
+MacroStartPos = Str.find('$(')
+MacroEndPos = Str.find(')', 
MacroStartPos)
+Macro = Str[MacroStartPos: 
MacroEndPos+1]
+Str = Str.replace(Macro, ' ')
 SingleCommandLength += len(Str)
 elif '$(INC)' in item:
 SingleCommandLength += 
self._AutoGenObject.IncludePathLength + len(IncPrefix) * 
len(self._AutoGenObject._IncludePathList)
 elif item.find('$(') != -1:
 Str = item
@@ -700,12 +709,16 @@ cleanlib:
 MacroName = '$('+ macro + ')'
 if (Str.find(MacroName) != -1):
 Str = Str.replace(MacroName, 
self._AutoGenObject.Macros[macro])
 break
 else:
-EdkLogger.error("build", 
AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, 
ExtraData="[%s]" % str(self._AutoGenObject))
-
+# if the Macro definition cannot 
be found, replace the Macro to ' '
+while(Str.find('$(') != -1):
+MacroStartPos = Str.find('$(')
+MacroEndPos = Str.find(')', 
MacroStartPos)
+Macro = Str[MacroStartPos: 
MacroEndPos+1]
+Str = Str.replace(Macro, ' ')
 SingleCommandLength += len(Str)
 
 if SingleCommandLength > 
GlobalData.gCommandMaxLength:
 FlagDict[Tool]['Value'] = True
 
@@ -715,18 +728,27 @@ cleanlib:
   

[edk2] ld -z being used linking PE (not ELF) binaries?

2016-03-22 Thread Charles Duffy
Howdy --

I'm running an edk2 build with TOOL_CHAIN_TAG=UNIXGCC.

This eventually fails as follows:

Building ...
/home/cduffy/VC/edk2/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
[X64]
"x86_64-w64-mingw32-ld" -o
/home/cduffy/VC/edk2/Build/OvmfX64/DEBUG_UNIXGCC/X64/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe/DEBUG/StatusCodeRuntimeDxe.dll
-nostdlib --pie --gc-sections --entry __ModuleEntryP
oint --file-alignment 0x20 --section-alignment 0x20 -Map
/home/cduffy/VC/edk2/Build/OvmfX64/DEBUG_UNIXGCC/X64/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe/DEBUG/StatusCodeRuntimeDxe.map
--image-base=0 -z comm
on-page-size=0x1000 --start-group
 
@/home/cduffy/VC/edk2/Build/OvmfX64/DEBUG_UNIXGCC/X64/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe/OUTPUT/static_library_files.lst
--end-group
x86_64-w64-mingw32-ld: unrecognized option '-z'
x86_64-w64-mingw32-ld: use the --help option for usage information
GNUmakefile:433: recipe for target
'/home/cduffy/VC/edk2/Build/OvmfX64/DEBUG_UNIXGCC/X64/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe/DEBUG/StatusCodeRuntimeDxe.dll'
failed
make: ***
[/home/cduffy/VC/edk2/Build/OvmfX64/DEBUG_UNIXGCC/X64/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe/DEBUG/StatusCodeRuntimeDxe.dll]
Error 1

The "-z" option to ld is ELF-specific, and doesn't make sense for PE
binaries (as generated by the mingw toolchain). Are we using the wrong
linker here, or is the option (specified in OvmfPkg/OvmfPkgX64.dsc) being
applied overbroadly?
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] OvmfPkg/PlatformPei: Fix VS2008 build breakage

2016-03-22 Thread Paolo Bonzini


On 18/03/2016 22:53, Laszlo Ersek wrote:
> > The correct character to use in that situation is the emdash, If you
> > *absolutely* must, then rewrite the whole sentence to avoid using it.
> > Do *not* replace it with hyphens.
> 
> Okay. I've googled the use of emdash in the English language, and it
> seems to be more or less interchangeable with parens. Is that okay?

Actually there is a good reason to replace the emdash with hyphens, and
the reason is that the emdash looks like crap (to me at least) in
monospaced fonts.

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


Re: [edk2] [PATCH 1/6] MdePkg/UefiLib: move InternalEmptyFunction to UefiLib.c

2016-03-22 Thread Laszlo Ersek
On 03/22/16 19:59, Jordan Justen wrote:
> On 2016-03-22 11:14:53, Laszlo Ersek wrote:
>> On 03/22/16 19:08, Jordan Justen wrote:
>>> On 2016-03-22 10:21:03, Laszlo Ersek wrote:
 The InternalEmptyFunction() is currently only used by code in
>>>
>>> How about a rename to EfiEmptyEventCallbackFunction?
>>
>> The Efi prefix suggests this function would be exported to consumers of
>> the library. Internal functions (of all library instances in edk2, as
>> far as I am aware) have the prefix Internal, even if they have external
>> linkage (so they can be shared between the .c files of the library
>> instance).
>>
>> How about InternalEmptyEventCallbackFunction?
>>
> 
> Bah. For some reason I thought you were proposing that the function
> become externally visible in the library interface. In other words, a
> no-op function that consumers could use when signalling. I read the
> other patches, so nevermind on that rename comment...
> 
> Series Reviewed-by: Jordan Justen 

Thank you!

I'll await Mike's feedback on the MdePkg & IntelFrameworkPkg patches.
(Liming's and Jeff's feedback is equivalently appreciated of course, but
it's early dawn in their timezone I think.)

Thanks!
Laszlo

> 
>>
>>>
>>> With that, Reviewed-by: Jordan Justen 
>>>
 "UefiNotTiano.c" -- "Library functions that abstract areas of conflict
 between framework and UEFI 2.0.". In the next patches,
 InternalEmptyFunction() will be used from "UefiLib.c" as well, hence
 promote it to "general utility" status: move the function definition to
 "UefiLib.c", and place the function declaration (which is already extern)
 into "UefiLibInternal.h".

 Cc: Michael D Kinney 
 Cc: Liming Gao 
 Cc: Jordan Justen 
 Cc: Ard Biesheuvel 
 Contributed-under: TianoCore Contribution Agreement 1.0
 Signed-off-by: Laszlo Ersek 
 ---
  MdePkg/Library/UefiLib/UefiLibInternal.h | 18 +
  MdePkg/Library/UefiLib/UefiLib.c | 19 ++
  MdePkg/Library/UefiLib/UefiNotTiano.c| 21 
  3 files changed, 37 insertions(+), 21 deletions(-)

 diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h 
 b/MdePkg/Library/UefiLib/UefiLibInternal.h
 index 196830e10cb6..2311f27f1e6d 100644
 --- a/MdePkg/Library/UefiLib/UefiLibInternal.h
 +++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
 @@ -41,4 +41,22 @@
  #include 
  #include 
  
 +/**
 +  An empty function to pass error checking of CreateEventEx ().
 +
 +  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
 +  checked correctly since it is now mapped into CreateEventEx() in UEFI 
 2.0.
 +
 +  @param  Event Event whose notification function is 
 being invoked.
 +  @param  Context   The pointer to the notification 
 function's context,
 +which is implementation-dependent.
 +
 +**/
 +VOID
 +EFIAPI
 +InternalEmptyFunction (
 +  IN EFI_EVENTEvent,
 +  IN VOID *Context
 +  );
 +
  #endif
 diff --git a/MdePkg/Library/UefiLib/UefiLib.c 
 b/MdePkg/Library/UefiLib/UefiLib.c
 index 112766ad8634..ba3acc1af228 100644
 --- a/MdePkg/Library/UefiLib/UefiLib.c
 +++ b/MdePkg/Library/UefiLib/UefiLib.c
 @@ -1545,3 +1545,22 @@ GetBestLanguage (
return NULL;
  }
  
 +/**
 +  An empty function to pass error checking of CreateEventEx ().
 +
 +  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
 +  checked correctly since it is now mapped into CreateEventEx() in UEFI 
 2.0.
 +
 +  @param  Event Event whose notification function is 
 being invoked.
 +  @param  Context   The pointer to the notification 
 function's context,
 +which is implementation-dependent.
 +
 +**/
 +VOID
 +EFIAPI
 +InternalEmptyFunction (
 +  IN EFI_EVENTEvent,
 +  IN VOID *Context
 +  )
 +{
 +}
 diff --git a/MdePkg/Library/UefiLib/UefiNotTiano.c 
 b/MdePkg/Library/UefiLib/UefiNotTiano.c
 index 9b95be65fd48..46fa737c0fd3 100644
 --- a/MdePkg/Library/UefiLib/UefiNotTiano.c
 +++ b/MdePkg/Library/UefiLib/UefiNotTiano.c
 @@ -22,27 +22,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, 
 EITHER EXPRESS OR IMPLIED.
  #include "UefiLibInternal.h"
  
  /**
 -  An empty function to pass error checking of CreateEventEx ().
 -
 -  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
 -  checked correctly since it is now mapped into CreateEventEx() in UEFI 
 2.0.

Re: [edk2] [PATCH 1/6] MdePkg/UefiLib: move InternalEmptyFunction to UefiLib.c

2016-03-22 Thread Jordan Justen
On 2016-03-22 11:14:53, Laszlo Ersek wrote:
> On 03/22/16 19:08, Jordan Justen wrote:
> > On 2016-03-22 10:21:03, Laszlo Ersek wrote:
> >> The InternalEmptyFunction() is currently only used by code in
> > 
> > How about a rename to EfiEmptyEventCallbackFunction?
> 
> The Efi prefix suggests this function would be exported to consumers of
> the library. Internal functions (of all library instances in edk2, as
> far as I am aware) have the prefix Internal, even if they have external
> linkage (so they can be shared between the .c files of the library
> instance).
> 
> How about InternalEmptyEventCallbackFunction?
> 

Bah. For some reason I thought you were proposing that the function
become externally visible in the library interface. In other words, a
no-op function that consumers could use when signalling. I read the
other patches, so nevermind on that rename comment...

Series Reviewed-by: Jordan Justen 

> 
> > 
> > With that, Reviewed-by: Jordan Justen 
> > 
> >> "UefiNotTiano.c" -- "Library functions that abstract areas of conflict
> >> between framework and UEFI 2.0.". In the next patches,
> >> InternalEmptyFunction() will be used from "UefiLib.c" as well, hence
> >> promote it to "general utility" status: move the function definition to
> >> "UefiLib.c", and place the function declaration (which is already extern)
> >> into "UefiLibInternal.h".
> >>
> >> Cc: Michael D Kinney 
> >> Cc: Liming Gao 
> >> Cc: Jordan Justen 
> >> Cc: Ard Biesheuvel 
> >> Contributed-under: TianoCore Contribution Agreement 1.0
> >> Signed-off-by: Laszlo Ersek 
> >> ---
> >>  MdePkg/Library/UefiLib/UefiLibInternal.h | 18 +
> >>  MdePkg/Library/UefiLib/UefiLib.c | 19 ++
> >>  MdePkg/Library/UefiLib/UefiNotTiano.c| 21 
> >>  3 files changed, 37 insertions(+), 21 deletions(-)
> >>
> >> diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h 
> >> b/MdePkg/Library/UefiLib/UefiLibInternal.h
> >> index 196830e10cb6..2311f27f1e6d 100644
> >> --- a/MdePkg/Library/UefiLib/UefiLibInternal.h
> >> +++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
> >> @@ -41,4 +41,22 @@
> >>  #include 
> >>  #include 
> >>  
> >> +/**
> >> +  An empty function to pass error checking of CreateEventEx ().
> >> +
> >> +  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
> >> +  checked correctly since it is now mapped into CreateEventEx() in UEFI 
> >> 2.0.
> >> +
> >> +  @param  Event Event whose notification function is 
> >> being invoked.
> >> +  @param  Context   The pointer to the notification 
> >> function's context,
> >> +which is implementation-dependent.
> >> +
> >> +**/
> >> +VOID
> >> +EFIAPI
> >> +InternalEmptyFunction (
> >> +  IN EFI_EVENTEvent,
> >> +  IN VOID *Context
> >> +  );
> >> +
> >>  #endif
> >> diff --git a/MdePkg/Library/UefiLib/UefiLib.c 
> >> b/MdePkg/Library/UefiLib/UefiLib.c
> >> index 112766ad8634..ba3acc1af228 100644
> >> --- a/MdePkg/Library/UefiLib/UefiLib.c
> >> +++ b/MdePkg/Library/UefiLib/UefiLib.c
> >> @@ -1545,3 +1545,22 @@ GetBestLanguage (
> >>return NULL;
> >>  }
> >>  
> >> +/**
> >> +  An empty function to pass error checking of CreateEventEx ().
> >> +
> >> +  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
> >> +  checked correctly since it is now mapped into CreateEventEx() in UEFI 
> >> 2.0.
> >> +
> >> +  @param  Event Event whose notification function is 
> >> being invoked.
> >> +  @param  Context   The pointer to the notification 
> >> function's context,
> >> +which is implementation-dependent.
> >> +
> >> +**/
> >> +VOID
> >> +EFIAPI
> >> +InternalEmptyFunction (
> >> +  IN EFI_EVENTEvent,
> >> +  IN VOID *Context
> >> +  )
> >> +{
> >> +}
> >> diff --git a/MdePkg/Library/UefiLib/UefiNotTiano.c 
> >> b/MdePkg/Library/UefiLib/UefiNotTiano.c
> >> index 9b95be65fd48..46fa737c0fd3 100644
> >> --- a/MdePkg/Library/UefiLib/UefiNotTiano.c
> >> +++ b/MdePkg/Library/UefiLib/UefiNotTiano.c
> >> @@ -22,27 +22,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, 
> >> EITHER EXPRESS OR IMPLIED.
> >>  #include "UefiLibInternal.h"
> >>  
> >>  /**
> >> -  An empty function to pass error checking of CreateEventEx ().
> >> -
> >> -  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
> >> -  checked correctly since it is now mapped into CreateEventEx() in UEFI 
> >> 2.0.
> >> - 
> >> -  @param  Event Event whose notification function is 
> >> being invoked.
> >> -  @param  Context   The pointer to the notification 
> >> function's context,
> >> -which is implementation-dependent.
> >> -
> 

Re: [edk2] [PATCH 1/6] MdePkg/UefiLib: move InternalEmptyFunction to UefiLib.c

2016-03-22 Thread Laszlo Ersek
On 03/22/16 19:08, Jordan Justen wrote:
> On 2016-03-22 10:21:03, Laszlo Ersek wrote:
>> The InternalEmptyFunction() is currently only used by code in
> 
> How about a rename to EfiEmptyEventCallbackFunction?

The Efi prefix suggests this function would be exported to consumers of
the library. Internal functions (of all library instances in edk2, as
far as I am aware) have the prefix Internal, even if they have external
linkage (so they can be shared between the .c files of the library
instance).

How about InternalEmptyEventCallbackFunction?

Thanks
Laszlo

> 
> With that, Reviewed-by: Jordan Justen 
> 
>> "UefiNotTiano.c" -- "Library functions that abstract areas of conflict
>> between framework and UEFI 2.0.". In the next patches,
>> InternalEmptyFunction() will be used from "UefiLib.c" as well, hence
>> promote it to "general utility" status: move the function definition to
>> "UefiLib.c", and place the function declaration (which is already extern)
>> into "UefiLibInternal.h".
>>
>> Cc: Michael D Kinney 
>> Cc: Liming Gao 
>> Cc: Jordan Justen 
>> Cc: Ard Biesheuvel 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek 
>> ---
>>  MdePkg/Library/UefiLib/UefiLibInternal.h | 18 +
>>  MdePkg/Library/UefiLib/UefiLib.c | 19 ++
>>  MdePkg/Library/UefiLib/UefiNotTiano.c| 21 
>>  3 files changed, 37 insertions(+), 21 deletions(-)
>>
>> diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h 
>> b/MdePkg/Library/UefiLib/UefiLibInternal.h
>> index 196830e10cb6..2311f27f1e6d 100644
>> --- a/MdePkg/Library/UefiLib/UefiLibInternal.h
>> +++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
>> @@ -41,4 +41,22 @@
>>  #include 
>>  #include 
>>  
>> +/**
>> +  An empty function to pass error checking of CreateEventEx ().
>> +
>> +  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
>> +  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
>> +
>> +  @param  Event Event whose notification function is being 
>> invoked.
>> +  @param  Context   The pointer to the notification function's 
>> context,
>> +which is implementation-dependent.
>> +
>> +**/
>> +VOID
>> +EFIAPI
>> +InternalEmptyFunction (
>> +  IN EFI_EVENTEvent,
>> +  IN VOID *Context
>> +  );
>> +
>>  #endif
>> diff --git a/MdePkg/Library/UefiLib/UefiLib.c 
>> b/MdePkg/Library/UefiLib/UefiLib.c
>> index 112766ad8634..ba3acc1af228 100644
>> --- a/MdePkg/Library/UefiLib/UefiLib.c
>> +++ b/MdePkg/Library/UefiLib/UefiLib.c
>> @@ -1545,3 +1545,22 @@ GetBestLanguage (
>>return NULL;
>>  }
>>  
>> +/**
>> +  An empty function to pass error checking of CreateEventEx ().
>> +
>> +  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
>> +  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
>> +
>> +  @param  Event Event whose notification function is being 
>> invoked.
>> +  @param  Context   The pointer to the notification function's 
>> context,
>> +which is implementation-dependent.
>> +
>> +**/
>> +VOID
>> +EFIAPI
>> +InternalEmptyFunction (
>> +  IN EFI_EVENTEvent,
>> +  IN VOID *Context
>> +  )
>> +{
>> +}
>> diff --git a/MdePkg/Library/UefiLib/UefiNotTiano.c 
>> b/MdePkg/Library/UefiLib/UefiNotTiano.c
>> index 9b95be65fd48..46fa737c0fd3 100644
>> --- a/MdePkg/Library/UefiLib/UefiNotTiano.c
>> +++ b/MdePkg/Library/UefiLib/UefiNotTiano.c
>> @@ -22,27 +22,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
>> EXPRESS OR IMPLIED.
>>  #include "UefiLibInternal.h"
>>  
>>  /**
>> -  An empty function to pass error checking of CreateEventEx ().
>> -
>> -  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
>> -  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
>> - 
>> -  @param  Event Event whose notification function is being 
>> invoked.
>> -  @param  Context   The pointer to the notification function's 
>> context,
>> -which is implementation-dependent.
>> -
>> -**/
>> -VOID
>> -EFIAPI
>> -InternalEmptyFunction (
>> -  IN EFI_EVENTEvent,
>> -  IN VOID *Context
>> -  )
>> -{
>> -  return;
>> -}
>> -
>> -/**
>>Creates an EFI event in the Legacy Boot Event Group.
>>  
>>Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and 
>> this library
>> -- 
>> 1.8.3.1
>>
>>
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 

___
edk2-devel mailing list

Re: [edk2] [PATCH 1/6] MdePkg/UefiLib: move InternalEmptyFunction to UefiLib.c

2016-03-22 Thread Jordan Justen
On 2016-03-22 10:21:03, Laszlo Ersek wrote:
> The InternalEmptyFunction() is currently only used by code in

How about a rename to EfiEmptyEventCallbackFunction?

With that, Reviewed-by: Jordan Justen 

> "UefiNotTiano.c" -- "Library functions that abstract areas of conflict
> between framework and UEFI 2.0.". In the next patches,
> InternalEmptyFunction() will be used from "UefiLib.c" as well, hence
> promote it to "general utility" status: move the function definition to
> "UefiLib.c", and place the function declaration (which is already extern)
> into "UefiLibInternal.h".
> 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Jordan Justen 
> Cc: Ard Biesheuvel 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  MdePkg/Library/UefiLib/UefiLibInternal.h | 18 +
>  MdePkg/Library/UefiLib/UefiLib.c | 19 ++
>  MdePkg/Library/UefiLib/UefiNotTiano.c| 21 
>  3 files changed, 37 insertions(+), 21 deletions(-)
> 
> diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h 
> b/MdePkg/Library/UefiLib/UefiLibInternal.h
> index 196830e10cb6..2311f27f1e6d 100644
> --- a/MdePkg/Library/UefiLib/UefiLibInternal.h
> +++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
> @@ -41,4 +41,22 @@
>  #include 
>  #include 
>  
> +/**
> +  An empty function to pass error checking of CreateEventEx ().
> +
> +  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
> +  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
> +
> +  @param  Event Event whose notification function is being 
> invoked.
> +  @param  Context   The pointer to the notification function's 
> context,
> +which is implementation-dependent.
> +
> +**/
> +VOID
> +EFIAPI
> +InternalEmptyFunction (
> +  IN EFI_EVENTEvent,
> +  IN VOID *Context
> +  );
> +
>  #endif
> diff --git a/MdePkg/Library/UefiLib/UefiLib.c 
> b/MdePkg/Library/UefiLib/UefiLib.c
> index 112766ad8634..ba3acc1af228 100644
> --- a/MdePkg/Library/UefiLib/UefiLib.c
> +++ b/MdePkg/Library/UefiLib/UefiLib.c
> @@ -1545,3 +1545,22 @@ GetBestLanguage (
>return NULL;
>  }
>  
> +/**
> +  An empty function to pass error checking of CreateEventEx ().
> +
> +  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
> +  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
> +
> +  @param  Event Event whose notification function is being 
> invoked.
> +  @param  Context   The pointer to the notification function's 
> context,
> +which is implementation-dependent.
> +
> +**/
> +VOID
> +EFIAPI
> +InternalEmptyFunction (
> +  IN EFI_EVENTEvent,
> +  IN VOID *Context
> +  )
> +{
> +}
> diff --git a/MdePkg/Library/UefiLib/UefiNotTiano.c 
> b/MdePkg/Library/UefiLib/UefiNotTiano.c
> index 9b95be65fd48..46fa737c0fd3 100644
> --- a/MdePkg/Library/UefiLib/UefiNotTiano.c
> +++ b/MdePkg/Library/UefiLib/UefiNotTiano.c
> @@ -22,27 +22,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  #include "UefiLibInternal.h"
>  
>  /**
> -  An empty function to pass error checking of CreateEventEx ().
> -
> -  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
> -  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
> - 
> -  @param  Event Event whose notification function is being 
> invoked.
> -  @param  Context   The pointer to the notification function's 
> context,
> -which is implementation-dependent.
> -
> -**/
> -VOID
> -EFIAPI
> -InternalEmptyFunction (
> -  IN EFI_EVENTEvent,
> -  IN VOID *Context
> -  )
> -{
> -  return;
> -}
> -
> -/**
>Creates an EFI event in the Legacy Boot Event Group.
>  
>Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this 
> library
> -- 
> 1.8.3.1
> 
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] signedness of CHAR8

2016-03-22 Thread Andrew Fish

> On Mar 21, 2016, at 10:23 PM, Gao, Liming  wrote:
> 
> Andrew:
>  Thanks for your point. I verify this change with VS2015 and GCC49 on IA32 
> arch. There is no warning report.  So, I think the compiler option is not 
> required for all tool chains and all archs. But, this is not true for CLANG. 
> It may not be true for ARM. So, I suggest we add option -funsigned-char for 
> every tool chain and every arch to ensure char is unsigned. For VS tool 
> chain, /J (Default char Type Is unsigned) option. can be used. And, we also 
> update CHAR8 definition with unsigned char to clearly follow UEFI spec. 
> 

Liming,

It looks like clang warns if you assume a string literal has a specific sign. 
The -funsigned-char flag does not change this behavior. 

~/work/Compiler>cat string.c

unsigned char *a = "a test";
signed char   *b = "b test";
char  *c = "c test";

~/work/Compiler>clang string.c -S  -funsigned-char 
string.c:2:16: warning: initializing 'unsigned char *' with an expression of 
type 'char [7]' converts between pointers to integer
  types with different sign [-Wpointer-sign]
unsigned char *a = "a test";
   ^   
string.c:3:16: warning: initializing 'signed char *' with an expression of type 
'char [7]' converts between pointers to integer types
  with different sign [-Wpointer-sign]
signed char   *b = "b test";
   ^   
2 warnings generated.

~/work/Compiler>clang string.c -S 
string.c:2:16: warning: initializing 'unsigned char *' with an expression of 
type 'char [7]' converts between pointers to integer
  types with different sign [-Wpointer-sign]
unsigned char *a = "a test";
   ^   
string.c:3:16: warning: initializing 'signed char *' with an expression of type 
'char [7]' converts between pointers to integer types
  with different sign [-Wpointer-sign]
signed char   *b = "b test";
   ^   
2 warnings generated.
~/work/Compiler>

It looks like clang's -Wpointer-sign will warn if you write code that assumes 
the sign of string literals. I assume this is to enforce portability. It looks 
like you need to cast between char * and (signed char *or unsigned char *) to 
make the compiler happy. 

If we try to force CHAR8 to be signed or unsigned explicitly (type unsigned 
char), then we will have to cast all string literals to (CHAR8 *)

~/work/Compiler>cat string.c

unsigned char *a = (unsigned char *)"a test";
signed char   *b = (signed char   *)"b test";
char  *c = "c test";

~/work/Compiler>clang string.c -S  -funsigned-char 
~/work/Compiler>clang string.c -S  

I think this is why CHAR8 is defined as a char in all the processor bindings. 

Thanks,

Andrew Fish

> Thanks
> Liming

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


Re: [edk2] [wave 1 PATCH 3/5] ArmVirtPkg: PlatformIntelBdsLib: install gRootBusesConnectedProtocolGuid

2016-03-22 Thread Laszlo Ersek
On 03/22/16 06:59, Jordan Justen wrote:
> Why not a guid based event, similar to gIdleLoopEventGuid?

I posted a prereq series for this:

  [edk2] [PATCH 0/6] introduce EfiEventGroupSignal(),
 rebase ArmVirtPkg and OvmfPkg
  http://thread.gmane.org/gmane.comp.bios.edk2.devel/9579

If it is "warmly received", I will do what you suggest.

Otherwise I would like to stick with the non-standard protocol in this
series. Installing a protocol interface in BDS is trivial (1 or 2
lines); signaling an event group is much more busywork, especially
considering that we're already doing that for End-of-DXE. So, with the
above pre-req series in place, implementing your idea here would improve
things; without the pre-req series it would duplicate more code.

Thanks!
Laszlo

> On 2016-03-21 03:19:06, Laszlo Ersek wrote:
>> On 03/21/16 10:58, Ard Biesheuvel wrote:
>>
>>> But by all means, let's decouple this from the review of this series.
>>
>> Thanks. Two recent Protocol/*.h additions were a48d0a3d72f9 and
>> 78741ce91e12, those also added the extern declarations. I agree the
>> declarations shouldn't be duplicated, but then we should all start
>> following this new rule.
>>
> 
> Maybe one of you should post an email with a more noticable subject to
> prompt discussion of this topic more globally on edk2-devel?
> 
> -Jordan
> ___
> 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] Shell Aliases and Case-Sensitivity

2016-03-22 Thread Carsey, Jaben


-Jaben

> On Mar 22, 2016, at 10:32 AM, "jim_dai...@dell.com"  
> wrote:
> 
> 
>> Jaben asked:
> 
>> Why would we want to add something case sensitive when everything else 
>> is not case sensitive? Do we really want to have to add DIR, dIR, 
>> Dir,
>> (etc...) to properly handle the built in alias that is required in the 
>> shell spec?
> 
> Environment variable names are case-sensitive.  If alias names joined
> them, then I think "dir" should suffice for the shell "automatic"
> aliases. If someone really wanted "Dir", they could create it, and,
> because aliases are non-volatile by default, they would only have to do
> it once.

I think that the spec would not want any other instances of dir alias to exist 
since that would make it a really easy to confuse users.  My interpretation is 
that alias is supposed to be as unique as the command names they refer to.

> 
>> What if we requested to change the spec to say alias is case
>> insensitive?
> 
> If that's the desired behavior, I think the spec should say so. I would
> rather have as few exceptions in the code as possible, but I'm okay with
> either way.
> 
> Regards,
> Jim
> ___
> 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] Shell Aliases and Case-Sensitivity

2016-03-22 Thread Jim_Dailey

> Jaben asked:

> Why would we want to add something case sensitive when everything else 
> is not case sensitive? Do we really want to have to add DIR, dIR, 
> Dir,
> (etc...) to properly handle the built in alias that is required in the 
> shell spec?

Environment variable names are case-sensitive.  If alias names joined
them, then I think "dir" should suffice for the shell "automatic"
aliases. If someone really wanted "Dir", they could create it, and,
because aliases are non-volatile by default, they would only have to do
it once.

> What if we requested to change the spec to say alias is case
> insensitive?

If that's the desired behavior, I think the spec should say so. I would
rather have as few exceptions in the code as possible, but I'm okay with
either way.

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


[edk2] [PATCH 2/6] MdePkg/UefiLib: introduce EfiEventGroupSignal

2016-03-22 Thread Laszlo Ersek
This is a small convenience function that eases signaling an event group
(identified by GUID). An example where it can be used is Platform BDS
signaling the End-of-DXE event group.

The naming follows EfiNamedEventSignal().

The patch modifies the library class header, and updates the most commonly
used library instance at once. Other library instances in the edk2 tree
will be adapted in the following patches.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Jordan Justen 
Cc: Ard Biesheuvel 
Suggested-by: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdePkg/Include/Library/UefiLib.h | 18 
 MdePkg/Library/UefiLib/UefiLib.c | 43 
 2 files changed, 61 insertions(+)

diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h
index 4ce8dc6c059a..e8a6b8498e65 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -223,6 +223,24 @@ EfiNamedEventSignal (
   IN CONST EFI_GUID  *Name
   );
 
+/**
+  Signals an event group by placing a new event in the group temporarily and
+  signaling it.
+
+  @param[in] EventGroup  Supplies the unique identifier of the event
+ group to signal.
+
+  @retval EFI_SUCCESSThe event group was signaled successfully.
+  @retval EFI_INVALID_PARAMETER  EventGroup is NULL.
+  @returnError codes that report problems about event
+ creation or signaling.
+**/
+EFI_STATUS
+EFIAPI
+EfiEventGroupSignal (
+  IN CONST EFI_GUID *EventGroup
+  );
+
 /** 
   Returns the current TPL.
 
diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index ba3acc1af228..96d375fb6f2e 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -304,6 +304,49 @@ EfiNamedEventSignal (
   return Status;
 }
 
+/**
+  Signals an event group by placing a new event in the group temporarily and
+  signaling it.
+
+  @param[in] EventGroup  Supplies the unique identifier of the event
+ group to signal.
+
+  @retval EFI_SUCCESSThe event group was signaled successfully.
+  @retval EFI_INVALID_PARAMETER  EventGroup is NULL.
+  @returnError codes that report problems about event
+ creation or signaling.
+**/
+EFI_STATUS
+EFIAPI
+EfiEventGroupSignal (
+  IN CONST EFI_GUID *EventGroup
+  )
+{
+  EFI_STATUS Status;
+  EFI_EVENT  Event;
+
+  if (EventGroup == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  Status = gBS->CreateEventEx (
+  EVT_NOTIFY_SIGNAL,
+  TPL_CALLBACK,
+  InternalEmptyFunction,
+  NULL,
+  EventGroup,
+  
+  );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = gBS->SignalEvent (Event);
+  gBS->CloseEvent (Event);
+
+  return Status;
+}
+
 /** 
   Returns the current TPL.
 
-- 
1.8.3.1


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


[edk2] [PATCH 6/6] OvmfPkg/PlatformBdsLib: rebase to EfiEventGroupSignal

2016-03-22 Thread Laszlo Ersek
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c | 30 +---
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
index 0abba98dfe03..4a2f7f332d34 100644
--- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -1164,27 +1164,6 @@ Returns:
 
 
 /**
-  Empty callback function executed when the EndOfDxe event group is signaled.
-
-  We only need this function because we'd like to signal EndOfDxe, and for that
-  we need to create an event, with a callback function.
-
-  @param[in] EventEvent whose notification function is being invoked.
-  @param[in] Context  The pointer to the notification function's context, which
-  is implementation-dependent.
-**/
-STATIC
-VOID
-EFIAPI
-OnEndOfDxe (
-  IN EFI_EVENT Event,
-  IN VOID  *Context
-  )
-{
-}
-
-
-/**
   Save the S3 boot script.
 
   Note that we trigger DxeSmmReadyToLock here -- otherwise the script wouldn't
@@ -1259,7 +1238,6 @@ Returns:
 {
   EFI_STATUS Status;
   EFI_BOOT_MODE  BootMode;
-  EFI_EVENT  EndOfDxeEvent;
 
   DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));
 
@@ -1273,13 +1251,7 @@ Returns:
   // installed after PCI enumeration completes, we must not trigger the S3 save
   // earlier, hence we can't signal End-of-Dxe earlier.
   //
-  Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, OnEndOfDxe,
-  NULL /* NotifyContext */, ,
-  );
-  if (!EFI_ERROR (Status)) {
-gBS->SignalEvent (EndOfDxeEvent);
-gBS->CloseEvent (EndOfDxeEvent);
-  }
+  EfiEventGroupSignal ();
 
   if (QemuFwCfgS3Enabled ()) {
 //
-- 
1.8.3.1

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


[edk2] [PATCH 5/6] ArmVirtPkg/PlatformIntelBdsLib: rebase to EfiEventGroupSignal

2016-03-22 Thread Laszlo Ersek
Cc: Ard Biesheuvel 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h |  1 +
 ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c | 34 
+---
 ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c   |  1 -
 3 files changed, 2 insertions(+), 34 deletions(-)

diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h 
b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h
index 3d29b0d099ce..190ce9b294b0 100644
--- a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h
+++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 VOID
diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c 
b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
index b242a293a103..9267a188e810 100644
--- a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
+++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
@@ -121,24 +121,6 @@ STATIC PLATFORM_USB_KEYBOARD mUsbKeyboard = {
   }
 };
 
-/**
-  An empty function to pass error checking of CreateEventEx ().
-
-  @param  Event Event whose notification function is being 
invoked.
-  @param  Context   Pointer to the notification function's context,
-which is implementation-dependent.
-
-**/
-STATIC
-VOID
-EFIAPI
-EmptyCallbackFunction (
-  IN EFI_EVENTEvent,
-  IN VOID *Context
-  )
-{
-}
-
 //
 // BDS Platform Functions
 //
@@ -153,24 +135,10 @@ PlatformBdsInit (
   VOID
   )
 {
-  EFI_EVENT   EndOfDxeEvent;
-  EFI_STATUS  Status;
-
   //
   // Signal EndOfDxe PI Event
   //
-  Status = gBS->CreateEventEx (
-  EVT_NOTIFY_SIGNAL,
-  TPL_CALLBACK,
-  EmptyCallbackFunction,
-  NULL,
-  ,
-  
-  );
-  if (!EFI_ERROR (Status)) {
-gBS->SignalEvent (EndOfDxeEvent);
-gBS->CloseEvent (EndOfDxeEvent);
-  }
+  EfiEventGroupSignal ();
 }
 
 
diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c 
b/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
index c48f4767ad8f..402db97a80a7 100644
--- a/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
+++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.8.3.1


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


[edk2] [PATCH 3/6] IntelFrameworkPkg/FrameworkUefiLib: move InternalEmptyFunction to UefiLib.c

2016-03-22 Thread Laszlo Ersek
The InternalEmptyFunction() is currently only used by code in
"UefiNotTiano.c" -- "Library functions that abstract areas of conflict
between framework and UEFI 2.0.". In the next patches,
InternalEmptyFunction() will be used from "UefiLib.c" as well, hence
promote it to "general utility" status: move the function definition to
"UefiLib.c", and place the function declaration (which is already extern)
into "UefiLibInternal.h".

Fix a typo in the function's name while at it.

Cc: Michael D Kinney 
Cc: Jeff Fan 
Cc: Jordan Justen 
Cc: Ard Biesheuvel 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---

Notes:
build tested only

 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h | 18 
++
 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 19 
+++
 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c| 25 
++--
 3 files changed, 39 insertions(+), 23 deletions(-)

diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h 
b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h
index e4bc433be47f..16c663626db2 100644
--- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h
+++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h
@@ -41,4 +41,22 @@
 #include 
 #include 
 
+/**
+  An empty function to pass error checking of CreateEventEx ().
+
+  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
+  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
+
+  @param  Event Event whose notification function is being 
invoked.
+  @param  Context   Pointer to the notification function's context,
+which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+InternalEmptyFunction (
+  IN EFI_EVENTEvent,
+  IN VOID *Context
+  );
+
 #endif
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c 
b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
index 554af2281e1c..9f73fb52eda6 100644
--- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
+++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
@@ -1415,3 +1415,22 @@ GetBestLanguage (
   return NULL;
 }
 
+/**
+  An empty function to pass error checking of CreateEventEx ().
+
+  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
+  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
+
+  @param  Event Event whose notification function is being 
invoked.
+  @param  Context   Pointer to the notification function's context,
+which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+InternalEmptyFunction (
+  IN EFI_EVENTEvent,
+  IN VOID *Context
+  )
+{
+}
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c 
b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c
index 2f8b1807fd2b..1221403672f9 100644
--- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c
+++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c
@@ -22,27 +22,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include "UefiLibInternal.h"
 
 /**
-  An empty function to pass error checking of CreateEventEx ().
-
-  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
-  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
- 
-  @param  Event Event whose notification function is being 
invoked.
-  @param  Context   Pointer to the notification function's context,
-which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-InternalEmptyFuntion (
-  IN EFI_EVENTEvent,
-  IN VOID *Context
-  )
-{
-  return;
-}
-
-/**
   Create a Legacy Boot Event.
 
   Tiano extended the CreateEvent Type enum to add a legacy boot event type.
@@ -66,7 +45,7 @@ EfiCreateEventLegacyBoot (
 {
   return EfiCreateEventLegacyBootEx (
TPL_CALLBACK,
-   InternalEmptyFuntion,
+   InternalEmptyFunction,
NULL,
LegacyBootEvent
);
@@ -156,7 +135,7 @@ EfiCreateEventReadyToBoot (
 {
   return EfiCreateEventReadyToBootEx (
TPL_CALLBACK,
-   InternalEmptyFuntion,
+   InternalEmptyFunction,
NULL,
ReadyToBootEvent
);
-- 
1.8.3.1


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


[edk2] [PATCH 1/6] MdePkg/UefiLib: move InternalEmptyFunction to UefiLib.c

2016-03-22 Thread Laszlo Ersek
The InternalEmptyFunction() is currently only used by code in
"UefiNotTiano.c" -- "Library functions that abstract areas of conflict
between framework and UEFI 2.0.". In the next patches,
InternalEmptyFunction() will be used from "UefiLib.c" as well, hence
promote it to "general utility" status: move the function definition to
"UefiLib.c", and place the function declaration (which is already extern)
into "UefiLibInternal.h".

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Jordan Justen 
Cc: Ard Biesheuvel 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdePkg/Library/UefiLib/UefiLibInternal.h | 18 +
 MdePkg/Library/UefiLib/UefiLib.c | 19 ++
 MdePkg/Library/UefiLib/UefiNotTiano.c| 21 
 3 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h 
b/MdePkg/Library/UefiLib/UefiLibInternal.h
index 196830e10cb6..2311f27f1e6d 100644
--- a/MdePkg/Library/UefiLib/UefiLibInternal.h
+++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
@@ -41,4 +41,22 @@
 #include 
 #include 
 
+/**
+  An empty function to pass error checking of CreateEventEx ().
+
+  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
+  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
+
+  @param  Event Event whose notification function is being 
invoked.
+  @param  Context   The pointer to the notification function's 
context,
+which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+InternalEmptyFunction (
+  IN EFI_EVENTEvent,
+  IN VOID *Context
+  );
+
 #endif
diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index 112766ad8634..ba3acc1af228 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -1545,3 +1545,22 @@ GetBestLanguage (
   return NULL;
 }
 
+/**
+  An empty function to pass error checking of CreateEventEx ().
+
+  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
+  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
+
+  @param  Event Event whose notification function is being 
invoked.
+  @param  Context   The pointer to the notification function's 
context,
+which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+InternalEmptyFunction (
+  IN EFI_EVENTEvent,
+  IN VOID *Context
+  )
+{
+}
diff --git a/MdePkg/Library/UefiLib/UefiNotTiano.c 
b/MdePkg/Library/UefiLib/UefiNotTiano.c
index 9b95be65fd48..46fa737c0fd3 100644
--- a/MdePkg/Library/UefiLib/UefiNotTiano.c
+++ b/MdePkg/Library/UefiLib/UefiNotTiano.c
@@ -22,27 +22,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include "UefiLibInternal.h"
 
 /**
-  An empty function to pass error checking of CreateEventEx ().
-
-  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
-  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
- 
-  @param  Event Event whose notification function is being 
invoked.
-  @param  Context   The pointer to the notification function's 
context,
-which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-InternalEmptyFunction (
-  IN EFI_EVENTEvent,
-  IN VOID *Context
-  )
-{
-  return;
-}
-
-/**
   Creates an EFI event in the Legacy Boot Event Group.
 
   Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this 
library
-- 
1.8.3.1


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


[edk2] [PATCH 0/6] introduce EfiEventGroupSignal(), rebase ArmVirtPkg and OvmfPkg

2016-03-22 Thread Laszlo Ersek
This is a trivial refactoring series, implementing an earlier idea from
Jordan (IIRC). I would greatly appreciate if you guys could ACK it
quickly, so I can commit it today.

Cc: Ard Biesheuvel 
Cc: Jeff Fan 
Cc: Jordan Justen 
Cc: Liming Gao 
Cc: Michael D Kinney 

Thanks
Laszlo

Laszlo Ersek (6):
  MdePkg/UefiLib: move InternalEmptyFunction to UefiLib.c
  MdePkg/UefiLib: introduce EfiEventGroupSignal
  IntelFrameworkPkg/FrameworkUefiLib: move InternalEmptyFunction to
UefiLib.c
  IntelFrameworkPkg/FrameworkUefiLib: implement EfiEventGroupSignal
  ArmVirtPkg/PlatformIntelBdsLib: rebase to EfiEventGroupSignal
  OvmfPkg/PlatformBdsLib: rebase to EfiEventGroupSignal

 ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c| 34 +--
 ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h|  1 +
 ArmVirtPkg/Library/PlatformIntelBdsLib/QemuKernel.c  |  1 -
 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 62 

 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h | 18 ++
 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c| 25 +---
 MdePkg/Include/Library/UefiLib.h | 18 ++
 MdePkg/Library/UefiLib/UefiLib.c | 62 

 MdePkg/Library/UefiLib/UefiLibInternal.h | 18 ++
 MdePkg/Library/UefiLib/UefiNotTiano.c| 21 ---
 OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c | 30 +-
 11 files changed, 183 insertions(+), 107 deletions(-)

-- 
1.8.3.1

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


Re: [edk2] [PATCH] ArmVExpressFastBoot: Add support for sparse Images

2016-03-22 Thread Ard Biesheuvel
On 8 March 2016 at 10:55, Riku Voipio  wrote:
> On 26 February 2016 at 11:32, Haojian Zhuang  
> wrote:
>> From: Riku Voipio 
>>
>> Add support for current Fastboot Sparse images. Tested to be able
>> to flash both a a small image (60MB) And a large 1.5GB image. The
>> code in it's current form doesn't do many checks, so no defences
>> against corrupt images.
>>
>> ArmVExpressFastBoot is obviously the wrong place to implement this,
>> Implementing it correctly in AndroidFastbootApp requires changing
>> FASTBOOT_PLATFORM_FLASH with a "offset" parameter.
>
> Last time I sent this patch, nobody answered if modifying the flash struct
> in AndroidFastbootPlatform.h would indeed be the right way? Does EDK
> guarantee api/abi
> compatibility here?
>

Actually, I think the split between the app and the platform driver is
somewhat pointless, or perhaps I am missing something?

I am happy to go either way, i.e., either update the protocol (and the
vexpress implementation, which should be moved to embeddedpkg imo), or
update the app so that it can operate on any block device in the
system, and does not depend on the protocol at all.

Any thoughts?

>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Cc: Zhangfei Gao 
>> Signed-off-by: Riku Voipio 
>> Signed-off-by: Haojian Zhuang 
>> ---
>>  .../ArmVExpressFastBootDxe/ArmVExpressFastBoot.c   | 58 
>> --
>>  .../Include/Protocol/AndroidFastbootPlatform.h | 26 ++
>>  2 files changed, 81 insertions(+), 3 deletions(-)
>>
>> diff --git 
>> a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c 
>> b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c
>> index 4d0811c..31ec584 100644
>> --- 
>> a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c
>> +++ 
>> b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c
>> @@ -319,6 +319,11 @@ ArmFastbootPlatformFlashPartition (
>>FASTBOOT_PARTITION_LIST *Entry;
>>CHAR16   PartitionNameUnicode[60];
>>BOOLEAN  PartitionFound;
>> +  SPARSE_HEADER   *SparseHeader;
>> +  CHUNK_HEADER*ChunkHeader;
>> +  UINTNOffset = 0;
>> +  UINT32   Chunk;
>> +
>>
>>AsciiStrToUnicodeStr (PartitionName, PartitionNameUnicode);
>>
>> @@ -350,6 +355,22 @@ ArmFastbootPlatformFlashPartition (
>>  return EFI_NOT_FOUND;
>>}
>>
>> +  SparseHeader=(SPARSE_HEADER *)Image;
>> +
>> +  if (SparseHeader->Magic == SPARSE_HEADER_MAGIC) {
>> +DEBUG ((EFI_D_INFO, "Sparse Magic: 0x%x Major: %d Minor: %d fhs: %d 
>> chs: %d bs: %d tbs: %d tcs: %d checksum: %d \n",
>> +SparseHeader->Magic, SparseHeader->MajorVersion, 
>> SparseHeader->MinorVersion,  SparseHeader->FileHeaderSize,
>> +SparseHeader->ChunkHeaderSize, SparseHeader->BlockSize, 
>> SparseHeader->TotalBlocks,
>> +SparseHeader->TotalChunks, SparseHeader->ImageChecksum));
>> +if (SparseHeader->MajorVersion != 1) {
>> +DEBUG ((EFI_D_ERROR, "Sparse image version %d.%d not supported.\n",
>> +SparseHeader->MajorVersion, 
>> SparseHeader->MinorVersion));
>> +return EFI_INVALID_PARAMETER;
>> +}
>> +
>> +Size = SparseHeader->BlockSize * SparseHeader->TotalBlocks;
>> +  }
>> +
>>// Check image will fit on device
>>PartitionSize = (BlockIo->Media->LastBlock + 1) * 
>> BlockIo->Media->BlockSize;
>>if (PartitionSize < Size) {
>> @@ -371,9 +392,40 @@ ArmFastbootPlatformFlashPartition (
>>);
>>ASSERT_EFI_ERROR (Status);
>>
>> -  Status = DiskIo->WriteDisk (DiskIo, MediaId, 0, Size, Image);
>> -  if (EFI_ERROR (Status)) {
>> -return Status;
>> +  if (SparseHeader->Magic == SPARSE_HEADER_MAGIC) {
>> +Image += SparseHeader->FileHeaderSize;
>> +for (Chunk = 0; Chunk < SparseHeader->TotalChunks; Chunk++) {
>> +  UINTN WriteSize;
>> +  ChunkHeader = (CHUNK_HEADER *)Image;
>> +  DEBUG ((EFI_D_INFO, "Chunk #%d - Type: 0x%x Size: %d TotalSize: %d 
>> Offset %d\n",
>> +  (Chunk+1), ChunkHeader->ChunkType, ChunkHeader->ChunkSize,
>> +  ChunkHeader->TotalSize, Offset));
>> +  Image += sizeof(CHUNK_HEADER);
>> +  WriteSize=(SparseHeader->BlockSize) * ChunkHeader->ChunkSize;
>> +  switch (ChunkHeader->ChunkType) {
>> +case CHUNK_TYPE_RAW:
>> +  DEBUG ((EFI_D_INFO, "Writing %d at Offset %d\n", WriteSize, 
>> Offset));
>> +  Status = DiskIo->WriteDisk (DiskIo, MediaId, Offset, WriteSize, 
>> Image);
>> +  if (EFI_ERROR (Status)) {
>> +return Status;
>> +  }
>> +  Image+=WriteSize;
>> +  break;
>> +case CHUNK_TYPE_DONT_CARE:
>> +  break;
>> +case CHUNK_TYPE_CRC32:

Re: [edk2] [Patch] BaseTools: replace not defined macro to ' ' when generate response file

2016-03-22 Thread Laszlo Ersek
On 03/22/16 16:49, Yonghong Zhu wrote:
> In last Nmake patch, when we generate the response file, we would replace
> all the Macros in the make file. Once there have no definition macro
> used, the tool direct report error. But for make tool, if there
> have no definition macro, it will ignore this macro. so this patch change
> the behavior to replace the not defined macro to ' ', but not report error.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/AutoGen/GenMake.py | 30 
> ++
>  1 file changed, 26 insertions(+), 4 deletions(-)

Tested-by: Laszlo Ersek 

> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index 59ac2e8..a43d158 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -676,18 +676,27 @@ cleanlib:
>  if Tool:
>  SingleCommandLength += 
> len(self._AutoGenObject._BuildOption[Tool]['PATH'])
>  for item in SingleCommandList[1:]:
>  if FlagDict[Tool]['Macro'] in item:
>  Str = 
> self._AutoGenObject._BuildOption[Tool]['FLAGS']
> +for Option in 
> self._AutoGenObject.BuildOption.keys():
> +for Attr in 
> self._AutoGenObject.BuildOption[Option]:
> +if Str.find(Option + '_' + Attr) 
> != -1:
> +Str = Str.replace('$(' + 
> Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
>  while(Str.find('$(') != -1):
>  for macro in 
> self._AutoGenObject.Macros.keys():
>  MacroName = '$('+ macro + ')'
>  if (Str.find(MacroName) != -1):
>  Str = Str.replace(MacroName, 
> self._AutoGenObject.Macros[macro])
>  break
>  else:
> -EdkLogger.error("build", 
> AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, 
> ExtraData="[%s]" % str(self._AutoGenObject))
> +# if the Macro definition cannot 
> be found, replace the Macro to ' '
> +while(Str.find('$(') != -1):
> +MacroStartPos = 
> Str.find('$(')
> +MacroEndPos = Str.find(')', 
> MacroStartPos)
> +Macro = Str[MacroStartPos: 
> MacroEndPos+1]
> +Str = Str.replace(Macro, ' ')
>  SingleCommandLength += len(Str)
>  elif '$(INC)' in item:
>  SingleCommandLength += 
> self._AutoGenObject.IncludePathLength + len(IncPrefix) * 
> len(self._AutoGenObject._IncludePathList)
>  elif item.find('$(') != -1:
>  Str = item
> @@ -700,12 +709,16 @@ cleanlib:
>  MacroName = '$('+ macro + ')'
>  if (Str.find(MacroName) != -1):
>  Str = Str.replace(MacroName, 
> self._AutoGenObject.Macros[macro])
>  break
>  else:
> -EdkLogger.error("build", 
> AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, 
> ExtraData="[%s]" % str(self._AutoGenObject))
> -
> +# if the Macro definition cannot 
> be found, replace the Macro to ' '
> +while(Str.find('$(') != -1):
> +MacroStartPos = 
> Str.find('$(')
> +MacroEndPos = Str.find(')', 
> MacroStartPos)
> +Macro = Str[MacroStartPos: 
> MacroEndPos+1]
> +Str = Str.replace(Macro, ' ')
>  SingleCommandLength += len(Str)
>  
>  if SingleCommandLength > 
> GlobalData.gCommandMaxLength:
>  FlagDict[Tool]['Value'] = True
>  
> @@ -715,18 +728,27 @@ cleanlib:
>  Key = Flag + '_RESP'
>

Re: [edk2] Shell Aliases and Case-Sensitivity

2016-03-22 Thread Carsey, Jaben
Jim,

Why would we want to add something case sensitive when everything else is not 
case sensitive?  Do we really want to have to add DIR, dIR, Dir, (etc...) to 
properly handle the built in alias that is required in the shell spec?

What if we requested to change the spec to say alias is case insensitive?

-Jaben


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> jim_dai...@dell.com
> Sent: Tuesday, March 22, 2016 7:13 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] Shell Aliases and Case-Sensitivity
> Importance: High
> 
> I see nothing in the Shell specification that says that alias names are
> case-insensitive, yet the code that deals with them attempts to treat
> them that way.
> 
> I say "attempts" because the code that handles aliases is broken when
> one tries to set or delete an alias containing an upper-case character.
> 
> Instead of fixing the problem in the code, which is quite simple to do,
> I'd rather remove the code that attempts to handle alias names in a
> case-insensitive manner.  One reason is to eliminate issues like the
> existing one (I'll describe it below); a second reason is that aliases
> are stored as UEFI variables and those are case-sensitive; and, finally,
> the shell spec says this:
> 
> An alias is a C-style identifier ...
> 
> and identifiers in C are also case-sensitive.
> 
> The one place I can think of where case probably needs to be ignored is
> when the shell checks that an alias name that is to be created is not
> the name of an internal command.  So "LS", "Ls", "lS", and "ls", for
> example, would not be permissible alias names. Other than that, I think
> that aliases could be case-sensitive.
> 
> Your thoughts?
> 
> Regards,
> Jim
> 
> --
> The current issue:
> 
> FS0:> alias LTxt "ls %.txt"
> FS0:> echo %lasterror% <--- No error from alias, however ..
> 0x0
> FS0:> alias LTxt
> alias: Invalid argument = 'LTxt'   <--- .. it didn't create the alias.
> FS0:> echo %lasterror%
> 0x2
> FS0:> alias ltxt "ls *.txt"<--- If no upper-case is used, alias
> FS0:> alias LTxt   <--- is created and can be accessed
> LTxt:ls *.txt  <--- using mixed-case.
> FS0:> LTxt <--- It also works as expected, even
> Directory of: ...  <--- if given in mixed case.
> ...
> FS0:> alias -d LTxt<--- Unless you try to delete it!
> FS0:> echo %lasterror%
> 0x0
> FS0:> alias LTxt   <--- LTxt is invincible!
> LTxt:ls *.txt
> FS0:> alias -d ltxt<--- But ltxt is not.
> FS0:> alias LTxt
> alias: Invalid argument = 'LTxt'
> FS0:>
> 
> ___
> 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] BaseTools: replace not defined macro to ' ' when generate response file

2016-03-22 Thread Yonghong Zhu
In last Nmake patch, when we generate the response file, we would replace
all the Macros in the make file. Once there have no definition macro
used, the tool direct report error. But for make tool, if there
have no definition macro, it will ignore this macro. so this patch change
the behavior to replace the not defined macro to ' ', but not report error.

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

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 59ac2e8..a43d158 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -676,18 +676,27 @@ cleanlib:
 if Tool:
 SingleCommandLength += 
len(self._AutoGenObject._BuildOption[Tool]['PATH'])
 for item in SingleCommandList[1:]:
 if FlagDict[Tool]['Macro'] in item:
 Str = 
self._AutoGenObject._BuildOption[Tool]['FLAGS']
+for Option in 
self._AutoGenObject.BuildOption.keys():
+for Attr in 
self._AutoGenObject.BuildOption[Option]:
+if Str.find(Option + '_' + Attr) 
!= -1:
+Str = Str.replace('$(' + 
Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
 while(Str.find('$(') != -1):
 for macro in 
self._AutoGenObject.Macros.keys():
 MacroName = '$('+ macro + ')'
 if (Str.find(MacroName) != -1):
 Str = Str.replace(MacroName, 
self._AutoGenObject.Macros[macro])
 break
 else:
-EdkLogger.error("build", 
AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, 
ExtraData="[%s]" % str(self._AutoGenObject))
+# if the Macro definition cannot 
be found, replace the Macro to ' '
+while(Str.find('$(') != -1):
+MacroStartPos = Str.find('$(')
+MacroEndPos = Str.find(')', 
MacroStartPos)
+Macro = Str[MacroStartPos: 
MacroEndPos+1]
+Str = Str.replace(Macro, ' ')
 SingleCommandLength += len(Str)
 elif '$(INC)' in item:
 SingleCommandLength += 
self._AutoGenObject.IncludePathLength + len(IncPrefix) * 
len(self._AutoGenObject._IncludePathList)
 elif item.find('$(') != -1:
 Str = item
@@ -700,12 +709,16 @@ cleanlib:
 MacroName = '$('+ macro + ')'
 if (Str.find(MacroName) != -1):
 Str = Str.replace(MacroName, 
self._AutoGenObject.Macros[macro])
 break
 else:
-EdkLogger.error("build", 
AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, 
ExtraData="[%s]" % str(self._AutoGenObject))
-
+# if the Macro definition cannot 
be found, replace the Macro to ' '
+while(Str.find('$(') != -1):
+MacroStartPos = Str.find('$(')
+MacroEndPos = Str.find(')', 
MacroStartPos)
+Macro = Str[MacroStartPos: 
MacroEndPos+1]
+Str = Str.replace(Macro, ' ')
 SingleCommandLength += len(Str)
 
 if SingleCommandLength > 
GlobalData.gCommandMaxLength:
 FlagDict[Tool]['Value'] = True
 
@@ -715,18 +728,27 @@ cleanlib:
 Key = Flag + '_RESP'
 RespMacro = FlagDict[Flag]['Macro'].replace('FLAGS', 
'RESP')
 Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']
 for inc in self._AutoGenObject._IncludePathList:
 Value += ' 

Re: [edk2] [PATCH v1 1/1] MdePkg: Move SMBIOS data into the IndustryStandard header.

2016-03-22 Thread Marvin Häuser
Star,



Thank you for your remark. Patch v2 has been sent to the mailing list with the 
changes you proposed.



Regards,

Marvin.



Von: Zeng, Star
Gesendet: Dienstag, 22. März 2016 06:32
An: Marvin Häuser; 
edk2-devel@lists.01.org
Cc: michael.d.kin...@intel.com; 
liming@intel.com
Betreff: Re: [edk2] [PATCH v1 1/1] MdePkg: Move SMBIOS data into the 
IndustryStandard header.



Marvin,

One comment below to the patch.

On 2016/3/22 2:41, Marvin Häuser wrote:
> As the SMBIOS table types belong to the SMBIOS standard, they were
> moved from the SMBIOS Protocol header into the SMBIOS
> IndustryStandard header without the EFI_-prefix. Defines with the
> EFI_-prefix have been kept in the Protocol header for
> backwards-compatibility, resolving to the IndustryStandard defines.
> The same has been done with the C types.
>
> The SMBIOS table header structure had been duplicated -
> SMBIOS_STRUCTURE in the IndustryStandard header and
> EFI_SMBIOS_TABLE_HEADER in the Protocol file - and thus the
> Protocol type was replaced with a typedef to the InudstryStandard's.
> This doesn't only make it easier to maintain, but it also prevents
> potential future issues as the Protocol type has been aligned, while
> the standard and the IndustryStandard header declare it as
> byte-packed.
> This has worked well till now only because the members of the
> structure do not require alignment yet.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Marvin Haeuser 
> ---
>   MdePkg/Include/IndustryStandard/SmBios.h |  87 +++-
>   MdePkg/Include/Protocol/Smbios.h | 139 
>   2 files changed, 137 insertions(+), 89 deletions(-)
>
> diff --git a/MdePkg/Include/IndustryStandard/SmBios.h 
> b/MdePkg/Include/IndustryStandard/SmBios.h
> index b7c54f2fac12..1bb72c053da1 100644
> --- a/MdePkg/Include/IndustryStandard/SmBios.h
> +++ b/MdePkg/Include/IndustryStandard/SmBios.h
> @@ -51,6 +51,53 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>   //
>   #define SMBIOS_3_0_TABLE_MAX_LENGTH 0x
>
> +//
> +// SMBIOS type macros which is according to SMBIOS 2.7 specification.
> +//
> +#define SMBIOS_TYPE_BIOS_INFORMATION 0
> +#define SMBIOS_TYPE_SYSTEM_INFORMATION   1
> +#define SMBIOS_TYPE_BASEBOARD_INFORMATION2
> +#define SMBIOS_TYPE_SYSTEM_ENCLOSURE 3
> +#define SMBIOS_TYPE_PROCESSOR_INFORMATION4
> +#define SMBIOS_TYPE_MEMORY_CONTROLLER_INFORMATION5
> +#define SMBIOS_TYPE_MEMORY_MODULE_INFORMATON 6
> +#define SMBIOS_TYPE_CACHE_INFORMATION7
> +#define SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION   8
> +#define SMBIOS_TYPE_SYSTEM_SLOTS 9
> +#define SMBIOS_TYPE_ONBOARD_DEVICE_INFORMATION   10
> +#define SMBIOS_TYPE_OEM_STRINGS  11
> +#define SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS 12
> +#define SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION13
> +#define SMBIOS_TYPE_GROUP_ASSOCIATIONS   14
> +#define SMBIOS_TYPE_SYSTEM_EVENT_LOG 15
> +#define SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY16
> +#define SMBIOS_TYPE_MEMORY_DEVICE17
> +#define SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION   18
> +#define SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS  19
> +#define SMBIOS_TYPE_MEMORY_DEVICE_MAPPED_ADDRESS 20
> +#define SMBIOS_TYPE_BUILT_IN_POINTING_DEVICE 21
> +#define SMBIOS_TYPE_PORTABLE_BATTERY 22
> +#define SMBIOS_TYPE_SYSTEM_RESET 23
> +#define SMBIOS_TYPE_HARDWARE_SECURITY24
> +#define SMBIOS_TYPE_SYSTEM_POWER_CONTROLS25
> +#define SMBIOS_TYPE_VOLTAGE_PROBE26
> +#define SMBIOS_TYPE_COOLING_DEVICE   27
> +#define SMBIOS_TYPE_TEMPERATURE_PROBE28
> +#define SMBIOS_TYPE_ELECTRICAL_CURRENT_PROBE 29
> +#define SMBIOS_TYPE_OUT_OF_BAND_REMOTE_ACCESS30
> +#define SMBIOS_TYPE_BOOT_INTEGRITY_SERVICE   31
> +#define SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION  32
> +#define SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION   33
> +#define SMBIOS_TYPE_MANAGEMENT_DEVICE34
> +#define SMBIOS_TYPE_MANAGEMENT_DEVICE_COMPONENT  35
> +#define SMBIOS_TYPE_MANAGEMENT_DEVICE_THRESHOLD_DATA 36
> +#define SMBIOS_TYPE_MEMORY_CHANNEL   37
> +#define SMBIOS_TYPE_IPMI_DEVICE_INFORMATION  38
> +#define SMBIOS_TYPE_SYSTEM_POWER_SUPPLY  39
> +#define SMBIOS_TYPE_ADDITIONAL_INFORMATION   40
> +#define 

[edk2] [PATCH v2 1/1] MdePkg: Move SMBIOS data into the IndustryStandard header.

2016-03-22 Thread Marvin Häuser
As the SMBIOS table types belong to the SMBIOS standard, they were
moved from the SMBIOS Protocol header into the SMBIOS
IndustryStandard header without the EFI_-prefix. Defines with the
EFI_-prefix have been kept in the Protocol header for
backwards-compatibility, resolving to the IndustryStandard defines.
The same has been done with the C types.

The SMBIOS table header structure had been duplicated -
SMBIOS_STRUCTURE in the IndustryStandard header and
EFI_SMBIOS_TABLE_HEADER in the Protocol file - and thus the
Protocol type was replaced with a typedef to the InudstryStandard's.
This doesn't only make it easier to maintain, but it also prevents
potential future issues as the Protocol type has been aligned, while
the standard and the IndustryStandard header declare it as
byte-packed.
This has worked well till now only because the members of the
structure do not require alignment yet.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser 
---
 MdePkg/Include/IndustryStandard/SmBios.h |  84 +++-
 MdePkg/Include/Protocol/Smbios.h | 139 
 2 files changed, 133 insertions(+), 90 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/SmBios.h 
b/MdePkg/Include/IndustryStandard/SmBios.h
index b7c54f2fac12..c66422fc3af4 100644
--- a/MdePkg/Include/IndustryStandard/SmBios.h
+++ b/MdePkg/Include/IndustryStandard/SmBios.h
@@ -51,6 +51,53 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 //
 #define SMBIOS_3_0_TABLE_MAX_LENGTH 0x
 
+//
+// SMBIOS type macros which is according to SMBIOS 2.7 specification.
+//
+#define SMBIOS_TYPE_BIOS_INFORMATION 0
+#define SMBIOS_TYPE_SYSTEM_INFORMATION   1
+#define SMBIOS_TYPE_BASEBOARD_INFORMATION2
+#define SMBIOS_TYPE_SYSTEM_ENCLOSURE 3
+#define SMBIOS_TYPE_PROCESSOR_INFORMATION4
+#define SMBIOS_TYPE_MEMORY_CONTROLLER_INFORMATION5
+#define SMBIOS_TYPE_MEMORY_MODULE_INFORMATON 6
+#define SMBIOS_TYPE_CACHE_INFORMATION7
+#define SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION   8
+#define SMBIOS_TYPE_SYSTEM_SLOTS 9
+#define SMBIOS_TYPE_ONBOARD_DEVICE_INFORMATION   10
+#define SMBIOS_TYPE_OEM_STRINGS  11
+#define SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS 12
+#define SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION13
+#define SMBIOS_TYPE_GROUP_ASSOCIATIONS   14
+#define SMBIOS_TYPE_SYSTEM_EVENT_LOG 15
+#define SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY16
+#define SMBIOS_TYPE_MEMORY_DEVICE17
+#define SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION   18
+#define SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS  19
+#define SMBIOS_TYPE_MEMORY_DEVICE_MAPPED_ADDRESS 20
+#define SMBIOS_TYPE_BUILT_IN_POINTING_DEVICE 21
+#define SMBIOS_TYPE_PORTABLE_BATTERY 22
+#define SMBIOS_TYPE_SYSTEM_RESET 23
+#define SMBIOS_TYPE_HARDWARE_SECURITY24
+#define SMBIOS_TYPE_SYSTEM_POWER_CONTROLS25
+#define SMBIOS_TYPE_VOLTAGE_PROBE26
+#define SMBIOS_TYPE_COOLING_DEVICE   27
+#define SMBIOS_TYPE_TEMPERATURE_PROBE28
+#define SMBIOS_TYPE_ELECTRICAL_CURRENT_PROBE 29
+#define SMBIOS_TYPE_OUT_OF_BAND_REMOTE_ACCESS30
+#define SMBIOS_TYPE_BOOT_INTEGRITY_SERVICE   31
+#define SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION  32
+#define SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION   33
+#define SMBIOS_TYPE_MANAGEMENT_DEVICE34
+#define SMBIOS_TYPE_MANAGEMENT_DEVICE_COMPONENT  35
+#define SMBIOS_TYPE_MANAGEMENT_DEVICE_THRESHOLD_DATA 36
+#define SMBIOS_TYPE_MEMORY_CHANNEL   37
+#define SMBIOS_TYPE_IPMI_DEVICE_INFORMATION  38
+#define SMBIOS_TYPE_SYSTEM_POWER_SUPPLY  39
+#define SMBIOS_TYPE_ADDITIONAL_INFORMATION   40
+#define SMBIOS_TYPE_ONBOARD_DEVICES_EXTENDED_INFORMATION 41
+#define SMBIOS_TYPE_MANAGEMENT_CONTROLLER_HOST_INTERFACE 42
+
 ///
 /// Inactive type is added from SMBIOS 2.2. Reference SMBIOS 2.6, chapter 
3.3.43.
 /// Upper-level software that interprets the SMBIOS structure-table should 
bypass an 
@@ -64,6 +111,27 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 ///
 #define SMBIOS_TYPE_END_OF_TABLE 0x007F
 
+#define SMBIOS_OEM_BEGIN 128
+#define SMBIOS_OEM_END   255
+
+///
+/// Types 0 through 127 (7Fh) are reserved for and defined by this
+/// specification. Types 128 through 256 (80h to FFh) are available for 
system- and OEM-specific information.  
+///
+typedef UINT8  SMBIOS_TYPE;
+
+///
+/// Specifies the structure's handle, a unique 16-bit number in the range 0 

[edk2] Shell Aliases and Case-Sensitivity

2016-03-22 Thread Jim_Dailey
I see nothing in the Shell specification that says that alias names are
case-insensitive, yet the code that deals with them attempts to treat
them that way.

I say "attempts" because the code that handles aliases is broken when
one tries to set or delete an alias containing an upper-case character.

Instead of fixing the problem in the code, which is quite simple to do,
I'd rather remove the code that attempts to handle alias names in a
case-insensitive manner.  One reason is to eliminate issues like the
existing one (I'll describe it below); a second reason is that aliases
are stored as UEFI variables and those are case-sensitive; and, finally,
the shell spec says this:

An alias is a C-style identifier ...

and identifiers in C are also case-sensitive.

The one place I can think of where case probably needs to be ignored is
when the shell checks that an alias name that is to be created is not
the name of an internal command.  So "LS", "Ls", "lS", and "ls", for
example, would not be permissible alias names. Other than that, I think
that aliases could be case-sensitive.

Your thoughts?

Regards,
Jim

--
The current issue:

FS0:> alias LTxt "ls %.txt"
FS0:> echo %lasterror% <--- No error from alias, however ..
0x0
FS0:> alias LTxt
alias: Invalid argument = 'LTxt'   <--- .. it didn't create the alias.
FS0:> echo %lasterror%
0x2
FS0:> alias ltxt "ls *.txt"<--- If no upper-case is used, alias
FS0:> alias LTxt   <--- is created and can be accessed
LTxt:ls *.txt  <--- using mixed-case.
FS0:> LTxt <--- It also works as expected, even
Directory of: ...  <--- if given in mixed case.
...
FS0:> alias -d LTxt<--- Unless you try to delete it!
FS0:> echo %lasterror%
0x0
FS0:> alias LTxt   <--- LTxt is invincible!
LTxt:ls *.txt
FS0:> alias -d ltxt<--- But ltxt is not.
FS0:> alias LTxt
alias: Invalid argument = 'LTxt'
FS0:> 

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


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread Ard Biesheuvel
On 22 March 2016 at 15:08, Gao, Liming  wrote:
> Yes. We have produced this issue, and investigating it. I mean we will build 
> ArmVirtQemu.dsc with ARM and AARCH64 in our unit test scope for new BaseTools 
> patch to avoid future build break.
>

Thank you very much. That should help a lot to catch problems like
this in the future.

Regards,
Ard.


> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard 
> Biesheuvel
> Sent: Tuesday, March 22, 2016 10:02 PM
> To: Gao, Liming 
> Cc: James Bottomley ; 
> edk2-devel@lists.01.org
> Subject: Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line 
> length limitation
>
> On 22 March 2016 at 14:59, Gao, Liming wrote:
>> Ard:
>>
>> Sorry for this break. We are looking it. Could you let me which DSC is
>> used to verify ARM and AARCH64? I will verify its build when we make the
>> change in BaseTools.
>>
>
> You can try to build ArmVirtPkg/ArmVirtQemu.dsc for both ARM and
> AARCH64, using GCC48/49 or CLANG35
>
> As I mentioned, I don't think you need to have the toolchain
> installed, since the error occurs before that.
>
> --
> Ard.
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread Gao, Liming
Yes. We have produced this issue, and investigating it. I mean we will build 
ArmVirtQemu.dsc with ARM and AARCH64 in our unit test scope for new BaseTools 
patch to avoid future build break.

From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard 
Biesheuvel
Sent: Tuesday, March 22, 2016 10:02 PM
To: Gao, Liming 
Cc: James Bottomley ; 
edk2-devel@lists.01.org
Subject: Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line 
length limitation

On 22 March 2016 at 14:59, Gao, Liming wrote:
> Ard:
>
> Sorry for this break. We are looking it. Could you let me which DSC is
> used to verify ARM and AARCH64? I will verify its build when we make the
> change in BaseTools.
>

You can try to build ArmVirtPkg/ArmVirtQemu.dsc for both ARM and
AARCH64, using GCC48/49 or CLANG35

As I mentioned, I don't think you need to have the toolchain
installed, since the error occurs before that.

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


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread Ard Biesheuvel
On 22 March 2016 at 14:59, Gao, Liming  wrote:
> Ard:
>
>   Sorry for this break. We are looking it. Could you let me which DSC is
> used to verify ARM and AARCH64? I will verify its build when we make the
> change in BaseTools.
>

You can try to build ArmVirtPkg/ArmVirtQemu.dsc for both ARM and
AARCH64, using GCC48/49 or CLANG35

As I mentioned, I don't think you need to have the toolchain
installed, since the error occurs before that.

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


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread Gao, Liming
Ard:
  Sorry for this break. We are looking it. Could you let me which DSC is used 
to verify ARM and AARCH64? I will verify its build when we make the change in 
BaseTools.

Thanks
Liming
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
Sent: Tuesday, March 22, 2016 9:01 PM
To: James Bottomley 
Cc: edk2-devel@lists.01.org; Gao, Liming 
Subject: Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line 
length limitation

On 22 March 2016 at 13:57, James Bottomley
wrote:
> On Tue, 2016-03-22 at 13:38 +0100, Ard Biesheuvel wrote:
>> On 22 March 2016 at 13:35, James Bottomley
>> wrote:
>> > On Tue, 2016-03-22 at 13:01 +0100, Ard Biesheuvel wrote:
>> > > On 22 March 2016 at 04:25, Gao, Liming
>> > > wrote:
>> > > > Reviewed-by: Liming Gao
>> > > >
>> > >
>> > > This patch breaks the AARCH64 build:
>> > >
>> > > Processing meta-data 
>> > >
>> > > build.py...
>> > > : error F000: Not supported macro is found in make command :
>> > > $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -g -fshort-wchar
>> > > -fno-strict-aliasing -Wall -Werror -Wno-array-bounds
>> > > -ffunction-sections -fdata-sections -c -include AutoGen.h -fno
>> > > -common
>> > > -DSTRING_ARRAY_NAME=DxePcdLibStrings -mcmodel=tiny -g -Os
>> > > -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array
>> > > -bounds -c
>> > > -include AutoGen.h -fno-common -mlittle-endian -fno-short-enums
>> > > -save-temps -fverbose-asm -fsigned-char -ffunction-sections
>> > > -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
>> > > -fno-asynchronous-unwind-tables -O0
>> > > [/home/ard/build/uefi
>> > > -next/MdePkg/Library/DxePcdLib/DxePcdLib.inf]
>> > >
>> > >
>> > > Could we *please* start testing BaseTools changes on other
>> > > toolchains/platforms than X64/VS?
>> >
>> > Since edk2 is Intel centric, this is how I do it:
>> >
>> > http://blog.hansenpartnership.com/constructing-architecture-emulati
>> > on-containers/
>> >
>> > As long as you're running an OS which supports containers (i.e.
>> > Linux
>> > not Windows), you can bring up a native aarch64 (or arm 32 bit)
>> > build
>> > environment for edk2 on an x86 system.
>> >
>>
>> Thanks for the link, it looks interesting. However, there is no need
>> at all to build natively. In fact, you don't even need the aarch64
>> toolchain to find out that the aarch64 build is broken by this patch,
>> since it errors out way before even invoking the compiler.
>
> Well, it depends what you do. I'm not really looking to find build
> errors, I need to validate a runtime system (so boot the output in qemu
> and run it through its paces). Since the build service I use builds
> natively, I also need to test the native build (cross compilers don't
> always work the same way the native build does).
>

Oh, I absolutely agree that building natively is preferred over
cross-building, and I should probably consider migrating my own CI
build jobs against EDK2 to a native environment (which wasn't
available when I first got involved with UEFI)

My point was simply that this particular patch breaks the build way
before it even matters whether you build natively, cross build or even
have no compatible toolchain installed to begin with.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/7] ArmPkg/AsmMacroIoLibV8: remove undocumented assumption from ELx macros

2016-03-22 Thread Ard Biesheuvel
On 21 March 2016 at 17:53, Cohen, Eugene  wrote:
> Alexei and Ard,
>
>> The suggested code for EL1_OR_EL2 macro:
>>
>> mrsSAFE_XREG, CurrentEL ;\
>> cmpSAFE_XREG, #0x8  ;\
>> b.eq   2f   ;\
>> tbnz   SAFE_XREG, #2, 1f;\
>> b  .;// We should never get here
>>
>> will successfully branch to 1f label in case of EL3 with SAFE_XREG = 0xC
>> because bit #2 will be set.
>
> Agreed.  If you assume that EL1_OR_EL2 can never be invoked at EL3 then 
> obviously this wouldn't be a concern.  But since there's already a case for 
> handling neither EL1 nor EL2 (b .) then it would make sense to correct this 
> so if it was accidentally used in EL3 it would hit the default case which is 
> better for debugability.  The last tbnz needs to be reverted to the previous 
> cmp/b.ne construct or equivalent.
>

Thanks for spotting that. I committed it as follows:

// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
// This only selects between EL1 and EL2, else we die.
// Provide the Macro with a safe temp xreg to use.
#define EL1_OR_EL2(SAFE_XREG)\
mrsSAFE_XREG, CurrentEL ;\
cmpSAFE_XREG, #0x8  ;\
b.gt   .;\
b.eq   2f   ;\
cbnz   SAFE_XREG, 1f;\
b  .;// We should never get here


// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
// This only selects between EL1 and EL2 and EL3, else we die.
// Provide the Macro with a safe temp xreg to use.
#define EL1_OR_EL2_OR_EL3(SAFE_XREG) \
mrsSAFE_XREG, CurrentEL ;\
cmpSAFE_XREG, #0x8  ;\
b.gt   3f   ;\
b.eq   2f   ;\
cbnz   SAFE_XREG, 1f;\
b  .;// We should never get here
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread Ard Biesheuvel
On 22 March 2016 at 13:57, James Bottomley
 wrote:
> On Tue, 2016-03-22 at 13:38 +0100, Ard Biesheuvel wrote:
>> On 22 March 2016 at 13:35, James Bottomley
>>  wrote:
>> > On Tue, 2016-03-22 at 13:01 +0100, Ard Biesheuvel wrote:
>> > > On 22 March 2016 at 04:25, Gao, Liming 
>> > > wrote:
>> > > > Reviewed-by: Liming Gao 
>> > > >
>> > >
>> > > This patch breaks the AARCH64 build:
>> > >
>> > > Processing meta-data 
>> > >
>> > > build.py...
>> > >  : error F000: Not supported macro is found in make command :
>> > > $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -g -fshort-wchar
>> > > -fno-strict-aliasing -Wall -Werror -Wno-array-bounds
>> > > -ffunction-sections -fdata-sections -c -include AutoGen.h -fno
>> > > -common
>> > > -DSTRING_ARRAY_NAME=DxePcdLibStrings -mcmodel=tiny -g -Os
>> > > -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array
>> > > -bounds -c
>> > > -include AutoGen.h -fno-common -mlittle-endian -fno-short-enums
>> > > -save-temps -fverbose-asm -fsigned-char  -ffunction-sections
>> > > -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
>> > > -fno-asynchronous-unwind-tables -O0
>> > > [/home/ard/build/uefi
>> > > -next/MdePkg/Library/DxePcdLib/DxePcdLib.inf]
>> > >
>> > >
>> > > Could we *please* start testing BaseTools changes on other
>> > > toolchains/platforms than X64/VS?
>> >
>> > Since edk2 is Intel centric, this is how I do it:
>> >
>> > http://blog.hansenpartnership.com/constructing-architecture-emulati
>> > on-containers/
>> >
>> > As long as you're running an OS which supports containers (i.e.
>> > Linux
>> > not Windows), you can bring up a native aarch64 (or arm 32 bit)
>> > build
>> > environment for edk2 on an x86 system.
>> >
>>
>> Thanks for the link, it looks interesting. However, there is no need
>> at all to build natively.  In fact, you don't even need the aarch64
>> toolchain to find out that the aarch64 build is broken by this patch,
>> since it errors out way before even invoking the compiler.
>
> Well, it depends what you do.  I'm not really looking to find build
> errors, I need to validate a runtime system (so boot the output in qemu
> and run it through its paces).  Since the build service I use builds
> natively, I also need to test the native build (cross compilers don't
> always work the same way the native build does).
>

Oh, I absolutely agree that building natively is preferred over
cross-building, and I should probably consider migrating my own CI
build jobs against EDK2 to a native environment (which wasn't
available when I first got involved with UEFI)

My point was simply that this particular patch breaks the build way
before it even matters whether you build natively, cross build or even
have no compatible toolchain installed to begin with.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread James Bottomley
On Tue, 2016-03-22 at 13:38 +0100, Ard Biesheuvel wrote:
> On 22 March 2016 at 13:35, James Bottomley
>  wrote:
> > On Tue, 2016-03-22 at 13:01 +0100, Ard Biesheuvel wrote:
> > > On 22 March 2016 at 04:25, Gao, Liming 
> > > wrote:
> > > > Reviewed-by: Liming Gao 
> > > > 
> > > 
> > > This patch breaks the AARCH64 build:
> > > 
> > > Processing meta-data 
> > > 
> > > build.py...
> > >  : error F000: Not supported macro is found in make command :
> > > $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -g -fshort-wchar
> > > -fno-strict-aliasing -Wall -Werror -Wno-array-bounds
> > > -ffunction-sections -fdata-sections -c -include AutoGen.h -fno
> > > -common
> > > -DSTRING_ARRAY_NAME=DxePcdLibStrings -mcmodel=tiny -g -Os
> > > -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array
> > > -bounds -c
> > > -include AutoGen.h -fno-common -mlittle-endian -fno-short-enums
> > > -save-temps -fverbose-asm -fsigned-char  -ffunction-sections
> > > -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
> > > -fno-asynchronous-unwind-tables -O0
> > > [/home/ard/build/uefi
> > > -next/MdePkg/Library/DxePcdLib/DxePcdLib.inf]
> > > 
> > > 
> > > Could we *please* start testing BaseTools changes on other
> > > toolchains/platforms than X64/VS?
> > 
> > Since edk2 is Intel centric, this is how I do it:
> > 
> > http://blog.hansenpartnership.com/constructing-architecture-emulati
> > on-containers/
> > 
> > As long as you're running an OS which supports containers (i.e.
> > Linux
> > not Windows), you can bring up a native aarch64 (or arm 32 bit)
> > build
> > environment for edk2 on an x86 system.
> > 
> 
> Thanks for the link, it looks interesting. However, there is no need
> at all to build natively.  In fact, you don't even need the aarch64
> toolchain to find out that the aarch64 build is broken by this patch,
> since it errors out way before even invoking the compiler.

Well, it depends what you do.  I'm not really looking to find build
errors, I need to validate a runtime system (so boot the output in qemu
and run it through its paces).  Since the build service I use builds
natively, I also need to test the native build (cross compilers don't
always work the same way the native build does).

James


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


[edk2] [PATCH v2 8/9] MmcDxe: set iospeed and bus width in SD stack

2016-03-22 Thread Haojian Zhuang
Add more SD commands to support 4-bit bus width & iospeed. It's not
formal code. And it needs to be updated later.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Include/Protocol/MmcHost.h   |   3 +
 EmbeddedPkg/Universal/MmcDxe/Mmc.h   |  17 +++
 EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c | 138 ---
 3 files changed, 142 insertions(+), 16 deletions(-)

diff --git a/EmbeddedPkg/Include/Protocol/MmcHost.h 
b/EmbeddedPkg/Include/Protocol/MmcHost.h
index 5e3a2b7..e9a74f0 100644
--- a/EmbeddedPkg/Include/Protocol/MmcHost.h
+++ b/EmbeddedPkg/Include/Protocol/MmcHost.h
@@ -64,11 +64,14 @@ typedef UINT32 MMC_CMD;
 #define MMC_CMD24 (MMC_INDX(24) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_CMD55 (MMC_INDX(55) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_ACMD41(MMC_INDX(41) | MMC_CMD_WAIT_RESPONSE | 
MMC_CMD_NO_CRC_RESPONSE)
+#define MMC_ACMD51(MMC_INDX(51) | MMC_CMD_WAIT_RESPONSE)
 
 // Valid responses for CMD1 in eMMC
 #define EMMC_CMD1_CAPACITY_LESS_THAN_2GB 0x00FF8080 // Capacity <= 2GB, byte 
addressing used
 #define EMMC_CMD1_CAPACITY_GREATER_THAN_2GB 0x40FF8080 // Capacity > 2GB, 
512-byte sector addressing used
 
+#define MMC_STATUS_APP_CMD(1 << 5)
+
 typedef enum _MMC_STATE {
 MmcInvalidState = 0,
 MmcHwInitializationState,
diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h 
b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
index 0ccbc80..a62ba32 100644
--- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h
+++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
@@ -75,6 +75,23 @@ typedef struct {
   UINT32  PowerUp: 1; // This bit is set to LOW if the card has not 
finished the power up routine
 } OCR;
 
+/* For little endian CPU */
+typedef struct {
+  UINT8   SD_SPEC:   4; // SD Memory Card - Spec. Version [59:56]
+  UINT8   SCR_STRUCTURE: 4; // SCR Structure [63:60]
+  UINT8   SD_BUS_WIDTHS: 4; // DAT Bus widths supported [51:48]
+  UINT8   DATA_STAT_AFTER_ERASE: 1; // Data Status after erases [55]
+  UINT8   SD_SECURITY:   3; // CPRM Security Support [54:52]
+  UINT8   EX_SECURITY_1: 1; // Extended Security Support [43]
+  UINT8   SD_SPEC4:  1; // Spec. Version 4.00 or higher [42]
+  UINT8   RESERVED_1:2; // Reserved [41:40]
+  UINT8   SD_SPEC3:  1; // Spec. Version 3.00 or higher [47]
+  UINT8   EX_SECURITY_2: 3; // Extended Security Support [46:44]
+  UINT8   CMD_SUPPORT:   4; // Command Support bits [35:32]
+  UINT8   RESERVED_2:4; // Reserved [39:36]
+  UINT32  RESERVED_3;   // Manufacturer Usage [31:0]
+} SCR;
+
 typedef struct {
   UINT32  NOT_USED;   // 1 [0:0]
   UINT32  CRC;// CRC7 checksum [7:1]
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c 
b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
index f806bfc..125d3f9 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
@@ -12,6 +12,9 @@
 *
 **/
 
+#include 
+#include 
+
 #include "Mmc.h"
 
 typedef union {
@@ -41,6 +44,11 @@ typedef union {
 
 #define EMMC_SWITCH_ERROR   (1 << 7)
 
+#define SD_BUS_WIDTH_1BIT   (1 << 0)
+#define SD_BUS_WIDTH_4BIT   (1 << 2)
+
+#define SD_CCC_SWITCH   (1 << 10)
+
 #define DEVICE_STATE(x) (((x) >> 9) & 0xf)
 typedef enum _EMMC_DEVICE_STATE {
   EMMC_IDLE_STATE = 0,
@@ -69,28 +77,30 @@ EmmcGetDeviceState (
 {
   EFI_MMC_HOST_PROTOCOL *Host;
   EFI_STATUS Status;
-  UINT32 Data, RCA;
+  UINT32 Rsp[4], RCA;
 
   if (State == NULL)
 return EFI_INVALID_PARAMETER;
 
   Host  = MmcHostInstance->MmcHost;
   RCA = MmcHostInstance->CardInfo.RCA << RCA_SHIFT_OFFSET;
-  Status = Host->SendCommand (Host, MMC_CMD13, RCA);
-  if (EFI_ERROR (Status)) {
-DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to get card status, 
Status=%r.\n", Status));
-return Status;
-  }
-  Status = Host->ReceiveResponse (Host, MMC_RESPONSE_TYPE_R1, );
-  if (EFI_ERROR (Status)) {
-DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to get response of 
CMD13, Status=%r.\n", Status));
-return Status;
-  }
-  if (Data & EMMC_SWITCH_ERROR) {
-DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to switch expected 
mode, Status=%r.\n", Status));
-return EFI_DEVICE_ERROR;
-  }
-  *State = DEVICE_STATE(Data);
+  do {
+Status = Host->SendCommand (Host, MMC_CMD13, RCA);
+if (EFI_ERROR (Status)) {
+  DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to get card status, 
Status=%r.\n", Status));
+  return Status;
+}
+Status = Host->ReceiveResponse (Host, MMC_RESPONSE_TYPE_R1, Rsp);
+if (EFI_ERROR (Status)) {
+  DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to get response of 
CMD13, Status=%r.\n", Status));
+  return Status;
+}
+if (Rsp[0] & EMMC_SWITCH_ERROR) {
+  DEBUG ((EFI_D_ERROR, 

[edk2] [PATCH v2 9/9] MmcDxe: expand to support multiple blocks

2016-03-22 Thread Haojian Zhuang
Make use of DMA to transfer multiple blocks at one time. It could
improve the performance on MMC/SD driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Include/Protocol/MmcHost.h|   6 +
 EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c | 175 --
 2 files changed, 122 insertions(+), 59 deletions(-)

diff --git a/EmbeddedPkg/Include/Protocol/MmcHost.h 
b/EmbeddedPkg/Include/Protocol/MmcHost.h
index e9a74f0..62501a0 100644
--- a/EmbeddedPkg/Include/Protocol/MmcHost.h
+++ b/EmbeddedPkg/Include/Protocol/MmcHost.h
@@ -62,6 +62,7 @@ typedef UINT32 MMC_CMD;
 #define MMC_CMD20 (MMC_INDX(20) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_CMD23 (MMC_INDX(23) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_CMD24 (MMC_INDX(24) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD25 (MMC_INDX(25) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_CMD55 (MMC_INDX(55) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_ACMD41(MMC_INDX(41) | MMC_CMD_WAIT_RESPONSE | 
MMC_CMD_NO_CRC_RESPONSE)
 #define MMC_ACMD51(MMC_INDX(51) | MMC_CMD_WAIT_RESPONSE)
@@ -152,6 +153,10 @@ typedef EFI_STATUS (EFIAPI *MMC_SETIOS) (
   IN  UINT32TimingMode
   );
 
+typedef BOOLEAN (EFIAPI *MMC_ISMULTIBLOCK) (
+  IN  EFI_MMC_HOST_PROTOCOL *This
+  );
+
 
 struct _EFI_MMC_HOST_PROTOCOL {
 
@@ -169,6 +174,7 @@ struct _EFI_MMC_HOST_PROTOCOL {
   MMC_WRITEBLOCKDATA  WriteBlockData;
 
   MMC_SETIOS  SetIos;
+  MMC_ISMULTIBLOCKIsMultiBlock;
 
 };
 
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c 
b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
index 0e1ef57..3bfae08 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
@@ -126,6 +126,95 @@ MmcStopTransmission (
 #define MMCI0_BLOCKLEN 512
 #define MMCI0_TIMEOUT  1
 
+STATIC EFI_STATUS
+MmcTransferBlock (
+  IN EFI_BLOCK_IO_PROTOCOL*This,
+  IN UINTNCmd,
+  IN UINTNTransfer,
+  IN UINT32   MediaId,
+  IN EFI_LBA  Lba,
+  IN UINTNBufferSize,
+  OUT VOID*Buffer
+  )
+{
+  EFI_STATUS  Status;
+  UINTN   CmdArg;
+  INTNTimeout;
+  UINT32  Response[4];
+  MMC_HOST_INSTANCE   *MmcHostInstance;
+  EFI_MMC_HOST_PROTOCOL   *MmcHost;
+
+  MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS (This);
+  MmcHost = MmcHostInstance->MmcHost;
+
+  //Set command argument based on the card access mode (Byte mode or Block 
mode)
+  if (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1) {
+CmdArg = Lba;
+  } else {
+CmdArg = Lba * This->Media->BlockSize;
+  }
+
+  Status = MmcHost->SendCommand (MmcHost, Cmd, CmdArg);
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "%a(MMC_CMD%d): Error %r\n", __func__, Cmd, Status));
+return Status;
+  }
+
+  if (Transfer == MMC_IOBLOCKS_READ) {
+// Read Data
+Status = MmcHost->ReadBlockData (MmcHost, Lba, BufferSize, Buffer);
+if (EFI_ERROR (Status)) {
+  DEBUG ((EFI_D_BLKIO, "%a(): Error Read Block Data and Status = %r\n", 
__func__, Status));
+  MmcStopTransmission (MmcHost);
+  return Status;
+}
+Status = MmcNotifyState (MmcHostInstance, MmcProgrammingState);
+if (EFI_ERROR (Status)) {
+  DEBUG ((EFI_D_ERROR, "%a() : Error MmcProgrammingState\n", __func__));
+  return Status;
+}
+  } else {
+// Write Data
+Status = MmcHost->WriteBlockData (MmcHost, Lba, BufferSize, Buffer);
+if (EFI_ERROR (Status)) {
+  DEBUG ((EFI_D_BLKIO, "%a(): Error Write Block Data and Status = %r\n", 
__func__, Status));
+  MmcStopTransmission (MmcHost);
+  return Status;
+}
+  }
+
+  // Command 13 - Read status and wait for programming to complete (return to 
tran)
+  Timeout = MMCI0_TIMEOUT;
+  CmdArg = MmcHostInstance->CardInfo.RCA << 16;
+  Response[0] = 0;
+  while(   (!(Response[0] & MMC_R0_READY_FOR_DATA))
+&& (MMC_R0_CURRENTSTATE (Response) != MMC_R0_STATE_TRAN)
+&& Timeout--) {
+Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
+if (!EFI_ERROR (Status)) {
+  MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
+  if ((Response[0] & MMC_R0_READY_FOR_DATA)) {
+break;  // Prevents delay once finished
+  }
+}
+gBS->Stall (1);
+  }
+
+  if (BufferSize > This->Media->BlockSize) {
+Status = MmcHost->SendCommand (MmcHost, MMC_CMD12, 0);
+if (EFI_ERROR (Status)) {
+  DEBUG ((EFI_D_BLKIO, "%a(): Error and Status:%r\n", __func__, Status));
+}
+  }
+
+  Status = MmcNotifyState (MmcHostInstance, MmcTransferState);
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "MmcIoBlocks() : Error MmcTransferState\n"));
+return Status;
+  }
+  return Status;
+}
+
 EFI_STATUS
 MmcIoBlocks (
   IN 

[edk2] [PATCH v2 1/9] MmcDxe: wait OCR busy bit free

2016-03-22 Thread Haojian Zhuang
According to eMMC spec, OCR.PowerUp bit is also busy bit. If the busy
bit is '0', CMD1 should be sent and OCR should be fetched again. And add
a timeout counter on the repeated steps.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c 
b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
index 2d8038f..0b0a044 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
@@ -222,14 +222,19 @@ MmcIdentificationMode (
 
   // Send CMD1 to get OCR (MMC)
   // This command only valid for MMC and eMMC
-  Status = MmcHost->SendCommand (MmcHost, MMC_CMD1, 
EMMC_CMD1_CAPACITY_GREATER_THAN_2GB);
-  if (Status == EFI_SUCCESS) {
+  Timeout = MAX_RETRY_COUNT;
+  do {
+Status = MmcHost->SendCommand (MmcHost, MMC_CMD1, 
EMMC_CMD1_CAPACITY_GREATER_THAN_2GB);
+if (EFI_ERROR (Status))
+  break;
 Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, (UINT32 
*));
 if (EFI_ERROR (Status)) {
   DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Failed to receive OCR, 
Status=%r.\n", Status));
   return Status;
 }
-
+Timeout--;
+  } while (!OcrResponse.Ocr.PowerUp && (Timeout > 0));
+  if (Status == EFI_SUCCESS) {
 if (!OcrResponse.Ocr.PowerUp) {
   DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD1): Card 
initialisation failure, Status=%r.\n", Status));
   return EFI_DEVICE_ERROR;
-- 
1.9.1

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


[edk2] [PATCH v2 6/9] MmcDxe: set io bus width before reading EXTCSD

2016-03-22 Thread Haojian Zhuang
Set io bus width on both MMC controller and EXTCSD. Otherwise, it may
cause unmatched failure case. And support more timing mode, high speed,
HS200 & HS400 mode.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Include/Protocol/MmcHost.h   |  16 +-
 EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c | 225 +--
 2 files changed, 219 insertions(+), 22 deletions(-)

diff --git a/EmbeddedPkg/Include/Protocol/MmcHost.h 
b/EmbeddedPkg/Include/Protocol/MmcHost.h
index 13e99e7..5e3a2b7 100644
--- a/EmbeddedPkg/Include/Protocol/MmcHost.h
+++ b/EmbeddedPkg/Include/Protocol/MmcHost.h
@@ -49,6 +49,7 @@ typedef UINT32 MMC_CMD;
 #define MMC_CMD2  (MMC_INDX(2) | MMC_CMD_WAIT_RESPONSE | 
MMC_CMD_LONG_RESPONSE)
 #define MMC_CMD3  (MMC_INDX(3) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_CMD5  (MMC_INDX(5) | MMC_CMD_WAIT_RESPONSE | 
MMC_CMD_NO_CRC_RESPONSE)
+#define MMC_CMD6  (MMC_INDX(6) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_CMD7  (MMC_INDX(7) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_CMD8  (MMC_INDX(8) | MMC_CMD_WAIT_RESPONSE)
 #define MMC_CMD9  (MMC_INDX(9) | MMC_CMD_WAIT_RESPONSE | 
MMC_CMD_LONG_RESPONSE)
@@ -82,6 +83,16 @@ typedef enum _MMC_STATE {
 MmcDisconnectState,
 } MMC_STATE;
 
+#define EMMCBACKWARD (0)
+#define EMMCHS26 (1 << 0)  // High-Speed @26MHz at rated 
device voltages
+#define EMMCHS52 (1 << 1)  // High-Speed @52MHz at rated 
device voltages
+#define EMMCHS52DDR1V8   (1 << 2)  // High-Speed Dual Data Rate @52MHz 
1.8V or 3V I/O
+#define EMMCHS52DDR1V2   (1 << 3)  // High-Speed Dual Data Rate @52MHz 
1.2V I/O
+#define EMMCHS200SDR1V8  (1 << 4)  // HS200 Single Data Rate @200MHz 
1.8V I/O
+#define EMMCHS200SDR1V2  (1 << 5)  // HS200 Single Data Rate @200MHz 
1.2V I/O
+#define EMMCHS400DDR1V8  (1 << 6)  // HS400 Dual Data Rate @400MHz 
1.8V I/O
+#define EMMCHS400DDR1V2  (1 << 7)  // HS400 Dual Data Rate @400MHz 
1.2V I/O
+
 ///
 /// Forward declaration for EFI_MMC_HOST_PROTOCOL
 ///
@@ -133,8 +144,9 @@ typedef EFI_STATUS (EFIAPI *MMC_WRITEBLOCKDATA) (
 
 typedef EFI_STATUS (EFIAPI *MMC_SETIOS) (
   IN  EFI_MMC_HOST_PROTOCOL *This,
-  IN  UINT32BusClockRate,
-  IN  UINT32BusWidth
+  IN  UINT32BusClockFreq,
+  IN  UINT32BusWidth,
+  IN  UINT32TimingMode
   );
 
 
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c 
b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
index 5be3d86..a5915e4 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
@@ -25,11 +25,109 @@ typedef union {
 #define EMMC_CARD_SIZE  512
 #define EMMC_ECSD_SIZE_OFFSET   53
 
+#define EXTCSD_BUS_WIDTH183
+#define EXTCSD_HS_TIMING185
+
+#define EMMC_TIMING_BACKWARD0
+#define EMMC_TIMING_HS  1
+#define EMMC_TIMING_HS200   2
+#define EMMC_TIMING_HS400   3
+
+#define EMMC_BUS_WIDTH_1BIT 0
+#define EMMC_BUS_WIDTH_4BIT 1
+#define EMMC_BUS_WIDTH_8BIT 2
+#define EMMC_BUS_WIDTH_DDR_4BIT 5
+#define EMMC_BUS_WIDTH_DDR_8BIT 6
+
+#define EMMC_SWITCH_ERROR   (1 << 7)
+
+#define DEVICE_STATE(x) (((x) >> 9) & 0xf)
+typedef enum _EMMC_DEVICE_STATE {
+  EMMC_IDLE_STATE = 0,
+  EMMC_READY_STATE,
+  EMMC_IDENT_STATE,
+  EMMC_STBY_STATE,
+  EMMC_TRAN_STATE,
+  EMMC_DATA_STATE,
+  EMMC_RCV_STATE,
+  EMMC_PRG_STATE,
+  EMMC_DIS_STATE,
+  EMMC_BTST_STATE,
+  EMMC_SLP_STATE
+} EMMC_DEVICE_STATE;
+
 UINT32 mEmmcRcaCount = 0;
 
 STATIC
 EFI_STATUS
 EFIAPI
+EmmcGetDeviceState (
+  IN  MMC_HOST_INSTANCE*MmcHostInstance,
+  OUT EMMC_DEVICE_STATE*State
+  )
+{
+  EFI_MMC_HOST_PROTOCOL *Host;
+  EFI_STATUS Status;
+  UINT32 Data, RCA;
+
+  if (State == NULL)
+return EFI_INVALID_PARAMETER;
+
+  Host  = MmcHostInstance->MmcHost;
+  RCA = MmcHostInstance->CardInfo.RCA << RCA_SHIFT_OFFSET;
+  Status = Host->SendCommand (Host, MMC_CMD13, RCA);
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to get card status, 
Status=%r.\n", Status));
+return Status;
+  }
+  Status = Host->ReceiveResponse (Host, MMC_RESPONSE_TYPE_R1, );
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to get response of 
CMD13, Status=%r.\n", Status));
+return Status;
+  }
+  if (Data & EMMC_SWITCH_ERROR) {
+DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to switch expected 
mode, Status=%r.\n", Status));
+return EFI_DEVICE_ERROR;
+  }
+  *State = DEVICE_STATE(Data);
+  return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+EmmcSetEXTCSD (
+  IN MMC_HOST_INSTANCE *MmcHostInstance,
+  UINT32   ExtCmdIndex,
+  UINT32   Value
+  )
+{
+  EFI_MMC_HOST_PROTOCOL 

[edk2] [PATCH v2 5/9] MmcDxe: declare ECSD structure

2016-03-22 Thread Haojian Zhuang
Declare fields in ECSD structure. And drop the original 128 words
arrary.

Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Universal/MmcDxe/Mmc.h   | 157 ++-
 EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c |   4 +-
 2 files changed, 158 insertions(+), 3 deletions(-)

diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h 
b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
index b1c5153..0ccbc80 100644
--- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h
+++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
@@ -133,13 +133,168 @@ typedef struct {
   UINT8   CSD_STRUCTURE:  2; // CSD structure [127:126]
 } CSD;
 
+typedef struct {
+  UINT8   RESERVED_1[16]; // Reserved [15:0]
+  UINT8   SECURE_REMOVAL_TYPE;// Secure Removal Type [16:16]
+  UINT8   PRODUCT_STATE_AWARENESS_ENABLEMENT; // Product state awareness 
enablement [17:17]
+  UINT8   MAX_PRE_LOADING_DATA_SIZE[4];   // MAX pre loading data size 
[21:18]
+  UINT8   PRE_LOADING_DATA_SIZE[4];   // Pre loading data size [25:22]
+  UINT8   FFU_STATUS; // FFU Status [26:26]
+  UINT8   RESERVED_2[2];  // Reserved [28:27]
+  UINT8   MODE_OPERATION_CODES;   // Mode operation codes [29:29]
+  UINT8   MODE_CONFIG;// Mode config [30:30]
+  UINT8   RESERVED_3; // Reserved [31:31]
+  UINT8   FLUSH_CACHE;// Flushing of the cache [32:32]
+  UINT8   CACHE_CTRL; // Control to turn the cache 
ON/OFF [33:33]
+  UINT8   POWER_OFF_NOTIFICATION; // Power Off Notification [34:34]
+  UINT8   PACKED_FAILURE_INDEX;   // Packed command failure index 
[35:35]
+  UINT8   PACKED_COMMAND_STATUS;  // Packed command status [36:36]
+  UINT8   CONTEXT_CONF[15];   // Context configuration [51:37]
+  UINT8   EXT_PARTITIONS_ATTRIBUTE[2];// Extended partitions attribute 
[53:52]
+  UINT8   EXCEPTION_EVENTS_STATUS[2]; // Exception events status 
[55:54]
+  UINT8   EXCEPTION_EVENTS_CTRL[2];   // Exception events control 
[57:56]
+  UINT8   DYNCAP_NEEDED;  // Number of addressed group to 
be released [58:58]
+  UINT8   CLASS_6_CTRL;   // Class 6 commands control 
[59:59]
+  UINT8   INI_TIMEOUT_EMU;// 1st initialization after 
disabling sector size emulation [60:60]
+  UINT8   DATA_SECTOR_SIZE;   // Sector size [61:61]
+  UINT8   USE_NATIVE_SECTOR;  // Sector size emulation [62:62]
+  UINT8   NATIVE_SECTOR_SIZE; // Native sector size [63:63]
+  UINT8   VENDOR_SPECIFIC_FIELD[64];  // Vendor specific fields 
[127:64]
+  UINT8   RESERVED_4[2];  // Reserved [129:128]
+  UINT8   PROGRAM_CID_CSD_DDR_SUPPORT;// Program CID/CSD in DDR mode 
support [130:130]
+  UINT8   PERIODIC_WAKEUP;// Periodic wake-up [131:131]
+  UINT8   TCASE_SUPPORT;  // Package case temperature is 
controlled [132:132]
+  UINT8   PRODUCTION_STATE_AWARENESS; // Production state awareness 
[133:133]
+  UINT8   SEC_BAD_BLK_MGMNT;  // Bad block management mode 
[134:134]
+  UINT8   RESERVED_5; // Reserved [135:135]
+  UINT8   ENH_START_ADDR[4];  // Enhanced user data start 
address [139:136]
+  UINT8   ENH_SIZE_MULT[3];   // Enhanced user data area size 
[142:140]
+  UINT8   GP_SIZE_MULT[12];   // General purpose partition 
size [154:143]
+  UINT8   PARTITION_SETTING_COMPLETED;// Partitioning setting [155:155]
+  UINT8   PARTITIONS_ATTRIBUTE;   // Partitions attribute [156:156]
+  UINT8   MAX_ENH_SIZE_MULT[3];   // Max enhanced area size 
[159:157]
+  UINT8   PARTITIONING_SUPPORT;   // Partitioning [160:160]
+  UINT8   HPI_MGMT;   // HPI management [161:161]
+  UINT8   RST_N_FUNCTION; // H/W reset function [162:162]
+  UINT8   BKOPS_EN;   // Enable background operations 
handshake [163:163]
+  UINT8   BKOPS_START;// Manually start background 
operations [164:164]
+  UINT8   SANITIZE_START; // Start sanitize operation 
[165:165]
+  UINT8   WR_REL_PARAM;   // Write reliability parameter 
register [166:166]
+  UINT8   WR_REL_SET; // Write reliability setting 
register [167:167]
+  UINT8   RPMB_SIZE_MULT; // RPMB size [168:168]
+  UINT8   FW_CONFIG;  // FW configuration [169:169]
+  UINT8   RESERVED_6; // Reserved [170:170]
+  UINT8   USER_WP;// User area write protection 
register [171:171]
+  UINT8   RESERVED_7; // Reserved [172:172]
+  UINT8   BOOT_WP;  

[edk2] [PATCH v2 4/9] MmcDxe: add interface to change io width and speed

2016-03-22 Thread Haojian Zhuang
By default, MMC is initialized with 1-bit mode and less than 400KHz bus
clock. It causes MMC working inefficiently.

Add the interface to change the bus width and speed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Include/Protocol/MmcHost.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/EmbeddedPkg/Include/Protocol/MmcHost.h 
b/EmbeddedPkg/Include/Protocol/MmcHost.h
index 89f2e80..13e99e7 100644
--- a/EmbeddedPkg/Include/Protocol/MmcHost.h
+++ b/EmbeddedPkg/Include/Protocol/MmcHost.h
@@ -131,6 +131,12 @@ typedef EFI_STATUS (EFIAPI *MMC_WRITEBLOCKDATA) (
   IN  UINT32*Buffer
   );
 
+typedef EFI_STATUS (EFIAPI *MMC_SETIOS) (
+  IN  EFI_MMC_HOST_PROTOCOL *This,
+  IN  UINT32BusClockRate,
+  IN  UINT32BusWidth
+  );
+
 
 struct _EFI_MMC_HOST_PROTOCOL {
 
@@ -147,6 +153,8 @@ struct _EFI_MMC_HOST_PROTOCOL {
   MMC_READBLOCKDATA   ReadBlockData;
   MMC_WRITEBLOCKDATA  WriteBlockData;
 
+  MMC_SETIOS  SetIos;
+
 };
 
 #define MMC_HOST_PROTOCOL_REVISION0x00010001// 1.1
-- 
1.9.1

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


[edk2] [PATCH v2 3/9] MmcDxe: add SPEC_VERS field in CSD structure

2016-03-22 Thread Haojian Zhuang
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Universal/MmcDxe/Mmc.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h 
b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
index f4e0aa0..b1c5153 100644
--- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h
+++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
@@ -128,7 +128,8 @@ typedef struct {
   UINT8   NSAC;  // Data read access-time 2 in CLK cycles 
(NSAC*100) [111:104]
   UINT8   TAAC;  // Data read access-time 1 [119:112]
 
-  UINT8   RESERVED_5: 6; // Reserved [125:120]
+  UINT8   RESERVED_5: 2; // Reserved [121:120]
+  UINT8   SPEC_VERS:  4; // System specification version [125:122]
   UINT8   CSD_STRUCTURE:  2; // CSD structure [127:126]
 } CSD;
 
-- 
1.9.1

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


[edk2] [PATCH v2 2/9] MmcDxe: move ECSD into CardInfo structure

2016-03-22 Thread Haojian Zhuang
Since ECSD also describes the information of card, move it into
structure CardInfo.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Universal/MmcDxe/Mmc.h   | 1 +
 EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h 
b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
index 46a156c..f4e0aa0 100644
--- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h
+++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
@@ -138,6 +138,7 @@ typedef struct  {
   OCR   OCRData;
   CID   CIDData;
   CSD   CSDData;
+  UINT32ECSD[128];  // MMC V4 extended card specific
 } CARD_INFO;
 
 typedef struct _MMC_HOST_INSTANCE {
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c 
b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
index 0b0a044..3531fb4 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
@@ -39,7 +39,6 @@ EmmcIdentificationMode (
   EFI_BLOCK_IO_MEDIA*Media;
   EFI_STATUS Status;
   UINT32 RCA;
-  UINT32 ECSD[128];
 
   Host  = MmcHostInstance->MmcHost;
   Media = MmcHostInstance->BlockIo.Media;
@@ -91,7 +90,7 @@ EmmcIdentificationMode (
 DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): ECSD fetch error, 
Status=%r.\n", Status));
   }
 
-  Status = Host->ReadBlockData (Host, 0, 512, ECSD);
+  Status = Host->ReadBlockData (Host, 0, 512, (UINT32 
*)&(MmcHostInstance->CardInfo.ECSD));
   if (EFI_ERROR (Status)) {
 DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): ECSD read error, 
Status=%r.\n", Status));
 return Status;
@@ -104,7 +103,7 @@ EmmcIdentificationMode (
   Media->LogicalBlocksPerPhysicalBlock = 1;
   Media->IoAlign = 4;
   // Compute last block using bits [215:212] of the ECSD
-  Media->LastBlock = ECSD[EMMC_ECSD_SIZE_OFFSET] - 1; // eMMC isn't supposed 
to report this for
+  Media->LastBlock = MmcHostInstance->CardInfo.ECSD[EMMC_ECSD_SIZE_OFFSET] - 
1; // eMMC isn't supposed to report this for
   // Cards <2GB in size, but the model does.
 
   // Setup card type
-- 
1.9.1

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


[edk2] [PATCH v2 7/9] MmcDxe: Fix uninitialized mediaid for SD

2016-03-22 Thread Haojian Zhuang
When SD card is used, mediaid is not initialized and used directly. So
fix it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang 
---
 EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c 
b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
index a5915e4..f806bfc 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
@@ -57,6 +57,7 @@ typedef enum _EMMC_DEVICE_STATE {
 } EMMC_DEVICE_STATE;
 
 UINT32 mEmmcRcaCount = 0;
+UINT32 CurrentMediaId = 0;
 
 STATIC
 EFI_STATUS
@@ -231,6 +232,10 @@ EmmcIdentificationMode (
   // Set up media
   Media->BlockSize = EMMC_CARD_SIZE; // 512-byte support is mandatory for eMMC 
cards
   Media->MediaId = MmcHostInstance->CardInfo.CIDData.PSN;
+  if (CurrentMediaId > Media->MediaId)
+Media->MediaId = ++CurrentMediaId;
+  else
+CurrentMediaId = Media->MediaId;
   Media->ReadOnly = MmcHostInstance->CardInfo.CSDData.PERM_WRITE_PROTECT;
   Media->LogicalBlocksPerPhysicalBlock = 1;
   Media->IoAlign = 4;
@@ -344,7 +349,7 @@ InitializeSdMmcDevice (
   MmcHostInstance->BlockIo.Media->BlockSize= BlockSize;
   MmcHostInstance->BlockIo.Media->ReadOnly = MmcHost->IsReadOnly (MmcHost);
   MmcHostInstance->BlockIo.Media->MediaPresent = TRUE;
-  MmcHostInstance->BlockIo.Media->MediaId++;
+  MmcHostInstance->BlockIo.Media->MediaId  = ++CurrentMediaId;
 
   CmdArg = MmcHostInstance->CardInfo.RCA << 16;
   Status = MmcHost->SendCommand (MmcHost, MMC_CMD7, CmdArg);
-- 
1.9.1

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


[edk2] [PATCH v2 0/9] enhance mmc

2016-03-22 Thread Haojian Zhuang
Changelog:
v2:
  * Fix print error with missing parameter.
  * Change CMD51 to ACMD51.
  * Add the protection after CMD55 for SD. If there's no reponse
of CMD55, skip to send ACMD51.

v1:
  * Wait OCR busy bit free according to eMMC spec.
  * Define ECSD structure.
  * Add interface to set IO bus width and speed.
  * Support to access multiple blocks.

Haojian Zhuang (9):
  MmcDxe: wait OCR busy bit free
  MmcDxe: move ECSD into CardInfo structure
  MmcDxe: add SPEC_VERS field in CSD structure
  MmcDxe: add interface to change io width and speed
  MmcDxe: declare ECSD structure
  MmcDxe: set io bus width before reading EXTCSD
  MmcDxe: Fix uninitialized mediaid for SD
  MmcDxe: set iospeed and bus width in SD stack
  MmcDxe: expand to support multiple blocks

 EmbeddedPkg/Include/Protocol/MmcHost.h   |  29 ++
 EmbeddedPkg/Universal/MmcDxe/Mmc.h   | 176 +++-
 EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c| 175 
 EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c | 350 +--
 4 files changed, 645 insertions(+), 85 deletions(-)

-- 
1.9.1

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


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread Ard Biesheuvel
On 22 March 2016 at 13:35, James Bottomley
 wrote:
> On Tue, 2016-03-22 at 13:01 +0100, Ard Biesheuvel wrote:
>> On 22 March 2016 at 04:25, Gao, Liming  wrote:
>> > Reviewed-by: Liming Gao 
>> >
>>
>> This patch breaks the AARCH64 build:
>>
>> Processing meta-data 
>>
>> build.py...
>>  : error F000: Not supported macro is found in make command :
>> $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -g -fshort-wchar
>> -fno-strict-aliasing -Wall -Werror -Wno-array-bounds
>> -ffunction-sections -fdata-sections -c -include AutoGen.h -fno-common
>> -DSTRING_ARRAY_NAME=DxePcdLibStrings -mcmodel=tiny -g -Os
>> -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -c
>> -include AutoGen.h -fno-common -mlittle-endian -fno-short-enums
>> -save-temps -fverbose-asm -fsigned-char  -ffunction-sections
>> -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
>> -fno-asynchronous-unwind-tables -O0
>> [/home/ard/build/uefi-next/MdePkg/Library/DxePcdLib/DxePcdLib.inf]
>>
>>
>> Could we *please* start testing BaseTools changes on other
>> toolchains/platforms than X64/VS?
>
> Since edk2 is Intel centric, this is how I do it:
>
> http://blog.hansenpartnership.com/constructing-architecture-emulation-containers/
>
> As long as you're running an OS which supports containers (i.e. Linux
> not Windows), you can bring up a native aarch64 (or arm 32 bit) build
> environment for edk2 on an x86 system.
>

Thanks for the link, it looks interesting. However, there is no need
at all to build natively.  In fact, you don't even need the aarch64
toolchain to find out that the aarch64 build is broken by this patch,
since it errors out way before even invoking the compiler.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread James Bottomley
On Tue, 2016-03-22 at 13:01 +0100, Ard Biesheuvel wrote:
> On 22 March 2016 at 04:25, Gao, Liming  wrote:
> > Reviewed-by: Liming Gao 
> > 
> 
> This patch breaks the AARCH64 build:
> 
> Processing meta-data 
> 
> build.py...
>  : error F000: Not supported macro is found in make command :
> $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -g -fshort-wchar
> -fno-strict-aliasing -Wall -Werror -Wno-array-bounds
> -ffunction-sections -fdata-sections -c -include AutoGen.h -fno-common
> -DSTRING_ARRAY_NAME=DxePcdLibStrings -mcmodel=tiny -g -Os
> -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -c
> -include AutoGen.h -fno-common -mlittle-endian -fno-short-enums
> -save-temps -fverbose-asm -fsigned-char  -ffunction-sections
> -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
> -fno-asynchronous-unwind-tables -O0
> [/home/ard/build/uefi-next/MdePkg/Library/DxePcdLib/DxePcdLib.inf]
> 
> 
> Could we *please* start testing BaseTools changes on other
> toolchains/platforms than X64/VS?

Since edk2 is Intel centric, this is how I do it:

http://blog.hansenpartnership.com/constructing-architecture-emulation-containers/

As long as you're running an OS which supports containers (i.e. Linux
not Windows), you can bring up a native aarch64 (or arm 32 bit) build
environment for edk2 on an x86 system.

James

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


Re: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line length limitation

2016-03-22 Thread Ard Biesheuvel
On 22 March 2016 at 04:25, Gao, Liming  wrote:
> Reviewed-by: Liming Gao 
>

This patch breaks the AARCH64 build:

Processing meta-data 

build.py...
 : error F000: Not supported macro is found in make command :
$(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -g -fshort-wchar
-fno-strict-aliasing -Wall -Werror -Wno-array-bounds
-ffunction-sections -fdata-sections -c -include AutoGen.h -fno-common
-DSTRING_ARRAY_NAME=DxePcdLibStrings -mcmodel=tiny -g -Os
-fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -c
-include AutoGen.h -fno-common -mlittle-endian -fno-short-enums
-save-temps -fverbose-asm -fsigned-char  -ffunction-sections
-fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
-fno-asynchronous-unwind-tables -O0
[/home/ard/build/uefi-next/MdePkg/Library/DxePcdLib/DxePcdLib.inf]


Could we *please* start testing BaseTools changes on other
toolchains/platforms than X64/VS?


>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>> Yonghong Zhu
>> Sent: Wednesday, March 16, 2016 11:09 AM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] [Patch] BaseTools: Fix nmake failure due to command-line
>> length limitation
>>
>> NMAKE is limited to command-line length of 4096 characters. Due to the
>> large number of /I directives specified on command line (one per include
>> directory), the path length of WORKSPACE is multiplied by the number of
>> /I directives and can exceed the limit.
>> This patch:
>> 1. Add new build option -l, --cmd-len to set the maximum command line
>> length, default value is 4096.
>> 2. Generate the response file only if the command line length exceed its
>> maximum characters (default is 4096) when build the module. Cover
>> PP_FLAGS, CC_FLAGS, VFRPP_FLAGS, APP_FLAGS, ASLPP_FLAGS,
>> ASLCC_FLAGS and
>> ASM_FLAGS.
>> 3. The content of the response file is combine from the FLAGS option and
>> INC option.
>> 4. When build failure, it would print out the response file's file
>> location and its content.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Yonghong Zhu 
>> ---
>>  BaseTools/Source/Python/AutoGen/AutoGen.py   |   9 +++
>>  BaseTools/Source/Python/AutoGen/GenMake.py   | 114
>> ++-
>>  BaseTools/Source/Python/Common/GlobalData.py |   2 +-
>>  BaseTools/Source/Python/build/build.py   |  12 +++
>>  4 files changed, 135 insertions(+), 2 deletions(-)
>>
>> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>> b/BaseTools/Source/Python/AutoGen/AutoGen.py
>> index c7aa84f..4934c57 100644
>> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>> @@ -2376,10 +2376,11 @@ class ModuleAutoGen(AutoGen):
>>  self._OutputDir   = None
>>  self._DebugDir= None
>>  self._MakeFileDir = None
>>
>>  self._IncludePathList = None
>> +self._IncludePathLength = 0
>>  self._AutoGenFileList = None
>>  self._UnicodeFileList = None
>>  self._SourceFileList  = None
>>  self._ObjectFileList  = None
>>  self._BinaryFileList  = None
>> @@ -3222,10 +3223,17 @@ class ModuleAutoGen(AutoGen):
>>  for Inc in Package.Includes:
>>  if Inc not in self._IncludePathList:
>>  self._IncludePathList.append(str(Inc))
>>  return self._IncludePathList
>>
>> +def _GetIncludePathLength(self):
>> +self._IncludePathLength = 0
>> +if self._IncludePathList:
>> +for inc in self._IncludePathList:
>> +self._IncludePathLength += len(' ' + inc)
>> +return self._IncludePathLength
>> +
>>  ## Get HII EX PCDs which maybe used by VFR
>>  #
>>  #  efivarstore used by VFR may relate with HII EX PCDs
>>  #  Get the variable name and GUID from efivarstore and HII EX PCD
>>  #  List the HII EX PCDs in As Built INF if both name and GUID match.
>> @@ -3814,10 +3822,11 @@ class ModuleAutoGen(AutoGen):
>>  DebugDir= property(_GetDebugDir)
>>  MakeFileDir = property(_GetMakeFileDir)
>>  CustomMakefile  = property(_GetCustomMakefile)
>>
>>  IncludePathList = property(_GetIncludePathList)
>> +IncludePathLength = property(_GetIncludePathLength)
>>  AutoGenFileList = property(_GetAutoGenFileList)
>>  UnicodeFileList = property(_GetUnicodeFileList)
>>  SourceFileList  = property(_GetSourceFileList)
>>  BinaryFileList  = property(_GetBinaryFiles) # FileType : [File List]
>>  Targets = property(_GetTargets)
>> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
>> b/BaseTools/Source/Python/AutoGen/GenMake.py
>> index ec24c70..5543aaa 100644
>> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
>> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
>> @@ -1,9 +1,9 @@
>>  ## @file
>>  # Create makefile for MS nmake and GNU 

Re: [edk2] [Patch] MdeModulePkg/Bds: BDS hotkey shouldn't work on inactive consoles

2016-03-22 Thread Wang, Sunny (HPS SW)
Looks good. It is good for the system having ConSplitter.
Reviewed-by: Sunny Wang 

Regards,
Sunny Wang

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Tuesday, March 22, 2016 11:09 AM
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni ; Feng Tian 
Subject: [edk2] [Patch] MdeModulePkg/Bds: BDS hotkey shouldn't work on inactive 
consoles

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Feng Tian 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c | 96 --
 1 file changed, 73 insertions(+), 23 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
index af303e8..4cc4fb4 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
@@ -1,7 +1,7 @@
 /** @file
   Hotkey library functions.
 
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2016, 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 @@ -441,6 +441,54 
@@ BmHotkeyCallback (  }
 
 /**
+  Return the active Simple Text Input Ex handle array.
+  If the SystemTable.ConsoleInHandle is NULL, the function returns all  
+ founded Simple Text Input Ex handles.
+  Otherwise, it just returns the ConsoleInHandle.
+
+  @param Count  Return the handle count.
+
+  @retval The active console handles.
+**/
+EFI_HANDLE *
+BmGetActiveConsoleIn (
+  OUT UINTN *Count
+  )
+{
+  EFI_STATUSStatus;
+  EFI_HANDLE*Handles;
+
+  if (gST->ConsoleInHandle != NULL) {
+Status = gBS->OpenProtocol (
+gST->ConsoleInHandle,
+,
+NULL,
+gImageHandle,
+NULL,
+EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+);
+if (!EFI_ERROR (Status)) {
+  Handles = AllocateCopyPool (sizeof (EFI_HANDLE *), 
>ConsoleInHandle);
+  *Count  = 1;
+}
+  } else {
+Status = gBS->LocateHandleBuffer (
+ByProtocol,
+,
+NULL,
+Count,
+
+);
+  }
+  if (EFI_ERROR (Status)) {
+Handles = NULL;
+*Count  = 0;
+  }
+
+  return Handles;
+}
+
+/**
   Unregister hotkey notify list.
 
   @paramHotkeyHotkey list.
@@ -461,13 +509,7 @@ BmUnregisterHotkeyNotify (
   EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx;
   VOID  *NotifyHandle;
 
-  gBS->LocateHandleBuffer (
-  ByProtocol,
-  ,
-  NULL,
-  ,
-  
-  );
+  Handles = BmGetActiveConsoleIn ();
   for (Index = 0; Index < HandleCount; Index++) {
 Status = gBS->HandleProtocol (Handles[Index], 
, (VOID **) );
 ASSERT_EFI_ERROR (Status);
@@ -485,6 +527,10 @@ BmUnregisterHotkeyNotify (
 }
   }
 
+  if (Handles != NULL) {
+FreePool (Handles);
+  }
+
   return EFI_SUCCESS;
 }
 
@@ -636,6 +682,8 @@ BmProcessKeyOption (
 
   EfiAcquireLock ();
 
+  Handles = BmGetActiveConsoleIn ();
+
   for (Index = 0; Index < KeyShiftStateCount; Index++) {
 Hotkey = AllocateZeroPool (sizeof (BM_HOTKEY));
 ASSERT (Hotkey != NULL);
@@ -651,13 +699,6 @@ BmProcessKeyOption (
 }
 InsertTailList (, >Link);
 
-gBS->LocateHandleBuffer (
-ByProtocol,
-,
-NULL,
-,
-
-);
 for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
   Status = gBS->HandleProtocol (Handles[HandleIndex], 
, (VOID **) );
   ASSERT_EFI_ERROR (Status);
@@ -665,6 +706,9 @@ BmProcessKeyOption (
 }
   }
 
+  if (Handles != NULL) {
+FreePool (Handles);
+  }
   EfiReleaseLock ();
 
   return EFI_SUCCESS;
@@ -875,13 +919,20 @@ EfiBootManagerStartHotkeyService (
 BmProcessKeyOption (mBmContinueKeyOption);
   }
 
-  EfiCreateProtocolNotifyEvent (
-,
-TPL_CALLBACK,
-BmTxtInExCallback,
-NULL,
-
-);
+  //
+  // Hook hotkey on every future SimpleTextInputEx instance when  // 
+ SystemTable.ConsoleInHandle == NULL, which means the console  // 
+ manager (ConSplitter) is absent.
+  //
+  if (gST->ConsoleInHandle == NULL) {
+EfiCreateProtocolNotifyEvent (
+  ,
+  TPL_CALLBACK,
+  BmTxtInExCallback,
+  NULL,
+  
+  );
+  }
 
   Status = EfiCreateEventReadyToBootEx (
  TPL_CALLBACK,
@@ -891,7 +942,6 @@ EfiBootManagerStartHotkeyService (
  );
   ASSERT_EFI_ERROR (Status);
 
-
   mBmHotkeyServiceStarted = 

Re: [edk2] [wave 1 PATCH 3/5] ArmVirtPkg: PlatformIntelBdsLib: install gRootBusesConnectedProtocolGuid

2016-03-22 Thread Laszlo Ersek
Adding Mike, Liming & Jeff

On 03/22/16 08:10, Laszlo Ersek wrote:
> On 03/22/16 06:59, Jordan Justen wrote:
>> Why not a guid based event, similar to gIdleLoopEventGuid?
> 
> Two reasons:
> 
> - specifically, it keeps the current structure of the AcpiPlatformDxe
> driver (i.e., we stick to the way the PCI bus driver installs
> gEfiPciEnumerationCompleteProtocolGuid, we just use a different GUID and
> tie it to a different circumstance)
> 
> - (I vaguely think I might have mentioned this earlier) generally, I
> prefer protocol installations to events, in this kind of situation. The
> protocol stays there permanently, and in general it allows the
> "consuming" driver to load & start after the protocol is installed.
> 
> The generic reason doesn't apply in this case, but I preferred to stick
> with the pattern. Do you have a strong reason to dislike it?

By the way: I seem to recall your earlier idea about abstracting the
signaling of event groups into UefiLib.

Investigating the core UefiLib instance
("MdePkg/Library/UefiLib/UefiLib.c"), I find that this kind of
functionality exists already. See the utility functions
EfiNamedEventListen() and EfiNamedEventSignal() especially -- the latter
takes only an EFI_GUID, so the function signature seems just right.

However, these functions are not implemented with event groups; instead
they too are based on RegisterProtocolNotify() and
InstallProtocolInterface(). I'm unsure about the reason.

I envisage an uphill battle for coming up with a new pair of functions
- for the same UefiLib class & core instance,
- with identical signaling functionality but different implementation
  (= event groups),
- with names clear enough that would prevent the client code programmer
  from mixing up the two implementations (like creating the listener
  with RegisterProtocolNotify() and trying to signal it with
  SignalEvent()).

For our use case specifically, the listener function wouldn't even be
useful. All we'd need is: create an event in the specified event group,
with an empty callback function; signal the event; close the event.

If this functionality is welcome to UefiLib (i.e., to the class and the
two existing instances in the tree), I'm willing to implement it, and to
rebase this series on top. (It would result in several more patches
because the current signaling of EndOfDxe in the OvmfPkg and ArmVirtPkg
PlatformBdsLib instances should be rebased as well.)

However, I'll need buy-in from the UefiLib maintainers (Mike, Liming,
Jeff) *in advance*. I have no capacity to rework this series only to see
the first patches (= for MdePkg and IntelFrameworkPkg) be rejected or
drag on forever.

Again, the entire functionality that would be abstracted into UefiLib, is:

EFI_STATUS
EFIAPI
EfiEventGroupSignal (
  IN CONST EFI_GUID *EventGroupGuid
  )
{
  EFI_STATUS Status;
  EFI_EVENT  Event;

  Status = gBS->CreateEventEx (
  EVT_NOTIFY_SIGNAL,
  TPL_CALLBACK,
  InternalEmptyFunction,
  NULL,  // NotifyContext
  EventGroupGuid,
  );
  if (EFI_ERROR (Status)) {
return Status;
  }
  Status = gBS->SignalEvent (Event);
  gBS->CloseEvent (Event);
  return Status;
}

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


Re: [edk2] [Patch] MdePkg/BaseSynchronizationLib: Add spin lock alignment for IA32/x64

2016-03-22 Thread Fan, Jeff
I removed the non-ASCII character in patch v2.

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jeff Fan
Sent: Tuesday, March 22, 2016 2:53 PM
To: edk2-devel@lists.01.org
Cc: Kinney, Michael D; Gao, Liming
Subject: [edk2] [Patch] MdePkg/BaseSynchronizationLib: Add spin lock alignment 
for IA32/x64

From Intel(R) 64 and IA-32 Architectures Software Developer’s Manual, one lock 
or semaphore is suggested to be present within a cache line. If the processors 
are based on Intel NetBurst microarchitecture, two cache lines are suggested.
This could minimize the bus traffic required to service locks.

Cc: Michael Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 .../BaseSynchronizationLib.inf |  8 ++-
 .../BaseSynchronizationLibInternals.h  | 14 -
 .../Ia32/InternalGetSpinLockProperties.c   | 60 ++
 .../Ipf/InternalGetSpinLockProperties.c| 29 +++
 .../BaseSynchronizationLib/SynchronizationGcc.c|  2 +-
 .../BaseSynchronizationLib/SynchronizationMsc.c|  2 +-
 6 files changed, 111 insertions(+), 4 deletions(-)  create mode 100644 
MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
 create mode 100644 
MdePkg/Library/BaseSynchronizationLib/Ipf/InternalGetSpinLockProperties.c

diff --git a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf 
b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
index bd1bec3..6930d21 100755
--- a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+++ b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Base Synchronization Library implementation.
 #
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights 
+reserved.
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.  #  
#  This program and the accompanying materials @@ -30,6 +30,8 @@
   BaseSynchronizationLibInternals.h
 
 [Sources.IA32]
+  Ia32/InternalGetSpinLockProperties.c
+
   Ia32/InterlockedCompareExchange64.c | MSFT 
   Ia32/InterlockedCompareExchange32.c | MSFT 
   Ia32/InterlockedCompareExchange16.c | MSFT @@ -48,6 +50,8 @@
   SynchronizationGcc.c  | GCC
 
 [Sources.X64]
+  Ia32/InternalGetSpinLockProperties.c
+
   X64/InterlockedCompareExchange64.c | MSFT
   X64/InterlockedCompareExchange32.c | MSFT
   X64/InterlockedCompareExchange16.c | MSFT @@ -68,6 +72,8 @@
   SynchronizationGcc.c  | GCC 
 
 [Sources.IPF]
+  Ipf/InternalGetSpinLockProperties.c
+
   Ipf/Synchronization.c
   Ipf/InterlockedCompareExchange64.s
   Ipf/InterlockedCompareExchange32.s
diff --git 
a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h 
b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
index 76f7023..9716b92 100644
--- a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
+++ b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibIntern
+++ als.h
@@ -1,7 +1,7 @@
 /** @file
   Declaration of internal functions in BaseSynchronizationLib.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2016, 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 @@ -138,4 +138,16 @@ InternalSyncCompareExchange64 (
   IN  UINT64ExchangeValue
   );
 
+/**
+  Internal function to retrieve the architecture specific spin lock 
+alignment
+  requirements for optimal spin lock performance.
+
+  @return The architecture specific spin lock alignment.
+  
+**/
+UINTN
+InternalGetSpinLockProperties (
+  VOID
+  );
+
 #endif
diff --git 
a/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c 
b/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
new file mode 100644
index 000..49f05fb
--- /dev/null
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProp
+++ erties.c
@@ -0,0 +1,60 @@
+/** @file
+  Internal function to get spin lock alignment.
+
+  Copyright (c) 2016, 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 "BaseSynchronizationLibInternals.h"
+
+/**
+  Internal 

[edk2] [Patch v2] MdePkg/BaseSynchronizationLib: Add spin lock alignment for IA32/x64

2016-03-22 Thread Jeff Fan
>From Intel(R) 64 and IA-32 Architectures Software Developer's Manual, one lock
or semaphore is suggested to be present within a cache line. If the processors
are based on Intel NetBurst microarchitecture, two cache lines are suggested.
This could minimize the bus traffic required to service locks.

Cc: Michael Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 .../BaseSynchronizationLib.inf |  8 ++-
 .../BaseSynchronizationLibInternals.h  | 14 -
 .../Ia32/InternalGetSpinLockProperties.c   | 60 ++
 .../Ipf/InternalGetSpinLockProperties.c| 29 +++
 .../BaseSynchronizationLib/SynchronizationGcc.c|  2 +-
 .../BaseSynchronizationLib/SynchronizationMsc.c|  2 +-
 6 files changed, 111 insertions(+), 4 deletions(-)
 create mode 100644 
MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
 create mode 100644 
MdePkg/Library/BaseSynchronizationLib/Ipf/InternalGetSpinLockProperties.c

diff --git a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf 
b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
index bd1bec3..6930d21 100755
--- a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+++ b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Base Synchronization Library implementation.
 #
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
 #
 #  This program and the accompanying materials
@@ -30,6 +30,8 @@
   BaseSynchronizationLibInternals.h
 
 [Sources.IA32]
+  Ia32/InternalGetSpinLockProperties.c
+
   Ia32/InterlockedCompareExchange64.c | MSFT 
   Ia32/InterlockedCompareExchange32.c | MSFT 
   Ia32/InterlockedCompareExchange16.c | MSFT
@@ -48,6 +50,8 @@
   SynchronizationGcc.c  | GCC
 
 [Sources.X64]
+  Ia32/InternalGetSpinLockProperties.c
+
   X64/InterlockedCompareExchange64.c | MSFT
   X64/InterlockedCompareExchange32.c | MSFT
   X64/InterlockedCompareExchange16.c | MSFT
@@ -68,6 +72,8 @@
   SynchronizationGcc.c  | GCC 
 
 [Sources.IPF]
+  Ipf/InternalGetSpinLockProperties.c
+
   Ipf/Synchronization.c
   Ipf/InterlockedCompareExchange64.s
   Ipf/InterlockedCompareExchange32.s
diff --git 
a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h 
b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
index 76f7023..9716b92 100644
--- a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
+++ b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
@@ -1,7 +1,7 @@
 /** @file
   Declaration of internal functions in BaseSynchronizationLib.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2016, 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
@@ -138,4 +138,16 @@ InternalSyncCompareExchange64 (
   IN  UINT64ExchangeValue
   );
 
+/**
+  Internal function to retrieve the architecture specific spin lock alignment
+  requirements for optimal spin lock performance.
+
+  @return The architecture specific spin lock alignment.
+  
+**/
+UINTN
+InternalGetSpinLockProperties (
+  VOID
+  );
+
 #endif
diff --git 
a/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c 
b/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
new file mode 100644
index 000..49f05fb
--- /dev/null
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
@@ -0,0 +1,60 @@
+/** @file
+  Internal function to get spin lock alignment.
+
+  Copyright (c) 2016, 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 "BaseSynchronizationLibInternals.h"
+
+/**
+  Internal function to retrieve the architecture specific spin lock alignment
+  requirements for optimal spin lock performance.
+
+  @return The architecture specific spin lock alignment.
+  
+**/
+UINTN
+InternalGetSpinLockProperties (
+  VOID
+  )
+{
+  UINT32  RegEax;
+  UINT32  RegEbx;
+  UINTN   FamilyId;
+  UINTN   ModelId;
+  UINTN   CacheLineSize;
+
+  //
+  // Retrieve 

Re: [edk2] [wave 1 PATCH 3/5] ArmVirtPkg: PlatformIntelBdsLib: install gRootBusesConnectedProtocolGuid

2016-03-22 Thread Laszlo Ersek
On 03/22/16 06:59, Jordan Justen wrote:
> Why not a guid based event, similar to gIdleLoopEventGuid?

Two reasons:

- specifically, it keeps the current structure of the AcpiPlatformDxe
driver (i.e., we stick to the way the PCI bus driver installs
gEfiPciEnumerationCompleteProtocolGuid, we just use a different GUID and
tie it to a different circumstance)

- (I vaguely think I might have mentioned this earlier) generally, I
prefer protocol installations to events, in this kind of situation. The
protocol stays there permanently, and in general it allows the
"consuming" driver to load & start after the protocol is installed.

The generic reason doesn't apply in this case, but I preferred to stick
with the pattern. Do you have a strong reason to dislike it?

Thanks
Laszlo

> On 2016-03-21 03:19:06, Laszlo Ersek wrote:
>> On 03/21/16 10:58, Ard Biesheuvel wrote:
>>
>>> But by all means, let's decouple this from the review of this series.
>>
>> Thanks. Two recent Protocol/*.h additions were a48d0a3d72f9 and
>> 78741ce91e12, those also added the extern declarations. I agree the
>> declarations shouldn't be duplicated, but then we should all start
>> following this new rule.
>>
> 
> Maybe one of you should post an email with a more noticable subject to
> prompt discussion of this topic more globally on edk2-devel?
> 
> -Jordan
> 

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


Re: [edk2] [wave 2 PATCH 0/3] OvmfPkg: enable 64-bit PCI MMIO

2016-03-22 Thread Laszlo Ersek
On 03/22/16 07:10, Jordan Justen wrote:
> o/ #2

(Is that a high five for wave 2? :))

> Reviewed-by: Jordan Justen 

Thanks!
Laszlo

> 
> On 2016-03-14 05:52:57, Laszlo Ersek wrote:
>> Identical repost of
>> .
>>
>> Public branch:
>> .
>>
>> Cc: Gerd Hoffmann 
>> Cc: Jordan Justen 
>> Cc: Marcel Apfelbaum 
>> Cc: Thomas Lamprecht 
>> Ref: https://github.com/tianocore/edk2/issues/59
>>
>> Laszlo Ersek (3):
>>   OvmfPkg: PlatformPei: factor out GetFirstNonAddress()
>>   OvmfPkg: PlatformPei: determine the 64-bit PCI host aperture for X64
>> DXE
>>   OvmfPkg: PciHostBridgeLib: install 64-bit PCI host aperture
>>
>>  OvmfPkg/OvmfPkg.dec   |   5 +
>>  OvmfPkg/OvmfPkgIa32X64.dsc|   2 +
>>  OvmfPkg/OvmfPkgX64.dsc|   2 +
>>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |   2 +
>>  OvmfPkg/PlatformPei/PlatformPei.inf   |   2 +
>>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   |   7 ++
>>  OvmfPkg/PlatformPei/MemDetect.c   | 128 
>> +++-
>>  7 files changed, 147 insertions(+), 1 deletion(-)
>>
>> -- 
>> 1.8.3.1
>>

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


Re: [edk2] [wave 1 PATCH 3/5] ArmVirtPkg: PlatformIntelBdsLib: install gRootBusesConnectedProtocolGuid

2016-03-22 Thread Jordan Justen
Why not a guid based event, similar to gIdleLoopEventGuid?

On 2016-03-21 03:19:06, Laszlo Ersek wrote:
> On 03/21/16 10:58, Ard Biesheuvel wrote:
> 
> > But by all means, let's decouple this from the review of this series.
> 
> Thanks. Two recent Protocol/*.h additions were a48d0a3d72f9 and
> 78741ce91e12, those also added the extern declarations. I agree the
> declarations shouldn't be duplicated, but then we should all start
> following this new rule.
> 

Maybe one of you should post an email with a more noticable subject to
prompt discussion of this topic more globally on edk2-devel?

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