blob: 082a33ee1b51276ce466cde1d7e77ffa44eef097 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/*++ @file
2
3Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4Portions copyright (c) 2011, Apple Inc. All rights reserved.
5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution. The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT 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
34extern EFI_DRIVER_BINDING_PROTOCOL gEmuBusDriverBinding;
35extern EFI_COMPONENT_NAME_PROTOCOL gEmuBusDriverComponentName;
36extern 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
44typedef 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
54typedef 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//
78EFI_STATUS
79EFIAPI
80EmuBusDriverBindingSupported (
81 IN EFI_DRIVER_BINDING_PROTOCOL *This,
82 IN EFI_HANDLE Handle,
83 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
84 );
85
86
87EFI_STATUS
88EFIAPI
89EmuBusDriverBindingStart (
90 IN EFI_DRIVER_BINDING_PROTOCOL *This,
91 IN EFI_HANDLE ParentHandle,
92 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
93 );
94
95
96EFI_STATUS
97EFIAPI
98EmuBusDriverBindingStop (
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//
108EFI_DEVICE_PATH_PROTOCOL *
109EmuBusCreateDevicePath (
110 IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
111 IN EFI_GUID *Guid,
112 IN UINT16 InstanceNumber
113 );
114
115
116#endif