TianoCore EDK2 master
Loading...
Searching...
No Matches
AmlResourceData.c
Go to the documentation of this file.
1
15
28BOOLEAN
29EFIAPI
31 IN CONST AML_RD_HEADER *Header,
32 IN AML_RD_HEADER DescriptorId
33 )
34{
35 if (Header == NULL) {
36 ASSERT (0);
37 return FALSE;
38 }
39
40 if (AML_RD_IS_LARGE (Header)) {
41 return ((*Header ^ DescriptorId) == 0);
42 } else {
43 return (((*Header & AML_RD_SMALL_ID_MASK) ^ DescriptorId) == 0);
44 }
45}
46
57EFIAPI
59 IN CONST AML_RD_HEADER *Header
60 )
61{
62 if (Header == NULL) {
63 ASSERT (0);
64 return FALSE;
65 }
66
67 if (AML_RD_IS_LARGE (Header)) {
68 return *Header;
69 }
70
71 // Header is a small resource data element.
72 return *Header & AML_RD_SMALL_ID_MASK;
73}
74
84UINT32
85EFIAPI
87 IN CONST AML_RD_HEADER *Header
88 )
89{
90 if (Header == NULL) {
91 ASSERT (0);
92 return FALSE;
93 }
94
95 if (AML_RD_IS_LARGE (Header)) {
96 return ((ACPI_LARGE_RESOURCE_HEADER *)Header)->Length +
97 sizeof (ACPI_LARGE_RESOURCE_HEADER);
98 }
99
100 // Header is a small resource data element.
101 return ((ACPI_SMALL_RESOURCE_HEADER *)Header)->Bits.Length +
102 sizeof (ACPI_SMALL_RESOURCE_HEADER);
103}
104
120EFIAPI
122 IN CONST AML_RD_HEADER *Header,
123 IN UINT8 CheckSum
124 )
125{
126 if ((Header == NULL) ||
128 Header,
129 AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
130 ))
131 {
132 ASSERT (0);
133 return EFI_INVALID_PARAMETER;
134 }
135
136 ((EFI_ACPI_END_TAG_DESCRIPTOR *)Header)->Checksum = CheckSum;
137 return EFI_SUCCESS;
138}
EFI_STATUS EFIAPI AmlRdSetEndTagChecksum(IN CONST AML_RD_HEADER *Header, IN UINT8 CheckSum)
#define AML_RD_SMALL_ID_MASK
UINT8 AML_RD_HEADER
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
#define AML_RD_IS_LARGE(Header)
UINT32 EFIAPI AmlRdGetSize(IN CONST AML_RD_HEADER *Header)
AML_RD_HEADER EFIAPI AmlRdGetDescId(IN CONST AML_RD_HEADER *Header)
BOOLEAN EFIAPI AmlRdCompareDescId(IN CONST AML_RD_HEADER *Header, IN AML_RD_HEADER DescriptorId)
#define AML_RD_BUILD_SMALL_DESC_ID(Id)