\r
#pragma pack (1)\r
typedef struct {\r
- VENDOR_DEVICE_PATH Vendor;\r
- UINT64 PhysBase;\r
- EFI_DEVICE_PATH_PROTOCOL End;\r
+ VENDOR_DEVICE_PATH Vendor;\r
+ UINT64 PhysBase;\r
+ EFI_DEVICE_PATH_PROTOCOL End;\r
} VIRTIO_TRANSPORT_DEVICE_PATH;\r
#pragma pack ()\r
\r
EFI_STATUS\r
EFIAPI\r
InitializeVirtioFdtDxe (\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
- EFI_STATUS Status, FindNodeStatus;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- INT32 Node;\r
- CONST UINT64 *Reg;\r
- UINT32 RegSize;\r
- VIRTIO_TRANSPORT_DEVICE_PATH *DevicePath;\r
- EFI_HANDLE Handle;\r
- UINT64 RegBase;\r
-\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
+ EFI_STATUS Status, FindNodeStatus;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ INT32 Node;\r
+ CONST UINT64 *Reg;\r
+ UINT32 RegSize;\r
+ VIRTIO_TRANSPORT_DEVICE_PATH *DevicePath;\r
+ EFI_HANDLE Handle;\r
+ UINT64 RegBase;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gFdtClientProtocolGuid,\r
+ NULL,\r
+ (VOID **)&FdtClient\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
- for (FindNodeStatus = FdtClient->FindCompatibleNode (FdtClient,\r
- "virtio,mmio", &Node);\r
+ for (FindNodeStatus = FdtClient->FindCompatibleNode (\r
+ FdtClient,\r
+ "virtio,mmio",\r
+ &Node\r
+ );\r
!EFI_ERROR (FindNodeStatus);\r
- FindNodeStatus = FdtClient->FindNextCompatibleNode (FdtClient,\r
- "virtio,mmio", Node, &Node)) {\r
-\r
- Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",\r
- (CONST VOID **)&Reg, &RegSize);\r
+ FindNodeStatus = FdtClient->FindNextCompatibleNode (\r
+ FdtClient,\r
+ "virtio,mmio",\r
+ Node,\r
+ &Node\r
+ ))\r
+ {\r
+ Status = FdtClient->GetNodeProperty (\r
+ FdtClient,\r
+ Node,\r
+ "reg",\r
+ (CONST VOID **)&Reg,\r
+ &RegSize\r
+ );\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: GetNodeProperty () failed (Status == %r)\n",\r
- __FUNCTION__, Status));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: GetNodeProperty () failed (Status == %r)\n",\r
+ __FUNCTION__,\r
+ Status\r
+ ));\r
continue;\r
}\r
\r
//\r
// Create a unique device path for this transport on the fly\r
//\r
- RegBase = SwapBytes64 (*Reg);\r
+ RegBase = SwapBytes64 (*Reg);\r
DevicePath = (VIRTIO_TRANSPORT_DEVICE_PATH *)CreateDeviceNode (\r
- HARDWARE_DEVICE_PATH,\r
- HW_VENDOR_DP,\r
- sizeof (VIRTIO_TRANSPORT_DEVICE_PATH));\r
+ HARDWARE_DEVICE_PATH,\r
+ HW_VENDOR_DP,\r
+ sizeof (VIRTIO_TRANSPORT_DEVICE_PATH)\r
+ );\r
if (DevicePath == NULL) {\r
DEBUG ((DEBUG_ERROR, "%a: Out of memory\n", __FUNCTION__));\r
continue;\r
\r
CopyGuid (&DevicePath->Vendor.Guid, &gVirtioMmioTransportGuid);\r
DevicePath->PhysBase = RegBase;\r
- SetDevicePathNodeLength (&DevicePath->Vendor,\r
- sizeof (*DevicePath) - sizeof (DevicePath->End));\r
+ SetDevicePathNodeLength (\r
+ &DevicePath->Vendor,\r
+ sizeof (*DevicePath) - sizeof (DevicePath->End)\r
+ );\r
SetDevicePathEndNode (&DevicePath->End);\r
\r
Handle = NULL;\r
- Status = gBS->InstallProtocolInterface (&Handle,\r
- &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,\r
- DevicePath);\r
+ Status = gBS->InstallProtocolInterface (\r
+ &Handle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ DevicePath\r
+ );\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: Failed to install the EFI_DEVICE_PATH "\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: Failed to install the EFI_DEVICE_PATH "\r
"protocol on a new handle (Status == %r)\n",\r
- __FUNCTION__, Status));\r
+ __FUNCTION__,\r
+ Status\r
+ ));\r
FreePool (DevicePath);\r
continue;\r
}\r
\r
Status = VirtioMmioInstallDevice (RegBase, Handle);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: Failed to install VirtIO transport @ 0x%Lx "\r
- "on handle %p (Status == %r)\n", __FUNCTION__, RegBase,\r
- Handle, Status));\r
-\r
- Status = gBS->UninstallProtocolInterface (Handle,\r
- &gEfiDevicePathProtocolGuid, DevicePath);\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: Failed to install VirtIO transport @ 0x%Lx "\r
+ "on handle %p (Status == %r)\n",\r
+ __FUNCTION__,\r
+ RegBase,\r
+ Handle,\r
+ Status\r
+ ));\r
+\r
+ Status = gBS->UninstallProtocolInterface (\r
+ Handle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ DevicePath\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
FreePool (DevicePath);\r
continue;\r
}\r
}\r
\r
- if (EFI_ERROR (FindNodeStatus) && FindNodeStatus != EFI_NOT_FOUND) {\r
- DEBUG ((DEBUG_ERROR, "%a: Error occurred while iterating DT nodes "\r
- "(FindNodeStatus == %r)\n", __FUNCTION__, FindNodeStatus));\r
+ if (EFI_ERROR (FindNodeStatus) && (FindNodeStatus != EFI_NOT_FOUND)) {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: Error occurred while iterating DT nodes "\r
+ "(FindNodeStatus == %r)\n",\r
+ __FUNCTION__,\r
+ FindNodeStatus\r
+ ));\r
}\r
\r
return EFI_SUCCESS;\r