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