]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/VirtioNetDxe/SnpGetStatus.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / VirtioNetDxe / SnpGetStatus.c
index 333a522d503a2ff41edbe78482b10d788244f674..0e13bdc78ce2e0d8286d353186013063636989cf 100644 (file)
                                 interface.\r
 \r
 **/\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VirtioNetGetStatus (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
-  OUT UINT32                     *InterruptStatus OPTIONAL,\r
-  OUT VOID                       **TxBuf OPTIONAL\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL  *This,\r
+  OUT UINT32                      *InterruptStatus OPTIONAL,\r
+  OUT VOID                        **TxBuf OPTIONAL\r
   )\r
 {\r
-  VNET_DEV             *Dev;\r
-  EFI_TPL              OldTpl;\r
-  EFI_STATUS           Status;\r
-  UINT16               RxCurUsed;\r
-  UINT16               TxCurUsed;\r
-  EFI_PHYSICAL_ADDRESS DeviceAddress;\r
+  VNET_DEV              *Dev;\r
+  EFI_TPL               OldTpl;\r
+  EFI_STATUS            Status;\r
+  UINT16                RxCurUsed;\r
+  UINT16                TxCurUsed;\r
+  EFI_PHYSICAL_ADDRESS  DeviceAddress;\r
 \r
   if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Dev = VIRTIO_NET_FROM_SNP (This);\r
+  Dev    = VIRTIO_NET_FROM_SNP (This);\r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
   switch (Dev->Snm.State) {\r
-  case EfiSimpleNetworkStopped:\r
-    Status = EFI_NOT_STARTED;\r
-    goto Exit;\r
-  case EfiSimpleNetworkStarted:\r
-    Status = EFI_DEVICE_ERROR;\r
-    goto Exit;\r
-  default:\r
-    break;\r
+    case EfiSimpleNetworkStopped:\r
+      Status = EFI_NOT_STARTED;\r
+      goto Exit;\r
+    case EfiSimpleNetworkStarted:\r
+      Status = EFI_DEVICE_ERROR;\r
+      goto Exit;\r
+    default:\r
+      break;\r
   }\r
 \r
   //\r
   // update link status\r
   //\r
   if (Dev->Snm.MediaPresentSupported) {\r
-    UINT16 LinkStatus;\r
+    UINT16  LinkStatus;\r
 \r
     Status = VIRTIO_CFG_READ (Dev, LinkStatus, &LinkStatus);\r
     if (EFI_ERROR (Status)) {\r
       goto Exit;\r
     }\r
+\r
     Dev->Snm.MediaPresent =\r
-      (BOOLEAN) ((LinkStatus & VIRTIO_NET_S_LINK_UP) != 0);\r
+      (BOOLEAN)((LinkStatus & VIRTIO_NET_S_LINK_UP) != 0);\r
   }\r
 \r
   //\r
@@ -110,6 +110,7 @@ VirtioNetGetStatus (
     if (Dev->RxLastUsed != RxCurUsed) {\r
       *InterruptStatus |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;\r
     }\r
+\r
     if (Dev->TxLastUsed != TxCurUsed) {\r
       ASSERT (Dev->TxCurPending > 0);\r
       *InterruptStatus |= EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;\r
@@ -119,10 +120,9 @@ VirtioNetGetStatus (
   if (TxBuf != NULL) {\r
     if (Dev->TxLastUsed == TxCurUsed) {\r
       *TxBuf = NULL;\r
-    }\r
-    else {\r
-      UINT16 UsedElemIdx;\r
-      UINT32 DescIdx;\r
+    } else {\r
+      UINT16  UsedElemIdx;\r
+      UINT32  DescIdx;\r
 \r
       //\r
       // fetch the first descriptor among those that the hypervisor reports\r
@@ -132,8 +132,8 @@ VirtioNetGetStatus (
       ASSERT (Dev->TxCurPending <= Dev->TxMaxPending);\r
 \r
       UsedElemIdx = Dev->TxLastUsed++ % Dev->TxRing.QueueSize;\r
-      DescIdx = Dev->TxRing.Used.UsedElem[UsedElemIdx].Id;\r
-      ASSERT (DescIdx < (UINT32) (2 * Dev->TxMaxPending - 1));\r
+      DescIdx     = Dev->TxRing.Used.UsedElem[UsedElemIdx].Id;\r
+      ASSERT (DescIdx < (UINT32)(2 * Dev->TxMaxPending - 1));\r
 \r
       //\r
       // get the device address that has been enqueued for the caller's\r
@@ -144,7 +144,7 @@ VirtioNetGetStatus (
       //\r
       // now this descriptor can be used again to enqueue a transmit buffer\r
       //\r
-      Dev->TxFreeStack[--Dev->TxCurPending] = (UINT16) DescIdx;\r
+      Dev->TxFreeStack[--Dev->TxCurPending] = (UINT16)DescIdx;\r
 \r
       //\r
       // Unmap the device address and perform the reverse mapping to find the\r