EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

UnixPkg/UnixThunkDxe/UnixThunk.c

Go to the documentation of this file.
00001 /*++
00002 
00003 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
00004 This program and the accompanying materials                          
00005 are licensed and made available under the terms and conditions of the BSD License         
00006 which accompanies this distribution.  The full text of the license may be found at        
00007 http://opensource.org/licenses/bsd-license.php                                            
00008                                                                                           
00009 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
00010 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
00011 
00012 Module Name:
00013 
00014   UnixThunk.c
00015 
00016 Abstract:
00017 
00018   Produce UnixThunk protocol and it's associated device path and controller 
00019   state protocols. UnixThunk is to the emulation environment as 
00020   PCI_ROOT_BRIGE is to real hardware. The UnixBusDriver is the child of this
00021   driver.
00022 
00023   Since we are a root hardware abstraction we do not install a Driver Binding
00024   protocol on this handle. This driver can only support one one UnixThunk protocol
00025   in the system, since the device path is hard coded.
00026 
00027 --*/
00028 #include "PiDxe.h"
00029 #include "UnixDxe.h"
00030 #include "UnixThunk.h"
00031 #include <Protocol/DevicePath.h>
00032 
00033 #include <Library/DebugLib.h>
00034 #include <Library/UefiLib.h>
00035 #include <Library/UefiDriverEntryPoint.h>
00036 #include <Library/UnixLib.h>
00037 #include <Library/MemoryAllocationLib.h>
00038 #include <Library/UefiBootServicesTableLib.h>
00039 #include <Library/DevicePathLib.h>
00040 
00041 //
00042 // WinNtThunk Device Path Protocol Instance
00043 //
00044 UNIX_THUNK_DEVICE_PATH mUnixThunkDevicePath = {
00045   {
00046     {
00047       HARDWARE_DEVICE_PATH,
00048       HW_VENDOR_DP,
00049       {
00050         (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
00051         (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
00052       }
00053     },
00054     EFI_UNIX_THUNK_PROTOCOL_GUID,
00055   },
00056   {
00057     END_DEVICE_PATH_TYPE,
00058     END_ENTIRE_DEVICE_PATH_SUBTYPE,
00059     {
00060       END_DEVICE_PATH_LENGTH,
00061       0
00062     }
00063   }
00064 };
00065 
00066 
00067 EFI_STATUS
00068 EFIAPI
00069 InitializeUnixThunk (
00070   IN EFI_HANDLE                            ImageHandle,
00071   IN EFI_SYSTEM_TABLE                      *SystemTable
00072   )
00073 /*++
00074 
00075 Routine Description:
00076   Install UnixThunk Protocol and it's associated Device Path protocol
00077 
00078 Arguments:
00079   (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
00080 
00081 Returns:
00082   EFI_SUCEESS - UnixThunk protocol is added or error status from 
00083                 gBS->InstallMultiProtocolInterfaces().
00084 
00085 --*/
00086 // TODO:    ImageHandle - add argument and description to function comment
00087 // TODO:    SystemTable - add argument and description to function comment
00088 {
00089   EFI_STATUS  Status;
00090   EFI_HANDLE  ControllerHandle;
00091 
00092   ControllerHandle = NULL;
00093   Status = gBS->InstallMultipleProtocolInterfaces (
00094                   &ControllerHandle,
00095                   &gEfiUnixThunkProtocolGuid,
00096                   gUnix,
00097                   &gEfiDevicePathProtocolGuid,
00098                   &mUnixThunkDevicePath,
00099                   NULL
00100                   );
00101 
00102   return Status;
00103 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines