1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042
|
/** @file
An internal header file for the Unit Test instance of the UEFI Boot Services Table Library.
This file includes common header files, defines internal structure and functions used by
the library implementation.
Copyright (c) Microsoft Corporation
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef UEFI_BOOT_SERVICES_TABLE_LIB_UNIT_TEST_H_
#define UEFI_BOOT_SERVICES_TABLE_LIB_UNIT_TEST_H_
#include <Uefi.h>
#include <Pi/PiMultiPhase.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UnitTestLib.h>
#include <Library/UefiBootServicesTableLib.h>
/**
Raise the task priority level to the new level.
High level is implemented by disabling processor interrupts.
@param NewTpl New task priority level
@return The previous task priority level
**/
EFI_TPL
EFIAPI
UnitTestRaiseTpl (
IN EFI_TPL NewTpl
);
/**
Lowers the task priority to the previous value. If the new
priority unmasks events at a higher priority, they are dispatched.
@param NewTpl New, lower, task priority
**/
VOID
EFIAPI
UnitTestRestoreTpl (
IN EFI_TPL NewTpl
);
/**
Allocates pages from the memory map.
@param Type The type of allocation to perform
@param MemoryType The type of memory to turn the allocated pages
into
@param NumberOfPages The number of pages to allocate
@param Memory A pointer to receive the base allocated memory
address
@return Status. On success, Memory is filled in with the base address allocated
@retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
spec.
@retval EFI_NOT_FOUND Could not allocate pages match the requirement.
@retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
@retval EFI_SUCCESS Pages successfully allocated.
**/
EFI_STATUS
EFIAPI
UnitTestAllocatePages (
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN NumberOfPages,
IN OUT EFI_PHYSICAL_ADDRESS *Memory
);
/**
Frees previous allocated pages.
@param Memory Base address of memory being freed
@param NumberOfPages The number of pages to free
@retval EFI_NOT_FOUND Could not find the entry that covers the range
@retval EFI_INVALID_PARAMETER Address not aligned
@return EFI_SUCCESS -Pages successfully freed.
**/
EFI_STATUS
EFIAPI
UnitTestFreePages (
IN EFI_PHYSICAL_ADDRESS Memory,
IN UINTN NumberOfPages
);
/**
This function returns a copy of the current memory map. The map is an array of
memory descriptors, each of which describes a contiguous block of memory.
@param MemoryMapSize A pointer to the size, in bytes, of the
MemoryMap buffer. On input, this is the size of
the buffer allocated by the caller. On output,
it is the size of the buffer returned by the
firmware if the buffer was large enough, or the
size of the buffer needed to contain the map if
the buffer was too small.
@param MemoryMap A pointer to the buffer in which firmware places
the current memory map.
@param MapKey A pointer to the location in which firmware
returns the key for the current memory map.
@param DescriptorSize A pointer to the location in which firmware
returns the size, in bytes, of an individual
EFI_MEMORY_DESCRIPTOR.
@param DescriptorVersion A pointer to the location in which firmware
returns the version number associated with the
EFI_MEMORY_DESCRIPTOR.
@retval EFI_SUCCESS The memory map was returned in the MemoryMap
buffer.
@retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
buffer size needed to hold the memory map is
returned in MemoryMapSize.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
**/
EFI_STATUS
EFIAPI
UnitTestGetMemoryMap (
IN OUT UINTN *MemoryMapSize,
IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
OUT UINTN *MapKey,
OUT UINTN *DescriptorSize,
OUT UINT32 *DescriptorVersion
);
/**
Allocate pool of a particular type.
@param PoolType Type of pool to allocate
@param Size The amount of pool to allocate
@param Buffer The address to return a pointer to the allocated
pool
@retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
@retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
@retval EFI_SUCCESS Pool successfully allocated.
**/
EFI_STATUS
EFIAPI
UnitTestAllocatePool (
IN EFI_MEMORY_TYPE PoolType,
IN UINTN Size,
OUT VOID **Buffer
);
/**
Frees pool.
@param Buffer The allocated pool entry to free
@retval EFI_INVALID_PARAMETER Buffer is not a valid value.
@retval EFI_SUCCESS Pool successfully freed.
**/
EFI_STATUS
EFIAPI
UnitTestFreePool (
IN VOID *Buffer
);
/**
Frees pool.
@param Buffer The allocated pool entry to free
@param PoolType Pointer to pool type
@retval EFI_INVALID_PARAMETER Buffer is not a valid value.
@retval EFI_SUCCESS Pool successfully freed.
**/
EFI_STATUS
EFIAPI
UnitTestInternalFreePool (
IN VOID *Buffer,
OUT EFI_MEMORY_TYPE *PoolType OPTIONAL
);
/**
Creates an event.
@param Type The type of event to create and its mode and
attributes
@param NotifyTpl The task priority level of event notifications
@param NotifyFunction Pointer to the events notification function
@param NotifyContext Pointer to the notification functions context;
corresponds to parameter "Context" in the
notification function
@param Event Pointer to the newly created event if the call
succeeds; undefined otherwise
@retval EFI_SUCCESS The event structure was created
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
@retval EFI_OUT_OF_RESOURCES The event could not be allocated
**/
EFI_STATUS
EFIAPI
UnitTestCreateEvent (
IN UINT32 Type,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
IN VOID *NotifyContext, OPTIONAL
OUT EFI_EVENT *Event
);
/**
Sets the type of timer and the trigger time for a timer event.
@param UserEvent The timer event that is to be signaled at the
specified time
@param Type The type of time that is specified in
TriggerTime
@param TriggerTime The number of 100ns units until the timer
expires
@retval EFI_SUCCESS The event has been set to be signaled at the
requested time
@retval EFI_INVALID_PARAMETER Event or Type is not valid
**/
EFI_STATUS
EFIAPI
UnitTestSetTimer (
IN EFI_EVENT UserEvent,
IN EFI_TIMER_DELAY Type,
IN UINT64 TriggerTime
);
/**
Stops execution until an event is signaled.
@param NumberOfEvents The number of events in the UserEvents array
@param UserEvents An array of EFI_EVENT
@param UserIndex Pointer to the index of the event which
satisfied the wait condition
@retval EFI_SUCCESS The event indicated by Index was signaled.
@retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
function or Event was not a valid type
@retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
**/
EFI_STATUS
EFIAPI
UnitTestWaitForEvent (
IN UINTN NumberOfEvents,
IN EFI_EVENT *UserEvents,
OUT UINTN *UserIndex
);
/**
Signals the event. Queues the event to be notified if needed.
@param UserEvent The event to signal .
@retval EFI_INVALID_PARAMETER Parameters are not valid.
@retval EFI_SUCCESS The event was signaled.
**/
EFI_STATUS
EFIAPI
UnitTestSignalEvent (
IN EFI_EVENT UserEvent
);
/**
Closes an event and frees the event structure.
@param UserEvent Event to close
@retval EFI_INVALID_PARAMETER Parameters are not valid.
@retval EFI_SUCCESS The event has been closed
**/
EFI_STATUS
EFIAPI
UnitTestCloseEvent (
IN EFI_EVENT UserEvent
);
/**
Check the status of an event.
@param UserEvent The event to check
@retval EFI_SUCCESS The event is in the signaled state
@retval EFI_NOT_READY The event is not in the signaled state
@retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
**/
EFI_STATUS
EFIAPI
UnitTestCheckEvent (
IN EFI_EVENT UserEvent
);
/**
Wrapper function to UnitTestInstallProtocolInterfaceNotify. This is the public API which
Calls the private one which contains a BOOLEAN parameter for notifications
@param UserHandle The handle to install the protocol handler on,
or NULL if a new handle is to be allocated
@param Protocol The protocol to add to the handle
@param InterfaceType Indicates whether Interface is supplied in
native form.
@param Interface The interface for the protocol being added
@return Status code
**/
EFI_STATUS
EFIAPI
UnitTestInstallProtocolInterface (
IN OUT EFI_HANDLE *UserHandle,
IN EFI_GUID *Protocol,
IN EFI_INTERFACE_TYPE InterfaceType,
IN VOID *Interface
);
/**
Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
@param UserHandle Handle on which the interface is to be
reinstalled
@param Protocol The numeric ID of the interface
@param OldInterface A pointer to the old interface
@param NewInterface A pointer to the new interface
@retval EFI_SUCCESS The protocol interface was installed
@retval EFI_NOT_FOUND The OldInterface on the handle was not found
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
**/
EFI_STATUS
EFIAPI
UnitTestReinstallProtocolInterface (
IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol,
IN VOID *OldInterface,
IN VOID *NewInterface
);
/**
Uninstalls all instances of a protocol:interfacer from a handle.
If the last protocol interface is remove from the handle, the
handle is freed.
@param UserHandle The handle to remove the protocol handler from
@param Protocol The protocol, of protocol:interface, to remove
@param Interface The interface, of protocol:interface, to remove
@retval EFI_INVALID_PARAMETER Protocol is NULL.
@retval EFI_SUCCESS Protocol interface successfully uninstalled.
**/
EFI_STATUS
EFIAPI
UnitTestUninstallProtocolInterface (
IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol,
IN VOID *Interface
);
/**
Queries a handle to determine if it supports a specified protocol.
@param UserHandle The handle being queried.
@param Protocol The published unique identifier of the protocol.
@param Interface Supplies the address where a pointer to the
corresponding Protocol Interface is returned.
@return The requested protocol interface for the handle
**/
EFI_STATUS
EFIAPI
UnitTestHandleProtocol (
IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol,
OUT VOID **Interface
);
/**
Add a new protocol notification record for the request protocol.
@param Protocol The requested protocol to add the notify
registration
@param Event The event to signal
@param Registration Returns the registration record
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_SUCCESS Successfully returned the registration record
that has been added
**/
EFI_STATUS
EFIAPI
UnitTestRegisterProtocolNotify (
IN EFI_GUID *Protocol,
IN EFI_EVENT Event,
OUT VOID **Registration
);
/**
Locates the requested handle(s) and returns them in Buffer.
@param SearchType The type of search to perform to locate the
handles
@param Protocol The protocol to search for
@param SearchKey Dependant on SearchType
@param BufferSize On input the size of Buffer. On output the
size of data returned.
@param Buffer The buffer to return the results in
@retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
returned in BufferSize.
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_SUCCESS Successfully found the requested handle(s) and
returns them in Buffer.
**/
EFI_STATUS
EFIAPI
UnitTestLocateHandle (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *BufferSize,
OUT EFI_HANDLE *Buffer
);
/**
Locates the handle to a device on the device path that best matches the specified protocol.
@param Protocol The protocol to search for.
@param DevicePath On input, a pointer to a pointer to the device
path. On output, the device path pointer is
modified to point to the remaining part of the
devicepath.
@param Device A pointer to the returned device handle.
@retval EFI_SUCCESS The resulting handle was returned.
@retval EFI_NOT_FOUND No handles matched the search.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
**/
EFI_STATUS
EFIAPI
UnitTestLocateDevicePath (
IN EFI_GUID *Protocol,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
OUT EFI_HANDLE *Device
);
/**
Boot Service called to add, modify, or remove a system configuration table from
the EFI System Table.
@param Guid Pointer to the GUID for the entry to add, update, or
remove
@param Table Pointer to the configuration table for the entry to add,
update, or remove, may be NULL.
@return EFI_SUCCESS Guid, Table pair added, updated, or removed.
@return EFI_INVALID_PARAMETER Input GUID not valid.
@return EFI_NOT_FOUND Attempted to delete non-existant entry
@return EFI_OUT_OF_RESOURCES Not enough memory available
**/
EFI_STATUS
EFIAPI
UnitTestInstallConfigurationTable (
IN EFI_GUID *Guid,
IN VOID *Table
);
/**
Loads an EFI image into memory and returns a handle to the image.
@param BootPolicy If TRUE, indicates that the request originates
from the boot manager, and that the boot
manager is attempting to load FilePath as a
boot selection.
@param ParentImageHandle The caller's image handle.
@param FilePath The specific file path from which the image is
loaded.
@param SourceBuffer If not NULL, a pointer to the memory location
containing a copy of the image to be loaded.
@param SourceSize The size in bytes of SourceBuffer.
@param ImageHandle Pointer to the returned image handle that is
created when the image is successfully loaded.
@retval EFI_SUCCESS The image was loaded into memory.
@retval EFI_NOT_FOUND The FilePath was not found.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
@retval EFI_UNSUPPORTED The image type is not supported, or the device
path cannot be parsed to locate the proper
protocol for loading the file.
@retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
resources.
@retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
understood.
@retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
@retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
image from being loaded. NULL is returned in *ImageHandle.
@retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
platform policy specifies that the image should not be started.
**/
EFI_STATUS
EFIAPI
UnitTestLoadImage (
IN BOOLEAN BootPolicy,
IN EFI_HANDLE ParentImageHandle,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
OUT EFI_HANDLE *ImageHandle
);
/**
Transfer control to a loaded image's entry point.
@param ImageHandle Handle of image to be started.
@param ExitDataSize Pointer of the size to ExitData
@param ExitData Pointer to a pointer to a data buffer that
includes a Null-terminated string,
optionally followed by additional binary data.
The string is a description that the caller may
use to further indicate the reason for the
image's exit.
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
@retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
@retval EFI_SUCCESS Successfully transfer control to the image's
entry point.
**/
EFI_STATUS
EFIAPI
UnitTestStartImage (
IN EFI_HANDLE ImageHandle,
OUT UINTN *ExitDataSize,
OUT CHAR16 **ExitData OPTIONAL
);
/**
Terminates the currently loaded EFI image and returns control to boot services.
@param ImageHandle Handle that identifies the image. This
parameter is passed to the image on entry.
@param Status The image's exit code.
@param ExitDataSize The size, in bytes, of ExitData. Ignored if
ExitStatus is EFI_SUCCESS.
@param ExitData Pointer to a data buffer that includes a
Null-terminated Unicode string, optionally
followed by additional binary data. The string
is a description that the caller may use to
further indicate the reason for the image's
exit.
@retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
image.
@retval EFI_SUCCESS Successfully terminates the currently loaded
EFI image.
@retval EFI_ACCESS_DENIED Should never reach there.
@retval EFI_OUT_OF_RESOURCES Could not allocate pool
**/
EFI_STATUS
EFIAPI
UnitTestExit (
IN EFI_HANDLE ImageHandle,
IN EFI_STATUS Status,
IN UINTN ExitDataSize,
IN CHAR16 *ExitData OPTIONAL
);
/**
Unloads an image.
@param ImageHandle Handle that identifies the image to be
unloaded.
@retval EFI_SUCCESS The image has been unloaded.
@retval EFI_UNSUPPORTED The image has been started, and does not support
unload.
@retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
**/
EFI_STATUS
EFIAPI
UnitTestUnloadImage (
IN EFI_HANDLE ImageHandle
);
/**
Terminates all boot services.
@param ImageHandle Handle that identifies the exiting image.
@param MapKey Key to the latest memory map.
@retval EFI_SUCCESS Boot Services terminated
@retval EFI_INVALID_PARAMETER MapKey is incorrect.
**/
EFI_STATUS
EFIAPI
UnitTestExitBootServices (
IN EFI_HANDLE ImageHandle,
IN UINTN MapKey
);
/**
Returns a monotonically increasing count for the platform.
@param[out] Count The pointer to returned value.
@retval EFI_SUCCESS The next monotonic count was returned.
@retval EFI_INVALID_PARAMETER Count is NULL.
@retval EFI_DEVICE_ERROR The device is not functioning properly.
**/
EFI_STATUS
EFIAPI
UnitTestGetNextMonotonicCount (
OUT UINT64 *Count
);
/**
Introduces a fine-grained stall.
@param Microseconds The number of microseconds to stall execution.
@retval EFI_SUCCESS Execution was stalled for at least the requested
amount of microseconds.
@retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
**/
EFI_STATUS
EFIAPI
UnitTestStall (
IN UINTN Microseconds
);
/**
Sets the system's watchdog timer.
@param Timeout The number of seconds to set the watchdog timer to.
A value of zero disables the timer.
@param WatchdogCode The numeric code to log on a watchdog timer timeout
event. The firmware reserves codes 0x0000 to 0xFFFF.
Loaders and operating systems may use other timeout
codes.
@param DataSize The size, in bytes, of WatchdogData.
@param WatchdogData A data buffer that includes a Null-terminated Unicode
string, optionally followed by additional binary data.
The string is a description that the call may use to
further indicate the reason to be logged with a
watchdog event.
@return EFI_SUCCESS Timeout has been set
@return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
@return EFI_UNSUPPORTED System does not have a timer (currently not used)
@return EFI_DEVICE_ERROR Could not complete due to hardware error
**/
EFI_STATUS
EFIAPI
UnitTestSetWatchdogTimer (
IN UINTN Timeout,
IN UINT64 WatchdogCode,
IN UINTN DataSize,
IN CHAR16 *WatchdogData OPTIONAL
);
/**
Connects one or more drivers to a controller.
@param ControllerHandle The handle of the controller to which driver(s) are to be connected.
@param DriverImageHandle A pointer to an ordered list handles that support the
EFI_DRIVER_BINDING_PROTOCOL.
@param RemainingDevicePath A pointer to the device path that specifies a child of the
controller specified by ControllerHandle.
@param Recursive If TRUE, then ConnectController() is called recursively
until the entire tree of controllers below the controller specified
by ControllerHandle have been created. If FALSE, then
the tree of controllers is only expanded one level.
@retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
2) No drivers were connected to ControllerHandle, but
RemainingDevicePath is not NULL, and it is an End Device
Path Node.
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
@retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
present in the system.
2) No drivers were connected to ControllerHandle.
@retval EFI_SECURITY_VIOLATION
The user has no permission to start UEFI device drivers on the device path
associated with the ControllerHandle or specified by the RemainingDevicePath.
**/
EFI_STATUS
EFIAPI
UnitTestConnectController (
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE *DriverImageHandle OPTIONAL,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,
IN BOOLEAN Recursive
);
/**
Disconnects a controller from a driver
@param ControllerHandle ControllerHandle The handle of
the controller from which
driver(s) are to be
disconnected.
@param DriverImageHandle DriverImageHandle The driver to
disconnect from ControllerHandle.
@param ChildHandle ChildHandle The handle of the
child to destroy.
@retval EFI_SUCCESS One or more drivers were
disconnected from the controller.
@retval EFI_SUCCESS On entry, no drivers are managing
ControllerHandle.
@retval EFI_SUCCESS DriverImageHandle is not NULL,
and on entry DriverImageHandle is
not managing ControllerHandle.
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
@retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
and it is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
is not a valid EFI_HANDLE.
@retval EFI_OUT_OF_RESOURCES There are not enough resources
available to disconnect any
drivers from ControllerHandle.
@retval EFI_DEVICE_ERROR The controller could not be
disconnected because of a device
error.
**/
EFI_STATUS
EFIAPI
UnitTestDisconnectController (
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE DriverImageHandle OPTIONAL,
IN EFI_HANDLE ChildHandle OPTIONAL
);
/**
Locates the installed protocol handler for the handle, and
invokes it to obtain the protocol interface. Usage information
is registered in the protocol data base.
@param UserHandle The handle to obtain the protocol interface on
@param Protocol The ID of the protocol
@param Interface The location to return the protocol interface
@param ImageHandle The handle of the Image that is opening the
protocol interface specified by Protocol and
Interface.
@param ControllerHandle The controller handle that is requiring this
interface.
@param Attributes The open mode of the protocol interface
specified by Handle and Protocol.
@retval EFI_INVALID_PARAMETER Protocol is NULL.
@retval EFI_SUCCESS Get the protocol interface.
**/
EFI_STATUS
EFIAPI
UnitTestOpenProtocol (
IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol,
OUT VOID **Interface OPTIONAL,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE ControllerHandle,
IN UINT32 Attributes
);
/**
Closes a protocol on a handle that was opened using OpenProtocol().
@param UserHandle The handle for the protocol interface that was
previously opened with OpenProtocol(), and is
now being closed.
@param Protocol The published unique identifier of the protocol.
It is the caller's responsibility to pass in a
valid GUID.
@param AgentHandle The handle of the agent that is closing the
protocol interface.
@param ControllerHandle If the agent that opened a protocol is a driver
that follows the EFI Driver Model, then this
parameter is the controller handle that required
the protocol interface. If the agent does not
follow the EFI Driver Model, then this parameter
is optional and may be NULL.
@retval EFI_SUCCESS The protocol instance was closed.
@retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
valid EFI_HANDLE.
@retval EFI_NOT_FOUND Can not find the specified protocol or
AgentHandle.
**/
EFI_STATUS
EFIAPI
UnitTestCloseProtocol (
IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol,
IN EFI_HANDLE AgentHandle,
IN EFI_HANDLE ControllerHandle
);
/**
Return information about Opened protocols in the system
@param UserHandle The handle to close the protocol interface on
@param Protocol The ID of the protocol
@param EntryBuffer A pointer to a buffer of open protocol
information in the form of
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
@param EntryCount Number of EntryBuffer entries
**/
EFI_STATUS
EFIAPI
UnitTestOpenProtocolInformation (
IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol,
OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
OUT UINTN *EntryCount
);
/**
Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
from pool.
@param UserHandle The handle from which to retrieve the list of
protocol interface GUIDs.
@param ProtocolBuffer A pointer to the list of protocol interface GUID
pointers that are installed on Handle.
@param ProtocolBufferCount A pointer to the number of GUID pointers present
in ProtocolBuffer.
@retval EFI_SUCCESS The list of protocol interface GUIDs installed
on Handle was returned in ProtocolBuffer. The
number of protocol interface GUIDs was returned
in ProtocolBufferCount.
@retval EFI_INVALID_PARAMETER Handle is NULL.
@retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
@retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
results.
**/
EFI_STATUS
EFIAPI
UnitTestProtocolsPerHandle (
IN EFI_HANDLE UserHandle,
OUT EFI_GUID ***ProtocolBuffer,
OUT UINTN *ProtocolBufferCount
);
/**
Function returns an array of handles that support the requested protocol
in a buffer allocated from pool. This is a version of UnitTestLocateHandle()
that allocates a buffer for the caller.
@param SearchType Specifies which handle(s) are to be returned.
@param Protocol Provides the protocol to search by. This
parameter is only valid for SearchType
ByProtocol.
@param SearchKey Supplies the search key depending on the
SearchType.
@param NumberHandles The number of handles returned in Buffer.
@param Buffer A pointer to the buffer to return the requested
array of handles that support Protocol.
@retval EFI_SUCCESS The result array of handles was returned.
@retval EFI_NOT_FOUND No handles match the search.
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
matching results.
@retval EFI_INVALID_PARAMETER One or more parameters are not valid.
**/
EFI_STATUS
EFIAPI
UnitTestLocateHandleBuffer (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *NumberHandles,
OUT EFI_HANDLE **Buffer
);
/**
Return the first Protocol Interface that matches the Protocol GUID. If
Registration is passed in, return a Protocol Instance that was just add
to the system. If Registration is NULL return the first Protocol Interface
you find.
@param Protocol The protocol to search for
@param Registration Optional Registration Key returned from
RegisterProtocolNotify()
@param Interface Return the Protocol interface (instance).
@retval EFI_SUCCESS If a valid Interface is returned
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_NOT_FOUND Protocol interface not found
**/
EFI_STATUS
EFIAPI
UnitTestLocateProtocol (
IN EFI_GUID *Protocol,
IN VOID *Registration OPTIONAL,
OUT VOID **Interface
);
/**
Installs a list of protocol interface into the boot services environment.
This function calls InstallProtocolInterface() in a loop. If any error
occurs all the protocols added by this function are removed. This is
basically a lib function to save space.
@param Handle The handle to install the protocol handlers on,
or NULL if a new handle is to be allocated
@param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the
arguments to InstallProtocolInterface(). All the
protocols are added to Handle.
@retval EFI_SUCCESS All the protocol interface was installed.
@retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
@retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
the handle database.
@retval EFI_INVALID_PARAMETER Handle is NULL.
@retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
**/
EFI_STATUS
EFIAPI
UnitTestInstallMultipleProtocolInterfaces (
IN OUT EFI_HANDLE *Handle,
...
);
/**
Uninstalls a list of protocol interface in the boot services environment.
This function calls UninstallProtocolInterface() in a loop. This is
basically a lib function to save space.
@param Handle The handle to uninstall the protocol
@param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the
arguments to UninstallProtocolInterface(). All
the protocols are added to Handle.
@return Status code
**/
EFI_STATUS
EFIAPI
UnitTestUninstallMultipleProtocolInterfaces (
IN EFI_HANDLE Handle,
...
);
/**
Computes and returns a 32-bit CRC for a data buffer.
@param[in] Data A pointer to the buffer on which the 32-bit CRC is to be computed.
@param[in] DataSize The number of bytes in the buffer Data.
@param[out] Crc32 The 32-bit CRC that was computed for the data buffer specified by Data
and DataSize.
@retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in
Crc32.
@retval EFI_INVALID_PARAMETER Data is NULL.
@retval EFI_INVALID_PARAMETER Crc32 is NULL.
@retval EFI_INVALID_PARAMETER DataSize is 0.
**/
EFI_STATUS
EFIAPI
UnitTestCalculateCrc32 (
IN VOID *Data,
IN UINTN DataSize,
OUT UINT32 *Crc32
);
/**
Creates an event in a group.
@param Type The type of event to create and its mode and
attributes
@param NotifyTpl The task priority level of event notifications
@param NotifyFunction Pointer to the events notification function
@param NotifyContext Pointer to the notification functions context;
corresponds to parameter "Context" in the
notification function
@param EventGroup GUID for EventGroup if NULL act the same as
gBS->CreateEvent().
@param Event Pointer to the newly created event if the call
succeeds; undefined otherwise
@retval EFI_SUCCESS The event structure was created
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
@retval EFI_OUT_OF_RESOURCES The event could not be allocated
**/
EFI_STATUS
EFIAPI
UnitTestCreateEventEx (
IN UINT32 Type,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
IN CONST VOID *NotifyContext, OPTIONAL
IN CONST EFI_GUID *EventGroup, OPTIONAL
OUT EFI_EVENT *Event
);
#endif
|