Skip to content

Commit

Permalink
AlderlakeSiliconPkg: Remove unused functions
Browse files Browse the repository at this point in the history
Signed-off-by: Nate DeSimone <[email protected]>
  • Loading branch information
nate-desimone committed Sep 25, 2024
1 parent 8aa7099 commit a513a55
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ GpioLib.c
GpioNativeLib.c
GpioInit.c
GpioLibrary.h

[BuildOptions]
GCC:*_*_*_CC_FLAGS = -Wno-unused-function
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,6 @@ IsSpiFlashWriteGranted (
VOID
);

/**
Check if a save and restore of the SPI controller state is necessary
@retval TRUE It's necessary to save and restore SPI controller state
@retval FALSE It's not necessary to save and restore SPI controller state
**/
BOOLEAN
IsSpiControllerSaveRestoreEnabled (
VOID
);

/**
Read data from the flash part.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,3 @@ IsSpiFlashWriteGranted (
{
return TRUE;
}

/**
Check if a save and restore of the SPI controller state is necessary
@retval TRUE It's necessary to save and restore SPI controller state
@retval FALSE It's not necessary to save and restore SPI controller state
**/
BOOLEAN
IsSpiControllerSaveRestoreEnabled (
VOID
)
{
return FALSE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -433,45 +433,6 @@ WaitForSpiCycleComplete (
return FALSE;
}

/**
This function waits for a pending SPI transaction to complete without clearing
status fields
@param[in] This Pointer to the PCH_SPI2_PROTOCOL instance.
@param[in] PchSpiBar0 SPI MMIO address
@retval TRUE SPI cycle completed on the interface.
@retval FALSE Time out while waiting the SPI cycle to complete.
It's not safe to program the next command on the SPI interface.
**/
BOOLEAN
STATIC
WaitForScipNoClear (
IN PCH_SPI2_PROTOCOL *This,
IN UINTN PchSpiBar0
)
{
UINT64 WaitTicks;
UINT64 WaitCount;
SPI_INSTANCE *SpiInstance;
UINT32 Data32;

SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);

//
// Wait for the SPI cycle to complete.
//
WaitCount = SPI_WAIT_TIME / SPI_WAIT_PERIOD;
for (WaitTicks = 0; WaitTicks < WaitCount; WaitTicks++) {
Data32 = MmioRead32 (PchSpiBar0 + R_SPI_MEM_HSFSC);
if ((Data32 & B_SPI_MEM_HSFSC_SCIP) == 0) {
return TRUE;
}
PchPmTimerStallRuntimeSafe (SpiInstance->PchAcpiBase, SPI_WAIT_PERIOD);
}
return FALSE;
}

/**
This function sends the programmed SPI command to the device.
Expand All @@ -498,7 +459,6 @@ SendSpiCmd (
IN OUT UINT8 *Buffer
)
{
UINT32 FdataSave[16];
EFI_STATUS Status;
UINT32 Index;
SPI_INSTANCE *SpiInstance;
Expand All @@ -512,11 +472,6 @@ SendSpiCmd (
UINT32 SmiEnSave;
UINT16 ABase;
UINT32 HsfstsCtl;
UINT32 FaddrSave;
UINT32 HsfscSave;
BOOLEAN HsfscFdoneSave;
BOOLEAN HsfscFcerrSave;
BOOLEAN RestoreState;

//
// For flash write, there is a requirement that all CPU threads are in SMM
Expand All @@ -532,7 +487,6 @@ SendSpiCmd (
SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
SpiBaseAddress = SpiInstance->PchSpiBase;
ABase = SpiInstance->PchAcpiBase;
RestoreState = FALSE;

//
// Disable SMIs to make sure normal mode flash access is not interrupted by an SMI
Expand Down Expand Up @@ -570,25 +524,6 @@ SendSpiCmd (
);
}

//
// Save current SPI controller state
//
if (IsSpiControllerSaveRestoreEnabled ()) {
if (!WaitForScipNoClear (This, PchSpiBar0)) {
Status = EFI_DEVICE_ERROR;
goto SendSpiCmdEnd;
}
HsfscSave = MmioRead32 (PchSpiBar0 + R_SPI_MEM_HSFSC);
HsfscFdoneSave = ((HsfscSave & B_SPI_MEM_HSFSC_FDONE) != 0) ? TRUE : FALSE;
HsfscFcerrSave = ((HsfscSave & B_SPI_MEM_HSFSC_FCERR) != 0) ? TRUE : FALSE;
HsfscSave &= B_SPI_MEM_HSFSC_SAVE_MASK;
FaddrSave = MmioRead32 (PchSpiBar0 + R_SPI_MEM_FADDR);
for (Index = 0; Index < 64; Index += sizeof (UINT32)) {
FdataSave[Index >> 2] = MmioRead32 (PchSpiBar0 + R_SPI_MEM_FDATA00 + Index);
}
RestoreState = TRUE;
}

//
// Make sure it's safe to program the command.
//
Expand Down
50 changes: 0 additions & 50 deletions Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/Spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mPchSpiBar0RefCount;
// state after finishing commands to the SPI controller.
//
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 mPchSpiSavedPciCmdReg;
GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mBootServiceExited;

/**
This function is invoked at ExitBootServices()
@param[in] Protocol Protocol unique ID.
@param[in] Interface Interface instance.
@param[in] Handle The handle on which the interface is installed..
@retval Status.
**/
EFI_STATUS
EFIAPI
SpiExitBootServicesCallback (
IN CONST EFI_GUID *Protocol,
IN VOID *Interface,
IN EFI_HANDLE Handle
)
{
mBootServiceExited = TRUE;
return EFI_SUCCESS;
}

/**
<b>SPI Runtime SMM Module Entry Point</b>\n
Expand Down Expand Up @@ -115,7 +93,6 @@ InstallPchSpi (
)
{
EFI_STATUS Status;
VOID *Registration;

//
// Init PCH spi reserved MMIO address.
Expand All @@ -124,7 +101,6 @@ InstallPchSpi (
mSpiSavedMmioAddr = 0;
mPchSpiBar0RefCount = 0;
mPchSpiSavedPciCmdReg = 0;
mBootServiceExited = FALSE;

///
/// Allocate pool for SPI protocol instance
Expand All @@ -151,18 +127,6 @@ InstallPchSpi (
return Status;
}

//
// Register ExitBootServices callback
//
Status = gSmst->SmmRegisterProtocolNotify (
&gEdkiiSmmExitBootServicesProtocolGuid,
SpiExitBootServicesCallback,
&Registration
);
if (EFI_ERROR (Status)) {
return Status;
}

//
// Install the SMM PCH_SPI2_PROTOCOL interface
//
Expand Down Expand Up @@ -391,17 +355,3 @@ IsSpiFlashWriteGranted (

return TRUE;
}

/**
Check if a save and restore of the SPI controller state is necessary
@retval TRUE It's necessary to save and restore SPI controller state
@retval FALSE It's not necessary to save and restore SPI controller state
**/
BOOLEAN
IsSpiControllerSaveRestoreEnabled (
VOID
)
{
return mBootServiceExited;
}

0 comments on commit a513a55

Please sign in to comment.