]>
Commit | Line | Data |
---|---|---|
c9093a06 | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | UnixThunk.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | This protocol allows an EFI driver in the Unix emulation environment\r | |
19 | to make Posix calls.\r | |
20 | \r | |
21 | NEVER make an Unix call directly, always make the call via this protocol.\r | |
22 | \r | |
23 | There are no This pointers on the protocol member functions as they map\r | |
24 | exactly into Unix system calls.\r | |
25 | \r | |
26 | --*/\r | |
27 | \r | |
28 | #ifndef _UNIX_THUNK_H_\r | |
29 | #define _UNIX_THUNK_H_\r | |
30 | \r | |
b19cfa69 | 31 | #include <sys/termios.h>\r |
c9093a06 | 32 | |
33 | #define EFI_UNIX_THUNK_PROTOCOL_GUID \\r | |
34 | { \\r | |
35 | 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \ | |
36 | }\r | |
37 | \r | |
38 | typedef\r | |
39 | VOID\r | |
40 | (*UnixSleep) (\r | |
41 | unsigned long Milliseconds\r | |
42 | );\r | |
43 | \r | |
44 | typedef\r | |
45 | VOID\r | |
46 | (*UnixExit) (\r | |
47 | int status // exit code for all threads\r | |
48 | );\r | |
49 | \r | |
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); | |
b19cfa69 | 141 | \r |
142 | typedef\r | |
143 | int\r | |
144 | (*UnixTcflush) (int fildes, int queue_selector);\r | |
145 | \r | |
146 | typedef\r | |
147 | void\r | |
148 | (*UnixPerror) (__const char *__s);\r | |
149 | \r | |
150 | typedef\r | |
151 | void\r | |
152 | (*UnixPrintf) (const char* format, ...);\r | |
153 | \r | |
154 | typedef \r | |
155 | int \r | |
156 | (*UnixIoCtl) (int fd, unsigned long int __request, ...);\r | |
157 | \r | |
158 | typedef \r | |
159 | int \r | |
160 | (*UnixFcntl) (int __fd, int __cmd, ...);\r | |
161 | \r | |
162 | typedef\r | |
163 | int \r | |
164 | (*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);\r | |
165 | \r | |
166 | typedef \r | |
167 | int \r | |
168 | (*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);\r | |
169 | \r | |
170 | typedef\r | |
171 | int \r | |
172 | (*UnixTcgetattr) (int __fd, struct termios *__termios_p);\r | |
173 | \r | |
174 | typedef \r | |
175 | int \r | |
176 | (*UnixTcsetattr) (int __fd, int __optional_actions,\r | |
177 | __const struct termios *__termios_p);\r | |
c9093a06 | 178 | |
179 | //\r | |
180 | //\r | |
181 | //\r | |
182 | \r | |
183 | #define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T')\r | |
184 | \r | |
185 | typedef struct _EFI_UNIX_THUNK_PROTOCOL {\r | |
186 | UINT64 Signature;\r | |
187 | ||
b19cfa69 | 188 | UnixSleep Sleep;\r |
c9093a06 | 189 | UnixExit Exit;\r |
b19cfa69 | 190 | UnixSetTimer SetTimer; |
191 | UnixGetLocalTime GetLocalTime; | |
c9093a06 | 192 | UnixGmTime GmTime; |
193 | UnixGetTimeZone GetTimeZone; | |
194 | UnixGetDayLight GetDayLight; | |
b19cfa69 | 195 | UnixPoll Poll; |
c9093a06 | 196 | UnixRead Read; |
197 | UnixWrite Write; | |
198 | UnixGetenv Getenv; | |
199 | UnixOpen Open; | |
200 | UnixSeek Lseek; | |
201 | UnixFtruncate FTruncate; | |
202 | UnixClose Close; | |
203 | UnixMkdir MkDir; | |
204 | UnixRmDir RmDir; | |
205 | UnixUnLink UnLink; | |
206 | UnixGetErrno GetErrno; | |
207 | UnixOpenDir OpenDir; | |
208 | UnixRewindDir RewindDir; | |
209 | UnixReadDir ReadDir; | |
210 | UnixCloseDir CloseDir; | |
211 | UnixStat Stat; | |
212 | UnixStatFs StatFs; | |
213 | UnixRename Rename; | |
214 | UnixMkTime MkTime; | |
215 | UnixFSync FSync; | |
216 | UnixChmod Chmod; | |
217 | UnixUTime UTime; | |
b19cfa69 | 218 | UnixTcflush Tcflush; |
219 | UnixUgaCreate UgaCreate; | |
220 | UnixPerror Perror;\r | |
221 | UnixPrintf Printf;\r | |
222 | UnixIoCtl IoCtl;\r | |
223 | UnixFcntl Fcntl;\r | |
224 | UnixCfsetispeed Cfsetispeed;\r | |
225 | UnixCfsetospeed Cfsetospeed;\r | |
226 | UnixTcgetattr Tcgetattr;\r | |
227 | UnixTcsetattr Tcsetattr;\r | |
c9093a06 | 228 | } EFI_UNIX_THUNK_PROTOCOL; |
229 | \r | |
230 | extern EFI_GUID gEfiUnixThunkProtocolGuid;\r | |
231 | \r | |
232 | #endif\r |