Reviewed by [email protected]

Do you think we can add ASSERT for invalid port width?


-----Original Message-----
From: edk2-devel [mailto:[email protected]] On Behalf Of Zeng, 
Star
Sent: Monday, November 09, 2015 1:37 PM
To: Gao, Liming; [email protected]
Subject: Re: [edk2] [Patch] MdePkg: Add more DataBits support to Port80 output

On 2015/11/2 18:30, Liming Gao wrote:
> The BasePostCodeLibPort80 instance just prints UINT8 to IoPort 80. 
> Some boards may support 16bit or 32bit. To support them, new PCD 
> PcdPort80DataWidth is introduced to specify the width of data bits to Port80.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao <[email protected]>
> ---
>   .../BasePostCodeLibPort80/BasePostCodeLibPort80.inf |   4 ++--
>   MdePkg/Library/BasePostCodeLibPort80/PostCode.c     |  19 
> ++++++++++++++++---
>   MdePkg/MdePkg.dec                                   |   5 +++++
>   MdePkg/MdePkg.uni                                   | Bin 69604 -> 70116 
> bytes
>   4 files changed, 23 insertions(+), 5 deletions(-)

Reviewed-by: Star Zeng <[email protected]>

How about to put this PCD declaration near with PcdPostCodePropertyMask?

Thanks,
Star
>
> diff --git 
> a/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf 
> b/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
> index e2f0be5..441c4c5 100644
> --- a/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
> +++ b/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
> @@ -3,7 +3,7 @@
>   #
>   #  Post Code Library that writes post code values to I/O port 0x80.
>   #
> -#  Copyright (c) 2007 - 2014, Intel Corporation. All rights 
> reserved.<BR>
> +#  Copyright (c) 2007 - 2015, Intel Corporation. All rights 
> +reserved.<BR>
>   #
>   #  This program and the accompanying materials
>   #  are licensed and made available under the terms and conditions of 
> the BSD License @@ -44,4 +44,4 @@
>
>   [Pcd]
>     gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask  ## CONSUMES
> -
> +  gEfiMdePkgTokenSpaceGuid.PcdPort80DataWidth ## CONSUMES
> diff --git a/MdePkg/Library/BasePostCodeLibPort80/PostCode.c 
> b/MdePkg/Library/BasePostCodeLibPort80/PostCode.c
> index 925c740..4d572db 100644
> --- a/MdePkg/Library/BasePostCodeLibPort80/PostCode.c
> +++ b/MdePkg/Library/BasePostCodeLibPort80/PostCode.c
> @@ -1,7 +1,7 @@
>   /** @file
>     Post Code Library instance that writes post code values to I/O port 0x80.
>
> -  Copyright (c) 2006 - 2010, Intel Corporation. All rights 
> reserved.<BR>
> +  Copyright (c) 2006 - 2015, Intel Corporation. All rights 
> + reserved.<BR>
>     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 @@ -42,7 +42,20 @@ PostCode (
>     IN UINT32  Value
>     )
>   {
> -  IoWrite8 (0x80, (UINT8)(Value));
> +  switch (PcdGet8 (PcdPort80DataWidth)) {  case 8:
> +    IoWrite8 (0x80, (UINT8)(Value));
> +    break;
> +  case 16:
> +    IoWrite16 (0x80, (UINT16)(Value));
> +    break;
> +  case 32:
> +    IoWrite32 (0x80, Value);
> +    break;
> +  default:
> +    break;
> +  }
> +
>     return Value;
>   }
>
> @@ -78,7 +91,7 @@ PostCodeWithDescription (
>     IN CONST CHAR8  *Description  OPTIONAL
>     )
>   {
> -  IoWrite8 (0x80, (UINT8)(Value));
> +  PostCode (Value);
>     return Value;
>   }
>
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 
> 337059a..30f29d3 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -1965,6 +1965,11 @@
>     # @Prompt Memory Address of GuidedExtractHandler Table.
>     
> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000000
> |UINT64|0x30001015
>
> +  ## The bit width of data to be written to Port80. The default value is 8.
> +  # @Prompt Port80 Data Width
> +  # @ValidList  0x80000001 | 8, 16, 32
> +  gEfiMdePkgTokenSpaceGuid.PcdPort80DataWidth|8|UINT8|0x30001017
> +
>   [PcdsFixedAtBuild.IPF, PcdsPatchableInModule.IPF]
>     ## The base address of IO port space for IA64 arch.
>     # @Prompt IA64 IO Port Space Base Address.
> diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni index 
> 38211344e0ae01e984d5d9b916e42f4f8b4c1c66..5a5126213e4f72ea8c47772aebf5
> e31e007bbc46 100644 GIT binary patch delta 257
> zcmaDdpXJG7mWC~iPxvRx?GKO*V8~}EVklv-U@%~CVMqkB5*fl7G8s~Utc=NqV&?J)
> zc?Gx%1tc|&YvM(*nlSl%is|GHt2pYDfaaAjC@_@6%muRZ8Pb4c3e-jgpnN`%pTv*~
> zR#ybpQ3B-U0r?O)WS8mzMMD@ez^YS#WE#+%QidF`EoDG<4v+^jDU+d?L4g<OIgkb=
> J23`g(1^^oLG@}3j
>
> delta 11
> ScmaE|nB~cQmWC~iPxt{N6a_l~
>

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to