QuarkPlatformPkg/PlatformSecureLib: Remove redundant GPIO expander config
authorMichael Kinney <michael.d.kinney@intel.com>
Thu, 7 Jan 2016 22:43:31 +0000 (22:43 +0000)
committermdkinney <mdkinney@Edk2>
Thu, 7 Jan 2016 22:43:31 +0000 (22:43 +0000)
Remove GPIO expander configuration actions that are now performed in
PEI Phase in PlatformInit module.  In order to detect physical presence
only the state of the Reset Button needs to be read.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19621 6f19259b-4bc3-4df7-8a09-765794883524

QuarkPlatformPkg/Library/PlatformSecureLib/PlatformSecureLib.c

index 169980c..7f60c5c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Provides a secure platform-specific method to detect physically present user.\r
 \r
-Copyright (c) 2013 Intel Corporation.\r
+Copyright (c) 2013 - 2016 Intel Corporation.\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -39,25 +39,8 @@ CheckResetButtonState (
   UINTN                   ReadLength;\r
   UINT8                   Buffer[2];\r
 \r
-  DEBUG ((EFI_D_ERROR, "CheckResetButtonState(): mPlatformType == %d\n", mPlatformType));\r
+  DEBUG ((EFI_D_INFO, "CheckResetButtonState(): mPlatformType == %d\n", mPlatformType));\r
   if (mPlatformType == GalileoGen2) {\r
-    //\r
-    //  Reset Button - EXP2.P1_7 should be configured as an input.\r
-    //\r
-    PlatformPcal9555GpioSetDir (\r
-      GALILEO_GEN2_IOEXP2_7BIT_SLAVE_ADDR,  // IO Expander 2.\r
-      15,                                   // P1-7.\r
-      FALSE\r
-      );\r
-\r
-    //\r
-    // Reset Button - EXP2.P1_7 pullup should be disabled.\r
-    //\r
-    PlatformPcal9555GpioDisablePull (\r
-      GALILEO_GEN2_IOEXP2_7BIT_SLAVE_ADDR,  // IO Expander 2.\r
-      15                                    // P1-7.\r
-      );\r
-\r
     //\r
     // Read state of Reset Button - EXP2.P1_7\r
     // This GPIO is pulled high when the button is not pressed\r
@@ -77,58 +60,14 @@ CheckResetButtonState (
     } else {\r
       I2CSlaveAddress.I2CDeviceAddress = GALILEO_IOEXP_J2LO_7BIT_SLAVE_ADDR;\r
     }\r
+    DEBUG ((EFI_D_INFO, "Galileo GPIO Expender Slave Address = %02x\n", I2CSlaveAddress.I2CDeviceAddress));\r
 \r
     //\r
-    // Select Port 5\r
-    //\r
-    Length = 2;\r
-    Buffer[0] = 0x18;\r
-    Buffer[1] = 0x05;\r
-    Status = I2cWriteMultipleByte (\r
-               I2CSlaveAddress,\r
-               EfiI2CSevenBitAddrMode,\r
-               &Length,\r
-               &Buffer\r
-               );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    //\r
-    // Read "Pin Direction" of Port 5\r
-    //\r
-    Length = 1;\r
-    ReadLength = 1;\r
-    Buffer[1] = 0x1C;\r
-    Status = I2cReadMultipleByte (\r
-               I2CSlaveAddress,\r
-               EfiI2CSevenBitAddrMode,\r
-               &Length,\r
-               &ReadLength,\r
-               &Buffer[1]\r
-               );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    //\r
-    // Set "Pin Direction" of Port 5, Bit 0 as input\r
-    //\r
-    Length = 2;\r
-    Buffer[0] = 0x1C;\r
-    Buffer[1] = Buffer[1] | BIT0;\r
-\r
-    Status = I2cWriteMultipleByte (\r
-               I2CSlaveAddress,\r
-               EfiI2CSevenBitAddrMode,\r
-               &Length,\r
-               &Buffer\r
-               );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    //\r
-    // Read Port 5\r
+    // Read state of RESET_N_SHLD (GPORT5_BIT0)\r
     //\r
     Buffer[1] = 5;\r
     Length = 1;\r
     ReadLength = 1;\r
-\r
     Status = I2cReadMultipleByte (\r
                I2CSlaveAddress,\r
                EfiI2CSevenBitAddrMode,\r
@@ -139,7 +78,7 @@ CheckResetButtonState (
     ASSERT_EFI_ERROR (Status);\r
 \r
     //\r
-    // Return the state of Port 5, Bit 0\r
+    // Return the state of GPORT5_BIT0\r
     //\r
     return ((Buffer[1] & BIT0) != 0);\r
   }\r