161 lines
4.6 KiB
C
161 lines
4.6 KiB
C
/** @file
|
|
NULL SpiAccessLib implementation for SPI Flash Type devices
|
|
|
|
;******************************************************************************
|
|
;* Copyright (c) 2012, Insyde Software Corp. All Rights Reserved.
|
|
;*
|
|
;* You may not reproduce, distribute, publish, display, perform, modify, adapt,
|
|
;* transmit, broadcast, present, recite, release, license or otherwise exploit
|
|
;* any part of this publication in any form, by any means, without the prior
|
|
;* written permission of Insyde Software Corporation.
|
|
;*
|
|
;******************************************************************************
|
|
*/
|
|
|
|
#include <Uefi.h>
|
|
#include <Library/FdSupportLib.h>
|
|
|
|
/**
|
|
Detect and Initialize SPI flash part OpCode and other parameter through PCH
|
|
|
|
@param FlashDevice pointer to FLASH_DEVICE structure
|
|
|
|
@retval EFI_SUCCESS The SPI device was successfully recognized
|
|
@retval EFI_UNSUPPORTED The flash device is not supported by this function
|
|
@retval EFI_DEVICE_ERROR Failed to Recognize the SPI device
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
SpiRecognize (
|
|
IN FLASH_DEVICE *FlashDevice
|
|
)
|
|
{
|
|
return EFI_UNSUPPORTED;
|
|
}
|
|
|
|
/**
|
|
Erase the SPI flash device from LbaWriteAddress through PCH
|
|
|
|
@param FlashDevice pointer to FLASH_DEVICE structure
|
|
@param FlashAddress Target address to be erased
|
|
@param Size The size in bytes to be erased
|
|
|
|
@retval EFI_SUCCESS The SPI device was successfully recognized
|
|
@retval EFI_UNSUPPORTED The flash device is not supported by this function
|
|
@retval EFI_DEVICE_ERROR Failed to erase the target address
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
SpiErase(
|
|
IN FLASH_DEVICE *FlashDevice,
|
|
IN UINTN FlashAddress,
|
|
IN UINTN Size
|
|
)
|
|
{
|
|
return EFI_UNSUPPORTED;
|
|
}
|
|
|
|
/**
|
|
Write the SPI flash device with given address and size through PCH
|
|
|
|
@param FlashDevice pointer to FLASH_DEVICE structure
|
|
@param FlashAddress Destination Offset
|
|
@param SrcAddress Source Offset
|
|
@param SPIBufferSize The size for programming
|
|
@param LbaWriteAddress Write Address
|
|
|
|
@retval EFI_SUCCESS The SPI device was successfully recognized
|
|
@retval EFI_UNSUPPORTED The flash device is not supported by this function
|
|
@retval EFI_DEVICE_ERROR Failed to erase the target address
|
|
|
|
**/
|
|
EFI_STATUS
|
|
SpiProgram (
|
|
IN FLASH_DEVICE *FlashDevice,
|
|
IN UINT8 *FlashAddress,
|
|
IN UINT8 *SrcAddress,
|
|
IN UINTN *SPIBufferSize,
|
|
IN UINTN LbaWriteAddress
|
|
)
|
|
{
|
|
return EFI_UNSUPPORTED;
|
|
}
|
|
|
|
/**
|
|
Read the SPI flash device with given address and size through PCH
|
|
|
|
@param FlashDevice pointer to FLASH_DEVICE structure
|
|
@param DstAddress Destination buffer address
|
|
@param FlashAddress The flash device address to be read
|
|
@param BufferSize The size to be read
|
|
|
|
@retval EFI_SUCCESS The SPI device was successfully recognized
|
|
@retval EFI_UNSUPPORTED The flash device is not supported by this function
|
|
@retval EFI_DEVICE_ERROR Failed to erase the target address
|
|
|
|
**/
|
|
EFI_STATUS
|
|
SpiRead (
|
|
IN FLASH_DEVICE *FlashDevice,
|
|
IN UINT8 *DstAddress,
|
|
IN UINT8 *FlashAddress,
|
|
IN UINTN BufferSize
|
|
)
|
|
{
|
|
return EFI_UNSUPPORTED;
|
|
}
|
|
|
|
|
|
/**
|
|
Get flash number from SPI Descriptor.
|
|
|
|
@param[out] FlashNumber Number of SPI flash devices returned.
|
|
|
|
@retval EFI_SUCCESS Function successfully returned.
|
|
@retval EFI_UNSUPPORTED The SPI flash is not in Descriptor mode.
|
|
**/
|
|
EFI_STATUS
|
|
GetSpiFlashNumber (
|
|
OUT UINT8 *FlashNumber
|
|
)
|
|
{
|
|
return EFI_UNSUPPORTED;
|
|
}
|
|
|
|
/**
|
|
Offset the BIOS address from top of 4G memory address to correct BIOS region
|
|
described in SPI Descriptor.
|
|
|
|
@param[in] MemoryAddress BIOS memory mapped address.
|
|
@param[out] BiosRegionAddress Flash ROM start address + BIOS address in flash ROM.
|
|
|
|
@retval EFI_SUCCESS Function successfully returned.
|
|
@retval EFI_UNSUPPORTED The SPI flash is not in Descriptor mode.
|
|
**/
|
|
EFI_STATUS
|
|
MemoryToBiosRegionAddress (
|
|
IN UINTN MemoryAddress,
|
|
OUT UINTN *BiosRegionAddress
|
|
)
|
|
{
|
|
return EFI_UNSUPPORTED;
|
|
}
|
|
|
|
/**
|
|
Get flash table from platform.
|
|
|
|
@param[in, out] DataBuffer IN: the input buffer address.
|
|
OUT:the flash region table from rom file.
|
|
|
|
@retval EFI_SUCCESS Function successfully returned.
|
|
**/
|
|
EFI_STATUS
|
|
GetSpiPlatformFlashTable (
|
|
IN OUT UINT8 *DataBuffer
|
|
)
|
|
{
|
|
return EFI_UNSUPPORTED;
|
|
}
|