]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
4ea9375a HT |
3 | Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>\r |
4 | This program and the accompanying materials \r | |
3eb9473e | 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 | EfiRuntimeLib.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Light weight lib to support EFI drivers.\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | #ifndef _EFI_RUNTIME_LIB_H_\r | |
23 | #define _EFI_RUNTIME_LIB_H_\r | |
24 | #define MAX_FVB_COUNT 16\r | |
25 | #include "EfiStatusCode.h"\r | |
26 | #include "EfiCommonLib.h"\r | |
27 | \r | |
28 | #include "LinkedList.h"\r | |
29 | #include "GetImage.h"\r | |
30 | #include "RtDevicePath.h"\r | |
31 | \r | |
32 | #include EFI_GUID_DEFINITION (DxeServices)\r | |
33 | #include EFI_GUID_DEFINITION (EventGroup)\r | |
34 | #include EFI_GUID_DEFINITION (EventLegacyBios)\r | |
35 | #include EFI_PROTOCOL_DEFINITION (CpuIo)\r | |
36 | #include EFI_PROTOCOL_DEFINITION (FirmwareVolume)\r | |
37 | #include EFI_PROTOCOL_DEFINITION (FirmwareVolume2)\r | |
38 | #include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)\r | |
39 | #include EFI_PROTOCOL_DEFINITION (FvbExtension)\r | |
40 | #include "ProcDep.h"\r | |
41 | \r | |
42 | typedef struct {\r | |
43 | EFI_HANDLE Handle;\r | |
44 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;\r | |
45 | EFI_FVB_EXTENSION_PROTOCOL *FvbExtension;\r | |
46 | } FVB_ENTRY;\r | |
47 | \r | |
48 | //\r | |
49 | // Driver Lib Globals.\r | |
50 | //\r | |
51 | extern EFI_BOOT_SERVICES *gBS;\r | |
52 | extern EFI_SYSTEM_TABLE *gST;\r | |
53 | extern EFI_DXE_SERVICES *gDS;\r | |
54 | extern UINTN gRtErrorLevel;\r | |
55 | extern FVB_ENTRY *mFvbEntry;\r | |
56 | \r | |
f90eb36c | 57 | #if defined(__GNUC__) && defined(ECP_CPU_IPF)\r |
58 | \r | |
59 | VOID\r | |
60 | EFIAPI\r | |
61 | EcpEfiBreakPoint (\r | |
62 | VOID\r | |
63 | )\r | |
64 | /*++\r | |
65 | \r | |
66 | Routine Description:\r | |
67 | \r | |
68 | Generates a breakpoint on the CPU.\r | |
69 | \r | |
70 | Generates a breakpoint on the CPU. The breakpoint must be implemented such\r | |
71 | that code can resume normal execution after the breakpoint.\r | |
72 | \r | |
73 | Arguments:\r | |
74 | \r | |
75 | VOID\r | |
76 | \r | |
77 | Returns: \r | |
78 | \r | |
79 | VOID\r | |
80 | \r | |
81 | --*/\r | |
82 | ;\r | |
83 | \r | |
84 | VOID\r | |
85 | EFIAPI\r | |
86 | EcpMemoryFence (\r | |
87 | VOID\r | |
88 | )\r | |
89 | /*++\r | |
90 | \r | |
91 | Routine Description:\r | |
92 | \r | |
93 | Used to serialize load and store operations.\r | |
94 | \r | |
95 | All loads and stores that proceed calls to this function are guaranteed to be\r | |
96 | globally visible when this function returns.\r | |
97 | \r | |
98 | Arguments:\r | |
99 | \r | |
100 | VOID\r | |
101 | \r | |
102 | Returns: \r | |
103 | \r | |
104 | VOID\r | |
105 | \r | |
106 | --*/\r | |
107 | ;\r | |
108 | \r | |
109 | #endif\r | |
110 | \r | |
3eb9473e | 111 | VOID\r |
112 | EFIAPI\r | |
113 | EfiRuntimeLibFvbVirtualNotifyEvent (\r | |
114 | IN EFI_EVENT Event,\r | |
115 | IN VOID *Context\r | |
116 | )\r | |
117 | /*++\r | |
118 | \r | |
119 | Routine Description:\r | |
120 | \r | |
121 | Notify function to convert pointers to Fvb functions after ExitBootServices\r | |
122 | \r | |
123 | Arguments:\r | |
124 | \r | |
125 | Event - Event whose notification function is being invoked.\r | |
fd0d281b | 126 | Context - Pointer to the notification function's context, which is\r |
3eb9473e | 127 | implementation-dependent.\r |
128 | \r | |
129 | Returns:\r | |
130 | \r | |
131 | None\r | |
132 | \r | |
133 | --*/\r | |
134 | ;\r | |
135 | \r | |
136 | EFI_STATUS\r | |
137 | EfiInitializeRuntimeDriverLib (\r | |
138 | IN EFI_HANDLE ImageHandle,\r | |
139 | IN EFI_SYSTEM_TABLE *SystemTable,\r | |
140 | IN EFI_EVENT_NOTIFY RuntimeNotifyEventHandler\r | |
141 | )\r | |
142 | /*++\r | |
143 | \r | |
144 | Routine Description:\r | |
145 | \r | |
146 | Intialize Runtime Driver Lib if it has not yet been initialized. \r | |
147 | \r | |
148 | Arguments:\r | |
149 | \r | |
150 | ImageHandle - The firmware allocated handle for the EFI image.\r | |
151 | \r | |
152 | SystemTable - A pointer to the EFI System Table.\r | |
153 | \r | |
154 | RuntimeNotifyEventHandler - Virtual address change notification event\r | |
155 | \r | |
156 | Returns: \r | |
157 | \r | |
158 | EFI_STATUS always returns EFI_SUCCESS\r | |
159 | \r | |
160 | --*/\r | |
161 | ;\r | |
162 | \r | |
163 | EFI_STATUS\r | |
164 | EfiShutdownRuntimeDriverLib (\r | |
165 | VOID\r | |
166 | )\r | |
167 | /*++\r | |
168 | \r | |
169 | Routine Description:\r | |
170 | \r | |
171 | This routine will free some resources which have been allocated in\r | |
172 | EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error, \r | |
173 | it must call this routine to free the allocated resource before the exiting.\r | |
174 | \r | |
175 | Arguments:\r | |
176 | \r | |
177 | None\r | |
178 | \r | |
179 | Returns: \r | |
180 | \r | |
181 | EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully\r | |
182 | EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all\r | |
183 | \r | |
184 | --*/\r | |
185 | ;\r | |
186 | \r | |
187 | EFI_STATUS\r | |
188 | EfiInitializeSmmDriverLib (\r | |
189 | IN EFI_HANDLE ImageHandle,\r | |
190 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
191 | )\r | |
192 | /*++\r | |
193 | \r | |
194 | Routine Description:\r | |
195 | \r | |
196 | Intialize Smm Driver Lib if it has not yet been initialized. \r | |
197 | \r | |
198 | Arguments:\r | |
199 | \r | |
200 | ImageHandle - The firmware allocated handle for the EFI image.\r | |
201 | \r | |
202 | SystemTable - A pointer to the EFI System Table.\r | |
203 | \r | |
204 | Returns: \r | |
205 | \r | |
206 | EFI_STATUS always returns EFI_SUCCESS\r | |
207 | \r | |
208 | --*/\r | |
209 | ;\r | |
210 | \r | |
211 | EFI_STATUS\r | |
212 | EfiLibGetSystemConfigurationTable (\r | |
213 | IN EFI_GUID *TableGuid,\r | |
214 | IN OUT VOID **Table\r | |
215 | )\r | |
216 | /*++\r | |
217 | \r | |
218 | Routine Description:\r | |
219 | \r | |
220 | Return the EFI 1.0 System Tabl entry with TableGuid\r | |
221 | \r | |
222 | Arguments:\r | |
223 | \r | |
224 | TableGuid - Name of entry to return in the system table\r | |
225 | Table - Pointer in EFI system table associated with TableGuid\r | |
226 | \r | |
227 | Returns: \r | |
228 | \r | |
229 | EFI_SUCCESS - Table returned;\r | |
230 | EFI_NOT_FOUND - TableGuid not in EFI system table\r | |
231 | \r | |
232 | --*/\r | |
233 | ;\r | |
234 | \r | |
235 | BOOLEAN\r | |
236 | EfiAtRuntime (\r | |
237 | VOID\r | |
238 | )\r | |
239 | /*++\r | |
240 | \r | |
241 | Routine Description:\r | |
242 | \r | |
243 | Am I at runtime?\r | |
244 | \r | |
245 | Arguments:\r | |
246 | \r | |
247 | None\r | |
248 | \r | |
249 | Returns:\r | |
250 | \r | |
251 | TRUE - At runtime\r | |
252 | FALSE - Not at runtime\r | |
253 | \r | |
254 | --*/\r | |
255 | ;\r | |
256 | \r | |
257 | BOOLEAN\r | |
258 | EfiGoneVirtual (\r | |
259 | VOID\r | |
260 | )\r | |
261 | /*++\r | |
262 | \r | |
263 | Routine Description:\r | |
264 | Return TRUE if SetVirtualAddressMap () has been called\r | |
265 | \r | |
266 | Arguments:\r | |
267 | NONE\r | |
268 | \r | |
269 | Returns: \r | |
270 | TRUE - If SetVirtualAddressMap () has been called\r | |
271 | FALSE - If SetVirtualAddressMap () has not been called\r | |
272 | \r | |
273 | --*/\r | |
274 | ;\r | |
275 | \r | |
276 | EFI_STATUS\r | |
277 | EfiLibGetSystemConfigurationTable (\r | |
278 | IN EFI_GUID *TableGuid,\r | |
279 | IN OUT VOID **Table\r | |
280 | )\r | |
281 | /*++\r | |
282 | \r | |
283 | \r | |
284 | \r | |
285 | Routine Description:\r | |
286 | \r | |
287 | \r | |
288 | \r | |
289 | Get table from configuration table by name\r | |
290 | \r | |
291 | \r | |
292 | \r | |
293 | Arguments:\r | |
294 | \r | |
295 | \r | |
296 | \r | |
297 | TableGuid - Table name to search\r | |
298 | \r | |
299 | \r | |
300 | \r | |
301 | Table - Pointer to the table caller wants\r | |
302 | \r | |
303 | \r | |
304 | \r | |
305 | Returns: \r | |
306 | \r | |
307 | \r | |
308 | \r | |
309 | EFI_NOT_FOUND - Not found the table\r | |
310 | \r | |
311 | \r | |
312 | \r | |
313 | EFI_SUCCESS - Found the table\r | |
314 | \r | |
315 | \r | |
316 | \r | |
317 | --*/\r | |
318 | \r | |
319 | ;\r | |
320 | \r | |
321 | EFI_EVENT\r | |
322 | RtEfiLibCreateProtocolNotifyEvent (\r | |
323 | IN EFI_GUID *ProtocolGuid,\r | |
324 | IN EFI_TPL NotifyTpl,\r | |
325 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
326 | IN VOID *NotifyContext,\r | |
327 | OUT VOID **Registration\r | |
328 | )\r | |
329 | /*++\r | |
330 | \r | |
331 | Routine Description:\r | |
332 | \r | |
333 | Create a protocol notification event and return it.\r | |
334 | \r | |
335 | Arguments:\r | |
336 | \r | |
337 | ProtocolGuid - Protocol to register notification event on.\r | |
338 | \r | |
339 | NotifyTpl - Maximum TPL to single the NotifyFunction.\r | |
340 | \r | |
341 | NotifyFunction - EFI notification routine.\r | |
342 | \r | |
343 | NotifyContext - Context passed into Event when it is created.\r | |
344 | \r | |
345 | Registration - Registration key returned from RegisterProtocolNotify().\r | |
346 | \r | |
347 | Returns: \r | |
348 | \r | |
349 | The EFI_EVENT that has been registered to be signaled when a ProtocolGuid \r | |
350 | is added to the system.\r | |
351 | \r | |
352 | --*/\r | |
353 | ;\r | |
354 | \r | |
355 | //\r | |
356 | // Lock.c\r | |
357 | //\r | |
358 | typedef struct {\r | |
359 | EFI_TPL Tpl;\r | |
360 | EFI_TPL OwnerTpl;\r | |
361 | UINTN Lock;\r | |
362 | } EFI_LOCK;\r | |
363 | \r | |
364 | VOID\r | |
365 | EfiInitializeLock (\r | |
366 | IN OUT EFI_LOCK *Lock,\r | |
367 | IN EFI_TPL Priority\r | |
368 | )\r | |
369 | /*++\r | |
370 | \r | |
371 | Routine Description:\r | |
372 | \r | |
373 | Initialize a basic mutual exclusion lock. Each lock\r | |
374 | provides mutual exclusion access at it's task priority\r | |
375 | level. Since there is no-premption (at any TPL) or\r | |
376 | multiprocessor support, acquiring the lock only consists\r | |
377 | of raising to the locks TPL.\r | |
378 | \r | |
379 | Note on a check build ASSERT()s are used to ensure proper\r | |
380 | lock usage.\r | |
381 | \r | |
382 | Arguments:\r | |
383 | \r | |
384 | Lock - The EFI_LOCK structure to initialize\r | |
385 | \r | |
386 | Priority - The task priority level of the lock\r | |
387 | \r | |
388 | \r | |
389 | Returns:\r | |
390 | \r | |
391 | An initialized Efi Lock structure.\r | |
392 | \r | |
393 | --*/\r | |
394 | ;\r | |
395 | \r | |
396 | //\r | |
397 | // Macro to initialize the state of a lock when a lock variable is declared\r | |
398 | //\r | |
399 | #define EFI_INITIALIZE_LOCK_VARIABLE(Tpl) {Tpl,0,0}\r | |
400 | \r | |
401 | \r | |
402 | VOID\r | |
403 | EfiAcquireLock (\r | |
404 | IN EFI_LOCK *Lock\r | |
405 | )\r | |
406 | /*++\r | |
407 | \r | |
408 | Routine Description:\r | |
409 | \r | |
410 | Raising to the task priority level of the mutual exclusion\r | |
411 | lock, and then acquires ownership of the lock.\r | |
412 | \r | |
413 | Arguments:\r | |
414 | \r | |
415 | Lock - The lock to acquire\r | |
416 | \r | |
417 | Returns:\r | |
418 | \r | |
419 | Lock owned\r | |
420 | \r | |
421 | --*/\r | |
422 | ;\r | |
423 | \r | |
424 | EFI_STATUS\r | |
425 | EfiAcquireLockOrFail (\r | |
426 | IN EFI_LOCK *Lock\r | |
427 | )\r | |
428 | /*++\r | |
429 | \r | |
430 | Routine Description:\r | |
431 | \r | |
432 | Initialize a basic mutual exclusion lock. Each lock\r | |
433 | provides mutual exclusion access at it's task priority\r | |
434 | level. Since there is no-premption (at any TPL) or\r | |
435 | multiprocessor support, acquiring the lock only consists\r | |
436 | of raising to the locks TPL.\r | |
437 | \r | |
438 | Arguments:\r | |
439 | \r | |
440 | Lock - The EFI_LOCK structure to initialize\r | |
441 | \r | |
442 | Returns:\r | |
443 | \r | |
444 | EFI_SUCCESS - Lock Owned.\r | |
445 | EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.\r | |
446 | \r | |
447 | --*/\r | |
448 | ;\r | |
449 | \r | |
450 | VOID\r | |
451 | EfiReleaseLock (\r | |
452 | IN EFI_LOCK *Lock\r | |
453 | )\r | |
454 | /*++\r | |
455 | \r | |
456 | Routine Description:\r | |
457 | \r | |
458 | Releases ownership of the mutual exclusion lock, and\r | |
459 | restores the previous task priority level.\r | |
460 | \r | |
461 | Arguments:\r | |
462 | \r | |
463 | Lock - The lock to release\r | |
464 | \r | |
465 | Returns:\r | |
466 | \r | |
467 | None\r | |
468 | \r | |
469 | --*/\r | |
470 | ;\r | |
471 | \r | |
472 | #define EfiCopyMem EfiCommonLibCopyMem\r | |
473 | #define EfiSetMem EfiCommonLibSetMem\r | |
474 | #define EfiZeroMem EfiCommonLibZeroMem\r | |
475 | \r | |
476 | INTN\r | |
477 | EfiCompareMem (\r | |
478 | IN VOID *MemOne,\r | |
479 | IN VOID *MemTwo,\r | |
480 | IN UINTN Len\r | |
481 | )\r | |
482 | /*++\r | |
483 | \r | |
484 | Routine Description:\r | |
485 | \r | |
486 | Compares two memory buffers of a given length.\r | |
487 | \r | |
488 | Arguments:\r | |
489 | \r | |
490 | MemOne - First memory buffer\r | |
491 | \r | |
492 | MemTwo - Second memory buffer\r | |
493 | \r | |
494 | Len - Length of Mem1 and Mem2 memory regions to compare\r | |
495 | \r | |
496 | Returns:\r | |
497 | \r | |
498 | = 0 if MemOne == MemTwo\r | |
499 | \r | |
500 | > 0 if MemOne > MemTwo\r | |
501 | \r | |
502 | < 0 if MemOne < MemTwo\r | |
503 | \r | |
504 | --*/\r | |
505 | ;\r | |
506 | \r | |
507 | //\r | |
508 | // Debug.c init\r | |
509 | //\r | |
510 | EFI_STATUS\r | |
511 | EfiDebugAssertInit (\r | |
512 | VOID\r | |
513 | )\r | |
514 | /*++\r | |
515 | \r | |
516 | Routine Description:\r | |
517 | \r | |
518 | Locate Debug Assert Protocol and set as mDebugAssert\r | |
519 | \r | |
520 | Arguments:\r | |
521 | \r | |
522 | None\r | |
523 | \r | |
524 | Returns:\r | |
525 | \r | |
526 | Status code\r | |
527 | \r | |
528 | --*/\r | |
529 | ;\r | |
530 | \r | |
531 | //\r | |
532 | // Wrapper for EFI runtime functions\r | |
533 | //\r | |
534 | VOID\r | |
535 | EfiResetSystem (\r | |
536 | IN EFI_RESET_TYPE ResetType,\r | |
537 | IN EFI_STATUS ResetStatus,\r | |
538 | IN UINTN DataSize,\r | |
539 | IN CHAR16 *ResetData\r | |
540 | )\r | |
541 | /*++\r | |
542 | \r | |
543 | Routine Description:\r | |
544 | \r | |
545 | Resets the entire platform.\r | |
546 | \r | |
547 | Arguments:\r | |
548 | \r | |
549 | ResetType - The type of reset to perform.\r | |
550 | ResetStatus - The status code for the reset.\r | |
551 | DataSize - The size, in bytes, of ResetData.\r | |
552 | ResetData - A data buffer that includes a Null-terminated Unicode string, optionally\r | |
553 | followed by additional binary data.\r | |
554 | \r | |
555 | Returns:\r | |
556 | \r | |
557 | None\r | |
558 | \r | |
559 | --*/\r | |
560 | ;\r | |
561 | \r | |
562 | EFI_STATUS\r | |
563 | EfiGetNextHighMonotonicCount (\r | |
564 | OUT UINT32 *HighCount\r | |
565 | )\r | |
566 | /*++\r | |
567 | \r | |
568 | Routine Description:\r | |
569 | \r | |
fd0d281b | 570 | Returns the next high 32 bits of the platform's monotonic counter.\r |
3eb9473e | 571 | \r |
572 | Arguments:\r | |
573 | \r | |
574 | HighCount - Pointer to returned value.\r | |
575 | \r | |
576 | Returns:\r | |
577 | \r | |
578 | Status code\r | |
579 | \r | |
580 | --*/\r | |
581 | ;\r | |
582 | \r | |
583 | EFI_STATUS\r | |
584 | EfiGetTime (\r | |
585 | OUT EFI_TIME *Time,\r | |
586 | OUT EFI_TIME_CAPABILITIES *Capabilities\r | |
587 | )\r | |
588 | /*++\r | |
589 | \r | |
590 | Routine Description:\r | |
591 | \r | |
592 | Returns the current time and date information, and the time-keeping \r | |
593 | capabilities of the hardware platform.\r | |
594 | \r | |
595 | Arguments:\r | |
596 | \r | |
597 | Time - A pointer to storage to receive a snapshot of the current time.\r | |
fd0d281b | 598 | Capabilities - An optional pointer to a buffer to receive the real time clock device's\r |
3eb9473e | 599 | capabilities.\r |
600 | \r | |
601 | Returns:\r | |
602 | \r | |
603 | Status code\r | |
604 | \r | |
605 | --*/\r | |
606 | ;\r | |
607 | \r | |
608 | EFI_STATUS\r | |
609 | EfiSetTime (\r | |
610 | OUT EFI_TIME *Time\r | |
611 | )\r | |
612 | /*++\r | |
613 | \r | |
614 | Routine Description:\r | |
615 | \r | |
616 | Sets the current local time and date information.\r | |
617 | \r | |
618 | Arguments:\r | |
619 | \r | |
620 | Time - A pointer to the current time.\r | |
621 | \r | |
622 | Returns:\r | |
623 | \r | |
624 | Status code\r | |
625 | \r | |
626 | --*/\r | |
627 | ;\r | |
628 | \r | |
629 | EFI_STATUS\r | |
630 | EfiGetWakeupTime (\r | |
631 | OUT BOOLEAN *Enabled,\r | |
632 | OUT BOOLEAN *Pending,\r | |
633 | OUT EFI_TIME *Time\r | |
634 | )\r | |
635 | /*++\r | |
636 | \r | |
637 | Routine Description:\r | |
638 | \r | |
639 | Returns the current wakeup alarm clock setting.\r | |
640 | \r | |
641 | Arguments:\r | |
642 | \r | |
643 | Enabled - Indicates if the alarm is currently enabled or disabled.\r | |
644 | Pending - Indicates if the alarm signal is pending and requires acknowledgement.\r | |
645 | Time - The current alarm setting.\r | |
646 | \r | |
647 | Returns:\r | |
648 | \r | |
649 | Status code\r | |
650 | \r | |
651 | --*/\r | |
652 | ;\r | |
653 | \r | |
654 | EFI_STATUS\r | |
655 | EfiSetWakeupTime (\r | |
656 | IN BOOLEAN Enable,\r | |
657 | IN EFI_TIME *Time\r | |
658 | )\r | |
659 | /*++\r | |
660 | \r | |
661 | Routine Description:\r | |
662 | \r | |
663 | Sets the system wakeup alarm clock time.\r | |
664 | \r | |
665 | Arguments:\r | |
666 | \r | |
667 | Enable - Enable or disable the wakeup alarm.\r | |
668 | Time - If Enable is TRUE, the time to set the wakeup alarm for.\r | |
669 | If Enable is FALSE, then this parameter is optional, and may be NULL.\r | |
670 | \r | |
671 | Returns:\r | |
672 | \r | |
673 | Status code\r | |
674 | \r | |
675 | --*/\r | |
676 | ;\r | |
677 | \r | |
678 | EFI_STATUS\r | |
679 | EfiGetVariable (\r | |
680 | IN CHAR16 *VariableName,\r | |
681 | IN EFI_GUID * VendorGuid,\r | |
682 | OUT UINT32 *Attributes OPTIONAL,\r | |
683 | IN OUT UINTN *DataSize,\r | |
684 | OUT VOID *Data\r | |
685 | )\r | |
686 | /*++\r | |
687 | \r | |
688 | Routine Description:\r | |
689 | \r | |
690 | Returns the value of a variable.\r | |
691 | \r | |
692 | Arguments:\r | |
693 | \r | |
694 | VariableName - A Null-terminated Unicode string that is the name of the\r | |
fd0d281b | 695 | vendor's variable.\r |
3eb9473e | 696 | VendorGuid - A unique identifier for the vendor.\r |
697 | Attributes - If not NULL, a pointer to the memory location to return the\r | |
698 | attributes bitmask for the variable.\r | |
699 | DataSize - On input, the size in bytes of the return Data buffer.\r | |
700 | On output the size of data returned in Data.\r | |
701 | Data - The buffer to return the contents of the variable.\r | |
702 | \r | |
703 | Returns:\r | |
704 | \r | |
705 | Status code\r | |
706 | \r | |
707 | --*/\r | |
708 | ;\r | |
709 | \r | |
710 | EFI_STATUS\r | |
711 | EfiGetNextVariableName (\r | |
712 | IN OUT UINTN *VariableNameSize,\r | |
713 | IN OUT CHAR16 *VariableName,\r | |
714 | IN OUT EFI_GUID *VendorGuid\r | |
715 | )\r | |
716 | /*++\r | |
717 | \r | |
718 | Routine Description:\r | |
719 | \r | |
720 | Enumerates the current variable names.\r | |
721 | \r | |
722 | Arguments:\r | |
723 | \r | |
724 | VariableNameSize - The size of the VariableName buffer.\r | |
725 | VariableName - On input, supplies the last VariableName that was returned\r | |
726 | by GetNextVariableName(). \r | |
727 | On output, returns the Nullterminated Unicode string of the\r | |
728 | current variable.\r | |
729 | VendorGuid - On input, supplies the last VendorGuid that was returned by\r | |
730 | GetNextVariableName(). \r | |
731 | On output, returns the VendorGuid of the current variable.\r | |
732 | \r | |
733 | Returns:\r | |
734 | \r | |
735 | Status code\r | |
736 | \r | |
737 | --*/\r | |
738 | ;\r | |
739 | \r | |
740 | EFI_STATUS\r | |
741 | EfiSetVariable (\r | |
742 | IN CHAR16 *VariableName,\r | |
743 | IN EFI_GUID *VendorGuid,\r | |
744 | IN UINT32 Attributes,\r | |
745 | IN UINTN DataSize,\r | |
746 | IN VOID *Data\r | |
747 | )\r | |
748 | /*++\r | |
749 | \r | |
750 | Routine Description:\r | |
751 | \r | |
752 | Sets the value of a variable.\r | |
753 | \r | |
754 | Arguments:\r | |
755 | \r | |
756 | VariableName - A Null-terminated Unicode string that is the name of the\r | |
fd0d281b | 757 | vendor's variable.\r |
3eb9473e | 758 | VendorGuid - A unique identifier for the vendor.\r |
759 | Attributes - Attributes bitmask to set for the variable.\r | |
760 | DataSize - The size in bytes of the Data buffer.\r | |
761 | Data - The contents for the variable.\r | |
762 | \r | |
763 | Returns:\r | |
764 | \r | |
765 | Status code\r | |
766 | \r | |
767 | --*/\r | |
768 | ;\r | |
769 | \r | |
770 | #if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r | |
771 | \r | |
772 | EFI_STATUS\r | |
773 | EfiQueryVariableInfo (\r | |
774 | IN UINT32 Attributes,\r | |
775 | OUT UINT64 *MaximumVariableStorageSize,\r | |
776 | OUT UINT64 *RemainingVariableStorageSize,\r | |
777 | OUT UINT64 *MaximumVariableSize\r | |
778 | )\r | |
779 | /*++\r | |
780 | \r | |
781 | Routine Description:\r | |
782 | \r | |
783 | This code returns information about the EFI variables.\r | |
784 | \r | |
785 | Arguments:\r | |
786 | \r | |
787 | Attributes Attributes bitmask to specify the type of variables \r | |
788 | on which to return information.\r | |
789 | MaximumVariableStorageSize Pointer to the maximum size of the storage space available\r | |
790 | for the EFI variables associated with the attributes specified.\r | |
791 | RemainingVariableStorageSize Pointer to the remaining size of the storage space available \r | |
792 | for the EFI variables associated with the attributes specified.\r | |
793 | MaximumVariableSize Pointer to the maximum size of the individual EFI variables\r | |
794 | associated with the attributes specified.\r | |
795 | \r | |
796 | Returns:\r | |
797 | \r | |
798 | Status code\r | |
799 | \r | |
800 | --*/\r | |
801 | ;\r | |
802 | #endif\r | |
803 | \r | |
804 | \r | |
805 | EFI_STATUS\r | |
806 | EfiReportStatusCode (\r | |
807 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
808 | IN EFI_STATUS_CODE_VALUE Value,\r | |
809 | IN UINT32 Instance,\r | |
810 | IN EFI_GUID * CallerId,\r | |
811 | IN EFI_STATUS_CODE_DATA * Data OPTIONAL\r | |
812 | )\r | |
813 | /*++\r | |
814 | \r | |
815 | Routine Description:\r | |
816 | \r | |
817 | Status Code reporter\r | |
818 | \r | |
819 | Arguments:\r | |
820 | \r | |
821 | CodeType - Type of Status Code.\r | |
822 | \r | |
823 | Value - Value to output for Status Code.\r | |
824 | \r | |
825 | Instance - Instance Number of this status code.\r | |
826 | \r | |
827 | CallerId - ID of the caller of this status code.\r | |
828 | \r | |
829 | Data - Optional data associated with this status code.\r | |
830 | \r | |
831 | Returns:\r | |
832 | \r | |
833 | Status code\r | |
834 | \r | |
835 | --*/\r | |
836 | ;\r | |
837 | \r | |
838 | EFI_STATUS\r | |
839 | EfiConvertPointer (\r | |
840 | IN UINTN DebugDisposition,\r | |
841 | IN OUT VOID *Address\r | |
842 | )\r | |
843 | /*++\r | |
844 | \r | |
845 | Routine Description:\r | |
846 | \r | |
847 | Determines the new virtual address that is to be used on subsequent memory accesses.\r | |
848 | \r | |
849 | Arguments:\r | |
850 | \r | |
851 | DebugDisposition - Supplies type information for the pointer being converted.\r | |
852 | Address - A pointer to a pointer that is to be fixed to be the value needed\r | |
853 | for the new virtual address mappings being applied.\r | |
854 | \r | |
855 | Returns:\r | |
856 | \r | |
857 | Status code\r | |
858 | \r | |
859 | --*/\r | |
860 | ;\r | |
861 | \r | |
862 | EFI_STATUS\r | |
863 | EfiConvertList (\r | |
864 | IN UINTN DebugDisposition,\r | |
865 | IN OUT EFI_LIST_ENTRY *ListHead\r | |
866 | )\r | |
867 | /*++\r | |
868 | \r | |
869 | Routine Description:\r | |
870 | \r | |
871 | Conver the standard Lib double linked list to a virtual mapping.\r | |
872 | \r | |
873 | Arguments:\r | |
874 | \r | |
875 | DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)\r | |
876 | \r | |
877 | ListHead - Head of linked list to convert\r | |
878 | \r | |
879 | Returns: \r | |
880 | \r | |
881 | EFI_SUCCESS\r | |
882 | \r | |
883 | --*/\r | |
884 | ;\r | |
885 | \r | |
886 | //\r | |
887 | // Base IO Class Functions\r | |
888 | //\r | |
889 | EFI_STATUS\r | |
890 | EfiIoRead (\r | |
891 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
892 | IN UINT64 Address,\r | |
893 | IN UINTN Count,\r | |
894 | IN OUT VOID *Buffer\r | |
895 | )\r | |
896 | /*++\r | |
897 | \r | |
898 | Routine Description:\r | |
899 | Perform an IO read into Buffer.\r | |
900 | \r | |
901 | Arguments:\r | |
902 | Width - Width of read transaction, and repeat operation to use\r | |
903 | Address - IO address to read\r | |
904 | Count - Number of times to read the IO address.\r | |
905 | Buffer - Buffer to read data into. size is Width * Count\r | |
906 | \r | |
907 | Returns: \r | |
908 | Status code\r | |
909 | \r | |
910 | --*/\r | |
911 | ;\r | |
912 | \r | |
913 | UINT8\r | |
914 | IoRead8 (\r | |
915 | IN UINT64 Address\r | |
916 | )\r | |
917 | /*++\r | |
918 | \r | |
919 | Routine Description:\r | |
920 | Do a one byte IO read\r | |
921 | \r | |
922 | Arguments:\r | |
923 | Address - IO address to read\r | |
924 | \r | |
925 | Returns: \r | |
926 | Data read\r | |
927 | \r | |
928 | --*/\r | |
929 | ;\r | |
930 | \r | |
931 | UINT16\r | |
932 | IoRead16 (\r | |
933 | IN UINT64 Address\r | |
934 | )\r | |
935 | /*++\r | |
936 | \r | |
937 | Routine Description:\r | |
938 | Do a two byte IO read\r | |
939 | \r | |
940 | Arguments:\r | |
941 | Address - IO address to read\r | |
942 | \r | |
943 | Returns: \r | |
944 | Data read\r | |
945 | \r | |
946 | --*/\r | |
947 | ;\r | |
948 | \r | |
949 | UINT32\r | |
950 | IoRead32 (\r | |
951 | IN UINT64 Address\r | |
952 | )\r | |
953 | /*++\r | |
954 | \r | |
955 | Routine Description:\r | |
956 | Do a four byte IO read\r | |
957 | \r | |
958 | Arguments:\r | |
959 | Address - IO address to read\r | |
960 | \r | |
961 | Returns: \r | |
962 | Data read\r | |
963 | \r | |
964 | --*/\r | |
965 | ;\r | |
966 | \r | |
967 | EFI_STATUS\r | |
968 | EfiIoWrite (\r | |
969 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
970 | IN UINT64 Address,\r | |
971 | IN UINTN Count,\r | |
972 | IN OUT VOID *Buffer\r | |
973 | )\r | |
974 | /*++\r | |
975 | \r | |
976 | Routine Description:\r | |
977 | Perform an IO write into Buffer.\r | |
978 | \r | |
979 | Arguments:\r | |
980 | Width - Width of write transaction, and repeat operation to use\r | |
981 | Address - IO address to write\r | |
982 | Count - Number of times to write the IO address.\r | |
983 | Buffer - Buffer to write data from. size is Width * Count\r | |
984 | \r | |
985 | Returns: \r | |
986 | Status code\r | |
987 | \r | |
988 | --*/\r | |
989 | ;\r | |
990 | \r | |
991 | VOID\r | |
992 | IoWrite8 (\r | |
993 | IN UINT64 Address,\r | |
994 | IN UINT8 Data\r | |
995 | )\r | |
996 | /*++\r | |
997 | \r | |
998 | Routine Description:\r | |
999 | Do a one byte IO write\r | |
1000 | \r | |
1001 | Arguments:\r | |
1002 | Address - IO address to write\r | |
1003 | Data - Data to write to Address\r | |
1004 | \r | |
1005 | Returns: \r | |
1006 | NONE\r | |
1007 | \r | |
1008 | --*/\r | |
1009 | ;\r | |
1010 | \r | |
1011 | VOID\r | |
1012 | IoWrite16 (\r | |
1013 | IN UINT64 Address,\r | |
1014 | IN UINT16 Data\r | |
1015 | )\r | |
1016 | /*++\r | |
1017 | \r | |
1018 | Routine Description:\r | |
1019 | Do a two byte IO write\r | |
1020 | \r | |
1021 | Arguments:\r | |
1022 | Address - IO address to write\r | |
1023 | Data - Data to write to Address\r | |
1024 | \r | |
1025 | Returns: \r | |
1026 | NONE\r | |
1027 | \r | |
1028 | --*/\r | |
1029 | ;\r | |
1030 | \r | |
1031 | VOID\r | |
1032 | IoWrite32 (\r | |
1033 | IN UINT64 Address,\r | |
1034 | IN UINT32 Data\r | |
1035 | )\r | |
1036 | /*++\r | |
1037 | \r | |
1038 | Routine Description:\r | |
1039 | Do a four byte IO write\r | |
1040 | \r | |
1041 | Arguments:\r | |
1042 | Address - IO address to write\r | |
1043 | Data - Data to write to Address\r | |
1044 | \r | |
1045 | Returns: \r | |
1046 | NONE\r | |
1047 | \r | |
1048 | --*/\r | |
1049 | ;\r | |
1050 | \r | |
1051 | EFI_STATUS\r | |
1052 | EfiMemRead (\r | |
1053 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
1054 | IN UINT64 Address,\r | |
1055 | IN UINTN Count,\r | |
1056 | IN OUT VOID *Buffer\r | |
1057 | )\r | |
1058 | /*++\r | |
1059 | \r | |
1060 | Routine Description:\r | |
1061 | Perform a Memory mapped IO read into Buffer.\r | |
1062 | \r | |
1063 | Arguments:\r | |
1064 | Width - Width of each read transaction.\r | |
1065 | Address - Memory mapped IO address to read\r | |
1066 | Count - Number of Width quanta to read\r | |
1067 | Buffer - Buffer to read data into. size is Width * Count\r | |
1068 | \r | |
1069 | Returns: \r | |
1070 | Status code\r | |
1071 | \r | |
1072 | --*/\r | |
1073 | ;\r | |
1074 | \r | |
1075 | UINT8\r | |
1076 | MemRead8 (\r | |
1077 | IN UINT64 Address\r | |
1078 | )\r | |
1079 | /*++\r | |
1080 | \r | |
1081 | Routine Description:\r | |
1082 | Do a one byte Memory mapped IO read\r | |
1083 | \r | |
1084 | Arguments:\r | |
1085 | Address - Memory mapped IO address to read\r | |
1086 | \r | |
1087 | Returns: \r | |
1088 | Data read\r | |
1089 | \r | |
1090 | --*/\r | |
1091 | ;\r | |
1092 | \r | |
1093 | UINT16\r | |
1094 | MemRead16 (\r | |
1095 | IN UINT64 Address\r | |
1096 | )\r | |
1097 | /*++\r | |
1098 | \r | |
1099 | Routine Description:\r | |
1100 | Do a two byte Memory mapped IO read\r | |
1101 | \r | |
1102 | Arguments:\r | |
1103 | Address - Memory mapped IO address to read\r | |
1104 | \r | |
1105 | Returns: \r | |
1106 | Data read\r | |
1107 | \r | |
1108 | --*/\r | |
1109 | ;\r | |
1110 | \r | |
1111 | UINT32\r | |
1112 | MemRead32 (\r | |
1113 | IN UINT64 Address\r | |
1114 | )\r | |
1115 | /*++\r | |
1116 | \r | |
1117 | Routine Description:\r | |
1118 | Do a four byte Memory mapped IO read\r | |
1119 | \r | |
1120 | Arguments:\r | |
1121 | Address - Memory mapped IO address to read\r | |
1122 | \r | |
1123 | Returns: \r | |
1124 | Data read\r | |
1125 | \r | |
1126 | --*/\r | |
1127 | ;\r | |
1128 | \r | |
1129 | UINT64\r | |
1130 | MemRead64 (\r | |
1131 | IN UINT64 Address\r | |
1132 | )\r | |
1133 | /*++\r | |
1134 | \r | |
1135 | Routine Description:\r | |
1136 | Do a eight byte Memory mapped IO read\r | |
1137 | \r | |
1138 | Arguments:\r | |
1139 | Address - Memory mapped IO address to read\r | |
1140 | \r | |
1141 | Returns: \r | |
1142 | Data read\r | |
1143 | \r | |
1144 | --*/\r | |
1145 | ;\r | |
1146 | \r | |
1147 | EFI_STATUS\r | |
1148 | EfiMemWrite (\r | |
1149 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
1150 | IN UINT64 Address,\r | |
1151 | IN UINTN Count,\r | |
1152 | IN OUT VOID *Buffer\r | |
1153 | )\r | |
1154 | /*++\r | |
1155 | \r | |
1156 | Routine Description:\r | |
1157 | Perform a memory mapped IO write into Buffer.\r | |
1158 | \r | |
1159 | Arguments:\r | |
1160 | Width - Width of write transaction, and repeat operation to use\r | |
1161 | Address - IO address to write\r | |
1162 | Count - Number of times to write the IO address.\r | |
1163 | Buffer - Buffer to write data from. size is Width * Count\r | |
1164 | \r | |
1165 | Returns: \r | |
1166 | Status code\r | |
1167 | \r | |
1168 | --*/\r | |
1169 | ;\r | |
1170 | \r | |
1171 | VOID\r | |
1172 | MemWrite8 (\r | |
1173 | IN UINT64 Address,\r | |
1174 | IN UINT8 Data\r | |
1175 | )\r | |
1176 | /*++\r | |
1177 | \r | |
1178 | Routine Description:\r | |
1179 | Do a one byte Memory mapped IO write\r | |
1180 | \r | |
1181 | Arguments:\r | |
1182 | Address - Memory mapped IO address to write\r | |
1183 | Data - Data to write to Address\r | |
1184 | \r | |
1185 | Returns: \r | |
1186 | NONE\r | |
1187 | \r | |
1188 | --*/\r | |
1189 | ;\r | |
1190 | \r | |
1191 | VOID\r | |
1192 | MemWrite16 (\r | |
1193 | IN UINT64 Address,\r | |
1194 | IN UINT16 Data\r | |
1195 | )\r | |
1196 | /*++\r | |
1197 | \r | |
1198 | Routine Description:\r | |
1199 | Do a two byte Memory mapped IO write\r | |
1200 | \r | |
1201 | Arguments:\r | |
1202 | Address - Memory mapped IO address to write\r | |
1203 | Data - Data to write to Address\r | |
1204 | \r | |
1205 | Returns: \r | |
1206 | NONE\r | |
1207 | \r | |
1208 | --*/\r | |
1209 | ;\r | |
1210 | \r | |
1211 | VOID\r | |
1212 | MemWrite32 (\r | |
1213 | IN UINT64 Address,\r | |
1214 | IN UINT32 Data\r | |
1215 | )\r | |
1216 | /*++\r | |
1217 | \r | |
1218 | Routine Description:\r | |
1219 | Do a four byte Memory mapped IO write\r | |
1220 | \r | |
1221 | Arguments:\r | |
1222 | Address - Memory mapped IO address to write\r | |
1223 | Data - Data to write to Address\r | |
1224 | \r | |
1225 | Returns: \r | |
1226 | NONE\r | |
1227 | \r | |
1228 | --*/\r | |
1229 | ;\r | |
1230 | \r | |
1231 | VOID\r | |
1232 | MemWrite64 (\r | |
1233 | IN UINT64 Address,\r | |
1234 | IN UINT64 Data\r | |
1235 | )\r | |
1236 | /*++\r | |
1237 | \r | |
1238 | Routine Description:\r | |
1239 | Do a eight byte Memory mapped IO write\r | |
1240 | \r | |
1241 | Arguments:\r | |
1242 | Address - Memory mapped IO address to write\r | |
1243 | Data - Data to write to Address\r | |
1244 | \r | |
1245 | Returns: \r | |
1246 | NONE\r | |
1247 | \r | |
1248 | --*/\r | |
1249 | ;\r | |
1250 | \r | |
1251 | //\r | |
1252 | // Platform specific functions\r | |
1253 | //\r | |
1254 | UINT8\r | |
1255 | PciRead8 (\r | |
1256 | UINT8 Segment,\r | |
1257 | UINT8 Bus,\r | |
1258 | UINT8 DevFunc,\r | |
1259 | UINT8 Register\r | |
1260 | )\r | |
1261 | /*++\r | |
1262 | \r | |
1263 | Routine Description:\r | |
1264 | Perform an one byte PCI config cycle read\r | |
1265 | \r | |
1266 | Arguments:\r | |
1267 | Segment - PCI Segment ACPI _SEG\r | |
1268 | Bus - PCI Bus\r | |
1269 | DevFunc - PCI Device(7:3) and Func(2:0)\r | |
1270 | Register - PCI config space register\r | |
1271 | \r | |
1272 | Returns:\r | |
1273 | Data read from PCI config space\r | |
1274 | \r | |
1275 | --*/\r | |
1276 | ;\r | |
1277 | \r | |
1278 | UINT16\r | |
1279 | PciRead16 (\r | |
1280 | UINT8 Segment,\r | |
1281 | UINT8 Bus,\r | |
1282 | UINT8 DevFunc,\r | |
1283 | UINT8 Register\r | |
1284 | )\r | |
1285 | /*++\r | |
1286 | \r | |
1287 | Routine Description:\r | |
1288 | Perform an two byte PCI config cycle read\r | |
1289 | \r | |
1290 | Arguments:\r | |
1291 | Segment - PCI Segment ACPI _SEG\r | |
1292 | Bus - PCI Bus\r | |
1293 | DevFunc - PCI Device(7:3) and Func(2:0)\r | |
1294 | Register - PCI config space register\r | |
1295 | \r | |
1296 | Returns:\r | |
1297 | Data read from PCI config space\r | |
1298 | \r | |
1299 | --*/\r | |
1300 | ;\r | |
1301 | \r | |
1302 | UINT32\r | |
1303 | PciRead32 (\r | |
1304 | UINT8 Segment,\r | |
1305 | UINT8 Bus,\r | |
1306 | UINT8 DevFunc,\r | |
1307 | UINT8 Register\r | |
1308 | )\r | |
1309 | /*++\r | |
1310 | \r | |
1311 | Routine Description:\r | |
1312 | Perform an four byte PCI config cycle read\r | |
1313 | \r | |
1314 | Arguments:\r | |
1315 | Segment - PCI Segment ACPI _SEG\r | |
1316 | Bus - PCI Bus\r | |
1317 | DevFunc - PCI Device(7:3) and Func(2:0)\r | |
1318 | Register - PCI config space register\r | |
1319 | \r | |
1320 | Returns:\r | |
1321 | Data read from PCI config space\r | |
1322 | \r | |
1323 | --*/\r | |
1324 | ;\r | |
1325 | \r | |
1326 | VOID\r | |
1327 | PciWrite8 (\r | |
1328 | UINT8 Segment,\r | |
1329 | UINT8 Bus,\r | |
1330 | UINT8 DevFunc,\r | |
1331 | UINT8 Register,\r | |
1332 | UINT8 Data\r | |
1333 | )\r | |
1334 | /*++\r | |
1335 | \r | |
1336 | Routine Description:\r | |
1337 | Perform an one byte PCI config cycle write\r | |
1338 | \r | |
1339 | Arguments:\r | |
1340 | Segment - PCI Segment ACPI _SEG\r | |
1341 | Bus - PCI Bus\r | |
1342 | DevFunc - PCI Device(7:3) and Func(2:0)\r | |
1343 | Register - PCI config space register\r | |
1344 | Data - Data to write\r | |
1345 | \r | |
1346 | Returns:\r | |
1347 | NONE\r | |
1348 | \r | |
1349 | --*/\r | |
1350 | ;\r | |
1351 | \r | |
1352 | VOID\r | |
1353 | PciWrite16 (\r | |
1354 | UINT8 Segment,\r | |
1355 | UINT8 Bus,\r | |
1356 | UINT8 DevFunc,\r | |
1357 | UINT8 Register,\r | |
1358 | UINT16 Data\r | |
1359 | )\r | |
1360 | /*++\r | |
1361 | \r | |
1362 | Routine Description:\r | |
1363 | Perform an two byte PCI config cycle write\r | |
1364 | \r | |
1365 | Arguments:\r | |
1366 | Segment - PCI Segment ACPI _SEG\r | |
1367 | Bus - PCI Bus\r | |
1368 | DevFunc - PCI Device(7:3) and Func(2:0)\r | |
1369 | Register - PCI config space register\r | |
1370 | Data - Data to write\r | |
1371 | \r | |
1372 | Returns:\r | |
1373 | NONE\r | |
1374 | \r | |
1375 | --*/\r | |
1376 | ;\r | |
1377 | \r | |
1378 | VOID\r | |
1379 | PciWrite32 (\r | |
1380 | UINT8 Segment,\r | |
1381 | UINT8 Bus,\r | |
1382 | UINT8 DevFunc,\r | |
1383 | UINT8 Register,\r | |
1384 | UINT32 Data\r | |
1385 | )\r | |
1386 | /*++\r | |
1387 | \r | |
1388 | Routine Description:\r | |
1389 | Perform an four byte PCI config cycle write\r | |
1390 | \r | |
1391 | Arguments:\r | |
1392 | Segment - PCI Segment ACPI _SEG\r | |
1393 | Bus - PCI Bus\r | |
1394 | DevFunc - PCI Device(7:3) and Func(2:0)\r | |
1395 | Register - PCI config space register\r | |
1396 | Data - Data to write\r | |
1397 | \r | |
1398 | Returns:\r | |
1399 | NONE\r | |
1400 | \r | |
1401 | --*/\r | |
1402 | ;\r | |
1403 | \r | |
1404 | VOID\r | |
1405 | EfiStall (\r | |
1406 | IN UINTN Microseconds\r | |
1407 | )\r | |
1408 | /*++\r | |
1409 | \r | |
1410 | Routine Description:\r | |
1411 | Delay for at least the request number of microseconds\r | |
1412 | \r | |
1413 | Arguments:\r | |
1414 | Microseconds - Number of microseconds to delay.\r | |
1415 | \r | |
1416 | Returns:\r | |
1417 | NONE\r | |
1418 | \r | |
1419 | --*/\r | |
1420 | ;\r | |
1421 | \r | |
1422 | //\r | |
1423 | // FVB Services.\r | |
1424 | //\r | |
1425 | EFI_STATUS\r | |
1426 | EfiFvbInitialize (\r | |
1427 | VOID\r | |
1428 | )\r | |
1429 | /*++\r | |
1430 | \r | |
1431 | Routine Description:\r | |
1432 | Initialize globals and register Fvb Protocol notification function.\r | |
1433 | \r | |
1434 | Arguments:\r | |
1435 | None \r | |
1436 | \r | |
1437 | Returns: \r | |
1438 | EFI_SUCCESS\r | |
1439 | \r | |
1440 | --*/\r | |
1441 | ;\r | |
1442 | \r | |
1443 | EFI_STATUS\r | |
1444 | EfiFvbShutdown (\r | |
1445 | VOID\r | |
1446 | )\r | |
1447 | /*++\r | |
1448 | \r | |
1449 | Routine Description:\r | |
1450 | Release resources allocated in EfiFvbInitialize.\r | |
1451 | \r | |
1452 | Arguments:\r | |
1453 | None \r | |
1454 | \r | |
1455 | Returns: \r | |
1456 | EFI_SUCCESS\r | |
1457 | \r | |
1458 | --*/\r | |
1459 | ;\r | |
1460 | \r | |
1461 | EFI_STATUS\r | |
1462 | EfiFvbReadBlock (\r | |
1463 | IN UINTN Instance,\r | |
1464 | IN EFI_LBA Lba,\r | |
1465 | IN UINTN Offset,\r | |
1466 | IN OUT UINTN *NumBytes,\r | |
1467 | IN UINT8 *Buffer\r | |
1468 | )\r | |
1469 | /*++\r | |
1470 | \r | |
1471 | Routine Description:\r | |
1472 | Reads specified number of bytes into a buffer from the specified block\r | |
1473 | \r | |
1474 | Arguments:\r | |
1475 | Instance - The FV instance to be read from\r | |
1476 | Lba - The logical block address to be read from\r | |
1477 | Offset - Offset into the block at which to begin reading\r | |
1478 | NumBytes - Pointer that on input contains the total size of\r | |
1479 | the buffer. On output, it contains the total number\r | |
1480 | of bytes read\r | |
1481 | Buffer - Pointer to a caller allocated buffer that will be\r | |
1482 | used to hold the data read\r | |
1483 | \r | |
1484 | Returns: \r | |
1485 | Status code\r | |
1486 | \r | |
1487 | --*/\r | |
1488 | ;\r | |
1489 | \r | |
1490 | EFI_STATUS\r | |
1491 | EfiFvbWriteBlock (\r | |
1492 | IN UINTN Instance,\r | |
1493 | IN EFI_LBA Lba,\r | |
1494 | IN UINTN Offset,\r | |
1495 | IN OUT UINTN *NumBytes,\r | |
1496 | IN UINT8 *Buffer\r | |
1497 | )\r | |
1498 | /*++\r | |
1499 | \r | |
1500 | Routine Description:\r | |
1501 | Writes specified number of bytes from the input buffer to the block\r | |
1502 | \r | |
1503 | Arguments:\r | |
1504 | Instance - The FV instance to be written to\r | |
1505 | Lba - The starting logical block index to write to\r | |
1506 | Offset - Offset into the block at which to begin writing\r | |
1507 | NumBytes - Pointer that on input contains the total size of\r | |
1508 | the buffer. On output, it contains the total number\r | |
1509 | of bytes actually written\r | |
1510 | Buffer - Pointer to a caller allocated buffer that contains\r | |
1511 | the source for the write\r | |
1512 | \r | |
1513 | Returns: \r | |
1514 | Status code\r | |
1515 | \r | |
1516 | --*/\r | |
1517 | ;\r | |
1518 | \r | |
1519 | EFI_STATUS\r | |
1520 | EfiFvbEraseBlock (\r | |
1521 | IN UINTN Instance,\r | |
1522 | IN EFI_LBA Lba\r | |
1523 | )\r | |
1524 | /*++\r | |
1525 | \r | |
1526 | Routine Description:\r | |
1527 | Erases and initializes a firmware volume block\r | |
1528 | \r | |
1529 | Arguments:\r | |
1530 | Instance - The FV instance to be erased\r | |
1531 | Lba - The logical block index to be erased\r | |
1532 | \r | |
1533 | Returns: \r | |
1534 | Status code\r | |
1535 | \r | |
1536 | --*/\r | |
1537 | ;\r | |
1538 | \r | |
1539 | EFI_STATUS\r | |
1540 | EfiFvbGetVolumeAttributes (\r | |
1541 | IN UINTN Instance,\r | |
1542 | OUT EFI_FVB_ATTRIBUTES *Attributes\r | |
1543 | )\r | |
1544 | /*++\r | |
1545 | \r | |
1546 | Routine Description:\r | |
1547 | Retrieves attributes, insures positive polarity of attribute bits, returns\r | |
1548 | resulting attributes in output parameter\r | |
1549 | \r | |
1550 | Arguments:\r | |
1551 | Instance - The FV instance whose attributes is going to be \r | |
1552 | returned\r | |
1553 | Attributes - Output buffer which contains attributes\r | |
1554 | \r | |
1555 | Returns: \r | |
1556 | Status code\r | |
1557 | \r | |
1558 | --*/\r | |
1559 | ;\r | |
1560 | \r | |
1561 | EFI_STATUS\r | |
1562 | EfiFvbSetVolumeAttributes (\r | |
1563 | IN UINTN Instance,\r | |
1564 | IN EFI_FVB_ATTRIBUTES Attributes\r | |
1565 | )\r | |
1566 | /*++\r | |
1567 | \r | |
1568 | Routine Description:\r | |
1569 | Modifies the current settings of the firmware volume according to the \r | |
c7f33ca4 | 1570 | input parameter.\r |
3eb9473e | 1571 | \r |
1572 | Arguments:\r | |
1573 | Instance - The FV instance whose attributes is going to be \r | |
1574 | modified\r | |
c7f33ca4 | 1575 | Attributes - It is a pointer to EFI_FVB_ATTRIBUTES \r |
3eb9473e | 1576 | containing the desired firmware volume settings.\r |
3eb9473e | 1577 | \r |
1578 | Returns: \r | |
1579 | Status code\r | |
1580 | \r | |
1581 | --*/\r | |
1582 | ;\r | |
1583 | \r | |
1584 | EFI_STATUS\r | |
1585 | EfiFvbGetPhysicalAddress (\r | |
1586 | IN UINTN Instance,\r | |
1587 | OUT EFI_PHYSICAL_ADDRESS *Address\r | |
1588 | )\r | |
1589 | /*++\r | |
1590 | \r | |
1591 | Routine Description:\r | |
1592 | Retrieves the physical address of a memory mapped FV\r | |
1593 | \r | |
1594 | Arguments:\r | |
1595 | Instance - The FV instance whose base address is going to be\r | |
1596 | returned\r | |
1597 | Address - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS \r | |
1598 | that on successful return, contains the base address\r | |
1599 | of the firmware volume. \r | |
1600 | \r | |
1601 | Returns: \r | |
1602 | Status code\r | |
1603 | \r | |
1604 | --*/\r | |
1605 | ;\r | |
1606 | \r | |
1607 | EFI_STATUS\r | |
1608 | EfiFvbGetBlockSize (\r | |
1609 | IN UINTN Instance,\r | |
1610 | IN EFI_LBA Lba,\r | |
1611 | OUT UINTN *BlockSize,\r | |
1612 | OUT UINTN *NumOfBlocks\r | |
1613 | )\r | |
1614 | /*++\r | |
1615 | \r | |
1616 | Routine Description:\r | |
1617 | Retrieve the size of a logical block\r | |
1618 | \r | |
1619 | Arguments:\r | |
1620 | Instance - The FV instance whose block size is going to be\r | |
1621 | returned\r | |
1622 | Lba - Indicates which block to return the size for.\r | |
1623 | BlockSize - A pointer to a caller allocated UINTN in which\r | |
1624 | the size of the block is returned\r | |
1625 | NumOfBlocks - a pointer to a caller allocated UINTN in which the\r | |
1626 | number of consecutive blocks starting with Lba is\r | |
1627 | returned. All blocks in this range have a size of\r | |
1628 | BlockSize\r | |
1629 | \r | |
1630 | Returns: \r | |
1631 | EFI_SUCCESS - The firmware volume was read successfully and \r | |
1632 | contents are in Buffer\r | |
1633 | \r | |
1634 | --*/\r | |
1635 | ;\r | |
1636 | EFI_STATUS\r | |
1637 | EfiFvbEraseCustomBlockRange (\r | |
1638 | IN UINTN Instance,\r | |
1639 | IN EFI_LBA StartLba,\r | |
1640 | IN UINTN OffsetStartLba,\r | |
1641 | IN EFI_LBA LastLba,\r | |
1642 | IN UINTN OffsetLastLba\r | |
1643 | )\r | |
1644 | /*++\r | |
1645 | \r | |
1646 | Routine Description:\r | |
1647 | Erases and initializes a specified range of a firmware volume\r | |
1648 | \r | |
1649 | Arguments:\r | |
1650 | Instance - The FV instance to be erased\r | |
1651 | StartLba - The starting logical block index to be erased\r | |
1652 | OffsetStartLba - Offset into the starting block at which to \r | |
1653 | begin erasing\r | |
1654 | LastLba - The last logical block index to be erased\r | |
1655 | OffsetLastLba - Offset into the last block at which to end erasing\r | |
1656 | \r | |
1657 | Returns: \r | |
1658 | Status code\r | |
1659 | \r | |
1660 | --*/\r | |
1661 | ;\r | |
1662 | \r | |
1663 | EFI_STATUS\r | |
1664 | EfiCpuFlushCache (\r | |
1665 | IN EFI_PHYSICAL_ADDRESS Start,\r | |
1666 | IN UINT64 Length\r | |
1667 | )\r | |
1668 | /*++\r | |
1669 | \r | |
1670 | Routine Description:\r | |
1671 | \r | |
1672 | Flush cache with specified range.\r | |
1673 | \r | |
1674 | Arguments:\r | |
1675 | \r | |
1676 | Start - Start address\r | |
1677 | Length - Length in bytes\r | |
1678 | \r | |
1679 | Returns:\r | |
1680 | \r | |
1681 | Status code\r | |
1682 | \r | |
1683 | --*/\r | |
1684 | ;\r | |
1685 | \r | |
1686 | EFI_STATUS\r | |
1687 | EFIAPI\r | |
1688 | RtEfiCreateEventLegacyBoot (\r | |
1689 | IN EFI_TPL NotifyTpl,\r | |
1690 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
1691 | IN VOID *NotifyContext,\r | |
1692 | OUT EFI_EVENT *LegacyBootEvent\r | |
1693 | )\r | |
1694 | /*++\r | |
1695 | \r | |
1696 | Routine Description:\r | |
1697 | Create a Legacy Boot Event. \r | |
1698 | Tiano extended the CreateEvent Type enum to add a legacy boot event type. \r | |
1699 | This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r | |
1700 | added and now it's possible to not voilate the UEFI specification by \r | |
1701 | declaring a GUID for the legacy boot event class. This library supports\r | |
1702 | the R8.5/EFI 1.10 form and R8.6/UEFI 2.0 form and allows common code to \r | |
1703 | work both ways.\r | |
1704 | \r | |
1705 | Arguments:\r | |
1706 | LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)\r | |
1707 | \r | |
1708 | Returns:\r | |
1709 | EFI_SUCCESS Event was created.\r | |
1710 | Other Event was not created.\r | |
1711 | \r | |
1712 | --*/\r | |
1713 | ;\r | |
1714 | \r | |
1715 | EFI_STATUS\r | |
1716 | EFIAPI\r | |
1717 | RtEfiCreateEventReadyToBoot (\r | |
1718 | IN EFI_TPL NotifyTpl,\r | |
1719 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
1720 | IN VOID *NotifyContext,\r | |
1721 | OUT EFI_EVENT *ReadyToBootEvent\r | |
1722 | )\r | |
1723 | /*++\r | |
1724 | \r | |
1725 | Routine Description:\r | |
1726 | Create a Read to Boot Event. \r | |
1727 | \r | |
1728 | Tiano extended the CreateEvent Type enum to add a ready to boot event type. \r | |
1729 | This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r | |
1730 | added and now it's possible to not voilate the UEFI specification and use \r | |
1731 | the ready to boot event class defined in UEFI 2.0. This library supports\r | |
1732 | the R8.5/EFI 1.10 form and R8.6/UEFI 2.0 form and allows common code to \r | |
1733 | work both ways.\r | |
1734 | \r | |
1735 | Arguments:\r | |
1736 | ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)\r | |
1737 | \r | |
1738 | Return:\r | |
1739 | EFI_SUCCESS - Event was created.\r | |
1740 | Other - Event was not created.\r | |
1741 | \r | |
1742 | --*/\r | |
1743 | ;\r | |
1744 | \r | |
1745 | #endif\r |