TianoCore EDK2 master
Loading...
Searching...
No Matches
AcpiSdt.c
Go to the documentation of this file.
1
9//
10// Includes
11//
12#include "AcpiTable.h"
13
15EFI_ACPI_SDT_PROTOCOL mAcpiSdtProtocolTemplate = {
16 EFI_ACPI_TABLE_VERSION_NONE,
19 Open,
20 OpenSdt,
21 Close,
26};
27
35 VOID
36 )
37{
38 return mPrivateData;
39}
40
50 IN VOID *Buffer
51 )
52{
53 EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
54 LIST_ENTRY *CurrentLink;
55 EFI_ACPI_TABLE_LIST *CurrentTableList;
56 LIST_ENTRY *StartLink;
57
58 //
59 // Get the instance of the ACPI Table
60 //
61 AcpiTableInstance = SdtGetAcpiTableInstance ();
62
63 //
64 // Find the notify
65 //
66 StartLink = &AcpiTableInstance->TableList;
67 CurrentLink = StartLink->ForwardLink;
68
69 while (CurrentLink != StartLink) {
70 CurrentTableList = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
71 if (((UINTN)CurrentTableList->Table <= (UINTN)Buffer) &&
72 ((UINTN)CurrentTableList->Table + CurrentTableList->TableSize > (UINTN)Buffer))
73 {
74 //
75 // Good! Found Table.
76 //
77 return CurrentTableList;
78 }
79
80 CurrentLink = CurrentLink->ForwardLink;
81 }
82
83 return NULL;
84}
85
97 IN VOID *Buffer
98 )
99{
100 EFI_ACPI_TABLE_LIST *CurrentTableList;
101
102 CurrentTableList = FindTableByBuffer (Buffer);
103 if (CurrentTableList == NULL) {
104 return EFI_NOT_FOUND;
105 }
106
108 (VOID *)CurrentTableList->Table,
109 CurrentTableList->Table->Length,
111 );
112 return EFI_SUCCESS;
113}
114
127 IN VOID *Buffer,
128 OUT UINTN *MaxSize
129 )
130{
131 EFI_ACPI_TABLE_LIST *CurrentTableList;
132
133 CurrentTableList = FindTableByBuffer (Buffer);
134 if (CurrentTableList == NULL) {
135 return EFI_NOT_FOUND;
136 }
137
138 *MaxSize = (UINTN)CurrentTableList->Table + CurrentTableList->Table->Length - (UINTN)Buffer;
139 return EFI_SUCCESS;
140}
141
149VOID
151 IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
152 IN EFI_ACPI_TABLE_VERSION Version,
153 IN UINTN Handle
154 )
155{
156 EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
157 LIST_ENTRY *CurrentLink;
158 LIST_ENTRY *StartLink;
159 EFI_ACPI_TABLE_LIST *Table;
160 EFI_STATUS Status;
161
162 //
163 // We should not use Table buffer, because it is user input buffer.
164 //
165 Status = FindTableByHandle (
166 Handle,
167 &AcpiTableInstance->TableList,
168 &Table
169 );
170 ASSERT_EFI_ERROR (Status);
171
172 //
173 // Find the notify
174 //
175 StartLink = &AcpiTableInstance->NotifyList;
176 CurrentLink = StartLink->ForwardLink;
177
178 while (CurrentLink != StartLink) {
179 CurrentNotifyList = EFI_ACPI_NOTIFY_LIST_FROM_LINK (CurrentLink);
180
181 //
182 // Inovke notification
183 //
184 CurrentNotifyList->Notification ((EFI_ACPI_SDT_HEADER *)Table->Table, Version, Handle);
185
186 CurrentLink = CurrentLink->ForwardLink;
187 }
188
189 return;
190}
191
219 IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
220 IN UINTN Index,
221 OUT EFI_ACPI_SDT_HEADER **Table,
222 OUT EFI_ACPI_TABLE_VERSION *Version,
223 OUT UINTN *TableKey
224 )
225{
226 UINTN TableIndex;
227 LIST_ENTRY *CurrentLink;
228 LIST_ENTRY *StartLink;
229 EFI_ACPI_TABLE_LIST *CurrentTable;
230
231 //
232 // Find the table
233 //
234 StartLink = &AcpiTableInstance->TableList;
235 CurrentLink = StartLink->ForwardLink;
236 TableIndex = 0;
237
238 while (CurrentLink != StartLink) {
239 if (TableIndex == Index) {
240 break;
241 }
242
243 //
244 // Next one
245 //
246 CurrentLink = CurrentLink->ForwardLink;
247 TableIndex++;
248 }
249
250 if ((TableIndex != Index) || (CurrentLink == StartLink)) {
251 return EFI_NOT_FOUND;
252 }
253
254 //
255 // Get handle and version
256 //
257 CurrentTable = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
258 *TableKey = CurrentTable->Handle;
259 *Version = CurrentTable->Version;
260 *Table = (EFI_ACPI_SDT_HEADER *)CurrentTable->Table;
261
262 return EFI_SUCCESS;
263}
264
291EFIAPI
293 IN UINTN Index,
294 OUT EFI_ACPI_SDT_HEADER **Table,
295 OUT EFI_ACPI_TABLE_VERSION *Version,
296 OUT UINTN *TableKey
297 )
298{
299 EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
300
301 ASSERT (Table != NULL);
302 ASSERT (Version != NULL);
303 ASSERT (TableKey != NULL);
304
305 //
306 // Get the instance of the ACPI Table
307 //
308 AcpiTableInstance = SdtGetAcpiTableInstance ();
309
310 return SdtGetAcpiTable (AcpiTableInstance, Index, Table, Version, TableKey);
311}
312
320VOID
322 IN EFI_ACPI_NOTIFICATION_FN Notification
323 )
324{
325 EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
326 EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
327
328 //
329 // Get the instance of the ACPI Table
330 //
331 AcpiTableInstance = SdtGetAcpiTableInstance ();
332
333 //
334 // Create a new list entry
335 //
336 CurrentNotifyList = AllocatePool (sizeof (EFI_ACPI_NOTIFY_LIST));
337 if (CurrentNotifyList == NULL) {
338 ASSERT (CurrentNotifyList != NULL);
339 DEBUG ((DEBUG_ERROR, "%a Failed to allocate pool\n", __func__));
340 return;
341 }
342
343 //
344 // Initialize the table contents
345 //
346 CurrentNotifyList->Signature = EFI_ACPI_NOTIFY_LIST_SIGNATURE;
347 CurrentNotifyList->Notification = Notification;
348
349 //
350 // Add the table to the current list of tables
351 //
352 InsertTailList (&AcpiTableInstance->NotifyList, &CurrentNotifyList->Link);
353
354 return;
355}
356
369 IN EFI_ACPI_NOTIFICATION_FN Notification
370 )
371{
372 EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
373 EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
374 LIST_ENTRY *CurrentLink;
375 LIST_ENTRY *StartLink;
376
377 //
378 // Get the instance of the ACPI Table
379 //
380 AcpiTableInstance = SdtGetAcpiTableInstance ();
381
382 //
383 // Find the notify
384 //
385 StartLink = &AcpiTableInstance->NotifyList;
386 CurrentLink = StartLink->ForwardLink;
387
388 while (CurrentLink != StartLink) {
389 CurrentNotifyList = EFI_ACPI_NOTIFY_LIST_FROM_LINK (CurrentLink);
390 if (CurrentNotifyList->Notification == Notification) {
391 //
392 // Good! Found notification.
393 //
394 // Remove it from list and free the node.
395 //
396 RemoveEntryList (&(CurrentNotifyList->Link));
397 FreePool (CurrentNotifyList);
398 return EFI_SUCCESS;
399 }
400
401 CurrentLink = CurrentLink->ForwardLink;
402 }
403
404 //
405 // Not found!
406 //
407 return EFI_INVALID_PARAMETER;
408}
409
425EFIAPI
427 IN BOOLEAN Register,
428 IN EFI_ACPI_NOTIFICATION_FN Notification
429 )
430{
431 //
432 // Check for invalid input parameters
433 //
434 if (Notification == NULL) {
435 return EFI_INVALID_PARAMETER;
436 }
437
438 if (Register) {
439 //
440 // Register a new notify
441 //
442 SdtRegisterNotify (Notification);
443 return EFI_SUCCESS;
444 } else {
445 //
446 // Unregister an old notify
447 //
448 return SdtUnregisterNotify (Notification);
449 }
450}
451
463 IN UINTN TableKey,
464 OUT EFI_ACPI_HANDLE *Handle
465 )
466{
467 EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
468 EFI_STATUS Status;
469 EFI_ACPI_TABLE_LIST *Table;
470 EFI_AML_HANDLE *AmlHandle;
471
472 //
473 // Get the instance of the ACPI Table
474 //
475 AcpiTableInstance = SdtGetAcpiTableInstance ();
476
477 //
478 // Find the table
479 //
480 Status = FindTableByHandle (
481 TableKey,
482 &AcpiTableInstance->TableList,
483 &Table
484 );
485 if (EFI_ERROR (Status)) {
486 return EFI_NOT_FOUND;
487 }
488
489 AmlHandle = AllocatePool (sizeof (*AmlHandle));
490 if (AmlHandle == NULL) {
491 ASSERT (AmlHandle != NULL);
492 return EFI_NOT_FOUND;
493 }
494
495 AmlHandle->Signature = EFI_AML_ROOT_HANDLE_SIGNATURE;
496 AmlHandle->Buffer = (VOID *)((UINTN)Table->Table + sizeof (EFI_ACPI_SDT_HEADER));
497 AmlHandle->Size = Table->Table->Length - sizeof (EFI_ACPI_SDT_HEADER);
498 AmlHandle->AmlByteEncoding = NULL;
499 AmlHandle->Modified = FALSE;
500
501 //
502 // return the ACPI handle
503 //
504 *Handle = (EFI_ACPI_HANDLE)AmlHandle;
505
506 return EFI_SUCCESS;
507}
508
519EFIAPI
521 IN UINTN TableKey,
522 OUT EFI_ACPI_HANDLE *Handle
523 )
524{
525 if (Handle == NULL) {
526 return EFI_INVALID_PARAMETER;
527 }
528
529 return SdtOpenSdtTable (TableKey, Handle);
530}
531
547 IN VOID *Buffer,
548 IN UINTN BufferSize,
549 OUT EFI_ACPI_HANDLE *Handle
550 )
551{
552 AML_BYTE_ENCODING *AmlByteEncoding;
553 EFI_AML_HANDLE *AmlHandle;
554
555 AmlByteEncoding = AmlSearchByOpByte (Buffer);
556 if (AmlByteEncoding == NULL) {
557 return EFI_INVALID_PARAMETER;
558 }
559
560 //
561 // Do not open NameString as handle
562 //
563 if ((AmlByteEncoding->Attribute & AML_IS_NAME_CHAR) != 0) {
564 return EFI_INVALID_PARAMETER;
565 }
566
567 //
568 // Good, find it
569 //
570 AmlHandle = AllocatePool (sizeof (*AmlHandle));
571 if (AmlHandle == NULL) {
572 ASSERT (AmlHandle != NULL);
573 return EFI_OUT_OF_RESOURCES;
574 }
575
576 AmlHandle->Signature = EFI_AML_HANDLE_SIGNATURE;
577 AmlHandle->Buffer = Buffer;
578 AmlHandle->AmlByteEncoding = AmlByteEncoding;
579 AmlHandle->Modified = FALSE;
580
581 AmlHandle->Size = AmlGetObjectSize (AmlByteEncoding, Buffer, BufferSize);
582 if (AmlHandle->Size == 0) {
583 FreePool (AmlHandle);
584 return EFI_INVALID_PARAMETER;
585 }
586
587 *Handle = (EFI_ACPI_HANDLE)AmlHandle;
588
589 return EFI_SUCCESS;
590}
591
604EFIAPI
606 IN VOID *Buffer,
607 OUT EFI_ACPI_HANDLE *Handle
608 )
609{
610 EFI_STATUS Status;
611 UINTN MaxSize;
612
613 MaxSize = 0;
614
615 //
616 // Check for invalid input parameters
617 //
618 if ((Buffer == NULL) || (Handle == NULL)) {
619 return EFI_INVALID_PARAMETER;
620 }
621
622 Status = SdtGetMaxAmlBufferSize (Buffer, &MaxSize);
623 if (EFI_ERROR (Status)) {
624 return EFI_INVALID_PARAMETER;
625 }
626
627 return SdtOpenEx (Buffer, MaxSize, Handle);
628}
629
639EFIAPI
641 IN EFI_ACPI_HANDLE Handle
642 )
643{
644 EFI_AML_HANDLE *AmlHandle;
645 EFI_STATUS Status;
646
647 //
648 // Check for invalid input parameters
649 //
650 if (Handle == NULL) {
651 return EFI_INVALID_PARAMETER;
652 }
653
654 AmlHandle = (EFI_AML_HANDLE *)Handle;
655 if ((AmlHandle->Signature != EFI_AML_ROOT_HANDLE_SIGNATURE) &&
656 (AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE))
657 {
658 return EFI_INVALID_PARAMETER;
659 }
660
661 //
662 // Update Checksum only if modified
663 //
664 if (AmlHandle->Modified) {
665 Status = SdtUpdateAmlChecksum (AmlHandle->Buffer);
666 if (EFI_ERROR (Status)) {
667 return EFI_INVALID_PARAMETER;
668 }
669 }
670
671 FreePool (AmlHandle);
672
673 return EFI_SUCCESS;
674}
675
691EFIAPI
693 IN EFI_ACPI_HANDLE Handle,
694 IN UINTN Index,
695 OUT EFI_ACPI_DATA_TYPE *DataType,
696 OUT CONST VOID **Data,
697 OUT UINTN *DataSize
698 )
699{
700 EFI_AML_HANDLE *AmlHandle;
701 AML_BYTE_ENCODING *AmlByteEncoding;
702 EFI_STATUS Status;
703
704 ASSERT (DataType != NULL);
705 ASSERT (Data != NULL);
706 ASSERT (DataSize != NULL);
707
708 //
709 // Check for invalid input parameters
710 //
711 if (Handle == NULL) {
712 return EFI_INVALID_PARAMETER;
713 }
714
715 AmlHandle = (EFI_AML_HANDLE *)Handle;
716 //
717 // Do not check EFI_AML_ROOT_HANDLE_SIGNATURE because there is no option for Root handle
718 //
719 if (AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE) {
720 return EFI_INVALID_PARAMETER;
721 }
722
723 AmlByteEncoding = AmlHandle->AmlByteEncoding;
724 if (Index > AmlByteEncoding->MaxIndex) {
725 *DataType = EFI_ACPI_DATA_TYPE_NONE;
726 return EFI_SUCCESS;
727 }
728
729 //
730 // Parse option
731 //
732 Status = AmlParseOptionHandleCommon (AmlHandle, (AML_OP_PARSE_INDEX)Index, DataType, (VOID **)Data, DataSize);
733 if (EFI_ERROR (Status)) {
734 return EFI_INVALID_PARAMETER;
735 }
736
737 return EFI_SUCCESS;
738}
739
756EFIAPI
758 IN EFI_ACPI_HANDLE Handle,
759 IN UINTN Index,
760 IN CONST VOID *Data,
761 IN UINTN DataSize
762 )
763{
764 EFI_AML_HANDLE *AmlHandle;
765 AML_BYTE_ENCODING *AmlByteEncoding;
766 EFI_STATUS Status;
767 EFI_ACPI_DATA_TYPE DataType;
768 VOID *OrgData;
769 UINTN OrgDataSize;
770
771 ASSERT (Data != NULL);
772
773 //
774 // Check for invalid input parameters
775 //
776 if (Handle == NULL) {
777 return EFI_INVALID_PARAMETER;
778 }
779
780 AmlHandle = (EFI_AML_HANDLE *)Handle;
781 //
782 // Do not check EFI_AML_ROOT_HANDLE_SIGNATURE because there is no option for Root handle
783 //
784 if (AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE) {
785 return EFI_INVALID_PARAMETER;
786 }
787
788 AmlByteEncoding = AmlHandle->AmlByteEncoding;
789
790 if (Index > AmlByteEncoding->MaxIndex) {
791 return EFI_INVALID_PARAMETER;
792 }
793
794 //
795 // Parse option
796 //
797 Status = AmlParseOptionHandleCommon (AmlHandle, (AML_OP_PARSE_INDEX)Index, &DataType, &OrgData, &OrgDataSize);
798 if (EFI_ERROR (Status)) {
799 return EFI_INVALID_PARAMETER;
800 }
801
802 if (DataType == EFI_ACPI_DATA_TYPE_NONE) {
803 return EFI_INVALID_PARAMETER;
804 }
805
806 if (DataSize > OrgDataSize) {
807 return EFI_BAD_BUFFER_SIZE;
808 }
809
810 //
811 // Update
812 //
813 CopyMem (OrgData, Data, DataSize);
814 AmlHandle->Modified = TRUE;
815
816 return EFI_SUCCESS;
817}
818
831EFIAPI
833 IN EFI_ACPI_HANDLE ParentHandle,
834 IN OUT EFI_ACPI_HANDLE *Handle
835 )
836{
837 EFI_AML_HANDLE *AmlParentHandle;
838 EFI_AML_HANDLE *AmlHandle;
839 VOID *Buffer;
840 EFI_STATUS Status;
841
842 ASSERT (Handle != NULL);
843
844 //
845 // Check for invalid input parameters
846 //
847 if (ParentHandle == NULL) {
848 return EFI_INVALID_PARAMETER;
849 }
850
851 AmlHandle = *Handle;
852 if ((AmlHandle != NULL) && (AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE)) {
853 return EFI_INVALID_PARAMETER;
854 }
855
856 AmlParentHandle = (EFI_AML_HANDLE *)ParentHandle;
857 if (AmlParentHandle->Signature == EFI_AML_ROOT_HANDLE_SIGNATURE) {
858 //
859 // Root handle
860 //
861 Status = AmlGetChildFromRoot (AmlParentHandle, AmlHandle, &Buffer);
862 } else if (AmlParentHandle->Signature == EFI_AML_HANDLE_SIGNATURE) {
863 //
864 // Non-root handle
865 //
866 Status = AmlGetChildFromNonRoot (AmlParentHandle, AmlHandle, &Buffer);
867 } else {
868 //
869 // Invalid
870 //
871 return EFI_INVALID_PARAMETER;
872 }
873
874 if (EFI_ERROR (Status)) {
875 return EFI_INVALID_PARAMETER;
876 }
877
878 if (Buffer == NULL) {
879 *Handle = NULL;
880 return EFI_SUCCESS;
881 }
882
883 return SdtOpenEx (Buffer, (UINTN)AmlParentHandle->Buffer + AmlParentHandle->Size - (UINTN)Buffer, Handle);
884}
885
899 IN EFI_ACPI_HANDLE HandleIn,
900 IN UINT8 *AmlPath,
901 OUT EFI_ACPI_HANDLE *HandleOut
902 )
903{
904 EFI_AML_HANDLE *AmlHandle;
905 VOID *Buffer;
906 EFI_STATUS Status;
907
908 Buffer = NULL;
909 AmlHandle = (EFI_AML_HANDLE *)HandleIn;
910
911 //
912 // For non-root handle, we need search from THIS node instead of ROOT.
913 //
914 Status = AmlFindPath (AmlHandle, AmlPath, &Buffer, FALSE);
915 if (EFI_ERROR (Status)) {
916 return EFI_INVALID_PARAMETER;
917 }
918
919 if (Buffer == NULL) {
920 *HandleOut = NULL;
921 return EFI_SUCCESS;
922 }
923
924 return SdtOpenEx (Buffer, (UINTN)AmlHandle->Buffer + AmlHandle->Size - (UINTN)Buffer, HandleOut);
925}
926
936 IN EFI_AML_HANDLE *AmlHandle
937 )
938{
939 EFI_AML_HANDLE *DstAmlHandle;
940
941 DstAmlHandle = AllocatePool (sizeof (*DstAmlHandle));
942 ASSERT (DstAmlHandle != NULL);
943 if (DstAmlHandle == NULL) {
944 return NULL;
945 }
946
947 CopyMem (DstAmlHandle, (VOID *)AmlHandle, sizeof (*DstAmlHandle));
948
949 return DstAmlHandle;
950}
951
966 IN EFI_ACPI_HANDLE HandleIn,
967 IN UINT8 *AmlPath,
968 OUT EFI_ACPI_HANDLE *HandleOut
969 )
970{
971 EFI_ACPI_HANDLE ChildHandle;
972 EFI_AML_HANDLE *AmlHandle;
973 EFI_STATUS Status;
974 VOID *Buffer;
975
976 Buffer = NULL;
977 AmlHandle = (EFI_AML_HANDLE *)HandleIn;
978
979 //
980 // Handle case that AcpiPath is Root
981 //
982 if (AmlIsRootPath (AmlPath)) {
983 //
984 // Duplicate RootHandle
985 //
986 *HandleOut = (EFI_ACPI_HANDLE)SdtDuplicateHandle (AmlHandle);
987 if (*HandleOut == NULL) {
988 return EFI_OUT_OF_RESOURCES;
989 }
990
991 return EFI_SUCCESS;
992 }
993
994 //
995 // Let children find it.
996 //
997 ChildHandle = NULL;
998 while (TRUE) {
999 Status = GetChild (HandleIn, &ChildHandle);
1000 if (EFI_ERROR (Status)) {
1001 return EFI_INVALID_PARAMETER;
1002 }
1003
1004 if (ChildHandle == NULL) {
1005 //
1006 // Not found
1007 //
1008 *HandleOut = NULL;
1009 return EFI_SUCCESS;
1010 }
1011
1012 //
1013 // More child
1014 //
1015 AmlHandle = (EFI_AML_HANDLE *)ChildHandle;
1016 Status = AmlFindPath (AmlHandle, AmlPath, &Buffer, TRUE);
1017 if (EFI_ERROR (Status)) {
1018 return EFI_INVALID_PARAMETER;
1019 }
1020
1021 if (Buffer != NULL) {
1022 //
1023 // Great! Find it, open
1024 //
1025 Status = SdtOpenEx (Buffer, (UINTN)AmlHandle->Buffer + AmlHandle->Size - (UINTN)Buffer, HandleOut);
1026 if (!EFI_ERROR (Status)) {
1027 return EFI_SUCCESS;
1028 }
1029
1030 //
1031 // Not success, try next one
1032 //
1033 }
1034 }
1035
1036 //
1037 // Should not run here
1038 //
1039}
1040
1053EFIAPI
1055 IN EFI_ACPI_HANDLE HandleIn,
1056 IN VOID *AcpiPath,
1057 OUT EFI_ACPI_HANDLE *HandleOut
1058 )
1059{
1060 EFI_AML_HANDLE *AmlHandle;
1061 EFI_STATUS Status;
1062 UINT8 *AmlPath;
1063
1064 //
1065 // Check for invalid input parameters
1066 //
1067 if (HandleIn == NULL) {
1068 return EFI_INVALID_PARAMETER;
1069 }
1070
1071 AmlHandle = (EFI_AML_HANDLE *)HandleIn;
1072
1073 //
1074 // Convert ASL path to AML path
1075 //
1076 AmlPath = AmlNameFromAslName (AcpiPath);
1077 if (AmlPath == NULL) {
1078 return EFI_INVALID_PARAMETER;
1079 }
1080
1082 DEBUG ((DEBUG_ERROR, "AcpiSdt: FindPath - "));
1083 AmlPrintNameString (AmlPath);
1084 DEBUG ((DEBUG_ERROR, "\n"));
1085 DEBUG_CODE_END ();
1086
1087 if (AmlHandle->Signature == EFI_AML_ROOT_HANDLE_SIGNATURE) {
1088 //
1089 // Root Handle
1090 //
1091 Status = SdtFindPathFromRoot (HandleIn, AmlPath, HandleOut);
1092 } else if (AmlHandle->Signature == EFI_AML_HANDLE_SIGNATURE) {
1093 //
1094 // Non-Root handle
1095 //
1096 Status = SdtFindPathFromNonRoot (HandleIn, AmlPath, HandleOut);
1097 } else {
1098 Status = EFI_INVALID_PARAMETER;
1099 }
1100
1101 FreePool (AmlPath);
1102
1103 return Status;
1104}
1105
1111VOID
1113 IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
1114 )
1115{
1116 InitializeListHead (&AcpiTableInstance->NotifyList);
1117 CopyMem (&AcpiTableInstance->AcpiSdtProtocol, &mAcpiSdtProtocolTemplate, sizeof (mAcpiSdtProtocolTemplate));
1118 AcpiTableInstance->AcpiSdtProtocol.AcpiVersion = (EFI_ACPI_TABLE_VERSION)PcdGet32 (PcdAcpiExposedTableVersions);
1119
1120 return;
1121}
UINT64 UINTN
EFI_STATUS SdtUnregisterNotify(IN EFI_ACPI_NOTIFICATION_FN Notification)
Definition: AcpiSdt.c:368
EFI_STATUS SdtUpdateAmlChecksum(IN VOID *Buffer)
Definition: AcpiSdt.c:96
VOID SdtAcpiTableAcpiSdtConstructor(IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance)
Definition: AcpiSdt.c:1112
EFI_STATUS EFIAPI OpenSdt(IN UINTN TableKey, OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:520
EFI_STATUS SdtGetMaxAmlBufferSize(IN VOID *Buffer, OUT UINTN *MaxSize)
Definition: AcpiSdt.c:126
EFI_STATUS EFIAPI GetAcpiTable2(IN UINTN Index, OUT EFI_ACPI_SDT_HEADER **Table, OUT EFI_ACPI_TABLE_VERSION *Version, OUT UINTN *TableKey)
Definition: AcpiSdt.c:292
EFI_STATUS EFIAPI RegisterNotify(IN BOOLEAN Register, IN EFI_ACPI_NOTIFICATION_FN Notification)
Definition: AcpiSdt.c:426
EFI_STATUS EFIAPI Open(IN VOID *Buffer, OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:605
EFI_STATUS EFIAPI FindPath(IN EFI_ACPI_HANDLE HandleIn, IN VOID *AcpiPath, OUT EFI_ACPI_HANDLE *HandleOut)
Definition: AcpiSdt.c:1054
VOID SdtRegisterNotify(IN EFI_ACPI_NOTIFICATION_FN Notification)
Definition: AcpiSdt.c:321
EFI_ACPI_TABLE_INSTANCE * SdtGetAcpiTableInstance(VOID)
Definition: AcpiSdt.c:34
EFI_STATUS EFIAPI SetOption(IN EFI_ACPI_HANDLE Handle, IN UINTN Index, IN CONST VOID *Data, IN UINTN DataSize)
Definition: AcpiSdt.c:757
EFI_STATUS EFIAPI GetChild(IN EFI_ACPI_HANDLE ParentHandle, IN OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:832
EFI_STATUS EFIAPI GetOption(IN EFI_ACPI_HANDLE Handle, IN UINTN Index, OUT EFI_ACPI_DATA_TYPE *DataType, OUT CONST VOID **Data, OUT UINTN *DataSize)
Definition: AcpiSdt.c:692
EFI_STATUS SdtOpenEx(IN VOID *Buffer, IN UINTN BufferSize, OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:546
VOID SdtNotifyAcpiList(IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN EFI_ACPI_TABLE_VERSION Version, IN UINTN Handle)
Definition: AcpiSdt.c:150
EFI_STATUS SdtFindPathFromNonRoot(IN EFI_ACPI_HANDLE HandleIn, IN UINT8 *AmlPath, OUT EFI_ACPI_HANDLE *HandleOut)
Definition: AcpiSdt.c:898
EFI_AML_HANDLE * SdtDuplicateHandle(IN EFI_AML_HANDLE *AmlHandle)
Definition: AcpiSdt.c:935
EFI_STATUS SdtOpenSdtTable(IN UINTN TableKey, OUT EFI_ACPI_HANDLE *Handle)
Definition: AcpiSdt.c:462
EFI_STATUS SdtGetAcpiTable(IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN UINTN Index, OUT EFI_ACPI_SDT_HEADER **Table, OUT EFI_ACPI_TABLE_VERSION *Version, OUT UINTN *TableKey)
Definition: AcpiSdt.c:218
EFI_ACPI_TABLE_LIST * FindTableByBuffer(IN VOID *Buffer)
Definition: AcpiSdt.c:49
EFI_STATUS SdtFindPathFromRoot(IN EFI_ACPI_HANDLE HandleIn, IN UINT8 *AmlPath, OUT EFI_ACPI_HANDLE *HandleOut)
Definition: AcpiSdt.c:965
EFI_STATUS EFIAPI Close(IN EFI_ACPI_HANDLE Handle)
Definition: AcpiSdt.c:640
EFI_STATUS AmlFindPath(IN EFI_AML_HANDLE *AmlHandle, IN UINT8 *AmlPath, OUT VOID **Buffer, IN BOOLEAN FromRoot)
Definition: AmlNamespace.c:525
UINTN AmlGetObjectSize(IN AML_BYTE_ENCODING *AmlByteEncoding, IN UINT8 *Buffer, IN UINTN MaxBufferSize)
Definition: AmlOption.c:308
VOID AmlPrintNameString(IN UINT8 *Buffer)
Definition: AmlString.c:498
EFI_STATUS AmlGetChildFromRoot(IN EFI_AML_HANDLE *AmlParentHandle, IN EFI_AML_HANDLE *AmlHandle, OUT VOID **Buffer)
Definition: AmlChild.c:81
EFI_STATUS AmlParseOptionHandleCommon(IN EFI_AML_HANDLE *AmlHandle, IN AML_OP_PARSE_INDEX Index, OUT EFI_ACPI_DATA_TYPE *DataType, OUT VOID **Data, OUT UINTN *DataSize)
Definition: AmlOption.c:449
UINT8 * AmlNameFromAslName(IN UINT8 *AslPath)
Definition: AmlString.c:385
AML_BYTE_ENCODING * AmlSearchByOpByte(IN UINT8 *OpByteBuffer)
Definition: Aml.c:180
EFI_STATUS AmlGetChildFromNonRoot(IN EFI_AML_HANDLE *AmlParentHandle, IN EFI_AML_HANDLE *AmlHandle, OUT VOID **Buffer)
Definition: AmlChild.c:249
EFI_STATUS(EFIAPI * EFI_ACPI_NOTIFICATION_FN)(IN EFI_ACPI_SDT_HEADER *Table, IN EFI_ACPI_TABLE_VERSION Version, IN UINTN TableKey)
#define AML_IS_NAME_CHAR
Definition: Aml.h:70
EFI_STATUS EFIAPI AcpiPlatformChecksum(IN EFI_ACPI_DESCRIPTION_HEADER *AcpiTable)
Definition: AmlUtility.c:24
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
Definition: LinkedList.c:590
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
Definition: LinkedList.c:259
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI AmlIsRootPath(IN CONST CHAR8 *Buffer)
Definition: AmlString.c:112
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS FindTableByHandle(IN UINTN Handle, IN LIST_ENTRY *TableList, OUT EFI_ACPI_TABLE_LIST **Table)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define VOID
Definition: Base.h:269
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758
#define OUT
Definition: Base.h:284
#define GLOBAL_REMOVE_IF_UNREFERENCED
Definition: Base.h:48
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:463
#define DEBUG_CODE_BEGIN()
Definition: DebugLib.h:565
#define DEBUG(Expression)
Definition: DebugLib.h:435
#define DEBUG_CODE_END()
Definition: DebugLib.h:579
#define PcdGet32(TokenName)
Definition: PcdLib.h:362
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI Register(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
AML_OP_ATTRIBUTE Attribute
Additional information on the AML object.
Definition: Aml.h:145
EAML_PARSE_INDEX MaxIndex
Definition: Aml.h:134