21500a43 |
1 | /*++ |
2 | |
3 | Copyright (c) 2004, 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 | UnixThunk.h |
15 | |
16 | Abstract: |
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 | |
38 | typedef |
39 | VOID |
40 | (*UnixSleep) ( |
41 | unsigned long Milliseconds |
42 | ); |
43 | |
44 | typedef |
45 | VOID |
46 | (*UnixExit) ( |
47 | int status // exit code for all threads |
48 | ); |
49 | |
c9093a06 |
50 | typedef |
51 | VOID |
52 | (*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs)); |
53 | typedef |
54 | VOID |
55 | (*UnixGetLocalTime) (EFI_TIME *Time); |
56 | typedef |
57 | struct tm * |
58 | (*UnixGmTime)(const time_t *timep); |
59 | typedef |
60 | long |
61 | (*UnixGetTimeZone)(void); |
62 | typedef |
63 | int |
64 | (*UnixGetDayLight)(void); |
65 | typedef |
66 | int |
67 | (*UnixPoll)(struct pollfd *pfd, int nfds, int timeout); |
68 | typedef |
69 | int |
70 | (*UnixRead) (int fd, void *buf, int count); |
71 | typedef |
72 | int |
73 | (*UnixWrite) (int fd, const void *buf, int count); |
74 | typedef |
75 | char * |
76 | (*UnixGetenv) (const char *var); |
77 | typedef |
78 | int |
79 | (*UnixOpen) (const char *name, int flags, int mode); |
80 | typedef |
81 | long int |
82 | (*UnixSeek) (int fd, long int off, int whence); |
83 | typedef |
84 | int |
85 | (*UnixFtruncate) (int fd, long int len); |
86 | typedef |
87 | int |
88 | (*UnixClose) (int fd); |
89 | |
90 | typedef |
91 | int |
92 | (*UnixMkdir)(const char *pathname, mode_t mode); |
93 | typedef |
94 | int |
95 | (*UnixRmDir)(const char *pathname); |
96 | typedef |
97 | int |
98 | (*UnixUnLink)(const char *pathname); |
99 | typedef |
100 | int |
101 | (*UnixGetErrno)(VOID); |
102 | typedef |
103 | DIR * |
104 | (*UnixOpenDir)(const char *pathname); |
105 | typedef |
106 | void |
107 | (*UnixRewindDir)(DIR *dir); |
108 | typedef |
109 | struct dirent * |
110 | (*UnixReadDir)(DIR *dir); |
111 | typedef |
112 | int |
113 | (*UnixCloseDir)(DIR *dir); |
114 | typedef |
115 | int |
116 | (*UnixStat)(const char *path, struct stat *buf); |
117 | typedef |
118 | int |
119 | (*UnixStatFs)(const char *path, struct statfs *buf); |
120 | typedef |
121 | int |
122 | (*UnixRename)(const char *oldpath, const char *newpath); |
123 | typedef |
124 | time_t |
125 | (*UnixMkTime)(struct tm *tm); |
126 | typedef |
127 | int |
128 | (*UnixFSync)(int fd); |
129 | typedef |
130 | int |
131 | (*UnixChmod)(const char *path, mode_t mode); |
132 | typedef |
133 | int |
134 | (*UnixUTime)(const char *filename, const struct utimbuf *buf); |
135 | |
136 | struct _EFI_UNIX_UGA_IO_PROTOCOL; |
137 | typedef |
138 | EFI_STATUS |
139 | (*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, |
140 | CONST CHAR16 *Title); |
21500a43 |
141 | |
142 | typedef |
143 | int |
144 | (*UnixTcflush) (int fildes, int queue_selector); |
145 | |
146 | typedef |
147 | void |
148 | (*UnixPerror) (__const char *__s); |
149 | |
150 | typedef |
151 | int |
152 | (*UnixIoCtl) (int fd, unsigned long int __request, ...); |
153 | |
154 | typedef |
155 | int |
156 | (*UnixFcntl) (int __fd, int __cmd, ...); |
157 | |
158 | typedef |
159 | int |
160 | (*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed); |
161 | |
162 | typedef |
163 | int |
164 | (*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed); |
165 | |
166 | typedef |
167 | int |
168 | (*UnixTcgetattr) (int __fd, struct termios *__termios_p); |
169 | |
170 | typedef |
171 | int |
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 | |
181 | typedef 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 | |
225 | extern EFI_GUID gEfiUnixThunkProtocolGuid; |
226 | |
227 | #endif |