Add PcdComponentName2Disable and PcdDriverDiagnostics2Disable.
[mirror_edk2.git] / EdkUnixPkg / Include / Protocol / UnixThunk.h
CommitLineData
21500a43 1/*++
2
3Copyright (c) 2004, Intel Corporation
4All rights reserved. This program and the accompanying materials
5are licensed and made available under the terms and conditions of the BSD License
6which accompanies this distribution. The full text of the license may be found at
7http://opensource.org/licenses/bsd-license.php
8
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12Module Name:
13
14 UnixThunk.h
15
16Abstract:
17
18 This protocol allows an EFI driver in the Unix emulation environment
19 to make Posix calls.
20
21 NEVER make an Unix call directly, always make the call via this protocol.
22
23 There are no This pointers on the protocol member functions as they map
24 exactly into Unix system calls.
25
26--*/
27
28#ifndef _UNIX_THUNK_H_
29#define _UNIX_THUNK_H_
30
31#include <sys/termios.h>
32
33#define EFI_UNIX_THUNK_PROTOCOL_GUID \
34 { \
c9093a06 35 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
21500a43 36 }
37
38typedef
39VOID
40(*UnixSleep) (
41 unsigned long Milliseconds
42 );
43
44typedef
45VOID
46(*UnixExit) (
47 int status // exit code for all threads
48 );
49
c9093a06 50typedef
51VOID
52(*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs));
53typedef
54VOID
55(*UnixGetLocalTime) (EFI_TIME *Time);
56typedef
57struct tm *
58(*UnixGmTime)(const time_t *timep);
59typedef
60long
61(*UnixGetTimeZone)(void);
62typedef
63int
64(*UnixGetDayLight)(void);
65typedef
66int
67(*UnixPoll)(struct pollfd *pfd, int nfds, int timeout);
68typedef
69int
70(*UnixRead) (int fd, void *buf, int count);
71typedef
72int
73(*UnixWrite) (int fd, const void *buf, int count);
74typedef
75char *
76(*UnixGetenv) (const char *var);
77typedef
78int
79(*UnixOpen) (const char *name, int flags, int mode);
80typedef
81long int
82(*UnixSeek) (int fd, long int off, int whence);
83typedef
84int
85(*UnixFtruncate) (int fd, long int len);
86typedef
87int
88(*UnixClose) (int fd);
89
90typedef
91int
92(*UnixMkdir)(const char *pathname, mode_t mode);
93typedef
94int
95(*UnixRmDir)(const char *pathname);
96typedef
97int
98(*UnixUnLink)(const char *pathname);
99typedef
100int
101(*UnixGetErrno)(VOID);
102typedef
103DIR *
104(*UnixOpenDir)(const char *pathname);
105typedef
106void
107(*UnixRewindDir)(DIR *dir);
108typedef
109struct dirent *
110(*UnixReadDir)(DIR *dir);
111typedef
112int
113(*UnixCloseDir)(DIR *dir);
114typedef
115int
116(*UnixStat)(const char *path, struct stat *buf);
117typedef
118int
119(*UnixStatFs)(const char *path, struct statfs *buf);
120typedef
121int
122(*UnixRename)(const char *oldpath, const char *newpath);
123typedef
124time_t
125(*UnixMkTime)(struct tm *tm);
126typedef
127int
128(*UnixFSync)(int fd);
129typedef
130int
131(*UnixChmod)(const char *path, mode_t mode);
132typedef
133int
134(*UnixUTime)(const char *filename, const struct utimbuf *buf);
135
136struct _EFI_UNIX_UGA_IO_PROTOCOL;
137typedef
138EFI_STATUS
139(*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo,
140 CONST CHAR16 *Title);
21500a43 141
142typedef
143int
144(*UnixTcflush) (int fildes, int queue_selector);
145
146typedef
147void
148(*UnixPerror) (__const char *__s);
149
150typedef
151int
152(*UnixIoCtl) (int fd, unsigned long int __request, ...);
153
154typedef
155int
156(*UnixFcntl) (int __fd, int __cmd, ...);
157
158typedef
159int
160(*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);
161
162typedef
163int
164(*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);
165
166typedef
167int
168(*UnixTcgetattr) (int __fd, struct termios *__termios_p);
169
170typedef
171int
172(*UnixTcsetattr) (int __fd, int __optional_actions,
173 __const struct termios *__termios_p);
174
175//
176//
177//
178
179#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T')
180
181typedef struct _EFI_UNIX_THUNK_PROTOCOL {
182 UINT64 Signature;
183
184 UnixSleep Sleep;
185 UnixExit Exit;
b19cfa69 186 UnixSetTimer SetTimer;
187 UnixGetLocalTime GetLocalTime;
c9093a06 188 UnixGmTime GmTime;
189 UnixGetTimeZone GetTimeZone;
190 UnixGetDayLight GetDayLight;
b19cfa69 191 UnixPoll Poll;
c9093a06 192 UnixRead Read;
193 UnixWrite Write;
194 UnixGetenv Getenv;
195 UnixOpen Open;
196 UnixSeek Lseek;
197 UnixFtruncate FTruncate;
198 UnixClose Close;
199 UnixMkdir MkDir;
200 UnixRmDir RmDir;
201 UnixUnLink UnLink;
202 UnixGetErrno GetErrno;
203 UnixOpenDir OpenDir;
204 UnixRewindDir RewindDir;
205 UnixReadDir ReadDir;
206 UnixCloseDir CloseDir;
207 UnixStat Stat;
208 UnixStatFs StatFs;
209 UnixRename Rename;
210 UnixMkTime MkTime;
211 UnixFSync FSync;
212 UnixChmod Chmod;
213 UnixUTime UTime;
b19cfa69 214 UnixTcflush Tcflush;
215 UnixUgaCreate UgaCreate;
21500a43 216 UnixPerror Perror;
217 UnixIoCtl IoCtl;
218 UnixFcntl Fcntl;
219 UnixCfsetispeed Cfsetispeed;
220 UnixCfsetospeed Cfsetospeed;
221 UnixTcgetattr Tcgetattr;
222 UnixTcsetattr Tcsetattr;
c9093a06 223} EFI_UNIX_THUNK_PROTOCOL;
21500a43 224
225extern EFI_GUID gEfiUnixThunkProtocolGuid;
226
227#endif