Skip to content

Commit

Permalink
8992: Fix 950 (MSM8992) PMIC reset (#83)
Browse files Browse the repository at this point in the history
* 8992: add IMEM2 region MMU mapping
* SPMI: Map 8992 IMEM2 memory at runtime
* Reset: add 8992 support
  • Loading branch information
imbushuo authored Mar 15, 2021
1 parent d6162d4 commit 7c20479
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Include/Configuration/DeviceMemoryMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ static ARM_MEMORY_REGION_DESCRIPTOR_EX gDeviceMemoryDescriptorEx[] = {
{0xFE87F000, 0x00001000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_INITIALIZED, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
AddDev, EfiConventionalMemory},
/* MSM8992 platform needs another section of IMEM */
#if SILICON_PLATFORM == 8992
{0xFE80F000, 0x00001000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_INITIALIZED, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
AddDev, EfiConventionalMemory},
#endif

/* Register regions */
/* IMEM SMEM Base */
Expand All @@ -188,6 +194,12 @@ static ARM_MEMORY_REGION_DESCRIPTOR_EX gDeviceMemoryDescriptorEx[] = {
{0xFE87F000, 0x00001000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
AddDev, EfiMemoryMappedIO},
/* MSM8992 platform needs another section of IMEM */
#if SILICON_PLATFORM == 8992
{0xFE80F000, 0x00001000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
AddDev, EfiMemoryMappedIO},
#endif
/* TERMINATOR */
{0xF9000000, 0x00113000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
Expand Down Expand Up @@ -433,6 +445,12 @@ static ARM_MEMORY_REGION_DESCRIPTOR_EX gDeviceMemoryDescriptor4GBEx[] = {
{0xFE87F000, 0x00001000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_INITIALIZED, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
AddDev, EfiConventionalMemory},
/* MSM8992 platform needs another section of IMEM */
#if SILICON_PLATFORM == 8992
{0xFE80F000, 0x00001000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_INITIALIZED, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
AddDev, EfiConventionalMemory},
#endif

/* Register regions */
/* IMEM SMEM Base */
Expand All @@ -443,6 +461,12 @@ static ARM_MEMORY_REGION_DESCRIPTOR_EX gDeviceMemoryDescriptor4GBEx[] = {
{0xFE87F000, 0x00001000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
AddDev, EfiMemoryMappedIO},
/* MSM8992 platform needs another section of IMEM */
#if SILICON_PLATFORM == 8992
{0xFE80F000, 0x00001000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
AddDev, EfiMemoryMappedIO},
#endif
/* TERMINATOR */
{0xF9000000, 0x00113000, EFI_RESOURCE_MEMORY_MAPPED_IO,
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,
Expand Down
7 changes: 7 additions & 0 deletions Library/QcomPmicResetSystemLib/QcomPmicResetSystemLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,14 @@ LibInitializeResetSystem(

// Set Address
pPonPsHoldAddressVirtual = MPM2_MPM_PS_HOLD;

#if SILICON_PLATFORM == 8994
pResetReasonAddressVirtual = RESTART_REASON_ADDR;
#elif SILICON_PLATFORM == 8992
pResetReasonAddressVirtual = RESTART_REASON_ADDR2;
#else
#error "Not a valid MSM platform"
#endif

// Register Virtual Address Change event.
Status = gBS->CreateEventEx(
Expand Down
17 changes: 17 additions & 0 deletions Library/RuntimeSpmiMemoryConfiguratorLib/RuntimeSpmiMemoryConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,23 @@ RtSpmiConfigMemory(VOID)
goto exit;
}

#if SILICON_PLATFORM == 8992
Status = gDS->GetMemorySpaceDescriptor(
ROUND_TO_PAGE(MSM_SHARED_IMEM_BASE2), &imemRegionMemoryDescriptor);

if (EFI_ERROR(Status))
goto exit;

if (!(imemRegionMemoryDescriptor.Attributes & EFI_MEMORY_RUNTIME)) {
Status = gDS->SetMemorySpaceAttributes(
ROUND_TO_PAGE(MSM_SHARED_IMEM_BASE2), EFI_PAGE_SIZE,
imemRegionMemoryDescriptor.Attributes | EFI_MEMORY_RUNTIME);

if (EFI_ERROR(Status))
goto exit;
}
#endif

Status = gDS->GetMemorySpaceDescriptor(
ROUND_TO_PAGE(SPMI_BASE), &spmiMemoryDescriptor);

Expand Down

0 comments on commit 7c20479

Please sign in to comment.