]> git.proxmox.com Git - mirror_edk2.git/blob - UnixPkg/UnixBlockIoDxe/UnixBlockIo.h
Integrate patch from Andrew Fish to make it run on OS X.
[mirror_edk2.git] / UnixPkg / UnixBlockIoDxe / UnixBlockIo.h
1 /*++
2
3 Copyright (c) 2004 - 2008, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 UnixBlockIo.h
15
16 Abstract:
17
18 Produce block IO abstractions for real devices on your PC using Posix APIs.
19 The configuration of what devices to mount or emulate comes from UNIX
20 environment variables. The variables must be visible to the Microsoft*
21 Developer Studio for them to work.
22
23 * Other names and brands may be claimed as the property of others.
24
25 --*/
26
27 #ifndef _UNIX_BLOCK_IO_H_
28 #define _UNIX_BLOCK_IO_H_
29
30 #include "PiDxe.h"
31 #include <Protocol/BlockIo.h>
32
33 #include <Library/DebugLib.h>
34 #include <Library/BaseLib.h>
35 #include <Library/UefiDriverEntryPoint.h>
36 #include <Library/UefiLib.h>
37 #include <Library/BaseMemoryLib.h>
38 #include <Library/MemoryAllocationLib.h>
39 #include <Library/UefiBootServicesTableLib.h>
40 #include "UnixDxe.h"
41
42 #define FILENAME_BUFFER_SIZE 80
43
44 //
45 // Language supported for driverconfiguration protocol
46 //
47 #define LANGUAGESUPPORTED "eng"
48
49 #define UNIX_BLOCK_IO_PRIVATE_SIGNATURE SIGNATURE_32 ('L', 'X', 'b', 'k')
50 typedef struct {
51 UINTN Signature;
52
53 EFI_LOCK Lock;
54
55 char Filename[FILENAME_BUFFER_SIZE];
56 UINTN ReadMode;
57 UINTN Mode;
58
59 int fd;
60
61 UINT64 LastBlock;
62 UINTN BlockSize;
63 UINT64 NumberOfBlocks;
64
65 EFI_HANDLE EfiHandle;
66 EFI_BLOCK_IO_PROTOCOL BlockIo;
67 EFI_BLOCK_IO_MEDIA Media;
68
69 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
70
71 EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
72
73 } UNIX_BLOCK_IO_PRIVATE;
74
75 #define UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
76 CR(a, UNIX_BLOCK_IO_PRIVATE, BlockIo, UNIX_BLOCK_IO_PRIVATE_SIGNATURE)
77
78 #define LIST_BUFFER_SIZE 512
79
80 //
81 // Block I/O Global Variables
82 //
83 extern EFI_DRIVER_BINDING_PROTOCOL gUnixBlockIoDriverBinding;
84 extern EFI_COMPONENT_NAME_PROTOCOL gUnixBlockIoComponentName;
85 extern EFI_DRIVER_CONFIGURATION_PROTOCOL gUnixBlockIoDriverConfiguration;
86 extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gUnixBlockIoDriverDiagnostics;
87
88 //
89 // EFI Driver Binding Functions
90 //
91 EFI_STATUS
92 EFIAPI
93 UnixBlockIoDriverBindingSupported (
94 IN EFI_DRIVER_BINDING_PROTOCOL *This,
95 IN EFI_HANDLE Handle,
96 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
97 )
98 /*++
99
100 Routine Description:
101
102 TODO: Add function description
103
104 Arguments:
105
106 This - TODO: add argument description
107 Handle - TODO: add argument description
108 RemainingDevicePath - TODO: add argument description
109
110 Returns:
111
112 TODO: add return values
113
114 --*/
115 ;
116
117 EFI_STATUS
118 EFIAPI
119 UnixBlockIoDriverBindingStart (
120 IN EFI_DRIVER_BINDING_PROTOCOL *This,
121 IN EFI_HANDLE Handle,
122 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
123 )
124 /*++
125
126 Routine Description:
127
128 TODO: Add function description
129
130 Arguments:
131
132 This - TODO: add argument description
133 Handle - TODO: add argument description
134 RemainingDevicePath - TODO: add argument description
135
136 Returns:
137
138 TODO: add return values
139
140 --*/
141 ;
142
143 EFI_STATUS
144 EFIAPI
145 UnixBlockIoDriverBindingStop (
146 IN EFI_DRIVER_BINDING_PROTOCOL *This,
147 IN EFI_HANDLE Handle,
148 IN UINTN NumberOfChildren,
149 IN EFI_HANDLE *ChildHandleBuffer
150 )
151 /*++
152
153 Routine Description:
154
155 TODO: Add function description
156
157 Arguments:
158
159 This - TODO: add argument description
160 Handle - TODO: add argument description
161 NumberOfChildren - TODO: add argument description
162 ChildHandleBuffer - TODO: add argument description
163
164 Returns:
165
166 TODO: add return values
167
168 --*/
169 ;
170
171 EFI_STATUS
172 SetFilePointer64 (
173 IN UNIX_BLOCK_IO_PRIVATE *Private,
174 IN INT64 DistanceToMove,
175 OUT UINT64 *NewFilePointer,
176 IN INT32 MoveMethod
177 )
178 /*++
179
180 Routine Description:
181
182 TODO: Add function description
183
184 Arguments:
185
186 Private - TODO: add argument description
187 DistanceToMove - TODO: add argument description
188 NewFilePointer - TODO: add argument description
189 MoveMethod - TODO: add argument description
190
191 Returns:
192
193 TODO: add return values
194
195 --*/
196 ;
197
198 UINTN
199 Atoi (
200 CHAR16 *String
201 )
202 /*++
203
204 Routine Description:
205
206 TODO: Add function description
207
208 Arguments:
209
210 String - TODO: add argument description
211
212 Returns:
213
214 TODO: add return values
215
216 --*/
217 ;
218
219 #endif