summaryrefslogtreecommitdiff
path: root/BraswellPlatformPkg/Common
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-08-03 13:26:50 +0800
committerGuo Mang <mang.guo@intel.com>2016-08-04 10:29:43 +0800
commit64fffaae10db55389ff69dbbfeb3c15aa8af5ea2 (patch)
tree7c6f28c6c1806b07a2aec30adfba060086a19807 /BraswellPlatformPkg/Common
parent26aab7effb41957820b1696f27bf9aff632473f0 (diff)
downloadedk2-platforms-64fffaae10db55389ff69dbbfeb3c15aa8af5ea2.tar.xz
BraswellPlatformPkg: Restructure code in Common/Flash directory
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com> Reviewed-by: David Wei <david.wei@intel.com>
Diffstat (limited to 'BraswellPlatformPkg/Common')
-rw-r--r--BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbInfo.c1
-rw-r--r--BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbServiceDxe.c1
-rw-r--r--BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmCommon.h1
-rw-r--r--BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmDxe.h1
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.c1
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.h1
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceDxe.c1
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmm.c1
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmComm.h1
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmDxe.c1
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiFlashParts/MX25/MX25.c1
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiFlashParts/W25/W25.c192
-rw-r--r--BraswellPlatformPkg/Common/Flash/SpiFlashParts/W25/W25.inf41
13 files changed, 11 insertions, 233 deletions
diff --git a/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbInfo.c b/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbInfo.c
index 15aae661e9..982a7ed1ed 100644
--- a/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbInfo.c
+++ b/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbInfo.c
@@ -367,3 +367,4 @@ GetFvbInfo (
return EFI_NOT_FOUND;
}
+
diff --git a/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbServiceDxe.c b/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbServiceDxe.c
index 26effe7181..54bdb67ddc 100644
--- a/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbServiceDxe.c
+++ b/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbServiceDxe.c
@@ -195,3 +195,4 @@ DxeFvbInitialize (
return Status;
}
+
diff --git a/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmCommon.h b/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmCommon.h
index a3c6f97829..5bd6429fcb 100644
--- a/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmCommon.h
+++ b/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmCommon.h
@@ -73,3 +73,4 @@ typedef struct {
} SMM_FVB_BLOCKS_HEADER;
#endif
+
diff --git a/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmDxe.h b/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmDxe.h
index cee43bae72..60cec3ec21 100644
--- a/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmDxe.h
+++ b/BraswellPlatformPkg/Common/Flash/FvbRuntimeDxe/FvbSmmDxe.h
@@ -229,3 +229,4 @@ FvbEraseBlocks (
);
#endif
+
diff --git a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.c b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.c
index d4eaced0d4..952e220567 100644
--- a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.c
+++ b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.c
@@ -657,3 +657,4 @@ SpiFlashInit (
return Status;
}
+
diff --git a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.h b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.h
index cb8229629d..9582173338 100644
--- a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.h
+++ b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDevice.h
@@ -209,3 +209,4 @@ SpiFlashInit (
);
#endif
+
diff --git a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceDxe.c b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceDxe.c
index 907b8e9517..8bff7465af 100644
--- a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceDxe.c
+++ b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceDxe.c
@@ -150,3 +150,4 @@ ReadUsingMmio (
{
return (BOOLEAN) ((SpiOffset >= BIOS_REGION_FLASH_OFFSET) && (SpiOffset < (BIOS_REGION_FLASH_OFFSET + PcdGet32 (PcdBiosImageSize))) && (!EfiAtRuntime ()));
}
+
diff --git a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmm.c b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmm.c
index 7d02aff9d0..7c5c929bf6 100644
--- a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmm.c
+++ b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmm.c
@@ -220,3 +220,4 @@ ReadUsingMmio (
{
return (BOOLEAN) ((SpiOffset >= BIOS_REGION_FLASH_OFFSET) && (SpiOffset < (BIOS_REGION_FLASH_OFFSET + PcdGet32 (PcdBiosImageSize))));
}
+
diff --git a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmComm.h b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmComm.h
index ee2d0a42a4..a446ad8da6 100644
--- a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmComm.h
+++ b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmComm.h
@@ -71,3 +71,4 @@ typedef struct {
} SMM_SPI_DEV_SET_RANGE_HEADER;
#endif
+
diff --git a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmDxe.c b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmDxe.c
index 392c549a95..a8b60d34e8 100644
--- a/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmDxe.c
+++ b/BraswellPlatformPkg/Common/Flash/SpiDeviceDxe/SpiDeviceSmmDxe.c
@@ -435,3 +435,4 @@ SmmSpiDeviceReady (
);
ASSERT_EFI_ERROR (Status);
}
+
diff --git a/BraswellPlatformPkg/Common/Flash/SpiFlashParts/MX25/MX25.c b/BraswellPlatformPkg/Common/Flash/SpiFlashParts/MX25/MX25.c
index 424dcc3186..0d8c3fbf3c 100644
--- a/BraswellPlatformPkg/Common/Flash/SpiFlashParts/MX25/MX25.c
+++ b/BraswellPlatformPkg/Common/Flash/SpiFlashParts/MX25/MX25.c
@@ -206,3 +206,4 @@ SpiFlashPart (
return Status;
}
+
diff --git a/BraswellPlatformPkg/Common/Flash/SpiFlashParts/W25/W25.c b/BraswellPlatformPkg/Common/Flash/SpiFlashParts/W25/W25.c
deleted file mode 100644
index b23351d23d..0000000000
--- a/BraswellPlatformPkg/Common/Flash/SpiFlashParts/W25/W25.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/** @file
- WINBOND W25*** family SPI flash support
-
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Protocol/SpiFlashPart.h>
-#include <Library/DebugLib.h>
-
-
-//
-// Initialization data that can be used to identify SPI flash part
-// DeviceId0 Device ID0 of the SPI device
-// DeviceId1 Device ID1 of the SPI device
-//
-typedef struct _SPI_CHIP_ID {
- UINT8 DeviceId0;
- UINT8 DeviceId1;
-} SPI_CHIP_ID;
-
-//
-// Flash VendorId and DeviceId
-//
-
-#define SF_VENDOR_ID_WINBOND 0xEF
-#define SF_DEVICE_ID0_W25XXX 0x30
-#define SF_DEVICE_ID1_W25X32 0x16
-#define SF_DEVICE_ID1_W25X64 0x17
-#define SF_DEVICE_ID0_W25QXX 0x60
-#define SF_DEVICE_ID0_W25QXX2 0x40
-#define SF_DEVICE_ID1_W25Q16 0x15
-#define SF_DEVICE_ID1_W25Q32 0x16
-#define SF_DEVICE_ID1_W25Q64 0x17
-#define SF_DEVICE_ID1_W25Q128 0x18
-
-//
-// Generic SPI flash part description
-//
-CONST FLASH_PART_DESCRIPTION mFlashDescription = {
- L"WINBOND W25Q*** family", // Part number
- 1, // Number of status bytes
- 0x06, // Write enable
- 0x50, // Write status enable
- 3, // Length of JEDEC ID response
- 8, // Number of opcodes in the table
-
- // Opcode table
- {
- {33000000, 3, FALSE, 0x9f, 0, SPI_FLASH_PART_OPCODE_JEDEC_ID},
- {50000000, 1, FALSE, 0x05, 0, SPI_FLASH_PART_OPCODE_READ_STATUS},
- {50000000, 1, TRUE, 0x01, 0, SPI_FLASH_PART_OPCODE_WRITE_STATUS},
- {33000000, 0xffffffff, FALSE, 0x03, 3, SPI_FLASH_PART_OPCODE_READ_BYTES},
- {50000000, 1, TRUE, 0x02, 3, SPI_FLASH_PART_OPCODE_WRITE_256_BYTE_PAGE},
- {50000000, 0, TRUE, 0x20, 3, SPI_FLASH_PART_OPCODE_ERASE_4K_BYTE_BLOCK},
- {50000000, 0, TRUE, 0xd8, 3, SPI_FLASH_PART_OPCODE_ERASE_64K_BYTE_BLOCK},
- {50000000, 0, TRUE, 0x5a, 0, SPI_FLASH_PART_OPCODE_WRITE_DISABLE_DISCOVERY}
- }
-};
-
-SPI_CHIP_ID mSpiChipIdTable[] = {
- {
- SF_DEVICE_ID0_W25QXX, // DeviceId 0
- SF_DEVICE_ID1_W25Q64 // DeviceId 1
- },
- {
- SF_DEVICE_ID0_W25QXX2, // DeviceId 0
- SF_DEVICE_ID1_W25Q64 // DeviceId 1
- }
-};
-
-/**
- Get the flash part size and opcode table.
-
- Validate support for this flash part and determine
- the flash part size and opcode description table
- from the JEDEC ID information provided.
-
- @param[in] This Pointer to a SPI_FLASH_DATA_PROTOCOL
- data structure.
- @param[in] JedecId Pointer to a three byte buffer containing
- the JEDEC ID returned by the flash part.
- If the input value is NULL then a
- table containing the description for the
- JEDEC ID opcode is returned by this
- routine.
- @param[out] FlashSize Pointer to receive the size of the flash
- part in bytes. Zero (0) is returned when
- JedecId is NULL.
- @returns When JedecId is not NULL, this routine returns a pointer
- to a FLASH_PART_DESCRIPTION data structure which supports
- this flash part. The returned value is NULL if the flash
- part is not supported.
- When JedecId is NULL, this routine returns a pointer to
- a FLASH_PART_DESCRIPTION structure which supports the
- JEDEC ID command. This opcode description may be used
- to determine the manufacture and product data for the
- SPI flash part.
-
-**/
-CONST FLASH_PART_DESCRIPTION *
-EFIAPI
-GetFlashDescription (
- IN SPI_FLASH_PART_PROTOCOL *This,
- IN UINT8 *JedecId OPTIONAL,
- OUT UINT64 *FlashSize OPTIONAL
- )
-{
- CONST FLASH_PART_DESCRIPTION *FlashDescription;
- UINT8 Shift;
- UINT64 Size;
- UINTN Index;
-
- //
- // Determine if the SPI flash device is supported
- //
- Size = 0;
- FlashDescription = &mFlashDescription;
- if (JedecId != NULL) {
- FlashDescription = NULL;
- if (JedecId [0] != SF_VENDOR_ID_WINBOND)
- return NULL;
-
- for (Index = 0;Index < (sizeof (mSpiChipIdTable) / sizeof (SPI_CHIP_ID));Index++) {
- if ((JedecId [1] == mSpiChipIdTable[Index].DeviceId0)
- && (JedecId [2] == mSpiChipIdTable[Index].DeviceId1))
- break;
- }
-
- if (Index >= (sizeof (mSpiChipIdTable) / sizeof (SPI_CHIP_ID)))
- return NULL;
-
- Shift = JedecId[2];
- if (Shift < 64) {
- Size = LShiftU64 (1, Shift);
- FlashDescription = &mFlashDescription;
- }
- }
-
- //
- // Return the flash size
- //
- if (FlashSize != NULL) {
- *FlashSize = Size;
- }
-
- return FlashDescription;
-}
-
-SPI_FLASH_PART_PROTOCOL mSpiFlashPartProtocol = {
- 0xC0000000, /// SPI flash part family priority
- GetFlashDescription
-};
-
-/**
- Indicate that all the SPI devices are available
-
- @retval EFI_SUCCESS SPI flash part protocol installed successfully
-
-**/
-EFI_STATUS
-EFIAPI
-SpiFlashPart (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Install the SPI flash part protocol
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &gImageHandle,
- &gSpiFlashPartProtocolGuid,
- &mSpiFlashPartProtocol,
- NULL
- );
-
- return Status;
-}
diff --git a/BraswellPlatformPkg/Common/Flash/SpiFlashParts/W25/W25.inf b/BraswellPlatformPkg/Common/Flash/SpiFlashParts/W25/W25.inf
deleted file mode 100644
index d48ca15a09..0000000000
--- a/BraswellPlatformPkg/Common/Flash/SpiFlashParts/W25/W25.inf
+++ /dev/null
@@ -1,41 +0,0 @@
-## @file
-# WINBOND W25*** family SPI flash support
-#
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010018
- BASE_NAME = W25XXX
- FILE_GUID = 1EAFA124-4F73-45B3-B749-8E7F80741CE4
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = SpiFlashPart
-
-[Sources]
- W25.c
-
-[Packages]
- MdePkg/MdePkg.dec
- BraswellPlatformPkg/BraswellPlatformPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- BaseLib
- UefiBootServicesTableLib
-
-[Protocols]
- gSpiFlashPartProtocolGuid ## PRODUCES
-
-[Depex]
- TRUE
-