diff options
Diffstat (limited to 'Platform')
8 files changed, 46 insertions, 45 deletions
diff --git a/Platform/Qualcomm/Common/QualcommCommonPlatformPkg/Library/PlatformInfoLib/PlatformInfoLib.c b/Platform/Qualcomm/Common/QualcommCommonPlatformPkg/Library/PlatformInfoLib/PlatformInfoLib.c index e8c96674d0..330fb1d9b0 100644 --- a/Platform/Qualcomm/Common/QualcommCommonPlatformPkg/Library/PlatformInfoLib/PlatformInfoLib.c +++ b/Platform/Qualcomm/Common/QualcommCommonPlatformPkg/Library/PlatformInfoLib/PlatformInfoLib.c @@ -10,7 +10,7 @@ #include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
-#include <Library/SmemLib.h>
+#include <Library/QualcommSmemLib.h>
#include "PlatformInfoInternal.h"
/**
@@ -71,7 +71,7 @@ PlatformInfoInit ( )
{
PlatformInfoDrvCtx *DrvCtx;
- UINT32 Size;
+ UINTN Size;
PlatformInfoSmemType *Smem;
EFI_STATUS Status;
@@ -81,8 +81,14 @@ PlatformInfoInit ( return EFI_SUCCESS;
}
- Smem = SmemGetAddr (SmemHwSwBuildId, &Size);
- if (Smem == NULL) {
+ Status = QualcommSmemLookup (
+ QUALCOMM_SMEM_HOST_COMMON,
+ SMEM_HW_SW_BUILD_ID,
+ QUALCOMM_SMEM_FLAG_NONE,
+ (VOID **)&Smem,
+ &Size
+ );
+ if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
diff --git a/Platform/Qualcomm/Common/QualcommCommonPlatformPkg/Library/PlatformInfoLib/PlatformInfoLib.inf b/Platform/Qualcomm/Common/QualcommCommonPlatformPkg/Library/PlatformInfoLib/PlatformInfoLib.inf index c117c1ee23..7ca0c85465 100644 --- a/Platform/Qualcomm/Common/QualcommCommonPlatformPkg/Library/PlatformInfoLib/PlatformInfoLib.inf +++ b/Platform/Qualcomm/Common/QualcommCommonPlatformPkg/Library/PlatformInfoLib/PlatformInfoLib.inf @@ -31,4 +31,4 @@ [LibraryClasses]
BaseMemoryLib
MemoryAllocationLib
- SmemLib
+ QualcommSmemLib
diff --git a/Platform/Qualcomm/GlymurFamily/GlymurMinPlatformPkg/GlymurMinPlatformPkg.dsc.inc b/Platform/Qualcomm/GlymurFamily/GlymurMinPlatformPkg/GlymurMinPlatformPkg.dsc.inc index cf59bb544f..d44122f029 100644 --- a/Platform/Qualcomm/GlymurFamily/GlymurMinPlatformPkg/GlymurMinPlatformPkg.dsc.inc +++ b/Platform/Qualcomm/GlymurFamily/GlymurMinPlatformPkg/GlymurMinPlatformPkg.dsc.inc @@ -123,10 +123,6 @@ gQualcommSiliconPkgTokenSpaceGuid.PcdSmemBaseAddress | 0xFFE00000
gQualcommSiliconPkgTokenSpaceGuid.PcdSmemSize | 0x200000
gQualcommSiliconPkgTokenSpaceGuid.PcdSmemMaxItems | 512
- gQualcommSiliconPkgTokenSpaceGuid.PcdSmemTcsrBase | 0x1f00000
- gQualcommSiliconPkgTokenSpaceGuid.PcdSmemMutexRegBase | 0x00040000
- gQualcommSiliconPkgTokenSpaceGuid.PcdSmemWonceRegBase | 0x000c0000
- gQualcommSiliconPkgTokenSpaceGuid.PcdSmemTargetInfoWonceReg | 0x00000000
#
# gQualcommMinPlatformPkgTokenSpaceGuid Overrides
diff --git a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLib.inf b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLib.inf index 3b3e4e8c96..faf3d798bd 100644 --- a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLib.inf +++ b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLib.inf @@ -43,6 +43,7 @@ PlatformInfoLib
RamPartitionTableLib
SortLib
+ QualcommSmemLib
[Sources.common]
ArmPlatformLib.c
diff --git a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c index 331a1cce52..c7a8f90db7 100644 --- a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c +++ b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c @@ -25,8 +25,8 @@ #include <Library/HobLib.h>
#include <Library/PcdLib.h>
#include <Library/PlatformInfoLib.h>
+#include <Library/QualcommSmemLib.h>
#include <Library/RamPartitionTableLib.h>
-#include <Library/SmemLib.h>
#include <PiPei.h>
#include <Pi/PiHob.h>
@@ -641,7 +641,7 @@ ArmPlatformGetVirtualMemoryMap ( /* Reserved DDR Region for T32 CMM Script */
ArmPlatformSetupDebugBuffer ();
- SmemInit ();
+ QualcommSmemInit ();
DEBUG ((DEBUG_INFO, "SmemInit\n"));
/* Print Chip and Platform Information */
@@ -654,13 +654,13 @@ ArmPlatformGetVirtualMemoryMap ( goto ExitError;
}
- Status = RamPartitionInitRamPartitionTableLib();
+ Status = RamPartitionInitRamPartitionTableLib ();
if (Status != EFI_SUCCESS) {
DEBUG ((DEBUG_ERROR, "InitRamPartitionTableLib failed\n"));
goto ExitError;
}
- DisplayRamPartitionInformation();
+ DisplayRamPartitionInformation ();
/* Try DT-based platform configuration first */
Status = LoadPlatformConfigFromDeviceTree ();
diff --git a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/RamPartitionTableLib/RamPartitionTableLib.c b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/RamPartitionTableLib/RamPartitionTableLib.c index d4c4e02609..3a8985ec34 100644 --- a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/RamPartitionTableLib/RamPartitionTableLib.c +++ b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/RamPartitionTableLib/RamPartitionTableLib.c @@ -15,7 +15,7 @@ #include <Library/DebugLib.h>
#include <Library/RamPartitionTableLib.h>
-#include <Library/SmemLib.h>
+#include <Library/QualcommSmemLib.h>
#include <MemRegionInfo.h>
#include <RamPartition.h>
@@ -87,8 +87,15 @@ RamPartitionGetRamPartitionTable ( BufferSize = 0;
/* Get the RAM partition table */
- *RamPartitionTable = SmemGetAddr (SmemUsableRamPartitionTable, (UINT32 *)&BufferSize);
- if (*RamPartitionTable == NULL) {
+ Status = QualcommSmemLookup (
+ QUALCOMM_SMEM_HOST_COMMON,
+ SMEM_USABLE_RAM_PARTITION_TABLE,
+ QUALCOMM_SMEM_FLAG_NONE,
+ RamPartitionTable,
+ (VOID *)&BufferSize
+ );
+
+ if (Status != EFI_SUCCESS) {
DEBUG ((DEBUG_ERROR, "WARNING: Unable to read memory partition table from SMEM\n"));
return EFI_NOT_READY;
}
@@ -129,8 +136,8 @@ RamPartitionGetInstalledSdramMemory ( UINT32 Index;
UINT32 Version;
- RamPartitionTable = NULL;
- Version = 0;
+ RamPartitionTable = NULL;
+ Version = 0;
if (MemoryCapacity == NULL) {
return EFI_INVALID_PARAMETER;
@@ -188,7 +195,6 @@ RamPartitionGetInstalledPhysicalMemory ( return EFI_INVALID_PARAMETER;
}
-
Status = RamPartitionGetRamPartitionTable (&RamPartitionTable, &Version);
if (Status != EFI_SUCCESS) {
return Status;
@@ -276,7 +282,7 @@ RamPartitionGetLowestPhysicalStartAddress ( SetMem (EntryList, sizeof (EntryList), 0);
EntryCount = RAM_NUM_PART_ENTRIES;
- Status = RamPartitionGetRamPartitions (&EntryCount, EntryList);
+ Status = RamPartitionGetRamPartitions (&EntryCount, EntryList);
if (Status != EFI_SUCCESS) {
return Status;
}
@@ -472,7 +478,6 @@ RamPartitionGetHighestBankBit ( return EFI_INVALID_PARAMETER;
}
-
Status = RamPartitionGetRamPartitionTable (&RamPartitionTable, &Version);
if (Status != EFI_SUCCESS) {
return Status;
@@ -661,9 +666,9 @@ RamPartitionInitRamPartitionTableLib ( RAM_PARTITION_TYPE PartitionType;
UINT64 StartAddr;
- PartitionCategory = Table->RamPartEntry[Index].PartitionCategory;
- PartitionType = Table->RamPartEntry[Index].PartitionType;
- StartAddr = Table->RamPartEntry[Index].StartAddress;
+ PartitionCategory = Table->RamPartEntry[Index].PartitionCategory;
+ PartitionType = Table->RamPartEntry[Index].PartitionType;
+ StartAddr = Table->RamPartEntry[Index].StartAddress;
if ((PartitionType == RamPartitionSysMemory) &&
(PartitionCategory == RamPartitionSdram))
@@ -685,7 +690,6 @@ RamPartitionInitRamPartitionTableLib ( }
}
-
TableEntry = &mRamPartitionTable[mRamPartitionTableEntryCount];
AsciiStrCpyS (TableEntry->Name, MAX_MEM_LABEL_NAME, "RAM Partition");
@@ -762,14 +766,13 @@ RamPartitionGetMinPasrSize ( UINT32 Index;
UINT32 Version;
- RamPartitionTable = NULL;
- Version = 0;
+ RamPartitionTable = NULL;
+ Version = 0;
if (MinPasrSize == NULL) {
return EFI_INVALID_PARAMETER;
}
-
Status = RamPartitionGetRamPartitionTable (&RamPartitionTable, &Version);
if (Status != EFI_SUCCESS) {
return Status;
diff --git a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/RamPartitionTableLib/RamPartitionTableLib.inf b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/RamPartitionTableLib/RamPartitionTableLib.inf index 7dfc956024..683989b445 100644 --- a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/RamPartitionTableLib/RamPartitionTableLib.inf +++ b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/RamPartitionTableLib/RamPartitionTableLib.inf @@ -33,7 +33,7 @@ [LibraryClasses]
DebugLib
- SmemLib
+ QualcommSmemLib
[FixedPcd]
gArmTokenSpaceGuid.PcdSystemMemoryBase
diff --git a/Platform/Qualcomm/QualcommMinPlatformPkg/README.md b/Platform/Qualcomm/QualcommMinPlatformPkg/README.md index 84764e0a1a..a951eefa36 100644 --- a/Platform/Qualcomm/QualcommMinPlatformPkg/README.md +++ b/Platform/Qualcomm/QualcommMinPlatformPkg/README.md @@ -35,7 +35,7 @@ Power-on ├─ Populates RAM Partition Table in SMEM
├─ Writes IMEM cookies to on-chip SRAM
└─► UEFI (QualcommMinPlatformPkg / QualcommSiliconPkg)
- ├─ Reads SMEM via SmemLib
+ ├─ Reads SMEM via QualcommSmemLib
├─ Reads RAM Partition Table from SMEM
├─ Reads IMEM cookies for boot state
└─► HLOS (Linux/Android)
@@ -52,8 +52,7 @@ re-initialize them; it reads what XBL has already established. SMEM is a DDR region that acts as a message-passing bus between the
Application Processor (UEFI/HLOS), Modem, DSPs, RPM, TrustZone, and other
-subsystems. Each item in SMEM is identified by a numeric ID from the
-`SMEM_MEM_TYPE` enum defined in `Silicon/Qualcomm/QualcommSiliconPkg/Include/SmemType.h`.
+subsystems.
### Hardware Configuration
@@ -64,16 +63,12 @@ UEFI locates SMEM using platform-specific PCDs: | `PcdSmemBaseAddress` | `UINT64` | Physical base address of the SMEM DDR region |
| `PcdSmemSize` | `UINT32` | Size of the SMEM region in bytes |
| `PcdSmemMaxItems` | `UINT16` | Maximum number of allocatable SMEM items |
-| `PcdSmemTcsrBase` | `UINT32` | Base address of TCSR registers (spinlock support) |
-| `PcdSmemMutexRegBase` | `UINT32` | Base address of hardware mutex registers |
-| `PcdSmemWonceRegBase` | `UINT32` | Base address of Write-Once registers |
-| `PcdSmemTargetInfoWonceReg` | `UINT32` | Offset of target info register within WONCE space |
### Initialization Contract
XBL initializes SMEM before transferring control to UEFI. UEFI calls
-`SmemInit()` early in `ArmPlatformGetVirtualMemoryMap()` to set up its
-local view of the SMEM region. UEFI must not call `SmemInit()` more than
+`QualcommSmemInit()` early in `ArmPlatformGetVirtualMemoryMap()` to set up its
+local view of the SMEM region. UEFI must not call `QualcommSmemInit()` more than
once.
### SMEM Version Protocol
@@ -92,21 +87,21 @@ A minor version mismatch is tolerated. ### UEFI Usage
UEFI uses SMEM exclusively to retrieve the RAM Partition Table (see §2).
-The relevant SMEM item ID is `SmemUsableRamPartitionTable` (value `402`).
+The relevant SMEM item ID is `SMEM_USABLE_RAM_PARTITION_TABLE` (value `402`).
```c
// Retrieve RAM partition table pointer from SMEM
-RamPartitionTable = SmemGetAddr(SmemUsableRamPartitionTable, &BufferSize);
+QualcommSmemLookup(QUALCOMM_SMEM_HOST_COMMON,
+ SMEM_USABLE_RAM_PARTITION_TABLE,
+ QUALCOMM_SMEM_FLAG_NONE, RamPartitionTable,
+ (VOID *)&BufferSize);
```
### Compatibility Requirements
- The physical address and size of SMEM **must not change** between XBL and
UEFI for a given target. They are fixed at SoC integration time.
-- The `SMEM_MEM_TYPE` enum values are an ABI shared with all subsystems.
- All entries carry **explicit numeric assignments** to prevent accidental
- value shifts when new entries are added.
-- SMEM item IDs used by UEFI (`SmemUsableRamPartitionTable`) must remain
+- SMEM item IDs used by UEFI (`SMEM_USABLE_RAM_PARTITION_TABLE`) must remain
stable across XBL versions.
---
@@ -121,7 +116,7 @@ memory map and build HOBs for the DXE phase. ### Location
-Stored in SMEM at item ID `SmemUsableRamPartitionTable` (value `402`).
+Stored in SMEM at item ID `SMEM_USABLE_RAM_PARTITION_TABLE` (value `402`).
### Structure
|
