summaryrefslogtreecommitdiff
path: root/Platform/Marvell/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'Platform/Marvell/Applications')
-rw-r--r--Platform/Marvell/Applications/FirmwareUpdate/FUpdate.c24
-rw-r--r--Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c39
2 files changed, 21 insertions, 42 deletions
diff --git a/Platform/Marvell/Applications/FirmwareUpdate/FUpdate.c b/Platform/Marvell/Applications/FirmwareUpdate/FUpdate.c
index 664411a97b..8a2ad3fb54 100644
--- a/Platform/Marvell/Applications/FirmwareUpdate/FUpdate.c
+++ b/Platform/Marvell/Applications/FirmwareUpdate/FUpdate.c
@@ -94,28 +94,18 @@ SpiFlashProbe (
)
{
EFI_STATUS Status;
- UINT32 IdBuffer, Id, RefId;
+ UINT32 FlashIdLen;
+ UINT8 *FlashId;
- Id = PcdGet32 (PcdSpiFlashId);
-
- IdBuffer = CMD_READ_ID & 0xff;
+ FlashId = (UINT8 *)PcdGetPtr (PcdSpiFlashId);
+ FlashIdLen = PcdGetSize (PcdSpiFlashId);
// Read SPI flash ID
- SpiFlashProtocol->ReadId (Slave, sizeof (UINT32), (UINT8 *)&IdBuffer);
-
- // Swap and extract 3 bytes of the ID
- RefId = SwapBytes32 (IdBuffer) >> 8;
-
- if (RefId == 0) {
- Print (L"%s: No SPI flash detected");
- return EFI_DEVICE_ERROR;
- } else if (RefId != Id) {
- Print (L"%s: Unsupported SPI flash detected with ID=%2x\n", CMD_NAME_STRING, RefId);
- return EFI_DEVICE_ERROR;
+ Status = SpiFlashProtocol->ReadId (Slave, FlashIdLen, FlashId);
+ if (EFI_ERROR (Status)) {
+ return SHELL_ABORTED;
}
- Print (L"%s: Detected supported SPI flash with ID=%3x\n", CMD_NAME_STRING, RefId);
-
Status = SpiFlashProtocol->Init (SpiFlashProtocol, Slave);
if (EFI_ERROR(Status)) {
Print (L"%s: Cannot initialize flash device\n", CMD_NAME_STRING);
diff --git a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c b/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c
index 9321f6b47f..7c81bfc0d0 100644
--- a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c
+++ b/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c
@@ -166,37 +166,26 @@ FlashProbe (
)
{
EFI_STATUS Status;
- UINT8 IdBuffer[4];
- UINT32 Id, RefId;
+ UINT32 FlashIdLen;
+ UINT8 *FlashId;
- Id = PcdGet32 (PcdSpiFlashId);
+ FlashId = (UINT8 *)PcdGetPtr (PcdSpiFlashId);
+ FlashIdLen = PcdGetSize (PcdSpiFlashId);
- IdBuffer[0] = CMD_READ_ID;
-
- SpiFlashProtocol->ReadId (
- Slave,
- 4,
- IdBuffer
- );
-
- RefId = (IdBuffer[0] << 16) + (IdBuffer[1] << 8) + IdBuffer[2];
+ Status = SpiFlashProtocol->ReadId (Slave, FlashIdLen, FlashId);
+ if (EFI_ERROR (Status)) {
+ return SHELL_ABORTED;
+ }
- if (RefId == Id) {
- Print (L"sf: Detected supported SPI flash with ID=%3x\n", RefId);
- Status = SpiFlashProtocol->Init (SpiFlashProtocol, Slave);
- if (EFI_ERROR(Status)) {
- Print (L"sf: Cannot initialize flash device\n");
- return SHELL_ABORTED;
- }
- InitFlag = 0;
- return EFI_SUCCESS;
- } else if (RefId != 0) {
- Print (L"sf: Unsupported SPI flash detected with ID=%2x\n", RefId);
+ Status = SpiFlashProtocol->Init (SpiFlashProtocol, Slave);
+ if (EFI_ERROR (Status)) {
+ Print (L"sf: Cannot initialize flash device\n");
return SHELL_ABORTED;
}
- Print (L"sf: No SPI flash detected");
- return SHELL_ABORTED;
+ InitFlag = 0;
+
+ return SHELL_SUCCESS;
}
SHELL_STATUS