[edk2,20/21] ArmVirtPkg/VirtFdtDxe: drop RTC handling

Message ID 1459959319-19293-21-git-send-email-ard.biesheuvel@linaro.org
State Superseded
Headers show

Commit Message

Ard Biesheuvel April 6, 2016, 4:15 p.m.
The RTC driver no longer relies on VirtFdtDxe to set the pl031 RTC base
address in a dynamic PCD, so drop the handling altogether.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 36 --------------------
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf |  6 ----
 2 files changed, 42 deletions(-)

-- 
2.5.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Ard Biesheuvel April 7, 2016, 8:28 a.m. | #1
On 6 April 2016 at 18:15, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> The RTC driver no longer relies on VirtFdtDxe to set the pl031 RTC base

> address in a dynamic PCD, so drop the handling altogether.

>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Note: I accidentally dropped the config table install as well, which
breaks DT booting. It would be good to decide where this should occur
after we get rid of VirtFdtDxe completely.

> ---

>  ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 36 --------------------

>  ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf |  6 ----

>  2 files changed, 42 deletions(-)

>

> diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c

> index 31e0ca7db8b4..0eb4932606ea 100644

> --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c

> +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c

> @@ -42,7 +42,6 @@ typedef struct {

>

>  typedef enum {

>    PropertyTypeUnknown,

> -  PropertyTypeRtc,

>    PropertyTypeVirtio,

>    PropertyTypeUart,

>    PropertyTypeXen,

> @@ -54,7 +53,6 @@ typedef struct {

>  } PROPERTY;

>

>  STATIC CONST PROPERTY CompatibleProperties[] = {

> -  { PropertyTypeRtc,     "arm,pl031"             },

>    { PropertyTypeVirtio,  "virtio,mmio"           },

>    { PropertyTypeUart,    "arm,pl011"             },

>    { PropertyTypeXen,     "xen,xen"               },

> @@ -96,7 +94,6 @@ InitializeVirtFdtDxe (

>    VOID                           *Hob;

>    VOID                           *DeviceTreeBase;

>    INT32                          Node, Prev;

> -  INT32                          RtcNode;

>    EFI_STATUS                     Status;

>    CONST CHAR8                    *Type;

>    INT32                          Len;

> @@ -119,7 +116,6 @@ InitializeVirtFdtDxe (

>

>    DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, DeviceTreeBase));

>

> -  RtcNode = -1;

>    //

>    // Now enumerate the nodes and install peripherals that we are interested in,

>    // i.e., GIC, RTC and virtio MMIO nodes

> @@ -196,18 +192,6 @@ InitializeVirtFdtDxe (

>        }

>        break;

>

> -    case PropertyTypeRtc:

> -      ASSERT (Len == 16);

> -

> -      RegBase = fdt64_to_cpu (((UINT64 *)RegProp)[0]);

> -      ASSERT (RegBase < MAX_UINT32);

> -

> -      PcdSet32 (PcdPL031RtcBase, (UINT32)RegBase);

> -

> -      DEBUG ((EFI_D_INFO, "Found PL031 RTC @ 0x%Lx\n", RegBase));

> -      RtcNode = Node;

> -      break;

> -

>      case PropertyTypeXen:

>        ASSERT (Len == 16);

>

> @@ -233,25 +217,5 @@ InitializeVirtFdtDxe (

>      }

>    }

>

> -  if (!FeaturePcdGet (PcdPureAcpiBoot)) {

> -    //

> -    // Only install the FDT as a configuration table if we want to leave it up

> -    // to the OS to decide whether it prefers ACPI over DT.

> -    //

> -    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);

> -    ASSERT_EFI_ERROR (Status);

> -

> -    //

> -    // UEFI takes ownership of the RTC hardware, and exposes its functionality

> -    // through the UEFI Runtime Services GetTime, SetTime, etc. This means we

> -    // need to disable it in the device tree to prevent the OS from attaching its

> -    // device driver as well.

> -    //

> -    if ((RtcNode != -1) &&

> -        fdt_setprop_string (DeviceTreeBase, RtcNode, "status",

> -          "disabled") != 0) {

> -      DEBUG ((EFI_D_WARN, "Failed to set PL031 status to 'disabled'\n"));

> -    }

> -  }

>    return EFI_SUCCESS;

>  }

> diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf

> index 8ebce337747f..dcad1e085e5b 100644

> --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf

> +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf

> @@ -49,12 +49,6 @@ [Guids]

>    gVirtioMmioTransportGuid

>    gFdtHobGuid

>

> -[Pcd]

> -  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase

> -

> -[FeaturePcd]

> -  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot

> -

>  [Protocols]

>    gEfiDevicePathProtocolGuid

>

> --

> 2.5.0

>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Patch

diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
index 31e0ca7db8b4..0eb4932606ea 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -42,7 +42,6 @@  typedef struct {
 
 typedef enum {
   PropertyTypeUnknown,
-  PropertyTypeRtc,
   PropertyTypeVirtio,
   PropertyTypeUart,
   PropertyTypeXen,
@@ -54,7 +53,6 @@  typedef struct {
 } PROPERTY;
 
 STATIC CONST PROPERTY CompatibleProperties[] = {
-  { PropertyTypeRtc,     "arm,pl031"             },
   { PropertyTypeVirtio,  "virtio,mmio"           },
   { PropertyTypeUart,    "arm,pl011"             },
   { PropertyTypeXen,     "xen,xen"               },
@@ -96,7 +94,6 @@  InitializeVirtFdtDxe (
   VOID                           *Hob;
   VOID                           *DeviceTreeBase;
   INT32                          Node, Prev;
-  INT32                          RtcNode;
   EFI_STATUS                     Status;
   CONST CHAR8                    *Type;
   INT32                          Len;
@@ -119,7 +116,6 @@  InitializeVirtFdtDxe (
 
   DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, DeviceTreeBase));
 
-  RtcNode = -1;
   //
   // Now enumerate the nodes and install peripherals that we are interested in,
   // i.e., GIC, RTC and virtio MMIO nodes
@@ -196,18 +192,6 @@  InitializeVirtFdtDxe (
       }
       break;
 
-    case PropertyTypeRtc:
-      ASSERT (Len == 16);
-
-      RegBase = fdt64_to_cpu (((UINT64 *)RegProp)[0]);
-      ASSERT (RegBase < MAX_UINT32);
-
-      PcdSet32 (PcdPL031RtcBase, (UINT32)RegBase);
-
-      DEBUG ((EFI_D_INFO, "Found PL031 RTC @ 0x%Lx\n", RegBase));
-      RtcNode = Node;
-      break;
-
     case PropertyTypeXen:
       ASSERT (Len == 16);
 
@@ -233,25 +217,5 @@  InitializeVirtFdtDxe (
     }
   }
 
-  if (!FeaturePcdGet (PcdPureAcpiBoot)) {
-    //
-    // Only install the FDT as a configuration table if we want to leave it up
-    // to the OS to decide whether it prefers ACPI over DT.
-    //
-    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);
-    ASSERT_EFI_ERROR (Status);
-
-    //
-    // UEFI takes ownership of the RTC hardware, and exposes its functionality
-    // through the UEFI Runtime Services GetTime, SetTime, etc. This means we
-    // need to disable it in the device tree to prevent the OS from attaching its
-    // device driver as well.
-    //
-    if ((RtcNode != -1) &&
-        fdt_setprop_string (DeviceTreeBase, RtcNode, "status",
-          "disabled") != 0) {
-      DEBUG ((EFI_D_WARN, "Failed to set PL031 status to 'disabled'\n"));
-    }
-  }
   return EFI_SUCCESS;
 }
diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
index 8ebce337747f..dcad1e085e5b 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
@@ -49,12 +49,6 @@  [Guids]
   gVirtioMmioTransportGuid
   gFdtHobGuid
 
-[Pcd]
-  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase
-
-[FeaturePcd]
-  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot
-
 [Protocols]
   gEfiDevicePathProtocolGuid