diff mbox

[edk2,6/7] ArmVirtPkg: record GIC revision in dynamic PCD

Message ID 1432902820-18721-7-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel May 29, 2015, 12:33 p.m. UTC
In order to allow a ArmGicArchLib to be implemented that returns
the supported GIC revision based on the device tree, add handling
to VirtFdtDxe to record the GIC revision at DT parsing time.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmVirtPkg/ArmVirtPkg.dec            | 7 ++++++-
 ArmVirtPkg/ArmVirtQemu.dsc           | 1 +
 ArmVirtPkg/ArmVirtXen.dsc            | 1 +
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 2 ++
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)

Comments

Ard Biesheuvel June 2, 2015, 10:48 a.m. UTC | #1
On 1 June 2015 at 20:11, Laszlo Ersek <lersek@redhat.com> wrote:
> On 05/29/15 14:33, Ard Biesheuvel wrote:
>> In order to allow a ArmGicArchLib to be implemented that returns
>> the supported GIC revision based on the device tree, add handling
>> to VirtFdtDxe to record the GIC revision at DT parsing time.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>  ArmVirtPkg/ArmVirtPkg.dec            | 7 ++++++-
>>  ArmVirtPkg/ArmVirtQemu.dsc           | 1 +
>>  ArmVirtPkg/ArmVirtXen.dsc            | 1 +
>>  ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 2 ++
>>  ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf | 1 +
>>  5 files changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
>> index 7bbd9fff570e..bf8de4db97be 100644
>> --- a/ArmVirtPkg/ArmVirtPkg.dec
>> +++ b/ArmVirtPkg/ArmVirtPkg.dec
>> @@ -61,6 +61,11 @@
>>    gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0|UINT64|0x00000004
>>    gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0|UINT64|0x00000005
>>
>> +  #
>> +  # Supported GIC revision (2, 3, ...)
>> +  #
>> +  gArmVirtTokenSpaceGuid.PcdArmGicRevision|0x0|UINT32|0x00000006
>> +
>>  [PcdsFeatureFlag]
>>    #
>>    # "Map PCI MMIO as Cached"
>> @@ -84,4 +89,4 @@
>>    #
>>    # The default is to turn off the kludge; DSC's can selectively enable it.
>>    #
>> -  gArmVirtTokenSpaceGuid.PcdKludgeMapPciMmioAsCached|FALSE|BOOLEAN|0x00000006
>> +  gArmVirtTokenSpaceGuid.PcdKludgeMapPciMmioAsCached|FALSE|BOOLEAN|0x00000007
>
> This is not a problem, but usually we don't shift preexistent PCD
> numbers, just locate the highest value in the DEC file, and assign the
> next one to the next PCD.
>

OK, I wondered about that. I will leave it like this for now, but I
won't bother next time.

>> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
>> index 374cf7a9ee02..592f07ee6d38 100644
>> --- a/ArmVirtPkg/ArmVirtQemu.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
>> @@ -192,6 +192,7 @@
>>    gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
>>    gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
>>    gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
>> +  gArmVirtTokenSpaceGuid.PcdArmGicRevision|0x0
>>
>>    ## PL031 RealTimeClock
>>    gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
>> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
>> index 3a53debedd2c..b4007ff3c6a4 100644
>> --- a/ArmVirtPkg/ArmVirtXen.dsc
>> +++ b/ArmVirtPkg/ArmVirtXen.dsc
>> @@ -127,6 +127,7 @@
>>    gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
>>    gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
>>    gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
>> +  gArmVirtTokenSpaceGuid.PcdArmGicRevision|0x0
>>
>>    ## PL031 RealTimeClock
>>    gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
>> diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
>> index c9a181a871b8..73db63078ffb 100644
>> --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
>> +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
>> @@ -441,6 +441,7 @@ InitializeVirtFdtDxe (
>>
>>        PcdSet32 (PcdGicDistributorBase, (UINT32)DistBase);
>>        PcdSet32 (PcdGicInterruptInterfaceBase, (UINT32)CpuBase);
>> +      PcdSet32 (PcdArmGicRevision, 2);
>>
>>        DEBUG ((EFI_D_INFO, "Found GIC @ 0x%Lx/0x%Lx\n", DistBase, CpuBase));
>>        break;
>> @@ -470,6 +471,7 @@ InitializeVirtFdtDxe (
>>
>>        PcdSet32 (PcdGicDistributorBase, (UINT32)DistBase);
>>        PcdSet32 (PcdGicRedistributorsBase, (UINT32)RedistBase);
>> +      PcdSet32 (PcdArmGicRevision, 3);
>>
>>        DEBUG ((EFI_D_INFO, "Found GIC v3 (re)distributor @ 0x%Lx (0x%Lx)\n",
>>          DistBase, RedistBase));
>> diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
>> index 3477db039f93..657b4e88019d 100644
>> --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
>> +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
>> @@ -53,6 +53,7 @@
>>    gArmVirtTokenSpaceGuid.PcdArmPsciMethod
>>    gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress
>>    gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress
>> +  gArmVirtTokenSpaceGuid.PcdArmGicRevision
>>    gArmTokenSpaceGuid.PcdGicDistributorBase
>>    gArmTokenSpaceGuid.PcdGicRedistributorsBase
>>    gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
>>
>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks,
Ard.

------------------------------------------------------------------------------
diff mbox

Patch

diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index 7bbd9fff570e..bf8de4db97be 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -61,6 +61,11 @@ 
   gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0|UINT64|0x00000004
   gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0|UINT64|0x00000005
 
+  #
+  # Supported GIC revision (2, 3, ...)
+  #
+  gArmVirtTokenSpaceGuid.PcdArmGicRevision|0x0|UINT32|0x00000006
+
 [PcdsFeatureFlag]
   #
   # "Map PCI MMIO as Cached"
@@ -84,4 +89,4 @@ 
   #
   # The default is to turn off the kludge; DSC's can selectively enable it.
   #
-  gArmVirtTokenSpaceGuid.PcdKludgeMapPciMmioAsCached|FALSE|BOOLEAN|0x00000006
+  gArmVirtTokenSpaceGuid.PcdKludgeMapPciMmioAsCached|FALSE|BOOLEAN|0x00000007
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 374cf7a9ee02..592f07ee6d38 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -192,6 +192,7 @@ 
   gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
   gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
+  gArmVirtTokenSpaceGuid.PcdArmGicRevision|0x0
 
   ## PL031 RealTimeClock
   gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 3a53debedd2c..b4007ff3c6a4 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -127,6 +127,7 @@ 
   gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
   gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
+  gArmVirtTokenSpaceGuid.PcdArmGicRevision|0x0
 
   ## PL031 RealTimeClock
   gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
index c9a181a871b8..73db63078ffb 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -441,6 +441,7 @@  InitializeVirtFdtDxe (
 
       PcdSet32 (PcdGicDistributorBase, (UINT32)DistBase);
       PcdSet32 (PcdGicInterruptInterfaceBase, (UINT32)CpuBase);
+      PcdSet32 (PcdArmGicRevision, 2);
 
       DEBUG ((EFI_D_INFO, "Found GIC @ 0x%Lx/0x%Lx\n", DistBase, CpuBase));
       break;
@@ -470,6 +471,7 @@  InitializeVirtFdtDxe (
 
       PcdSet32 (PcdGicDistributorBase, (UINT32)DistBase);
       PcdSet32 (PcdGicRedistributorsBase, (UINT32)RedistBase);
+      PcdSet32 (PcdArmGicRevision, 3);
 
       DEBUG ((EFI_D_INFO, "Found GIC v3 (re)distributor @ 0x%Lx (0x%Lx)\n",
         DistBase, RedistBase));
diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
index 3477db039f93..657b4e88019d 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
@@ -53,6 +53,7 @@ 
   gArmVirtTokenSpaceGuid.PcdArmPsciMethod
   gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress
   gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress
+  gArmVirtTokenSpaceGuid.PcdArmGicRevision
   gArmTokenSpaceGuid.PcdGicDistributorBase
   gArmTokenSpaceGuid.PcdGicRedistributorsBase
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase