1 /*++ @file 2 3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> 4 Portions copyright (c) 2011, Apple Inc. All rights reserved. 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #ifndef __EMU_BUS_DRIVER_H__ 16 #define __EMU_BUS_DRIVER_H__ 17 18 #include <PiDxe.h> 19 20 #include <Protocol/DevicePath.h> 21 #include <Protocol/EmuThunk.h> 22 #include <Protocol/EmuIoThunk.h> 23 24 #include <Library/DebugLib.h> 25 #include <Library/BaseLib.h> 26 #include <Library/UefiDriverEntryPoint.h> 27 #include <Library/UefiLib.h> 28 #include <Library/PcdLib.h> 29 #include <Library/BaseMemoryLib.h> 30 #include <Library/MemoryAllocationLib.h> 31 #include <Library/UefiBootServicesTableLib.h> 32 #include <Library/DevicePathLib.h> 33 34 extern EFI_DRIVER_BINDING_PROTOCOL gEmuBusDriverBinding; 35 extern EFI_COMPONENT_NAME_PROTOCOL gEmuBusDriverComponentName; 36 extern EFI_COMPONENT_NAME2_PROTOCOL gEmuBusDriverComponentName2; 37 38 39 // 40 // Unix Bus Controller Structure 41 // 42 #define EMU_BUS_DEVICE_SIGNATURE SIGNATURE_32 ('L', 'X', 'B', 'D') 43 44 typedef struct { 45 UINT64 Signature; 46 EFI_UNICODE_STRING_TABLE *ControllerNameTable; 47 } EMU_BUS_DEVICE; 48 49 // 50 // Unix Child Device Controller Structure 51 // 52 #define EMU_IO_DEVICE_SIGNATURE SIGNATURE_32 ('L', 'X', 'V', 'D') 53 54 typedef struct { 55 UINT64 Signature; 56 EFI_HANDLE Handle; 57 EMU_IO_THUNK_PROTOCOL EmuIoThunk; 58 EFI_DEVICE_PATH_PROTOCOL *DevicePath; 59 60 // 61 // Private data about the parent 62 // 63 EFI_HANDLE ControllerHandle; 64 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; 65 66 EFI_UNICODE_STRING_TABLE *ControllerNameTable; 67 68 } EMU_IO_DEVICE; 69 70 #define EMU_IO_DEVICE_FROM_THIS(a) \ 71 CR(a, EMU_IO_DEVICE, EmuIoThunk, EMU_IO_DEVICE_SIGNATURE) 72 73 74 75 // 76 // Driver Binding Protocol function prototypes 77 // 78 EFI_STATUS 79 EFIAPI 80 EmuBusDriverBindingSupported ( 81 IN EFI_DRIVER_BINDING_PROTOCOL *This, 82 IN EFI_HANDLE Handle, 83 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath 84 ); 85 86 87 EFI_STATUS 88 EFIAPI 89 EmuBusDriverBindingStart ( 90 IN EFI_DRIVER_BINDING_PROTOCOL *This, 91 IN EFI_HANDLE ParentHandle, 92 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath 93 ); 94 95 96 EFI_STATUS 97 EFIAPI 98 EmuBusDriverBindingStop ( 99 IN EFI_DRIVER_BINDING_PROTOCOL *This, 100 IN EFI_HANDLE Handle, 101 IN UINTN NumberOfChildren, 102 IN EFI_HANDLE *ChildHandleBuffer 103 ); 104 105 // 106 // Unix Bus Driver private worker functions 107 // 108 EFI_DEVICE_PATH_PROTOCOL * 109 EmuBusCreateDevicePath ( 110 IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath, 111 IN EFI_GUID *Guid, 112 IN UINT16 InstanceNumber 113 ); 114 115 116 #endif 117