]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkUnixPkg/Dxe/UnixThunk/UnixThunk/UnixThunk.c
Unix version of EFI emulator
[mirror_edk2.git] / EdkUnixPkg / Dxe / UnixThunk / UnixThunk / UnixThunk.c
diff --git a/EdkUnixPkg/Dxe/UnixThunk/UnixThunk/UnixThunk.c b/EdkUnixPkg/Dxe/UnixThunk/UnixThunk/UnixThunk.c
new file mode 100644 (file)
index 0000000..e7f4a24
--- /dev/null
@@ -0,0 +1,87 @@
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  UnixThunk.c\r
+\r
+Abstract:\r
+\r
+  Produce UnixThunk protocol and it's associated device path and controller \r
+  state protocols. UnixThunk is to the emulation environment as \r
+  PCI_ROOT_BRIGE is to real hardware. The UnixBusDriver is the child of this\r
+  driver.\r
+\r
+  Since we are a root hardware abstraction we do not install a Driver Binding\r
+  protocol on this handle. This driver can only support one one UnixThunk protocol\r
+  in the system, since the device path is hard coded.\r
+\r
+--*/\r
+\r
+#include "UnixThunk.h"\r
+\r
+//\r
+// WinNtThunk Device Path Protocol Instance\r
+//\r
+static UNIX_THUNK_DEVICE_PATH mUnixThunkDevicePath = {\r
+  {\r
+    HARDWARE_DEVICE_PATH,\r
+    HW_VENDOR_DP,\r
+    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
+    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),\r
+    EFI_UNIX_THUNK_PROTOCOL_GUID,\r
+  },\r
+  {\r
+    END_DEVICE_PATH_TYPE,\r
+    END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
+    END_DEVICE_PATH_LENGTH,\r
+    0\r
+  }\r
+};\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeUnixThunk (\r
+  IN EFI_HANDLE                            ImageHandle,\r
+  IN EFI_SYSTEM_TABLE                      *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  Install UnixThunk Protocol and it's associated Device Path protocol\r
+\r
+Arguments:\r
+  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+\r
+Returns:\r
+  EFI_SUCEESS - UnixThunk protocol is added or error status from \r
+                gBS->InstallMultiProtocolInterfaces().\r
+\r
+--*/\r
+// TODO:    ImageHandle - add argument and description to function comment\r
+// TODO:    SystemTable - add argument and description to function comment\r
+{\r
+  EFI_STATUS  Status;\r
+  EFI_HANDLE  ControllerHandle;\r
+\r
+  ControllerHandle = NULL;\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &ControllerHandle,\r
+                  &gEfiUnixThunkProtocolGuid,\r
+                  gUnix,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  &mUnixThunkDevicePath,\r
+                  NULL\r
+                  );\r
+\r
+  return Status;\r
+}\r