]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
EmbeddedPkg: Apply uncrustify changes
[mirror_edk2.git] / EmbeddedPkg / Drivers / FdtClientDxe / FdtClientDxe.c
index 45bed5e776c10b04f2c59eb5e1457acc13971057..b182c77d19b1c66f96eb9dc5034f68cd47b99d65 100644 (file)
@@ -26,14 +26,14 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 GetNodeProperty (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  IN  INT32                   Node,\r
-  IN  CONST CHAR8             *PropertyName,\r
-  OUT CONST VOID              **Prop,\r
-  OUT UINT32                  *PropSize OPTIONAL\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  IN  INT32                Node,\r
+  IN  CONST CHAR8          *PropertyName,\r
+  OUT CONST VOID           **Prop,\r
+  OUT UINT32               *PropSize OPTIONAL\r
   )\r
 {\r
-  INT32 Len;\r
+  INT32  Len;\r
 \r
   ASSERT (mDeviceTreeBase != NULL);\r
   ASSERT (Prop != NULL);\r
@@ -46,6 +46,7 @@ GetNodeProperty (
   if (PropSize != NULL) {\r
     *PropSize = Len;\r
   }\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -53,14 +54,14 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 SetNodeProperty (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  IN  INT32                   Node,\r
-  IN  CONST CHAR8             *PropertyName,\r
-  IN  CONST VOID              *Prop,\r
-  IN  UINT32                  PropSize\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  IN  INT32                Node,\r
+  IN  CONST CHAR8          *PropertyName,\r
+  IN  CONST VOID           *Prop,\r
+  IN  UINT32               PropSize\r
   )\r
 {\r
-  INT32 Ret;\r
+  INT32  Ret;\r
 \r
   ASSERT (mDeviceTreeBase != NULL);\r
 \r
@@ -75,11 +76,11 @@ SetNodeProperty (
 STATIC\r
 BOOLEAN\r
 IsNodeEnabled (\r
-  INT32                       Node\r
+  INT32  Node\r
   )\r
 {\r
-  CONST CHAR8   *NodeStatus;\r
-  INT32         Len;\r
+  CONST CHAR8  *NodeStatus;\r
+  INT32        Len;\r
 \r
   //\r
   // A missing status property implies 'ok' so ignore any errors that\r
@@ -90,12 +91,15 @@ IsNodeEnabled (
   if (NodeStatus == NULL) {\r
     return TRUE;\r
   }\r
-  if (Len >= 5 && AsciiStrCmp (NodeStatus, "okay") == 0) {\r
+\r
+  if ((Len >= 5) && (AsciiStrCmp (NodeStatus, "okay") == 0)) {\r
     return TRUE;\r
   }\r
-  if (Len >= 3 && AsciiStrCmp (NodeStatus, "ok") == 0) {\r
+\r
+  if ((Len >= 3) && (AsciiStrCmp (NodeStatus, "ok") == 0)) {\r
     return TRUE;\r
   }\r
+\r
   return FALSE;\r
 }\r
 \r
@@ -103,20 +107,20 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 FindNextCompatibleNode (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  IN  CONST CHAR8             *CompatibleString,\r
-  IN  INT32                   PrevNode,\r
-  OUT INT32                   *Node\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  IN  CONST CHAR8          *CompatibleString,\r
+  IN  INT32                PrevNode,\r
+  OUT INT32                *Node\r
   )\r
 {\r
-  INT32          Prev, Next;\r
-  CONST CHAR8    *Type, *Compatible;\r
-  INT32          Len;\r
+  INT32        Prev, Next;\r
+  CONST CHAR8  *Type, *Compatible;\r
+  INT32        Len;\r
 \r
   ASSERT (mDeviceTreeBase != NULL);\r
   ASSERT (Node != NULL);\r
 \r
-  for (Prev = PrevNode;; Prev = Next) {\r
+  for (Prev = PrevNode; ; Prev = Next) {\r
     Next = fdt_next_node (mDeviceTreeBase, Prev, NULL);\r
     if (Next < 0) {\r
       break;\r
@@ -136,13 +140,15 @@ FindNextCompatibleNode (
     // compatible strings so check each one\r
     //\r
     for (Compatible = Type; Compatible < Type + Len && *Compatible;\r
-         Compatible += 1 + AsciiStrLen (Compatible)) {\r
+         Compatible += 1 + AsciiStrLen (Compatible))\r
+    {\r
       if (AsciiStrCmp (CompatibleString, Compatible) == 0) {\r
         *Node = Next;\r
         return EFI_SUCCESS;\r
       }\r
     }\r
   }\r
+\r
   return EFI_NOT_FOUND;\r
 }\r
 \r
@@ -150,9 +156,9 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 FindCompatibleNode (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  IN  CONST CHAR8             *CompatibleString,\r
-  OUT INT32                   *Node\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  IN  CONST CHAR8          *CompatibleString,\r
+  OUT INT32                *Node\r
   )\r
 {\r
   return FindNextCompatibleNode (This, CompatibleString, 0, Node);\r
@@ -162,15 +168,15 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 FindCompatibleNodeProperty (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  IN  CONST CHAR8             *CompatibleString,\r
-  IN  CONST CHAR8             *PropertyName,\r
-  OUT CONST VOID              **Prop,\r
-  OUT UINT32                  *PropSize OPTIONAL\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  IN  CONST CHAR8          *CompatibleString,\r
+  IN  CONST CHAR8          *PropertyName,\r
+  OUT CONST VOID           **Prop,\r
+  OUT UINT32               *PropSize OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS        Status;\r
-  INT32             Node;\r
+  EFI_STATUS  Status;\r
+  INT32       Node;\r
 \r
   Status = FindCompatibleNode (This, CompatibleString, &Node);\r
   if (EFI_ERROR (Status)) {\r
@@ -184,15 +190,15 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 FindCompatibleNodeReg (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  IN  CONST CHAR8             *CompatibleString,\r
-  OUT CONST VOID              **Reg,\r
-  OUT UINTN                   *AddressCells,\r
-  OUT UINTN                   *SizeCells,\r
-  OUT UINT32                  *RegSize\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  IN  CONST CHAR8          *CompatibleString,\r
+  OUT CONST VOID           **Reg,\r
+  OUT UINTN                *AddressCells,\r
+  OUT UINTN                *SizeCells,\r
+  OUT UINT32               *RegSize\r
   )\r
 {\r
-  EFI_STATUS Status;\r
+  EFI_STATUS  Status;\r
 \r
   ASSERT (RegSize != NULL);\r
 \r
@@ -201,21 +207,30 @@ FindCompatibleNodeReg (
   // 8 byte quantities for base and size, respectively.\r
   // TODO use #cells root properties instead\r
   //\r
-  Status = FindCompatibleNodeProperty (This, CompatibleString, "reg", Reg,\r
-             RegSize);\r
+  Status = FindCompatibleNodeProperty (\r
+             This,\r
+             CompatibleString,\r
+             "reg",\r
+             Reg,\r
+             RegSize\r
+             );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
   if ((*RegSize % 16) != 0) {\r
-    DEBUG ((DEBUG_ERROR,\r
+    DEBUG ((\r
+      DEBUG_ERROR,\r
       "%a: '%a' compatible node has invalid 'reg' property (size == 0x%x)\n",\r
-      __FUNCTION__, CompatibleString, *RegSize));\r
+      __FUNCTION__,\r
+      CompatibleString,\r
+      *RegSize\r
+      ));\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
   *AddressCells = 2;\r
-  *SizeCells = 2;\r
+  *SizeCells    = 2;\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -224,24 +239,24 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 FindNextMemoryNodeReg (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  IN  INT32                   PrevNode,\r
-  OUT INT32                   *Node,\r
-  OUT CONST VOID              **Reg,\r
-  OUT UINTN                   *AddressCells,\r
-  OUT UINTN                   *SizeCells,\r
-  OUT UINT32                  *RegSize\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  IN  INT32                PrevNode,\r
+  OUT INT32                *Node,\r
+  OUT CONST VOID           **Reg,\r
+  OUT UINTN                *AddressCells,\r
+  OUT UINTN                *SizeCells,\r
+  OUT UINT32               *RegSize\r
   )\r
 {\r
-  INT32          Prev, Next;\r
-  CONST CHAR8    *DeviceType;\r
-  INT32          Len;\r
-  EFI_STATUS     Status;\r
+  INT32        Prev, Next;\r
+  CONST CHAR8  *DeviceType;\r
+  INT32        Len;\r
+  EFI_STATUS   Status;\r
 \r
   ASSERT (mDeviceTreeBase != NULL);\r
   ASSERT (Node != NULL);\r
 \r
-  for (Prev = PrevNode;; Prev = Next) {\r
+  for (Prev = PrevNode; ; Prev = Next) {\r
     Next = fdt_next_node (mDeviceTreeBase, Prev, NULL);\r
     if (Next < 0) {\r
       break;\r
@@ -253,7 +268,7 @@ FindNextMemoryNodeReg (
     }\r
 \r
     DeviceType = fdt_getprop (mDeviceTreeBase, Next, "device_type", &Len);\r
-    if (DeviceType != NULL && AsciiStrCmp (DeviceType, "memory") == 0) {\r
+    if ((DeviceType != NULL) && (AsciiStrCmp (DeviceType, "memory") == 0)) {\r
       //\r
       // Get the 'reg' property of this memory node. For now, we will assume\r
       // 8 byte quantities for base and size, respectively.\r
@@ -261,24 +276,31 @@ FindNextMemoryNodeReg (
       //\r
       Status = GetNodeProperty (This, Next, "reg", Reg, RegSize);\r
       if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_WARN,\r
+        DEBUG ((\r
+          DEBUG_WARN,\r
           "%a: ignoring memory node with no 'reg' property\n",\r
-          __FUNCTION__));\r
+          __FUNCTION__\r
+          ));\r
         continue;\r
       }\r
+\r
       if ((*RegSize % 16) != 0) {\r
-        DEBUG ((DEBUG_WARN,\r
+        DEBUG ((\r
+          DEBUG_WARN,\r
           "%a: ignoring memory node with invalid 'reg' property (size == 0x%x)\n",\r
-          __FUNCTION__, *RegSize));\r
+          __FUNCTION__,\r
+          *RegSize\r
+          ));\r
         continue;\r
       }\r
 \r
-      *Node = Next;\r
+      *Node         = Next;\r
       *AddressCells = 2;\r
-      *SizeCells = 2;\r
+      *SizeCells    = 2;\r
       return EFI_SUCCESS;\r
     }\r
   }\r
+\r
   return EFI_NOT_FOUND;\r
 }\r
 \r
@@ -286,27 +308,34 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 FindMemoryNodeReg (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  OUT INT32                   *Node,\r
-  OUT CONST VOID              **Reg,\r
-  OUT UINTN                   *AddressCells,\r
-  OUT UINTN                   *SizeCells,\r
-  OUT UINT32                  *RegSize\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  OUT INT32                *Node,\r
+  OUT CONST VOID           **Reg,\r
+  OUT UINTN                *AddressCells,\r
+  OUT UINTN                *SizeCells,\r
+  OUT UINT32               *RegSize\r
   )\r
 {\r
-  return FindNextMemoryNodeReg (This, 0, Node, Reg, AddressCells, SizeCells,\r
-           RegSize);\r
+  return FindNextMemoryNodeReg (\r
+           This,\r
+           0,\r
+           Node,\r
+           Reg,\r
+           AddressCells,\r
+           SizeCells,\r
+           RegSize\r
+           );\r
 }\r
 \r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 GetOrInsertChosenNode (\r
-  IN  FDT_CLIENT_PROTOCOL     *This,\r
-  OUT INT32                   *Node\r
+  IN  FDT_CLIENT_PROTOCOL  *This,\r
+  OUT INT32                *Node\r
   )\r
 {\r
-  INT32 NewNode;\r
+  INT32  NewNode;\r
 \r
   ASSERT (mDeviceTreeBase != NULL);\r
   ASSERT (Node != NULL);\r
@@ -325,7 +354,7 @@ GetOrInsertChosenNode (
   return EFI_SUCCESS;\r
 }\r
 \r
-STATIC FDT_CLIENT_PROTOCOL mFdtClientProtocol = {\r
+STATIC FDT_CLIENT_PROTOCOL  mFdtClientProtocol = {\r
   GetNodeProperty,\r
   SetNodeProperty,\r
   FindCompatibleNode,\r
@@ -341,13 +370,13 @@ STATIC
 VOID\r
 EFIAPI\r
 OnPlatformHasDeviceTree (\r
-  IN EFI_EVENT Event,\r
-  IN VOID      *Context\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-  VOID       *Interface;\r
-  VOID       *DeviceTreeBase;\r
+  EFI_STATUS  Status;\r
+  VOID        *Interface;\r
+  VOID        *DeviceTreeBase;\r
 \r
   Status = gBS->LocateProtocol (\r
                   &gEdkiiPlatformHasDeviceTreeGuid,\r
@@ -374,25 +403,30 @@ OnPlatformHasDeviceTree (
 EFI_STATUS\r
 EFIAPI\r
 InitializeFdtClientDxe (\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  VOID              *Hob;\r
-  VOID              *DeviceTreeBase;\r
-  EFI_STATUS        Status;\r
-  EFI_EVENT         PlatformHasDeviceTreeEvent;\r
-  VOID              *Registration;\r
+  VOID        *Hob;\r
+  VOID        *DeviceTreeBase;\r
+  EFI_STATUS  Status;\r
+  EFI_EVENT   PlatformHasDeviceTreeEvent;\r
+  VOID        *Registration;\r
 \r
   Hob = GetFirstGuidHob (&gFdtHobGuid);\r
-  if (Hob == NULL || GET_GUID_HOB_DATA_SIZE (Hob) != sizeof (UINT64)) {\r
+  if ((Hob == NULL) || (GET_GUID_HOB_DATA_SIZE (Hob) != sizeof (UINT64))) {\r
     return EFI_NOT_FOUND;\r
   }\r
+\r
   DeviceTreeBase = (VOID *)(UINTN)*(UINT64 *)GET_GUID_HOB_DATA (Hob);\r
 \r
   if (fdt_check_header (DeviceTreeBase) != 0) {\r
-    DEBUG ((DEBUG_ERROR, "%a: No DTB found @ 0x%p\n", __FUNCTION__,\r
-      DeviceTreeBase));\r
+    DEBUG ((\r
+      DEBUG_ERROR,\r
+      "%a: No DTB found @ 0x%p\n",\r
+      __FUNCTION__,\r
+      DeviceTreeBase\r
+      ));\r
     return EFI_NOT_FOUND;\r
   }\r
 \r