ReactOS  0.4.14-dev-583-g2a1ba2c
rslist.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acresrc.h"
Include dependency graph for rslist.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_RESOURCES
 

Functions

ACPI_STATUS AcpiRsConvertAmlToResources (UINT8 *Aml, UINT32 Length, UINT32 Offset, UINT8 ResourceIndex, void **Context)
 
ACPI_STATUS AcpiRsConvertResourcesToAml (ACPI_RESOURCE *Resource, ACPI_SIZE AmlSizeNeeded, UINT8 *OutputBuffer)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_RESOURCES

Definition at line 48 of file rslist.c.

Function Documentation

◆ AcpiRsConvertAmlToResources()

ACPI_STATUS AcpiRsConvertAmlToResources ( UINT8 Aml,
UINT32  Length,
UINT32  Offset,
UINT8  ResourceIndex,
void **  Context 
)

Definition at line 68 of file rslist.c.

74 {
75  ACPI_RESOURCE **ResourcePtr = ACPI_CAST_INDIRECT_PTR (
78  AML_RESOURCE *AmlResource;
79  ACPI_RSCONVERT_INFO *ConversionTable;
81 
82 
83  ACPI_FUNCTION_TRACE (RsConvertAmlToResources);
84 
85 
86  /*
87  * Check that the input buffer and all subsequent pointers into it
88  * are aligned on a native word boundary. Most important on IA64
89  */
90  Resource = *ResourcePtr;
92  {
94  "Misaligned resource pointer %p", Resource));
95  }
96 
97  /* Get the appropriate conversion info table */
98 
99  AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml);
100 
101  if (AcpiUtGetResourceType (Aml) ==
103  {
104  if (AmlResource->CommonSerialBus.Type >
106  {
107  ConversionTable = NULL;
108  }
109  else
110  {
111  /* This is an I2C, SPI, or UART SerialBus descriptor */
112 
113  ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch [
114  AmlResource->CommonSerialBus.Type];
115  }
116  }
117  else
118  {
119  ConversionTable = AcpiGbl_GetResourceDispatch[ResourceIndex];
120  }
121 
122  if (!ConversionTable)
123  {
125  "Invalid/unsupported resource descriptor: Type 0x%2.2X",
126  ResourceIndex));
128  }
129 
130  /* Convert the AML byte stream resource to a local resource struct */
131 
133  Resource, AmlResource, ConversionTable);
134  if (ACPI_FAILURE (Status))
135  {
137  "Could not convert AML resource (Type 0x%X)", *Aml));
139  }
140 
142  "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
144  Resource->Length));
145 
146  /* Point to the next structure in the output buffer */
147 
148  *ResourcePtr = ACPI_NEXT_RESOURCE (Resource);
150 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define AML_RESOURCE_MAX_SERIALBUSTYPE
Definition: amlresrc.h:463
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
ACPI_RSCONVERT_INFO * AcpiGbl_GetResourceDispatch[]
Definition: rsinfo.c:96
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_RSCONVERT_INFO * AcpiGbl_ConvertResourceSerialBusDispatch[]
Definition: rsinfo.c:142
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus
Definition: amlresrc.h:687
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_IS_MISALIGNED(value)
Definition: acmacros.h:265
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_RESOURCES
Definition: acoutput.h:176
#define ACPI_CAST_INDIRECT_PTR(t, p)
Definition: actypes.h:545
#define ACPI_NEXT_RESOURCE(Res)
Definition: acrestyp.h:802
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_STATUS AcpiRsConvertAmlToResource(ACPI_RESOURCE *Resource, AML_RESOURCE *Aml, ACPI_RSCONVERT_INFO *Info)
Definition: rsmisc.c:77
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_RESOURCE_NAME_SERIAL_BUS
Definition: aclocal.h:1342
UINT8 AcpiUtGetResourceType(void *Aml)
Definition: utresrc.c:486
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97
#define AE_AML_INVALID_RESOURCE_TYPE
Definition: acexcep.h:202
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 const char BOOLEAN UINT8 * Aml
Definition: acpixf.h:1293

Referenced by AcpiBufferToResource(), and AcpiRsCreateResourceList().

◆ AcpiRsConvertResourcesToAml()

ACPI_STATUS AcpiRsConvertResourcesToAml ( ACPI_RESOURCE Resource,
ACPI_SIZE  AmlSizeNeeded,
UINT8 OutputBuffer 
)

Definition at line 173 of file rslist.c.

177 {
179  UINT8 *EndAml = OutputBuffer + AmlSizeNeeded;
180  ACPI_RSCONVERT_INFO *ConversionTable;
182 
183 
184  ACPI_FUNCTION_TRACE (RsConvertResourcesToAml);
185 
186 
187  /* Walk the resource descriptor list, convert each descriptor */
188 
189  while (Aml < EndAml)
190  {
191  /* Validate the (internal) Resource Type */
192 
193  if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
194  {
196  "Invalid descriptor type (0x%X) in resource list",
197  Resource->Type));
199  }
200 
201  /* Sanity check the length. It must not be zero, or we loop forever */
202 
203  if (!Resource->Length)
204  {
206  "Invalid zero length descriptor in resource list\n"));
208  }
209 
210  /* Perform the conversion */
211 
213  {
214  if (Resource->Data.CommonSerialBus.Type >
216  {
217  ConversionTable = NULL;
218  }
219  else
220  {
221  /* This is an I2C, SPI, or UART SerialBus descriptor */
222 
224  Resource->Data.CommonSerialBus.Type];
225  }
226  }
227  else
228  {
229  ConversionTable = AcpiGbl_SetResourceDispatch[Resource->Type];
230  }
231 
232  if (!ConversionTable)
233  {
235  "Invalid/unsupported resource descriptor: Type 0x%2.2X",
236  Resource->Type));
238  }
239 
241  ACPI_CAST_PTR (AML_RESOURCE, Aml), ConversionTable);
242  if (ACPI_FAILURE (Status))
243  {
245  "Could not convert resource (type 0x%X) to AML",
246  Resource->Type));
248  }
249 
250  /* Perform final sanity check on the new AML resource descriptor */
251 
254  if (ACPI_FAILURE (Status))
255  {
257  }
258 
259  /* Check for end-of-list, normal exit */
260 
262  {
263  /* An End Tag indicates the end of the input Resource Template */
264 
266  }
267 
268  /*
269  * Extract the total length of the new descriptor and set the
270  * Aml to point to the next (output) resource descriptor
271  */
273 
274  /* Point to the next input resource descriptor */
275 
277  }
278 
279  /* Completed buffer, but did not find an EndTag resource descriptor */
280 
282 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define AE_AML_BAD_RESOURCE_LENGTH
Definition: acexcep.h:210
#define AML_RESOURCE_MAX_SERIALBUSTYPE
Definition: amlresrc.h:463
ACPI_STATUS AcpiUtValidateResource(ACPI_WALK_STATE *WalkState, void *Aml, UINT8 *ReturnIndex)
Definition: utresrc.c:313
#define ACPI_RESOURCE_TYPE_SERIAL_BUS
Definition: acrestyp.h:733
#define ACPI_RESOURCE_TYPE_END_TAG
Definition: acrestyp.h:721
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_RSCONVERT_INFO * AcpiGbl_ConvertResourceSerialBusDispatch[]
Definition: rsinfo.c:142
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
ACPI_RSCONVERT_INFO * AcpiGbl_SetResourceDispatch[]
Definition: rsinfo.c:65
UINT32 AcpiUtGetDescriptorLength(void *Aml)
Definition: utresrc.c:605
#define ACPI_RESOURCE_TYPE_MAX
Definition: acrestyp.h:739
Status
Definition: gdiplustypes.h:24
#define AE_BAD_DATA
Definition: acexcep.h:154
#define ACPI_NEXT_RESOURCE(Res)
Definition: acrestyp.h:802
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_AML_NO_RESOURCE_END_TAG
Definition: acexcep.h:207
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
ACPI_STATUS AcpiRsConvertResourceToAml(ACPI_RESOURCE *Resource, AML_RESOURCE *Aml, ACPI_RSCONVERT_INFO *Info)
Definition: rsmisc.c:468
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97
#define AE_AML_INVALID_RESOURCE_TYPE
Definition: acexcep.h:202
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 const char BOOLEAN UINT8 * Aml
Definition: acpixf.h:1293

Referenced by AcpiRsCreateAmlResources().