Revision: 18765
          http://sourceforge.net/p/edk2/code/18765
Author:   lgao4
Date:     2015-11-11 02:16:35 +0000 (Wed, 11 Nov 2015)
Log Message:
-----------
MdePkg: Add more DataBits support to Port80 output

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]>
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
    trunk/edk2/MdePkg/Library/BasePostCodeLibPort80/PostCode.c
    trunk/edk2/MdePkg/MdePkg.dec
    trunk/edk2/MdePkg/MdePkg.uni

Modified: 
trunk/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
===================================================================
--- trunk/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf   
2015-11-10 10:02:24 UTC (rev 18764)
+++ trunk/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf   
2015-11-11 02:16:35 UTC (rev 18765)
@@ -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
@@ -40,8 +40,9 @@
 [LibraryClasses]
   IoLib
   PcdLib
+  DebugLib
 
 
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask  ## CONSUMES
-
+  gEfiMdePkgTokenSpaceGuid.PcdPort80DataWidth ## CONSUMES

Modified: trunk/edk2/MdePkg/Library/BasePostCodeLibPort80/PostCode.c
===================================================================
--- trunk/edk2/MdePkg/Library/BasePostCodeLibPort80/PostCode.c  2015-11-10 
10:02:24 UTC (rev 18764)
+++ trunk/edk2/MdePkg/Library/BasePostCodeLibPort80/PostCode.c  2015-11-11 
02:16:35 UTC (rev 18765)
@@ -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        
@@ -17,6 +17,7 @@
 #include <Library/PostCodeLib.h>
 #include <Library/PcdLib.h>
 #include <Library/IoLib.h>
+#include <Library/DebugLib.h>
 
 /**
   Sends an 32-bit value to a POST card.
@@ -42,7 +43,24 @@
   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:
+    //
+    // Assert on the invalid data width
+    //
+    ASSERT (FALSE);
+    break;
+  }
+  
   return Value;
 }
 
@@ -78,7 +96,7 @@
   IN CONST CHAR8  *Description  OPTIONAL
   )
 {
-  IoWrite8 (0x80, (UINT8)(Value));
+  PostCode (Value);
   return Value;
 }
 

Modified: trunk/edk2/MdePkg/MdePkg.dec
===================================================================
--- trunk/edk2/MdePkg/MdePkg.dec        2015-11-10 10:02:24 UTC (rev 18764)
+++ trunk/edk2/MdePkg/MdePkg.dec        2015-11-11 02:16:35 UTC (rev 18765)
@@ -1938,6 +1938,11 @@
   # @Expression  0x80000002 | 
(gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask & 0xFC) == 0
   gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0|UINT8|0x0000000b
 
+  ## 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|0x0000002d
+
   ## This value is used to configure X86 Processor FSB clock.
   # @Prompt FSB Clock.
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock|200000000|UINT32|0x0000000c

Modified: trunk/edk2/MdePkg/MdePkg.uni
===================================================================
--- trunk/edk2/MdePkg/MdePkg.uni        2015-11-10 10:02:24 UTC (rev 18764)
+++ trunk/edk2/MdePkg/MdePkg.uni        2015-11-11 02:16:35 UTC (rev 18765)
@@ -790,4 +790,10 @@
  +++ \ No newline at end of file


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to