ReactOS  0.4.14-dev-317-g96040ec
acresrc.h File Reference
#include "amlresrc.h"
Include dependency graph for acresrc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  acpi_rsconvert_info
 
struct  acpi_rsdump_info
 
struct  acpi_vendor_walk_info
 

Macros

#define ACPI_RSC_COMPARE_AML_LENGTH   0
 
#define ACPI_RSC_COMPARE_VALUE   1
 
#define ACPI_RSC_TABLE_SIZE(d)   (sizeof (d) / sizeof (ACPI_RSCONVERT_INFO))
 
#define ACPI_RS_OFFSET(f)   (UINT8) ACPI_OFFSET (ACPI_RESOURCE,f)
 
#define AML_OFFSET(f)   (UINT8) ACPI_OFFSET (AML_RESOURCE,f)
 

Typedefs

typedef const struct acpi_rsconvert_info ACPI_RSCONVERT_INFO
 
typedef const struct acpi_rsdump_info ACPI_RSDUMP_INFO
 
typedef struct acpi_vendor_walk_info ACPI_VENDOR_WALK_INFO
 

Enumerations

enum  ACPI_RSCONVERT_OPCODES {
  ACPI_RSC_INITGET = 0, ACPI_RSC_INITSET, ACPI_RSC_FLAGINIT, ACPI_RSC_1BITFLAG,
  ACPI_RSC_2BITFLAG, ACPI_RSC_3BITFLAG, ACPI_RSC_ADDRESS, ACPI_RSC_BITMASK,
  ACPI_RSC_BITMASK16, ACPI_RSC_COUNT, ACPI_RSC_COUNT16, ACPI_RSC_COUNT_GPIO_PIN,
  ACPI_RSC_COUNT_GPIO_RES, ACPI_RSC_COUNT_GPIO_VEN, ACPI_RSC_COUNT_SERIAL_RES, ACPI_RSC_COUNT_SERIAL_VEN,
  ACPI_RSC_DATA8, ACPI_RSC_EXIT_EQ, ACPI_RSC_EXIT_LE, ACPI_RSC_EXIT_NE,
  ACPI_RSC_LENGTH, ACPI_RSC_MOVE_GPIO_PIN, ACPI_RSC_MOVE_GPIO_RES, ACPI_RSC_MOVE_SERIAL_RES,
  ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RSC_MOVE8, ACPI_RSC_MOVE16, ACPI_RSC_MOVE32,
  ACPI_RSC_MOVE64, ACPI_RSC_SET8, ACPI_RSC_SOURCE, ACPI_RSC_SOURCEX
}
 
enum  ACPI_RSDUMP_OPCODES {
  ACPI_RSD_TITLE = 0, ACPI_RSD_1BITFLAG, ACPI_RSD_2BITFLAG, ACPI_RSD_3BITFLAG,
  ACPI_RSD_ADDRESS, ACPI_RSD_DWORDLIST, ACPI_RSD_LITERAL, ACPI_RSD_LONGLIST,
  ACPI_RSD_SHORTLIST, ACPI_RSD_SHORTLISTX, ACPI_RSD_SOURCE, ACPI_RSD_STRING,
  ACPI_RSD_UINT8, ACPI_RSD_UINT16, ACPI_RSD_UINT32, ACPI_RSD_UINT64,
  ACPI_RSD_WORDLIST, ACPI_RSD_LABEL, ACPI_RSD_SOURCE_LABEL
}
 

Functions

ACPI_STATUS AcpiRsCreateResourceList (ACPI_OPERAND_OBJECT *AmlBuffer, ACPI_BUFFER *OutputBuffer)
 
ACPI_STATUS AcpiRsCreateAmlResources (ACPI_BUFFER *ResourceList, ACPI_BUFFER *OutputBuffer)
 
ACPI_STATUS AcpiRsCreatePciRoutingTable (ACPI_OPERAND_OBJECT *PackageObject, ACPI_BUFFER *OutputBuffer)
 
ACPI_STATUS AcpiRsGetPrtMethodData (ACPI_NAMESPACE_NODE *Node, ACPI_BUFFER *RetBuffer)
 
ACPI_STATUS AcpiRsGetCrsMethodData (ACPI_NAMESPACE_NODE *Node, ACPI_BUFFER *RetBuffer)
 
ACPI_STATUS AcpiRsGetPrsMethodData (ACPI_NAMESPACE_NODE *Node, ACPI_BUFFER *RetBuffer)
 
ACPI_STATUS AcpiRsGetMethodData (ACPI_HANDLE Handle, const char *Path, ACPI_BUFFER *RetBuffer)
 
ACPI_STATUS AcpiRsSetSrsMethodData (ACPI_NAMESPACE_NODE *Node, ACPI_BUFFER *RetBuffer)
 
ACPI_STATUS AcpiRsGetAeiMethodData (ACPI_NAMESPACE_NODE *Node, ACPI_BUFFER *RetBuffer)
 
ACPI_STATUS AcpiRsGetListLength (UINT8 *AmlBuffer, UINT32 AmlBufferLength, ACPI_SIZE *SizeNeeded)
 
ACPI_STATUS AcpiRsGetAmlLength (ACPI_RESOURCE *ResourceList, ACPI_SIZE ResourceListSize, ACPI_SIZE *SizeNeeded)
 
ACPI_STATUS AcpiRsGetPciRoutingTableLength (ACPI_OPERAND_OBJECT *PackageObject, ACPI_SIZE *BufferSizeNeeded)
 
ACPI_STATUS AcpiRsConvertAmlToResources (UINT8 *Aml, UINT32 Length, UINT32 Offset, UINT8 ResourceIndex, void **Context)
 
ACPI_STATUS AcpiRsConvertResourcesToAml (ACPI_RESOURCE *Resource, ACPI_SIZE AmlSizeNeeded, UINT8 *OutputBuffer)
 
void AcpiRsSetAddressCommon (AML_RESOURCE *Aml, ACPI_RESOURCE *Resource)
 
BOOLEAN AcpiRsGetAddressCommon (ACPI_RESOURCE *Resource, AML_RESOURCE *Aml)
 
ACPI_STATUS AcpiRsConvertAmlToResource (ACPI_RESOURCE *Resource, AML_RESOURCE *Aml, ACPI_RSCONVERT_INFO *Info)
 
ACPI_STATUS AcpiRsConvertResourceToAml (ACPI_RESOURCE *Resource, AML_RESOURCE *Aml, ACPI_RSCONVERT_INFO *Info)
 
void AcpiRsMoveData (void *Destination, void *Source, UINT16 ItemCount, UINT8 MoveType)
 
UINT8 AcpiRsDecodeBitmask (UINT16 Mask, UINT8 *List)
 
UINT16 AcpiRsEncodeBitmask (UINT8 *List, UINT8 Count)
 
ACPI_RS_LENGTH AcpiRsGetResourceSource (ACPI_RS_LENGTH ResourceLength, ACPI_RS_LENGTH MinimumLength, ACPI_RESOURCE_SOURCE *ResourceSource, AML_RESOURCE *Aml, char *StringPtr)
 
ACPI_RSDESC_SIZE AcpiRsSetResourceSource (AML_RESOURCE *Aml, ACPI_RS_LENGTH MinimumLength, ACPI_RESOURCE_SOURCE *ResourceSource)
 
void AcpiRsSetResourceHeader (UINT8 DescriptorType, ACPI_RSDESC_SIZE TotalLength, AML_RESOURCE *Aml)
 
void AcpiRsSetResourceLength (ACPI_RSDESC_SIZE TotalLength, AML_RESOURCE *Aml)
 

Variables

const UINT8 AcpiGbl_AmlResourceSizes []
 
const UINT8 AcpiGbl_AmlResourceSerialBusSizes []
 
ACPI_RSCONVERT_INFOAcpiGbl_SetResourceDispatch []
 
const UINT8 AcpiGbl_ResourceStructSizes []
 
const UINT8 AcpiGbl_ResourceStructSerialBusSizes []
 
ACPI_RSCONVERT_INFOAcpiGbl_GetResourceDispatch []
 
ACPI_RSCONVERT_INFOAcpiGbl_ConvertResourceSerialBusDispatch []
 
ACPI_RSCONVERT_INFO AcpiRsConvertDma []
 
ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf []
 
ACPI_RSCONVERT_INFO AcpiRsConvertIo []
 
ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo []
 
ACPI_RSCONVERT_INFO AcpiRsConvertEndTag []
 
ACPI_RSCONVERT_INFO AcpiRsConvertMemory24 []
 
ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg []
 
ACPI_RSCONVERT_INFO AcpiRsConvertMemory32 []
 
ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32 []
 
ACPI_RSCONVERT_INFO AcpiRsConvertAddress32 []
 
ACPI_RSCONVERT_INFO AcpiRsConvertAddress16 []
 
ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq []
 
ACPI_RSCONVERT_INFO AcpiRsConvertAddress64 []
 
ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64 []
 
ACPI_RSCONVERT_INFO AcpiRsConvertGpio []
 
ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma []
 
ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus []
 
ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus []
 
ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus []
 
ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction []
 
ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig []
 
ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup []
 
ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction []
 
ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig []
 
ACPI_RSCONVERT_INFO AcpiRsGetIrq []
 
ACPI_RSCONVERT_INFO AcpiRsGetStartDpf []
 
ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall []
 
ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge []
 
ACPI_RSCONVERT_INFO AcpiRsSetIrq []
 
ACPI_RSCONVERT_INFO AcpiRsSetStartDpf []
 
ACPI_RSCONVERT_INFO AcpiRsSetVendor []
 

Macro Definition Documentation

◆ ACPI_RS_OFFSET

#define ACPI_RS_OFFSET (   f)    (UINT8) ACPI_OFFSET (ACPI_RESOURCE,f)

Definition at line 122 of file acresrc.h.

◆ ACPI_RSC_COMPARE_AML_LENGTH

#define ACPI_RSC_COMPARE_AML_LENGTH   0

Definition at line 117 of file acresrc.h.

◆ ACPI_RSC_COMPARE_VALUE

#define ACPI_RSC_COMPARE_VALUE   1

Definition at line 118 of file acresrc.h.

◆ ACPI_RSC_TABLE_SIZE

#define ACPI_RSC_TABLE_SIZE (   d)    (sizeof (d) / sizeof (ACPI_RSCONVERT_INFO))

Definition at line 120 of file acresrc.h.

◆ AML_OFFSET

#define AML_OFFSET (   f)    (UINT8) ACPI_OFFSET (AML_RESOURCE,f)

Definition at line 123 of file acresrc.h.

Typedef Documentation

◆ ACPI_RSCONVERT_INFO

◆ ACPI_RSDUMP_INFO

◆ ACPI_VENDOR_WALK_INFO

Enumeration Type Documentation

◆ ACPI_RSCONVERT_OPCODES

Enumerator
ACPI_RSC_INITGET 
ACPI_RSC_INITSET 
ACPI_RSC_FLAGINIT 
ACPI_RSC_1BITFLAG 
ACPI_RSC_2BITFLAG 
ACPI_RSC_3BITFLAG 
ACPI_RSC_ADDRESS 
ACPI_RSC_BITMASK 
ACPI_RSC_BITMASK16 
ACPI_RSC_COUNT 
ACPI_RSC_COUNT16 
ACPI_RSC_COUNT_GPIO_PIN 
ACPI_RSC_COUNT_GPIO_RES 
ACPI_RSC_COUNT_GPIO_VEN 
ACPI_RSC_COUNT_SERIAL_RES 
ACPI_RSC_COUNT_SERIAL_VEN 
ACPI_RSC_DATA8 
ACPI_RSC_EXIT_EQ 
ACPI_RSC_EXIT_LE 
ACPI_RSC_EXIT_NE 
ACPI_RSC_LENGTH 
ACPI_RSC_MOVE_GPIO_PIN 
ACPI_RSC_MOVE_GPIO_RES 
ACPI_RSC_MOVE_SERIAL_RES 
ACPI_RSC_MOVE_SERIAL_VEN 
ACPI_RSC_MOVE8 
ACPI_RSC_MOVE16 
ACPI_RSC_MOVE32 
ACPI_RSC_MOVE64 
ACPI_RSC_SET8 
ACPI_RSC_SOURCE 
ACPI_RSC_SOURCEX 

Definition at line 78 of file acresrc.h.

79 {
80  ACPI_RSC_INITGET = 0,
112 
ACPI_RSCONVERT_OPCODES
Definition: acresrc.h:78

◆ ACPI_RSDUMP_OPCODES

Enumerator
ACPI_RSD_TITLE 
ACPI_RSD_1BITFLAG 
ACPI_RSD_2BITFLAG 
ACPI_RSD_3BITFLAG 
ACPI_RSD_ADDRESS 
ACPI_RSD_DWORDLIST 
ACPI_RSD_LITERAL 
ACPI_RSD_LONGLIST 
ACPI_RSD_SHORTLIST 
ACPI_RSD_SHORTLISTX 
ACPI_RSD_SOURCE 
ACPI_RSD_STRING 
ACPI_RSD_UINT8 
ACPI_RSD_UINT16 
ACPI_RSD_UINT32 
ACPI_RSD_UINT64 
ACPI_RSD_WORDLIST 
ACPI_RSD_LABEL 
ACPI_RSD_SOURCE_LABEL 

Definition at line 140 of file acresrc.h.

Function Documentation

◆ AcpiRsConvertAmlToResource()

ACPI_STATUS AcpiRsConvertAmlToResource ( ACPI_RESOURCE Resource,
AML_RESOURCE Aml,
ACPI_RSCONVERT_INFO Info 
)

Definition at line 77 of file rsmisc.c.

81 {
82  ACPI_RS_LENGTH AmlResourceLength;
83  void *Source;
84  void *Destination;
85  char *Target;
86  UINT8 Count;
87  UINT8 FlagsMode = FALSE;
88  UINT16 ItemCount = 0;
89  UINT16 Temp16 = 0;
90 
91 
92  ACPI_FUNCTION_TRACE (RsConvertAmlToResource);
93 
94 
95  if (!Info)
96  {
98  }
99 
100  if (((ACPI_SIZE) Resource) & 0x3)
101  {
102  /* Each internal resource struct is expected to be 32-bit aligned */
103 
105  "Misaligned resource pointer (get): %p Type 0x%2.2X Length %u",
106  Resource, Resource->Type, Resource->Length));
107  }
108 
109  /* Extract the resource Length field (does not include header length) */
110 
111  AmlResourceLength = AcpiUtGetResourceLength (Aml);
112 
113  /*
114  * First table entry must be ACPI_RSC_INITxxx and must contain the
115  * table length (# of table entries)
116  */
118  while (Count)
119  {
120  /*
121  * Source is the external AML byte stream buffer,
122  * destination is the internal resource descriptor
123  */
124  Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
125  Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
126 
127  switch (Info->Opcode)
128  {
129  case ACPI_RSC_INITGET:
130  /*
131  * Get the resource type and the initial (minimum) length
132  */
134  Resource->Type = INIT_RESOURCE_TYPE (Info);
135  Resource->Length = INIT_RESOURCE_LENGTH (Info);
136  break;
137 
138  case ACPI_RSC_INITSET:
139  break;
140 
141  case ACPI_RSC_FLAGINIT:
142 
143  FlagsMode = TRUE;
144  break;
145 
146  case ACPI_RSC_1BITFLAG:
147  /*
148  * Mask and shift the flag bit
149  */
151  ((ACPI_GET8 (Source) >> Info->Value) & 0x01));
152  break;
153 
154  case ACPI_RSC_2BITFLAG:
155  /*
156  * Mask and shift the flag bits
157  */
159  ((ACPI_GET8 (Source) >> Info->Value) & 0x03));
160  break;
161 
162  case ACPI_RSC_3BITFLAG:
163  /*
164  * Mask and shift the flag bits
165  */
167  ((ACPI_GET8 (Source) >> Info->Value) & 0x07));
168  break;
169 
170  case ACPI_RSC_COUNT:
171 
172  ItemCount = ACPI_GET8 (Source);
173  ACPI_SET8 (Destination, ItemCount);
174 
175  Resource->Length = Resource->Length +
176  (Info->Value * (ItemCount - 1));
177  break;
178 
179  case ACPI_RSC_COUNT16:
180 
181  ItemCount = AmlResourceLength;
182  ACPI_SET16 (Destination, ItemCount);
183 
184  Resource->Length = Resource->Length +
185  (Info->Value * (ItemCount - 1));
186  break;
187 
189 
190  Target = ACPI_ADD_PTR (void, Aml, Info->Value);
191  ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source);
192 
193  Resource->Length = Resource->Length + ItemCount;
194  ItemCount = ItemCount / 2;
195  ACPI_SET16 (Destination, ItemCount);
196  break;
197 
199 
200  ItemCount = ACPI_GET8 (Source);
201  ACPI_SET8 (Destination, ItemCount);
202 
203  Resource->Length = Resource->Length + (Info->Value * ItemCount);
204  break;
205 
207  /*
208  * Vendor data is optional (length/offset may both be zero)
209  * Examine vendor data length field first
210  */
211  Target = ACPI_ADD_PTR (void, Aml, (Info->Value + 2));
212  if (ACPI_GET16 (Target))
213  {
214  /* Use vendor offset to get resource source length */
215 
216  Target = ACPI_ADD_PTR (void, Aml, Info->Value);
217  ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source);
218  }
219  else
220  {
221  /* No vendor data to worry about */
222 
223  ItemCount = Aml->LargeHeader.ResourceLength +
224  sizeof (AML_RESOURCE_LARGE_HEADER) -
225  ACPI_GET16 (Source);
226  }
227 
228  Resource->Length = Resource->Length + ItemCount;
229  ACPI_SET16 (Destination, ItemCount);
230  break;
231 
233 
234  ItemCount = ACPI_GET16 (Source) - Info->Value;
235 
236  Resource->Length = Resource->Length + ItemCount;
237  ACPI_SET16 (Destination, ItemCount);
238  break;
239 
241 
242  ItemCount = (AmlResourceLength +
243  sizeof (AML_RESOURCE_LARGE_HEADER)) -
244  ACPI_GET16 (Source) - Info->Value;
245 
246  Resource->Length = Resource->Length + ItemCount;
247  ACPI_SET16 (Destination, ItemCount);
248  break;
249 
250  case ACPI_RSC_LENGTH:
251 
252  Resource->Length = Resource->Length + Info->Value;
253  break;
254 
255  case ACPI_RSC_MOVE8:
256  case ACPI_RSC_MOVE16:
257  case ACPI_RSC_MOVE32:
258  case ACPI_RSC_MOVE64:
259  /*
260  * Raw data move. Use the Info value field unless ItemCount has
261  * been previously initialized via a COUNT opcode
262  */
263  if (Info->Value)
264  {
265  ItemCount = Info->Value;
266  }
267  AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
268  break;
269 
271 
272  /* Generate and set the PIN data pointer */
273 
274  Target = (char *) ACPI_ADD_PTR (void, Resource,
275  (Resource->Length - ItemCount * 2));
277 
278  /* Copy the PIN data */
279 
280  Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source));
281  AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
282  break;
283 
285 
286  /* Generate and set the ResourceSource string pointer */
287 
288  Target = (char *) ACPI_ADD_PTR (void, Resource,
289  (Resource->Length - ItemCount));
291 
292  /* Copy the ResourceSource string */
293 
294  Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source));
295  AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
296  break;
297 
299 
300  /* Generate and set the Vendor Data pointer */
301 
302  Target = (char *) ACPI_ADD_PTR (void, Resource,
303  (Resource->Length - ItemCount));
305 
306  /* Copy the Vendor Data */
307 
308  Source = ACPI_ADD_PTR (void, Aml, Info->Value);
309  AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
310  break;
311 
313 
314  /* Generate and set the ResourceSource string pointer */
315 
316  Target = (char *) ACPI_ADD_PTR (void, Resource,
317  (Resource->Length - ItemCount));
319 
320  /* Copy the ResourceSource string */
321 
322  Source = ACPI_ADD_PTR (
323  void, Aml, (ACPI_GET16 (Source) + Info->Value));
324  AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
325  break;
326 
327  case ACPI_RSC_SET8:
328 
329  memset (Destination, Info->AmlOffset, Info->Value);
330  break;
331 
332  case ACPI_RSC_DATA8:
333 
334  Target = ACPI_ADD_PTR (char, Resource, Info->Value);
336  break;
337 
338  case ACPI_RSC_ADDRESS:
339  /*
340  * Common handler for address descriptor flags
341  */
343  {
345  }
346  break;
347 
348  case ACPI_RSC_SOURCE:
349  /*
350  * Optional ResourceSource (Index and String)
351  */
352  Resource->Length +=
353  AcpiRsGetResourceSource (AmlResourceLength, Info->Value,
354  Destination, Aml, NULL);
355  break;
356 
357  case ACPI_RSC_SOURCEX:
358  /*
359  * Optional ResourceSource (Index and String). This is the more
360  * complicated case used by the Interrupt() macro
361  */
362  Target = ACPI_ADD_PTR (char, Resource,
363  Info->AmlOffset + (ItemCount * 4));
364 
365  Resource->Length +=
366  AcpiRsGetResourceSource (AmlResourceLength, (ACPI_RS_LENGTH)
367  (((ItemCount - 1) * sizeof (UINT32)) + Info->Value),
369  break;
370 
371  case ACPI_RSC_BITMASK:
372  /*
373  * 8-bit encoded bitmask (DMA macro)
374  */
376  if (ItemCount)
377  {
378  Resource->Length += (ItemCount - 1);
379  }
380 
381  Target = ACPI_ADD_PTR (char, Resource, Info->Value);
382  ACPI_SET8 (Target, ItemCount);
383  break;
384 
385  case ACPI_RSC_BITMASK16:
386  /*
387  * 16-bit encoded bitmask (IRQ macro)
388  */
389  ACPI_MOVE_16_TO_16 (&Temp16, Source);
390 
391  ItemCount = AcpiRsDecodeBitmask (Temp16, Destination);
392  if (ItemCount)
393  {
394  Resource->Length += (ItemCount - 1);
395  }
396 
397  Target = ACPI_ADD_PTR (char, Resource, Info->Value);
398  ACPI_SET8 (Target, ItemCount);
399  break;
400 
401  case ACPI_RSC_EXIT_NE:
402  /*
403  * Control - Exit conversion if not equal
404  */
405  switch (Info->ResourceOffset)
406  {
408 
409  if (AmlResourceLength != Info->Value)
410  {
411  goto Exit;
412  }
413  break;
414 
416 
417  if (ACPI_GET8 (Source) != Info->Value)
418  {
419  goto Exit;
420  }
421  break;
422 
423  default:
424 
425  ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
427  }
428  break;
429 
430  default:
431 
432  ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
434  }
435 
436  Count--;
437  Info++;
438  }
439 
440 Exit:
441  if (!FlagsMode)
442  {
443  /* Round the resource struct length up to the next boundary (32 or 64) */
444 
445  Resource->Length = (UINT32)
447  }
449 }
#define ACPI_MOVE_16_TO_16(d, s)
Definition: acmacros.h:141
ACPI_RS_LENGTH AcpiRsGetResourceSource(ACPI_RS_LENGTH ResourceLength, ACPI_RS_LENGTH MinimumLength, ACPI_RESOURCE_SOURCE *ResourceSource, AML_RESOURCE *Aml, char *StringPtr)
Definition: rsutils.c:366
#define TRUE
Definition: types.h:120
#define INIT_RESOURCE_TYPE(i)
Definition: rsmisc.c:52
#define ACPI_GET16(ptr)
Definition: acmacros.h:58
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
UINT16 AcpiUtGetResourceLength(void *Aml)
Definition: utresrc.c:526
void AcpiRsMoveData(void *Destination, void *Source, UINT16 ItemCount, UINT8 MoveType)
Definition: rsutils.c:150
struct aml_resource_large_header AML_RESOURCE_LARGE_HEADER
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define ACPI_GET8(ptr)
Definition: acmacros.h:57
#define ACPI_RSC_COMPARE_AML_LENGTH
Definition: acresrc.h:117
struct TraceInfo Info
BOOLEAN AcpiRsGetAddressCommon(ACPI_RESOURCE *Resource, AML_RESOURCE *Aml)
Definition: rsaddr.c:322
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)
Definition: acmacros.h:254
static void Exit(void)
Definition: sock.c:1331
UINT8 AcpiRsDecodeBitmask(UINT16 Mask, UINT8 *List)
Definition: rsutils.c:68
#define INIT_RESOURCE_LENGTH(i)
Definition: rsmisc.c:53
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2891
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
#define INIT_TABLE_LENGTH(i)
Definition: rsmisc.c:54
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ACPI_SET8(ptr, val)
Definition: acmacros.h:61
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_RSC_COMPARE_VALUE
Definition: acresrc.h:118
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned short UINT16
UINT16 ACPI_RS_LENGTH
Definition: acrestyp.h:51
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_ADD_PTR(t, a, b)
Definition: actypes.h:546
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
#define ACPI_SET16(ptr, val)
Definition: acmacros.h:62
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
unsigned char UINT8
#define memset(x, y, z)
Definition: compat.h:39
#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:1287

Referenced by AcpiRsConvertAmlToResources(), and AcpiRsGetAddressCommon().

◆ 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:1287

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:1287

Referenced by AcpiRsCreateAmlResources().

◆ AcpiRsConvertResourceToAml()

ACPI_STATUS AcpiRsConvertResourceToAml ( ACPI_RESOURCE Resource,
AML_RESOURCE Aml,
ACPI_RSCONVERT_INFO Info 
)

Definition at line 468 of file rsmisc.c.

472 {
473  void *Source = NULL;
474  void *Destination;
475  char *Target;
476  ACPI_RSDESC_SIZE AmlLength = 0;
477  UINT8 Count;
478  UINT16 Temp16 = 0;
479  UINT16 ItemCount = 0;
480 
481 
482  ACPI_FUNCTION_TRACE (RsConvertResourceToAml);
483 
484 
485  if (!Info)
486  {
488  }
489 
490  /*
491  * First table entry must be ACPI_RSC_INITxxx and must contain the
492  * table length (# of table entries)
493  */
495 
496  while (Count)
497  {
498  /*
499  * Source is the internal resource descriptor,
500  * destination is the external AML byte stream buffer
501  */
502  Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
503  Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
504 
505  switch (Info->Opcode)
506  {
507  case ACPI_RSC_INITSET:
508 
510  AmlLength = INIT_RESOURCE_LENGTH (Info);
512  INIT_RESOURCE_TYPE (Info), AmlLength, Aml);
513  break;
514 
515  case ACPI_RSC_INITGET:
516  break;
517 
518  case ACPI_RSC_FLAGINIT:
519  /*
520  * Clear the flag byte
521  */
522  ACPI_SET8 (Destination, 0);
523  break;
524 
525  case ACPI_RSC_1BITFLAG:
526  /*
527  * Mask and shift the flag bit
528  */
530  ((ACPI_GET8 (Source) & 0x01) << Info->Value));
531  break;
532 
533  case ACPI_RSC_2BITFLAG:
534  /*
535  * Mask and shift the flag bits
536  */
538  ((ACPI_GET8 (Source) & 0x03) << Info->Value));
539  break;
540 
541  case ACPI_RSC_3BITFLAG:
542  /*
543  * Mask and shift the flag bits
544  */
546  ((ACPI_GET8 (Source) & 0x07) << Info->Value));
547  break;
548 
549  case ACPI_RSC_COUNT:
550 
551  ItemCount = ACPI_GET8 (Source);
552  ACPI_SET8 (Destination, ItemCount);
553 
554  AmlLength = (UINT16)
555  (AmlLength + (Info->Value * (ItemCount - 1)));
556  break;
557 
558  case ACPI_RSC_COUNT16:
559 
560  ItemCount = ACPI_GET16 (Source);
561  AmlLength = (UINT16) (AmlLength + ItemCount);
562  AcpiRsSetResourceLength (AmlLength, Aml);
563  break;
564 
566 
567  ItemCount = ACPI_GET16 (Source);
568  ACPI_SET16 (Destination, AmlLength);
569 
570  AmlLength = (UINT16) (AmlLength + ItemCount * 2);
571  Target = ACPI_ADD_PTR (void, Aml, Info->Value);
572  ACPI_SET16 (Target, AmlLength);
573  AcpiRsSetResourceLength (AmlLength, Aml);
574  break;
575 
577 
578  ItemCount = ACPI_GET16 (Source);
579  ACPI_SET16 (Destination, ItemCount);
580 
581  AmlLength = (UINT16) (
582  AmlLength + (Info->Value * ItemCount));
583  AcpiRsSetResourceLength (AmlLength, Aml);
584  break;
585 
587 
588  /* Set resource source string length */
589 
590  ItemCount = ACPI_GET16 (Source);
591  ACPI_SET16 (Destination, AmlLength);
592 
593  /* Compute offset for the Vendor Data */
594 
595  AmlLength = (UINT16) (AmlLength + ItemCount);
596  Target = ACPI_ADD_PTR (void, Aml, Info->Value);
597 
598  /* Set vendor offset only if there is vendor data */
599 
600  ACPI_SET16 (Target, AmlLength);
601 
602  AcpiRsSetResourceLength (AmlLength, Aml);
603  break;
604 
606 
607  ItemCount = ACPI_GET16 (Source);
608  ACPI_SET16 (Destination, ItemCount + Info->Value);
609  AmlLength = (UINT16) (AmlLength + ItemCount);
610  AcpiRsSetResourceLength (AmlLength, Aml);
611  break;
612 
614 
615  ItemCount = ACPI_GET16 (Source);
616  AmlLength = (UINT16) (AmlLength + ItemCount);
617  AcpiRsSetResourceLength (AmlLength, Aml);
618  break;
619 
620  case ACPI_RSC_LENGTH:
621 
622  AcpiRsSetResourceLength (Info->Value, Aml);
623  break;
624 
625  case ACPI_RSC_MOVE8:
626  case ACPI_RSC_MOVE16:
627  case ACPI_RSC_MOVE32:
628  case ACPI_RSC_MOVE64:
629 
630  if (Info->Value)
631  {
632  ItemCount = Info->Value;
633  }
634  AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
635  break;
636 
638 
639  Destination = (char *) ACPI_ADD_PTR (void, Aml,
641  Source = * (UINT16 **) Source;
642  AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
643  break;
644 
646 
647  /* Used for both ResourceSource string and VendorData */
648 
649  Destination = (char *) ACPI_ADD_PTR (void, Aml,
651  Source = * (UINT8 **) Source;
652  AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
653  break;
654 
656 
657  Destination = (char *) ACPI_ADD_PTR (void, Aml,
658  (AmlLength - ItemCount));
659  Source = * (UINT8 **) Source;
660  AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
661  break;
662 
664 
665  Destination = (char *) ACPI_ADD_PTR (void, Aml,
666  (AmlLength - ItemCount));
667  Source = * (UINT8 **) Source;
668  AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
669  break;
670 
671  case ACPI_RSC_ADDRESS:
672 
673  /* Set the Resource Type, General Flags, and Type-Specific Flags */
674 
676  break;
677 
678  case ACPI_RSC_SOURCEX:
679  /*
680  * Optional ResourceSource (Index and String)
681  */
682  AmlLength = AcpiRsSetResourceSource (
683  Aml, (ACPI_RS_LENGTH) AmlLength, Source);
684  AcpiRsSetResourceLength (AmlLength, Aml);
685  break;
686 
687  case ACPI_RSC_SOURCE:
688  /*
689  * Optional ResourceSource (Index and String). This is the more
690  * complicated case used by the Interrupt() macro
691  */
692  AmlLength = AcpiRsSetResourceSource (Aml, Info->Value, Source);
693  AcpiRsSetResourceLength (AmlLength, Aml);
694  break;
695 
696  case ACPI_RSC_BITMASK:
697  /*
698  * 8-bit encoded bitmask (DMA macro)
699  */
702  *ACPI_ADD_PTR (UINT8, Resource, Info->Value)));
703  break;
704 
705  case ACPI_RSC_BITMASK16:
706  /*
707  * 16-bit encoded bitmask (IRQ macro)
708  */
709  Temp16 = AcpiRsEncodeBitmask (
710  Source, *ACPI_ADD_PTR (UINT8, Resource, Info->Value));
711  ACPI_MOVE_16_TO_16 (Destination, &Temp16);
712  break;
713 
714  case ACPI_RSC_EXIT_LE:
715  /*
716  * Control - Exit conversion if less than or equal
717  */
718  if (ItemCount <= Info->Value)
719  {
720  goto Exit;
721  }
722  break;
723 
724  case ACPI_RSC_EXIT_NE:
725  /*
726  * Control - Exit conversion if not equal
727  */
728  switch (COMPARE_OPCODE (Info))
729  {
731 
732  if (*ACPI_ADD_PTR (UINT8, Resource,
734  {
735  goto Exit;
736  }
737  break;
738 
739  default:
740 
741  ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
743  }
744  break;
745 
746  case ACPI_RSC_EXIT_EQ:
747  /*
748  * Control - Exit conversion if equal
749  */
750  if (*ACPI_ADD_PTR (UINT8, Resource,
752  {
753  goto Exit;
754  }
755  break;
756 
757  default:
758 
759  ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
761  }
762 
763  Count--;
764  Info++;
765  }
766 
767 Exit:
769 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define ACPI_MOVE_16_TO_16(d, s)
Definition: acmacros.h:141
#define INIT_RESOURCE_TYPE(i)
Definition: rsmisc.c:52
#define ACPI_GET16(ptr)
Definition: acmacros.h:58
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_SET_BIT(target, bit)
Definition: actypes.h:533
void AcpiRsMoveData(void *Destination, void *Source, UINT16 ItemCount, UINT8 MoveType)
Definition: rsutils.c:150
#define COMPARE_VALUE(i)
Definition: rsmisc.c:58
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
UINT16 AcpiRsEncodeBitmask(UINT8 *List, UINT8 Count)
Definition: rsutils.c:110
#define ACPI_GET8(ptr)
Definition: acmacros.h:57
void AcpiRsSetAddressCommon(AML_RESOURCE *Aml, ACPI_RESOURCE *Resource)
Definition: rsaddr.c:381
struct TraceInfo Info
void AcpiRsSetResourceHeader(UINT8 DescriptorType, ACPI_RSDESC_SIZE TotalLength, AML_RESOURCE *Aml)
Definition: rsutils.c:289
#define ACPI_CAST8(ptr)
Definition: acmacros.h:53
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
ACPI_RSDESC_SIZE AcpiRsSetResourceSource(AML_RESOURCE *Aml, ACPI_RS_LENGTH MinimumLength, ACPI_RESOURCE_SOURCE *ResourceSource)
Definition: rsutils.c:457
#define COMPARE_TARGET(i)
Definition: rsmisc.c:57
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define COMPARE_OPCODE(i)
Definition: rsmisc.c:56
static void Exit(void)
Definition: sock.c:1331
#define INIT_RESOURCE_LENGTH(i)
Definition: rsmisc.c:53
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2891
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
#define INIT_TABLE_LENGTH(i)
Definition: rsmisc.c:54
#define ACPI_SET8(ptr, val)
Definition: acmacros.h:61
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_RSC_COMPARE_VALUE
Definition: acresrc.h:118
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned short UINT16
UINT32 ACPI_RSDESC_SIZE
Definition: acrestyp.h:52
UINT16 ACPI_RS_LENGTH
Definition: acrestyp.h:51
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
void AcpiRsSetResourceLength(ACPI_RSDESC_SIZE TotalLength, AML_RESOURCE *Aml)
Definition: rsutils.c:233
#define ACPI_ADD_PTR(t, a, b)
Definition: actypes.h:546
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
#define ACPI_SET16(ptr, val)
Definition: acmacros.h:62
unsigned char UINT8
#define memset(x, y, z)
Definition: compat.h:39
#define AE_OK
Definition: acexcep.h:97
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:1287

Referenced by AcpiRsConvertResourcesToAml(), and AcpiRsSetAddressCommon().

◆ AcpiRsCreateAmlResources()

ACPI_STATUS AcpiRsCreateAmlResources ( ACPI_BUFFER ResourceList,
ACPI_BUFFER OutputBuffer 
)

Definition at line 458 of file rscreate.c.

461 {
463  ACPI_SIZE AmlSizeNeeded = 0;
464 
465 
466  ACPI_FUNCTION_TRACE (RsCreateAmlResources);
467 
468 
469  /* Params already validated, no need to re-validate here */
470 
471  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ResourceList Buffer = %p\n",
472  ResourceList->Pointer));
473 
474  /* Get the buffer size needed for the AML byte stream */
475 
477  ResourceList->Pointer, ResourceList->Length, &AmlSizeNeeded);
478 
479  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
480  (UINT32) AmlSizeNeeded, AcpiFormatException (Status)));
481  if (ACPI_FAILURE (Status))
482  {
484  }
485 
486  /* Validate/Allocate/Clear caller buffer */
487 
488  Status = AcpiUtInitializeBuffer (OutputBuffer, AmlSizeNeeded);
489  if (ACPI_FAILURE (Status))
490  {
492  }
493 
494  /* Do the conversion */
495 
497  AmlSizeNeeded, OutputBuffer->Pointer);
498  if (ACPI_FAILURE (Status))
499  {
501  }
502 
503  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
504  OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
506 }
ACPI_STATUS AcpiUtInitializeBuffer(ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength)
Definition: utalloc.c:336
UINT32 ACPI_STATUS
Definition: actypes.h:460
const MUI_LANGUAGE_RESOURCE ResourceList[]
Definition: muilanguages.h:414
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
const char * AcpiFormatException(ACPI_STATUS Status)
Definition: utexcep.c:70
unsigned int UINT32
ACPI_STATUS AcpiRsConvertResourcesToAml(ACPI_RESOURCE *Resource, ACPI_SIZE AmlSizeNeeded, UINT8 *OutputBuffer)
Definition: rslist.c:173
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
ACPI_STATUS AcpiRsGetAmlLength(ACPI_RESOURCE *ResourceList, ACPI_SIZE ResourceListSize, ACPI_SIZE *SizeNeeded)
Definition: rscalc.c:211
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiRsSetSrsMethodData().

◆ AcpiRsCreatePciRoutingTable()

ACPI_STATUS AcpiRsCreatePciRoutingTable ( ACPI_OPERAND_OBJECT PackageObject,
ACPI_BUFFER OutputBuffer 
)

Definition at line 234 of file rscreate.c.

237 {
238  UINT8 *Buffer;
239  ACPI_OPERAND_OBJECT **TopObjectList;
240  ACPI_OPERAND_OBJECT **SubObjectList;
241  ACPI_OPERAND_OBJECT *ObjDesc;
242  ACPI_SIZE BufferSizeNeeded = 0;
243  UINT32 NumberOfElements;
244  UINT32 Index;
245  ACPI_PCI_ROUTING_TABLE *UserPrt;
248  ACPI_BUFFER PathBuffer;
249 
250 
251  ACPI_FUNCTION_TRACE (RsCreatePciRoutingTable);
252 
253 
254  /* Params already validated, so we don't re-validate here */
255 
256  /* Get the required buffer length */
257 
259  PackageObject,&BufferSizeNeeded);
260  if (ACPI_FAILURE (Status))
261  {
263  }
264 
265  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n",
267 
268  /* Validate/Allocate/Clear caller buffer */
269 
271  if (ACPI_FAILURE (Status))
272  {
274  }
275 
276  /*
277  * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a
278  * package that in turn contains an UINT64 Address, a UINT8 Pin,
279  * a Name, and a UINT8 SourceIndex.
280  */
281  TopObjectList = PackageObject->Package.Elements;
282  NumberOfElements = PackageObject->Package.Count;
283  Buffer = OutputBuffer->Pointer;
285 
286  for (Index = 0; Index < NumberOfElements; Index++)
287  {
288  /*
289  * Point UserPrt past this current structure
290  *
291  * NOTE: On the first iteration, UserPrt->Length will
292  * be zero because we cleared the return buffer earlier
293  */
294  Buffer += UserPrt->Length;
296 
297  /*
298  * Fill in the Length field with the information we have at this
299  * point. The minus four is to subtract the size of the UINT8
300  * Source[4] member because it is added below.
301  */
302  UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4);
303 
304  /* Each subpackage must be of length 4 */
305 
306  if ((*TopObjectList)->Package.Count != 4)
307  {
309  "(PRT[%u]) Need package of length 4, found length %u",
310  Index, (*TopObjectList)->Package.Count));
312  }
313 
314  /*
315  * Dereference the subpackage.
316  * The SubObjectList will now point to an array of the four IRQ
317  * elements: [Address, Pin, Source, SourceIndex]
318  */
319  SubObjectList = (*TopObjectList)->Package.Elements;
320 
321  /* 1) First subobject: Dereference the PRT.Address */
322 
323  ObjDesc = SubObjectList[0];
324  if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
325  {
327  "(PRT[%u].Address) Need Integer, found %s",
328  Index, AcpiUtGetObjectTypeName (ObjDesc)));
330  }
331 
332  UserPrt->Address = ObjDesc->Integer.Value;
333 
334  /* 2) Second subobject: Dereference the PRT.Pin */
335 
336  ObjDesc = SubObjectList[1];
337  if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
338  {
339  ACPI_ERROR ((AE_INFO, "(PRT[%u].Pin) Need Integer, found %s",
340  Index, AcpiUtGetObjectTypeName (ObjDesc)));
342  }
343 
344  UserPrt->Pin = (UINT32) ObjDesc->Integer.Value;
345 
346  /*
347  * 3) Third subobject: Dereference the PRT.SourceName
348  * The name may be unresolved (slack mode), so allow a null object
349  */
350  ObjDesc = SubObjectList[2];
351  if (ObjDesc)
352  {
353  switch (ObjDesc->Common.Type)
354  {
356 
357  if (ObjDesc->Reference.Class != ACPI_REFCLASS_NAME)
358  {
360  "(PRT[%u].Source) Need name, found Reference Class 0x%X",
361  Index, ObjDesc->Reference.Class));
363  }
364 
365  Node = ObjDesc->Reference.Node;
366 
367  /* Use *remaining* length of the buffer as max for pathname */
368 
369  PathBuffer.Length = OutputBuffer->Length -
370  (UINT32) ((UINT8 *) UserPrt->Source -
371  (UINT8 *) OutputBuffer->Pointer);
372  PathBuffer.Pointer = UserPrt->Source;
373 
375  (ACPI_HANDLE) Node, &PathBuffer, FALSE);
376 
377  /* +1 to include null terminator */
378 
379  UserPrt->Length += (UINT32) strlen (UserPrt->Source) + 1;
380  break;
381 
382  case ACPI_TYPE_STRING:
383 
384  strcpy (UserPrt->Source, ObjDesc->String.Pointer);
385 
386  /*
387  * Add to the Length field the length of the string
388  * (add 1 for terminator)
389  */
390  UserPrt->Length += ObjDesc->String.Length + 1;
391  break;
392 
393  case ACPI_TYPE_INTEGER:
394  /*
395  * If this is a number, then the Source Name is NULL, since
396  * the entire buffer was zeroed out, we can leave this alone.
397  *
398  * Add to the Length field the length of the UINT32 NULL
399  */
400  UserPrt->Length += sizeof (UINT32);
401  break;
402 
403  default:
404 
406  "(PRT[%u].Source) Need Ref/String/Integer, found %s",
407  Index, AcpiUtGetObjectTypeName (ObjDesc)));
409  }
410  }
411 
412  /* Now align the current length */
413 
414  UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BIT (UserPrt->Length);
415 
416  /* 4) Fourth subobject: Dereference the PRT.SourceIndex */
417 
418  ObjDesc = SubObjectList[3];
419  if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
420  {
422  "(PRT[%u].SourceIndex) Need Integer, found %s",
423  Index, AcpiUtGetObjectTypeName (ObjDesc)));
425  }
426 
427  UserPrt->SourceIndex = (UINT32) ObjDesc->Integer.Value;
428 
429  /* Point to the next ACPI_OPERAND_OBJECT in the top level package */
430 
431  TopObjectList++;
432  }
433 
434  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
435  OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
437 }
ACPI_STATUS AcpiUtInitializeBuffer(ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength)
Definition: utalloc.c:336
_Must_inspect_result_ _Inout_opt_ PUNICODE_STRING _Out_opt_ PULONG BufferSizeNeeded
Definition: fltkernel.h:1117
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:520
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
#define ACPI_ROUND_UP_TO_64BIT(a)
Definition: acmacros.h:253
ACPI_SIZE Length
Definition: actypes.h:1042
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:710
void * Pointer
Definition: actypes.h:1043
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct acpi_pci_routing_table ACPI_PCI_ROUTING_TABLE
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:440
unsigned int UINT32
union node Node
Definition: types.h:1255
#define AE_INFO
Definition: acoutput.h:230
Definition: bufpool.h:45
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:537
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
ACPI_STATUS AcpiNsHandleToPathname(ACPI_HANDLE TargetHandle, ACPI_BUFFER *Buffer, BOOLEAN NoTrailing)
Definition: nsnames.c:193
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
static const UCHAR Index[8]
Definition: usbohci.c:18
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
ACPI_OBJECT_STRING String
Definition: acobject.h:518
Status
Definition: gdiplustypes.h:24
#define AE_BAD_DATA
Definition: acexcep.h:154
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:444
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define ACPI_TYPE_STRING
Definition: actypes.h:680
#define AE_AML_PACKAGE_LIMIT
Definition: acexcep.h:190
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
unsigned char UINT8
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:263
#define AE_OK
Definition: acexcep.h:97
ACPI_STATUS AcpiRsGetPciRoutingTableLength(ACPI_OPERAND_OBJECT *PackageObject, ACPI_SIZE *BufferSizeNeeded)
Definition: rscalc.c:746
union acpi_operand_object ** Elements
Definition: acobject.h:161
Definition: dlist.c:348

Referenced by AcpiRsGetPrtMethodData().

◆ AcpiRsCreateResourceList()

ACPI_STATUS AcpiRsCreateResourceList ( ACPI_OPERAND_OBJECT AmlBuffer,
ACPI_BUFFER OutputBuffer 
)

Definition at line 151 of file rscreate.c.

154 {
155 
157  UINT8 *AmlStart;
158  ACPI_SIZE ListSizeNeeded = 0;
160  void *Resource;
161 
162 
163  ACPI_FUNCTION_TRACE (RsCreateResourceList);
164 
165 
166  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlBuffer = %p\n",
167  AmlBuffer));
168 
169  /* Params already validated, so we don't re-validate here */
170 
171  AmlBufferLength = AmlBuffer->Buffer.Length;
172  AmlStart = AmlBuffer->Buffer.Pointer;
173 
174  /*
175  * Pass the AmlBuffer into a module that can calculate
176  * the buffer size needed for the linked list
177  */
179  &ListSizeNeeded);
180 
181  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n",
182  Status, (UINT32) ListSizeNeeded));
183  if (ACPI_FAILURE (Status))
184  {
186  }
187 
188  /* Validate/Allocate/Clear caller buffer */
189 
190  Status = AcpiUtInitializeBuffer (OutputBuffer, ListSizeNeeded);
191  if (ACPI_FAILURE (Status))
192  {
194  }
195 
196  /* Do the conversion */
197 
198  Resource = OutputBuffer->Pointer;
201  if (ACPI_FAILURE (Status))
202  {
204  }
205 
206  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
207  OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
209 }
ACPI_STATUS AcpiRsConvertAmlToResources(UINT8 *Aml, UINT32 Length, UINT32 Offset, UINT8 ResourceIndex, void **Context)
Definition: rslist.c:68
ACPI_STATUS AcpiUtInitializeBuffer(ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength)
Definition: utalloc.c:336
ACPI_STATUS AcpiUtWalkAmlResources(ACPI_WALK_STATE *WalkState, UINT8 *Aml, ACPI_SIZE AmlLength, ACPI_WALK_AML_CALLBACK UserFunction, void **Context)
Definition: utresrc.c:180
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 AmlBufferLength
Definition: acpixf.h:1089
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
ACPI_STATUS AcpiRsGetListLength(UINT8 *AmlBuffer, UINT32 AmlBufferLength, ACPI_SIZE *SizeNeeded)
Definition: rscalc.c:460
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiRsGetAeiMethodData(), AcpiRsGetCrsMethodData(), AcpiRsGetMethodData(), and AcpiRsGetPrsMethodData().

◆ AcpiRsDecodeBitmask()

UINT8 AcpiRsDecodeBitmask ( UINT16  Mask,
UINT8 List 
)

Definition at line 68 of file rsutils.c.

71 {
72  UINT8 i;
73  UINT8 BitCount;
74 
75 
77 
78 
79  /* Decode the mask bits */
80 
81  for (i = 0, BitCount = 0; Mask; i++)
82  {
83  if (Mask & 0x0001)
84  {
85  List[BitCount] = i;
86  BitCount++;
87  }
88 
89  Mask >>= 1;
90  }
91 
92  return (BitCount);
93 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
LIST_ENTRY List
Definition: psmgr.c:57
unsigned char UINT8

Referenced by AcpiRsConvertAmlToResource().

◆ AcpiRsEncodeBitmask()

UINT16 AcpiRsEncodeBitmask ( UINT8 List,
UINT8  Count 
)

Definition at line 110 of file rsutils.c.

113 {
114  UINT32 i;
115  UINT16 Mask;
116 
117 
119 
120 
121  /* Encode the list into a single bitmask */
122 
123  for (i = 0, Mask = 0; i < Count; i++)
124  {
125  Mask |= (0x1 << List[i]);
126  }
127 
128  return (Mask);
129 }
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
LIST_ENTRY List
Definition: psmgr.c:57
unsigned short UINT16

Referenced by AcpiRsConvertResourceToAml().

◆ AcpiRsGetAddressCommon()

BOOLEAN AcpiRsGetAddressCommon ( ACPI_RESOURCE Resource,
AML_RESOURCE Aml 
)

Definition at line 322 of file rsaddr.c.

325 {
327 
328 
329  /* Validate the Resource Type */
330 
331  if ((Aml->Address.ResourceType > 2) &&
332  (Aml->Address.ResourceType < 0xC0))
333  {
334  return (FALSE);
335  }
336 
337  /* Get the Resource Type and General Flags */
338 
341 
342  /* Get the Type-Specific Flags (Memory and I/O descriptors only) */
343 
344  if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE)
345  {
348  }
349  else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE)
350  {
353  }
354  else
355  {
356  /* Generic resource type, just grab the TypeSpecific byte */
357 
358  Resource->Data.Address.Info.TypeSpecific =
359  Aml->Address.SpecificFlags;
360  }
361 
362  return (TRUE);
363 }
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static ACPI_RSCONVERT_INFO AcpiRsConvertIoFlags[4]
Definition: rsaddr.c:286
static ACPI_RSCONVERT_INFO AcpiRsConvertMemFlags[5]
Definition: rsaddr.c:255
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_IO_RANGE
Definition: acrestyp.h:138
static ACPI_RSCONVERT_INFO AcpiRsConvertGeneralFlags[6]
Definition: rsaddr.c:218
#define ACPI_MEMORY_RANGE
Definition: acrestyp.h:137
ACPI_STATUS AcpiRsConvertAmlToResource(ACPI_RESOURCE *Resource, AML_RESOURCE *Aml, ACPI_RSCONVERT_INFO *Info)
Definition: rsmisc.c:77
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:1287

Referenced by AcpiRsConvertAmlToResource().

◆ AcpiRsGetAeiMethodData()

ACPI_STATUS AcpiRsGetAeiMethodData ( ACPI_NAMESPACE_NODE Node,
ACPI_BUFFER RetBuffer 
)

Definition at line 685 of file rsutils.c.

688 {
689  ACPI_OPERAND_OBJECT *ObjDesc;
691 
692 
693  ACPI_FUNCTION_TRACE (RsGetAeiMethodData);
694 
695 
696  /* Parameters guaranteed valid by caller */
697 
698  /* Execute the method, no parameters */
699 
702  if (ACPI_FAILURE (Status))
703  {
705  }
706 
707  /*
708  * Make the call to create a resource linked list from the
709  * byte stream buffer that comes back from the _CRS method
710  * execution.
711  */
712  Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
713 
714  /* On exit, we must delete the object returned by evaluateObject */
715 
716  AcpiUtRemoveReference (ObjDesc);
718 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiRsCreateResourceList(ACPI_OPERAND_OBJECT *AmlBuffer, ACPI_BUFFER *OutputBuffer)
Definition: rscreate.c:151
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_BTYPE_BUFFER
Definition: aclocal.h:334
ACPI_STATUS AcpiUtEvaluateObject(ACPI_NAMESPACE_NODE *PrefixNode, const char *Path, UINT32 ExpectedReturnBtypes, ACPI_OPERAND_OBJECT **ReturnDesc)
Definition: uteval.c:73
#define METHOD_NAME__AEI
Definition: acnames.h:50
Definition: dlist.c:348

Referenced by AcpiGetEventResources().

◆ AcpiRsGetAmlLength()

ACPI_STATUS AcpiRsGetAmlLength ( ACPI_RESOURCE ResourceList,
ACPI_SIZE  ResourceListSize,
ACPI_SIZE *  SizeNeeded 
)

Definition at line 211 of file rscalc.c.

215 {
216  ACPI_SIZE AmlSizeNeeded = 0;
217  ACPI_RESOURCE *ResourceEnd;
218  ACPI_RS_LENGTH TotalSize;
219 
220 
221  ACPI_FUNCTION_TRACE (RsGetAmlLength);
222 
223 
224  /* Traverse entire list of internal resource descriptors */
225 
226  ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, ResourceListSize);
227  while (Resource < ResourceEnd)
228  {
229  /* Validate the descriptor type */
230 
231  if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
232  {
234  }
235 
236  /* Sanity check the length. It must not be zero, or we loop forever */
237 
238  if (!Resource->Length)
239  {
241  }
242 
243  /* Get the base size of the (external stream) resource descriptor */
244 
245  TotalSize = AcpiGbl_AmlResourceSizes [Resource->Type];
246 
247  /*
248  * Augment the base size for descriptors with optional and/or
249  * variable-length fields
250  */
251  switch (Resource->Type)
252  {
254 
255  /* Length can be 3 or 2 */
256 
257  if (Resource->Data.Irq.DescriptorLength == 2)
258  {
259  TotalSize--;
260  }
261  break;
262 
263 
265 
266  /* Length can be 1 or 0 */
267 
268  if (Resource->Data.Irq.DescriptorLength == 0)
269  {
270  TotalSize--;
271  }
272  break;
273 
274 
276  /*
277  * Vendor Defined Resource:
278  * For a Vendor Specific resource, if the Length is between 1 and 7
279  * it will be created as a Small Resource data type, otherwise it
280  * is a Large Resource data type.
281  */
282  if (Resource->Data.Vendor.ByteLength > 7)
283  {
284  /* Base size of a Large resource descriptor */
285 
286  TotalSize = sizeof (AML_RESOURCE_LARGE_HEADER);
287  }
288 
289  /* Add the size of the vendor-specific data */
290 
291  TotalSize = (ACPI_RS_LENGTH)
292  (TotalSize + Resource->Data.Vendor.ByteLength);
293  break;
294 
295 
297  /*
298  * End Tag:
299  * We are done -- return the accumulated total size.
300  */
301  *SizeNeeded = AmlSizeNeeded + TotalSize;
302 
303  /* Normal exit */
304 
306 
307 
309  /*
310  * 16-Bit Address Resource:
311  * Add the size of the optional ResourceSource info
312  */
313  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
315  &Resource->Data.Address16.ResourceSource));
316  break;
317 
318 
320  /*
321  * 32-Bit Address Resource:
322  * Add the size of the optional ResourceSource info
323  */
324  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
326  &Resource->Data.Address32.ResourceSource));
327  break;
328 
329 
331  /*
332  * 64-Bit Address Resource:
333  * Add the size of the optional ResourceSource info
334  */
335  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
337  &Resource->Data.Address64.ResourceSource));
338  break;
339 
340 
342  /*
343  * Extended IRQ Resource:
344  * Add the size of each additional optional interrupt beyond the
345  * required 1 (4 bytes for each UINT32 interrupt number)
346  */
347  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
348  ((Resource->Data.ExtendedIrq.InterruptCount - 1) * 4) +
349 
350  /* Add the size of the optional ResourceSource info */
351 
353  &Resource->Data.ExtendedIrq.ResourceSource));
354  break;
355 
356 
358 
359  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
360  (Resource->Data.Gpio.PinTableLength * 2) +
361  Resource->Data.Gpio.ResourceSource.StringLength +
362  Resource->Data.Gpio.VendorLength);
363 
364  break;
365 
367 
368  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
369  (Resource->Data.PinFunction.PinTableLength * 2) +
370  Resource->Data.PinFunction.ResourceSource.StringLength +
371  Resource->Data.PinFunction.VendorLength);
372 
373  break;
374 
375 
377 
379  Resource->Data.CommonSerialBus.Type];
380 
381  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
382  Resource->Data.I2cSerialBus.ResourceSource.StringLength +
383  Resource->Data.I2cSerialBus.VendorLength);
384 
385  break;
386 
388 
389  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
390  (Resource->Data.PinConfig.PinTableLength * 2) +
391  Resource->Data.PinConfig.ResourceSource.StringLength +
392  Resource->Data.PinConfig.VendorLength);
393 
394  break;
395 
397 
398  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
399  (Resource->Data.PinGroup.PinTableLength * 2) +
400  Resource->Data.PinGroup.ResourceLabel.StringLength +
401  Resource->Data.PinGroup.VendorLength);
402 
403  break;
404 
406 
407  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
408  Resource->Data.PinGroupFunction.ResourceSource.StringLength +
409  Resource->Data.PinGroupFunction.ResourceSourceLabel.StringLength +
410  Resource->Data.PinGroupFunction.VendorLength);
411 
412  break;
413 
415 
416  TotalSize = (ACPI_RS_LENGTH) (TotalSize +
417  Resource->Data.PinGroupConfig.ResourceSource.StringLength +
418  Resource->Data.PinGroupConfig.ResourceSourceLabel.StringLength +
419  Resource->Data.PinGroupConfig.VendorLength);
420 
421  break;
422 
423  default:
424 
425  break;
426  }
427 
428  /* Update the total */
429 
430  AmlSizeNeeded += TotalSize;
431 
432  /* Point to the next object */
433 
435  }
436 
437  /* Did not find an EndTag resource descriptor */
438 
440 }
#define AE_AML_BAD_RESOURCE_LENGTH
Definition: acexcep.h:210
#define ACPI_RESOURCE_TYPE_PIN_FUNCTION
Definition: acrestyp.h:734
#define ACPI_RESOURCE_TYPE_START_DEPENDENT
Definition: acrestyp.h:716
#define ACPI_RESOURCE_TYPE_SERIAL_BUS
Definition: acrestyp.h:733
const UINT8 AcpiGbl_AmlResourceSerialBusSizes[]
Definition: rsinfo.c:273
#define ACPI_RESOURCE_TYPE_IRQ
Definition: acrestyp.h:714
struct aml_resource_large_header AML_RESOURCE_LARGE_HEADER
#define ACPI_RESOURCE_TYPE_END_TAG
Definition: acrestyp.h:721
#define ACPI_RESOURCE_TYPE_GPIO
Definition: acrestyp.h:731
#define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG
Definition: acrestyp.h:738
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
#define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION
Definition: acrestyp.h:737
#define ACPI_RESOURCE_TYPE_PIN_CONFIG
Definition: acrestyp.h:735
#define ACPI_RESOURCE_TYPE_ADDRESS32
Definition: acrestyp.h:726
#define ACPI_RESOURCE_TYPE_VENDOR
Definition: acrestyp.h:720
#define ACPI_RESOURCE_TYPE_ADDRESS64
Definition: acrestyp.h:727
const UINT8 AcpiGbl_AmlResourceSizes[]
Definition: rsinfo.c:199
#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ
Definition: acrestyp.h:729
#define ACPI_RESOURCE_TYPE_MAX
Definition: acrestyp.h:739
#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
UINT16 ACPI_RS_LENGTH
Definition: acrestyp.h:51
#define ACPI_RESOURCE_TYPE_PIN_GROUP
Definition: acrestyp.h:736
#define ACPI_RESOURCE_TYPE_ADDRESS16
Definition: acrestyp.h:725
#define ACPI_ADD_PTR(t, a, b)
Definition: actypes.h:546
static ACPI_RS_LENGTH AcpiRsStructOptionLength(ACPI_RESOURCE_SOURCE *ResourceSource)
Definition: rscalc.c:119
#define AE_OK
Definition: acexcep.h:97
#define AE_AML_INVALID_RESOURCE_TYPE
Definition: acexcep.h:202

Referenced by AcpiRsCreateAmlResources().

◆ AcpiRsGetCrsMethodData()

ACPI_STATUS AcpiRsGetCrsMethodData ( ACPI_NAMESPACE_NODE Node,
ACPI_BUFFER RetBuffer 
)

Definition at line 575 of file rsutils.c.

578 {
579  ACPI_OPERAND_OBJECT *ObjDesc;
581 
582 
583  ACPI_FUNCTION_TRACE (RsGetCrsMethodData);
584 
585 
586  /* Parameters guaranteed valid by caller */
587 
588  /* Execute the method, no parameters */
589 
592  if (ACPI_FAILURE (Status))
593  {
595  }
596 
597  /*
598  * Make the call to create a resource linked list from the
599  * byte stream buffer that comes back from the _CRS method
600  * execution.
601  */
602  Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
603 
604  /* On exit, we must delete the object returned by evaluateObject */
605 
606  AcpiUtRemoveReference (ObjDesc);
608 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiRsCreateResourceList(ACPI_OPERAND_OBJECT *AmlBuffer, ACPI_BUFFER *OutputBuffer)
Definition: rscreate.c:151
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define METHOD_NAME__CRS
Definition: acnames.h:55
#define ACPI_BTYPE_BUFFER
Definition: aclocal.h:334
ACPI_STATUS AcpiUtEvaluateObject(ACPI_NAMESPACE_NODE *PrefixNode, const char *Path, UINT32 ExpectedReturnBtypes, ACPI_OPERAND_OBJECT **ReturnDesc)
Definition: uteval.c:73
Definition: dlist.c:348

Referenced by AcpiGetCurrentResources().

◆ AcpiRsGetListLength()

ACPI_STATUS AcpiRsGetListLength ( UINT8 AmlBuffer,
UINT32  AmlBufferLength,
ACPI_SIZE *  SizeNeeded 
)

Definition at line 460 of file rscalc.c.

464 {
466  UINT8 *EndAml;
467  UINT8 *Buffer;
469  UINT16 Temp16;
470  UINT16 ResourceLength;
471  UINT32 ExtraStructBytes;
472  UINT8 ResourceIndex;
473  UINT8 MinimumAmlResourceLength;
474  AML_RESOURCE *AmlResource;
475 
476 
477  ACPI_FUNCTION_TRACE (RsGetListLength);
478 
479 
480  *SizeNeeded = ACPI_RS_SIZE_MIN; /* Minimum size is one EndTag */
481  EndAml = AmlBuffer + AmlBufferLength;
482 
483  /* Walk the list of AML resource descriptors */
484 
485  while (AmlBuffer < EndAml)
486  {
487  /* Validate the Resource Type and Resource Length */
488 
489  Status = AcpiUtValidateResource (NULL, AmlBuffer, &ResourceIndex);
490  if (ACPI_FAILURE (Status))
491  {
492  /*
493  * Exit on failure. Cannot continue because the descriptor length
494  * may be bogus also.
495  */
497  }
498 
499  AmlResource = (void *) AmlBuffer;
500 
501  /* Get the resource length and base (minimum) AML size */
502 
503  ResourceLength = AcpiUtGetResourceLength (AmlBuffer);
504  MinimumAmlResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex];
505 
506  /*
507  * Augment the size for descriptors with optional
508  * and/or variable length fields
509  */
510  ExtraStructBytes = 0;
511  Buffer = AmlBuffer + AcpiUtGetResourceHeaderLength (AmlBuffer);
512 
513  switch (AcpiUtGetResourceType (AmlBuffer))
514  {
516  /*
517  * IRQ Resource:
518  * Get the number of bits set in the 16-bit IRQ mask
519  */
520  ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
521  ExtraStructBytes = AcpiRsCountSetBits (Temp16);
522  break;
523 
524 
526  /*
527  * DMA Resource:
528  * Get the number of bits set in the 8-bit DMA mask
529  */
530  ExtraStructBytes = AcpiRsCountSetBits (*Buffer);
531  break;
532 
533 
536  /*
537  * Vendor Resource:
538  * Get the number of vendor data bytes
539  */
540  ExtraStructBytes = ResourceLength;
541 
542  /*
543  * There is already one byte included in the minimum
544  * descriptor size. If there are extra struct bytes,
545  * subtract one from the count.
546  */
547  if (ExtraStructBytes)
548  {
549  ExtraStructBytes--;
550  }
551  break;
552 
553 
555  /*
556  * End Tag: This is the normal exit
557  */
559 
560 
564  /*
565  * Address Resource:
566  * Add the size of the optional ResourceSource
567  */
568  ExtraStructBytes = AcpiRsStreamOptionLength (
569  ResourceLength, MinimumAmlResourceLength);
570  break;
571 
572 
574  /*
575  * Extended IRQ Resource:
576  * Using the InterruptTableLength, add 4 bytes for each additional
577  * interrupt. Note: at least one interrupt is required and is
578  * included in the minimum descriptor size (reason for the -1)
579  */
580  ExtraStructBytes = (Buffer[1] - 1) * sizeof (UINT32);
581 
582  /* Add the size of the optional ResourceSource */
583 
584  ExtraStructBytes += AcpiRsStreamOptionLength (
585  ResourceLength - ExtraStructBytes, MinimumAmlResourceLength);
586  break;
587 
589 
590  /* Vendor data is optional */
591 
592  if (AmlResource->Gpio.VendorLength)
593  {
594  ExtraStructBytes +=
595  AmlResource->Gpio.VendorOffset -
596  AmlResource->Gpio.PinTableOffset +
597  AmlResource->Gpio.VendorLength;
598  }
599  else
600  {
601  ExtraStructBytes +=
602  AmlResource->LargeHeader.ResourceLength +
603  sizeof (AML_RESOURCE_LARGE_HEADER) -
604  AmlResource->Gpio.PinTableOffset;
605  }
606  break;
607 
609 
610  /* Vendor data is optional */
611 
612  if (AmlResource->PinFunction.VendorLength)
613  {
614  ExtraStructBytes +=
615  AmlResource->PinFunction.VendorOffset -
616  AmlResource->PinFunction.PinTableOffset +
617  AmlResource->PinFunction.VendorLength;
618  }
619  else
620  {
621  ExtraStructBytes +=
622  AmlResource->LargeHeader.ResourceLength +
623  sizeof (AML_RESOURCE_LARGE_HEADER) -
624  AmlResource->PinFunction.PinTableOffset;
625  }
626  break;
627 
629 
630  MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[
631  AmlResource->CommonSerialBus.Type];
632  ExtraStructBytes +=
633  AmlResource->CommonSerialBus.ResourceLength -
634  MinimumAmlResourceLength;
635  break;
636 
638 
639  /* Vendor data is optional */
640 
641  if (AmlResource->PinConfig.VendorLength)
642  {
643  ExtraStructBytes +=
644  AmlResource->PinConfig.VendorOffset -
645  AmlResource->PinConfig.PinTableOffset +
646  AmlResource->PinConfig.VendorLength;
647  }
648  else
649  {
650  ExtraStructBytes +=
651  AmlResource->LargeHeader.ResourceLength +
652  sizeof (AML_RESOURCE_LARGE_HEADER) -
653  AmlResource->PinConfig.PinTableOffset;
654  }
655  break;
656 
658 
659  ExtraStructBytes +=
660  AmlResource->PinGroup.VendorOffset -
661  AmlResource->PinGroup.PinTableOffset +
662  AmlResource->PinGroup.VendorLength;
663 
664  break;
665 
667 
668  ExtraStructBytes +=
669  AmlResource->PinGroupFunction.VendorOffset -
670  AmlResource->PinGroupFunction.ResSourceOffset +
671  AmlResource->PinGroupFunction.VendorLength;
672 
673  break;
674 
676 
677  ExtraStructBytes +=
678  AmlResource->PinGroupConfig.VendorOffset -
679  AmlResource->PinGroupConfig.ResSourceOffset +
680  AmlResource->PinGroupConfig.VendorLength;
681 
682  break;
683 
684  default:
685 
686  break;
687  }
688 
689  /*
690  * Update the required buffer size for the internal descriptor structs
691  *
692  * Important: Round the size up for the appropriate alignment. This
693  * is a requirement on IA64.
694  */
695  if (AcpiUtGetResourceType (AmlBuffer) ==
697  {
699  AmlResource->CommonSerialBus.Type] + ExtraStructBytes;
700  }
701  else
702  {
703  BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] +
704  ExtraStructBytes;
705  }
706 
708  *SizeNeeded += BufferSize;
709 
711  "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
712  AcpiUtGetResourceType (AmlBuffer),
713  AcpiUtGetDescriptorLength (AmlBuffer), BufferSize));
714 
715  /*
716  * Point to the next resource within the AML stream using the length
717  * contained in the resource descriptor header
718  */
719  AmlBuffer += AcpiUtGetDescriptorLength (AmlBuffer);
720  }
721 
722  /* Did not find an EndTag resource descriptor */
723 
725 }
#define ACPI_MOVE_16_TO_16(d, s)
Definition: acmacros.h:141
#define ACPI_RESOURCE_NAME_END_TAG
Definition: aclocal.h:1323
#define ACPI_RESOURCE_NAME_DMA
Definition: aclocal.h:1313
ACPI_STATUS AcpiUtValidateResource(ACPI_WALK_STATE *WalkState, void *Aml, UINT8 *ReturnIndex)
Definition: utresrc.c:313
#define ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION
Definition: aclocal.h:1345
#define ACPI_RESOURCE_NAME_EXTENDED_IRQ
Definition: aclocal.h:1337
AML_RESOURCE_PIN_GROUP PinGroup
Definition: amlresrc.h:690
#define ACPI_RESOURCE_NAME_VENDOR_LARGE
Definition: aclocal.h:1332
UINT16 AcpiUtGetResourceLength(void *Aml)
Definition: utresrc.c:526
AML_RESOURCE_PIN_FUNCTION PinFunction
Definition: amlresrc.h:688
struct aml_resource_large_header AML_RESOURCE_LARGE_HEADER
AML_RESOURCE_PIN_GROUP_FUNCTION PinGroupFunction
Definition: amlresrc.h:691
UINT32 ACPI_STATUS
Definition: actypes.h:460
static UINT32 AcpiRsStreamOptionLength(UINT32 ResourceLength, UINT32 MinimumTotalLength)
Definition: rscalc.c:156
const UINT8 AcpiGbl_ResourceStructSizes[]
Definition: rsinfo.c:229
#define ACPI_RESOURCE_NAME_ADDRESS16
Definition: aclocal.h:1336
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
static UINT8 AcpiRsCountSetBits(UINT16 BitField)
Definition: rscalc.c:84
#define ACPI_RESOURCE_NAME_ADDRESS32
Definition: aclocal.h:1335
unsigned int UINT32
#define ACPI_RESOURCE_NAME_ADDRESS64
Definition: aclocal.h:1338
AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus
Definition: amlresrc.h:687
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
UINT16 PinTableOffset
Definition: amlresrc.h:424
const UINT8 AcpiGbl_ResourceStructSerialBusSizes[]
Definition: rsinfo.c:281
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 AmlBufferLength
Definition: acpixf.h:1089
UINT8 AcpiUtGetResourceHeaderLength(void *Aml)
Definition: utresrc.c:571
const UINT8 AcpiGbl_ResourceAmlSizes[]
Definition: utresrc.c:57
#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)
Definition: acmacros.h:254
AML_RESOURCE_LARGE_HEADER LargeHeader
Definition: amlresrc.h:657
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_RESOURCE_NAME_IRQ
Definition: aclocal.h:1312
#define BufferSize
Definition: classpnp.h:419
UINT32 AcpiUtGetDescriptorLength(void *Aml)
Definition: utresrc.c:605
AML_RESOURCE_PIN_GROUP_CONFIG PinGroupConfig
Definition: amlresrc.h:692
Status
Definition: gdiplustypes.h:24
AML_RESOURCE_PIN_CONFIG PinConfig
Definition: amlresrc.h:689
UINT16 VendorLength
Definition: amlresrc.h:428
#define ACPI_RESOURCE_NAME_PIN_GROUP
Definition: aclocal.h:1344
#define ACPI_DB_RESOURCES
Definition: acoutput.h:176
#define ACPI_RESOURCE_NAME_PIN_FUNCTION
Definition: aclocal.h:1341
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned short UINT16
#define AE_AML_NO_RESOURCE_END_TAG
Definition: acexcep.h:207
#define ACPI_RESOURCE_NAME_SERIAL_BUS
Definition: aclocal.h:1342
UINT8 AcpiUtGetResourceType(void *Aml)
Definition: utresrc.c:486
#define ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG
Definition: aclocal.h:1346
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
UINT16 VendorOffset
Definition: amlresrc.h:427
unsigned char UINT8
#define ACPI_RS_SIZE_MIN
Definition: acrestyp.h:797
#define ACPI_RESOURCE_NAME_GPIO
Definition: aclocal.h:1340
#define AE_OK
Definition: acexcep.h:97
#define ACPI_RESOURCE_NAME_VENDOR_SMALL
Definition: aclocal.h:1322
const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[]
Definition: utresrc.c:101
#define ACPI_RESOURCE_NAME_PIN_CONFIG
Definition: aclocal.h:1343
AML_RESOURCE_GPIO Gpio
Definition: amlresrc.h:683

Referenced by AcpiBufferToResource(), and AcpiRsCreateResourceList().

◆ AcpiRsGetMethodData()

ACPI_STATUS AcpiRsGetMethodData ( ACPI_HANDLE  Handle,
const char Path,
ACPI_BUFFER RetBuffer 
)

Definition at line 741 of file rsutils.c.

745 {
746  ACPI_OPERAND_OBJECT *ObjDesc;
748 
749 
750  ACPI_FUNCTION_TRACE (RsGetMethodData);
751 
752 
753  /* Parameters guaranteed valid by caller */
754 
755  /* Execute the method, no parameters */
756 
759  Path, ACPI_BTYPE_BUFFER, &ObjDesc);
760  if (ACPI_FAILURE (Status))
761  {
763  }
764 
765  /*
766  * Make the call to create a resource linked list from the
767  * byte stream buffer that comes back from the method
768  * execution.
769  */
770  Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
771 
772  /* On exit, we must delete the object returned by EvaluateObject */
773 
774  AcpiUtRemoveReference (ObjDesc);
776 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
_In_ HANDLE Handle
Definition: extypes.h:390
ACPI_STATUS AcpiRsCreateResourceList(ACPI_OPERAND_OBJECT *AmlBuffer, ACPI_BUFFER *OutputBuffer)
Definition: rscreate.c:151
Status
Definition: gdiplustypes.h:24
PRTL_UNICODE_STRING_BUFFER Path
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_BTYPE_BUFFER
Definition: aclocal.h:334
ACPI_STATUS AcpiUtEvaluateObject(ACPI_NAMESPACE_NODE *PrefixNode, const char *Path, UINT32 ExpectedReturnBtypes, ACPI_OPERAND_OBJECT **ReturnDesc)
Definition: uteval.c:73
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544

Referenced by AcpiWalkResources().

◆ AcpiRsGetPciRoutingTableLength()

ACPI_STATUS AcpiRsGetPciRoutingTableLength ( ACPI_OPERAND_OBJECT PackageObject,
ACPI_SIZE *  BufferSizeNeeded 
)

Definition at line 746 of file rscalc.c.

749 {
750  UINT32 NumberOfElements;
751  ACPI_SIZE TempSizeNeeded = 0;
752  ACPI_OPERAND_OBJECT **TopObjectList;
753  UINT32 Index;
754  ACPI_OPERAND_OBJECT *PackageElement;
755  ACPI_OPERAND_OBJECT **SubObjectList;
756  BOOLEAN NameFound;
757  UINT32 TableIndex;
758 
759 
760  ACPI_FUNCTION_TRACE (RsGetPciRoutingTableLength);
761 
762 
763  NumberOfElements = PackageObject->Package.Count;
764 
765  /*
766  * Calculate the size of the return buffer.
767  * The base size is the number of elements * the sizes of the
768  * structures. Additional space for the strings is added below.
769  * The minus one is to subtract the size of the UINT8 Source[1]
770  * member because it is added below.
771  *
772  * But each PRT_ENTRY structure has a pointer to a string and
773  * the size of that string must be found.
774  */
775  TopObjectList = PackageObject->Package.Elements;
776 
777  for (Index = 0; Index < NumberOfElements; Index++)
778  {
779  /* Dereference the subpackage */
780 
781  PackageElement = *TopObjectList;
782 
783  /* We must have a valid Package object */
784 
785  if (!PackageElement ||
786  (PackageElement->Common.Type != ACPI_TYPE_PACKAGE))
787  {
789  }
790 
791  /*
792  * The SubObjectList will now point to an array of the
793  * four IRQ elements: Address, Pin, Source and SourceIndex
794  */
795  SubObjectList = PackageElement->Package.Elements;
796 
797  /* Scan the IrqTableElements for the Source Name String */
798 
799  NameFound = FALSE;
800 
801  for (TableIndex = 0;
802  TableIndex < PackageElement->Package.Count && !NameFound;
803  TableIndex++)
804  {
805  if (*SubObjectList && /* Null object allowed */
806 
807  ((ACPI_TYPE_STRING ==
808  (*SubObjectList)->Common.Type) ||
809 
811  (*SubObjectList)->Common.Type) &&
812 
813  ((*SubObjectList)->Reference.Class ==
815  {
816  NameFound = TRUE;
817  }
818  else
819  {
820  /* Look at the next element */
821 
822  SubObjectList++;
823  }
824  }
825 
826  TempSizeNeeded += (sizeof (ACPI_PCI_ROUTING_TABLE) - 4);
827 
828  /* Was a String type found? */
829 
830  if (NameFound)
831  {
832  if ((*SubObjectList)->Common.Type == ACPI_TYPE_STRING)
833  {
834  /*
835  * The length String.Length field does not include the
836  * terminating NULL, add 1
837  */
838  TempSizeNeeded += ((ACPI_SIZE)
839  (*SubObjectList)->String.Length + 1);
840  }
841  else
842  {
843  TempSizeNeeded += AcpiNsGetPathnameLength (
844  (*SubObjectList)->Reference.Node);
845  }
846  }
847  else
848  {
849  /*
850  * If no name was found, then this is a NULL, which is
851  * translated as a UINT32 zero.
852  */
853  TempSizeNeeded += sizeof (UINT32);
854  }
855 
856  /* Round up the size since each element must be aligned */
857 
858  TempSizeNeeded = ACPI_ROUND_UP_TO_64BIT (TempSizeNeeded);
859 
860  /* Point to the next ACPI_OPERAND_OBJECT */
861 
862  TopObjectList++;
863  }
864 
865  /*
866  * Add an extra element to the end of the list, essentially a
867  * NULL terminator
868  */
869  *BufferSizeNeeded = TempSizeNeeded + sizeof (ACPI_PCI_ROUTING_TABLE);
871 }
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _Inout_opt_ PUNICODE_STRING _Out_opt_ PULONG BufferSizeNeeded
Definition: fltkernel.h:1117
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:520
#define ACPI_ROUND_UP_TO_64BIT(a)
Definition: acmacros.h:253
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:710
ACPI_SIZE AcpiNsGetPathnameLength(ACPI_NAMESPACE_NODE *Node)
Definition: nsnames.c:103
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
struct acpi_pci_routing_table ACPI_PCI_ROUTING_TABLE
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:682
unsigned int UINT32
unsigned char BOOLEAN
static const UCHAR Index[8]
Definition: usbohci.c:18
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define ACPI_TYPE_STRING
Definition: actypes.h:680
#define AE_OK
Definition: acexcep.h:97
union acpi_operand_object ** Elements
Definition: acobject.h:161

Referenced by AcpiRsCreatePciRoutingTable().

◆ AcpiRsGetPrsMethodData()

ACPI_STATUS AcpiRsGetPrsMethodData ( ACPI_NAMESPACE_NODE Node,
ACPI_BUFFER RetBuffer 
)

Definition at line 630 of file rsutils.c.

633 {
634  ACPI_OPERAND_OBJECT *ObjDesc;
636 
637 
638  ACPI_FUNCTION_TRACE (RsGetPrsMethodData);
639 
640 
641  /* Parameters guaranteed valid by caller */
642 
643  /* Execute the method, no parameters */
644 
647  if (ACPI_FAILURE (Status))
648  {
650  }
651 
652  /*
653  * Make the call to create a resource linked list from the
654  * byte stream buffer that comes back from the _CRS method
655  * execution.
656  */
657  Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
658 
659  /* On exit, we must delete the object returned by evaluateObject */
660 
661  AcpiUtRemoveReference (ObjDesc);
663 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define METHOD_NAME__PRS
Definition: acnames.h:62
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiRsCreateResourceList(ACPI_OPERAND_OBJECT *AmlBuffer, ACPI_BUFFER *OutputBuffer)
Definition: rscreate.c:151
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_BTYPE_BUFFER
Definition: aclocal.h:334
ACPI_STATUS AcpiUtEvaluateObject(ACPI_NAMESPACE_NODE *PrefixNode, const char *Path, UINT32 ExpectedReturnBtypes, ACPI_OPERAND_OBJECT **ReturnDesc)
Definition: uteval.c:73
Definition: dlist.c:348

Referenced by AcpiGetPossibleResources().

◆ AcpiRsGetPrtMethodData()

ACPI_STATUS AcpiRsGetPrtMethodData ( ACPI_NAMESPACE_NODE Node,
ACPI_BUFFER RetBuffer 
)

Definition at line 521 of file rsutils.c.

524 {
525  ACPI_OPERAND_OBJECT *ObjDesc;
527 
528 
529  ACPI_FUNCTION_TRACE (RsGetPrtMethodData);
530 
531 
532  /* Parameters guaranteed valid by caller */
533 
534  /* Execute the method, no parameters */
535 
538  if (ACPI_FAILURE (Status))
539  {
541  }
542 
543  /*
544  * Create a resource linked list from the byte stream buffer that comes
545  * back from the _CRS method execution.
546  */
547  Status = AcpiRsCreatePciRoutingTable (ObjDesc, RetBuffer);
548 
549  /* On exit, we must delete the object returned by EvaluateObject */
550 
551  AcpiUtRemoveReference (ObjDesc);
553 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiRsCreatePciRoutingTable(ACPI_OPERAND_OBJECT *PackageObject, ACPI_BUFFER *OutputBuffer)
Definition: rscreate.c:234
#define METHOD_NAME__PRT
Definition: acnames.h:63
#define ACPI_BTYPE_PACKAGE
Definition: aclocal.h:335
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
ACPI_STATUS AcpiUtEvaluateObject(ACPI_NAMESPACE_NODE *PrefixNode, const char *Path, UINT32 ExpectedReturnBtypes, ACPI_OPERAND_OBJECT **ReturnDesc)
Definition: uteval.c:73
Definition: dlist.c:348

Referenced by AcpiGetIrqRoutingTable().

◆ AcpiRsGetResourceSource()

ACPI_RS_LENGTH AcpiRsGetResourceSource ( ACPI_RS_LENGTH  ResourceLength,
ACPI_RS_LENGTH  MinimumLength,
ACPI_RESOURCE_SOURCE ResourceSource,
AML_RESOURCE Aml,
char StringPtr 
)

Definition at line 366 of file rsutils.c.

372 {
374  UINT8 *AmlResourceSource;
375 
376 
378 
379 
380  TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
381  AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
382 
383  /*
384  * ResourceSource is present if the length of the descriptor is longer
385  * than the minimum length.
386  *
387  * Note: Some resource descriptors will have an additional null, so
388  * we add 1 to the minimum length.
389  */
390  if (TotalLength > (ACPI_RSDESC_SIZE) (MinimumLength + 1))
391  {
392  /* Get the ResourceSourceIndex */
393 
394  ResourceSource->Index = AmlResourceSource[0];
395 
396  ResourceSource->StringPtr = StringPtr;
397  if (!StringPtr)
398  {
399  /*
400  * String destination pointer is not specified; Set the String
401  * pointer to the end of the current ResourceSource structure.
402  */
403  ResourceSource->StringPtr = ACPI_ADD_PTR (
404  char, ResourceSource, sizeof (ACPI_RESOURCE_SOURCE));
405  }
406 
407  /*
408  * In order for the Resource length to be a multiple of the native
409  * word, calculate the length of the string (+1 for NULL terminator)
410  * and expand to the next word multiple.
411  *
412  * Zero the entire area of the buffer.
413  */
415  ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1;
416 
418 
419  memset (ResourceSource->StringPtr, 0, TotalLength);
420 
421  /* Copy the ResourceSource string to the destination */
422 
423  ResourceSource->StringLength = AcpiRsStrcpy (
424  ResourceSource->StringPtr,
425  ACPI_CAST_PTR (char, &AmlResourceSource[1]));
426 
427  return ((ACPI_RS_LENGTH) TotalLength);
428  }
429 
430  /* ResourceSource is not present */
431 
432  ResourceSource->Index = 0;
433  ResourceSource->StringLength = 0;
434  ResourceSource->StringPtr = NULL;
435  return (0);
436 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
struct aml_resource_large_header AML_RESOURCE_LARGE_HEADER
_In_ ULONG TotalLength
Definition: usbdlib.h:145
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)
Definition: acmacros.h:254
static UINT16 AcpiRsStrcpy(char *Destination, char *Source)
Definition: rsutils.c:322
UINT32 ACPI_RSDESC_SIZE
Definition: acrestyp.h:52
UINT16 ACPI_RS_LENGTH
Definition: acrestyp.h:51
#define ACPI_ADD_PTR(t, a, b)
Definition: actypes.h:546
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
unsigned char UINT8
#define memset(x, y, z)
Definition: compat.h:39
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:1287

Referenced by AcpiRsConvertAmlToResource().

◆ AcpiRsMoveData()

void AcpiRsMoveData ( void Destination,
void Source,
UINT16  ItemCount,
UINT8  MoveType 
)

Definition at line 150 of file rsutils.c.

155 {
156  UINT32 i;
157 
158 
160 
161 
162  /* One move per item */
163 
164  for (i = 0; i < ItemCount; i++)
165  {
166  switch (MoveType)
167  {
168  /*
169  * For the 8-bit case, we can perform the move all at once
170  * since there are no alignment or endian issues
171  */
172  case ACPI_RSC_MOVE8:
176 
177  memcpy (Destination, Source, ItemCount);
178  return;
179 
180  /*
181  * 16-, 32-, and 64-bit cases must use the move macros that perform
182  * endian conversion and/or accommodate hardware that cannot perform
183  * misaligned memory transfers
184  */
185  case ACPI_RSC_MOVE16:
187 
191  break;
192 
193  case ACPI_RSC_MOVE32:
194 
198  break;
199 
200  case ACPI_RSC_MOVE64:
201 
205  break;
206 
207  default:
208 
209  return;
210  }
211  }
212 }
#define ACPI_MOVE_16_TO_16(d, s)
Definition: acmacros.h:141
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2891
#define ACPI_MOVE_32_TO_32(d, s)
Definition: acmacros.h:148
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned short UINT16
#define ACPI_MOVE_64_TO_64(d, s)
Definition: acmacros.h:155
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
unsigned long long UINT64
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544

Referenced by AcpiRsConvertAmlToResource(), and AcpiRsConvertResourceToAml().

◆ AcpiRsSetAddressCommon()

void AcpiRsSetAddressCommon ( AML_RESOURCE Aml,
ACPI_RESOURCE Resource 
)

Definition at line 381 of file rsaddr.c.

384 {
386 
387 
388  /* Set the Resource Type and General Flags */
389 
392 
393  /* Set the Type-Specific Flags (Memory and I/O descriptors only) */
394 
395  if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE)
396  {
399  }
400  else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE)
401  {
404  }
405  else
406  {
407  /* Generic resource type, just copy the TypeSpecific byte */
408 
409  Aml->Address.SpecificFlags =
410  Resource->Data.Address.Info.TypeSpecific;
411  }
412 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static ACPI_RSCONVERT_INFO AcpiRsConvertIoFlags[4]
Definition: rsaddr.c:286
static ACPI_RSCONVERT_INFO AcpiRsConvertMemFlags[5]
Definition: rsaddr.c:255
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_IO_RANGE
Definition: acrestyp.h:138
static ACPI_RSCONVERT_INFO AcpiRsConvertGeneralFlags[6]
Definition: rsaddr.c:218
#define ACPI_MEMORY_RANGE
Definition: acrestyp.h:137
ACPI_STATUS AcpiRsConvertResourceToAml(ACPI_RESOURCE *Resource, AML_RESOURCE *Aml, ACPI_RSCONVERT_INFO *Info)
Definition: rsmisc.c:468
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:1287

Referenced by AcpiRsConvertResourceToAml().

◆ AcpiRsSetResourceHeader()

void AcpiRsSetResourceHeader ( UINT8  DescriptorType,
ACPI_RSDESC_SIZE  TotalLength,
AML_RESOURCE Aml 
)

Definition at line 289 of file rsutils.c.

293 {
295 
296 
297  /* Set the Resource Type */
298 
299  Aml->SmallHeader.DescriptorType = DescriptorType;
300 
301  /* Set the Resource Length */
302 
304 }
void AcpiRsSetResourceLength(ACPI_RSDESC_SIZE TotalLength, AML_RESOURCE *Aml)
Definition: rsutils.c:233
_In_ ULONG TotalLength
Definition: usbdlib.h:145
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
_In_ ULONG _In_ PVOID _In_ LONG DescriptorType
Definition: usbdlib.h:145
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:1287

Referenced by AcpiRsConvertResourceToAml().

◆ AcpiRsSetResourceLength()

void AcpiRsSetResourceLength ( ACPI_RSDESC_SIZE  TotalLength,
AML_RESOURCE Aml 
)

Definition at line 233 of file rsutils.c.

236 {
237  ACPI_RS_LENGTH ResourceLength;
238 
239 
241 
242 
243  /* Length is the total descriptor length minus the header length */
244 
245  ResourceLength = (ACPI_RS_LENGTH)
247 
248  /* Length is stored differently for large and small descriptors */
249 
250  if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
251  {
252  /* Large descriptor -- bytes 1-2 contain the 16-bit length */
253 
255  &Aml->LargeHeader.ResourceLength, &ResourceLength);
256  }
257  else
258  {
259  /*
260  * Small descriptor -- bits 2:0 of byte 0 contain the length
261  * Clear any existing length, preserving descriptor type bits
262  */
263  Aml->SmallHeader.DescriptorType = (UINT8)
264  ((Aml->SmallHeader.DescriptorType &
266  | ResourceLength);
267  }
268 }
#define ACPI_MOVE_16_TO_16(d, s)
Definition: acmacros.h:141
#define ACPI_RESOURCE_NAME_LARGE
Definition: aclocal.h:1300
_In_ ULONG TotalLength
Definition: usbdlib.h:145
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
UINT8 AcpiUtGetResourceHeaderLength(void *Aml)
Definition: utresrc.c:571
#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK
Definition: aclocal.h:1304
UINT16 ACPI_RS_LENGTH
Definition: acrestyp.h:51
unsigned char UINT8
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:1287

Referenced by AcpiRsConvertResourceToAml(), and AcpiRsSetResourceHeader().

◆ AcpiRsSetResourceSource()

ACPI_RSDESC_SIZE AcpiRsSetResourceSource ( AML_RESOURCE Aml,
ACPI_RS_LENGTH  MinimumLength,
ACPI_RESOURCE_SOURCE ResourceSource 
)

Definition at line 457 of file rsutils.c.

461 {
462  UINT8 *AmlResourceSource;
463  ACPI_RSDESC_SIZE DescriptorLength;
464 
465 
467 
468 
469  DescriptorLength = MinimumLength;
470 
471  /* Non-zero string length indicates presence of a ResourceSource */
472 
473  if (ResourceSource->StringLength)
474  {
475  /* Point to the end of the AML descriptor */
476 
477  AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
478 
479  /* Copy the ResourceSourceIndex */
480 
481  AmlResourceSource[0] = (UINT8) ResourceSource->Index;
482 
483  /* Copy the ResourceSource string */
484 
485  strcpy (ACPI_CAST_PTR (char, &AmlResourceSource[1]),
486  ResourceSource->StringPtr);
487 
488  /*
489  * Add the length of the string (+ 1 for null terminator) to the
490  * final descriptor length
491  */
492  DescriptorLength += ((ACPI_RSDESC_SIZE)
493  ResourceSource->StringLength + 1);
494  }
495 
496  /* Return the new total length of the AML descriptor */
497 
498  return (DescriptorLength);
499 }
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
UINT32 ACPI_RSDESC_SIZE
Definition: acrestyp.h:52
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define ACPI_ADD_PTR(t, a, b)
Definition: actypes.h:546
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
unsigned char UINT8
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:1287

Referenced by AcpiRsConvertResourceToAml().

◆ AcpiRsSetSrsMethodData()

ACPI_STATUS AcpiRsSetSrsMethodData ( ACPI_NAMESPACE_NODE Node,
ACPI_BUFFER RetBuffer 
)

Definition at line 800 of file rsutils.c.

803 {
808 
809 
810  ACPI_FUNCTION_TRACE (RsSetSrsMethodData);
811 
812 
813  /* Allocate and initialize the evaluation information block */
814 
816  if (!Info)
817  {
819  }
820 
821  Info->PrefixNode = Node;
822  Info->RelativePathname = METHOD_NAME__SRS;
823  Info->Parameters = Args;
825 
826  /*
827  * The InBuffer parameter will point to a linked list of
828  * resource parameters. It needs to be formatted into a
829  * byte stream to be sent in as an input parameter to _SRS
830  *
831  * Convert the linked list into a byte stream
832  */
834  Status = AcpiRsCreateAmlResources (InBuffer, &Buffer);
835  if (ACPI_FAILURE (Status))
836  {
837  goto Cleanup;
838  }
839 
840  /* Create and initialize the method parameter object */
841 
843  if (!Args[0])
844  {
845  /*
846  * Must free the buffer allocated above (otherwise it is freed
847  * later)
848  */
849  ACPI_FREE (Buffer.Pointer);
851  goto Cleanup;
852  }
853 
854  Args[0]->Buffer.Length = (UINT32) Buffer.Length;
855  Args[0]->Buffer.Pointer = Buffer.Pointer;
856  Args[0]->Common.Flags = AOPOBJ_DATA_VALID;
857  Args[1] = NULL;
858 
859  /* Execute the method, no return value is expected */
860 
862 
863  /* Clean up and return the status from AcpiNsEvaluate */
864 
866 
867 Cleanup:
868  ACPI_FREE (Info);
870 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
ACPI_STATUS AcpiRsCreateAmlResources(ACPI_BUFFER *ResourceList, ACPI_BUFFER *OutputBuffer)
Definition: rscreate.c:458
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
ACPI_STATUS AcpiNsEvaluate(ACPI_EVALUATE_INFO *Info)
Definition: nseval.c:82
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define METHOD_NAME__SRS
Definition: acnames.h:72
unsigned int UINT32
union node Node
Definition: types.h:1255
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_ALLOCATE_LOCAL_BUFFER
Definition: actypes.h:1036
char ** Args
Definition: acdebug.h:343
Definition: bufpool.h:45
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define ACPI_IGNORE_RETURN_VALUE
Definition: acstruct.h:231
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:654
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

Referenced by AcpiSetCurrentResources().

Variable Documentation

◆ AcpiGbl_AmlResourceSerialBusSizes

const UINT8 AcpiGbl_AmlResourceSerialBusSizes[]

Definition at line 273 of file rsinfo.c.

Referenced by AcpiRsGetAmlLength().

◆ AcpiGbl_AmlResourceSizes

const UINT8 AcpiGbl_AmlResourceSizes[]

Definition at line 199 of file rsinfo.c.

Referenced by AcpiRsGetAmlLength().

◆ AcpiGbl_ConvertResourceSerialBusDispatch

ACPI_RSCONVERT_INFO* AcpiGbl_ConvertResourceSerialBusDispatch[]

Definition at line 142 of file rsinfo.c.

Referenced by AcpiRsConvertAmlToResources(), and AcpiRsConvertResourcesToAml().

◆ AcpiGbl_GetResourceDispatch

ACPI_RSCONVERT_INFO* AcpiGbl_GetResourceDispatch[]

Definition at line 96 of file rsinfo.c.

Referenced by AcpiRsConvertAmlToResources().

◆ AcpiGbl_ResourceStructSerialBusSizes

const UINT8 AcpiGbl_ResourceStructSerialBusSizes[]

Definition at line 281 of file rsinfo.c.

Referenced by AcpiRsGetListLength().

◆ AcpiGbl_ResourceStructSizes

const UINT8 AcpiGbl_ResourceStructSizes[]

Definition at line 229 of file rsinfo.c.

Referenced by AcpiRsGetListLength().

◆ AcpiGbl_SetResourceDispatch

ACPI_RSCONVERT_INFO* AcpiGbl_SetResourceDispatch[]

Definition at line 65 of file rsinfo.c.

Referenced by AcpiRsConvertResourcesToAml().

◆ AcpiRsConvertAddress16

ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[]

Definition at line 58 of file rsaddr.c.

◆ AcpiRsConvertAddress32

ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[]

Definition at line 98 of file rsaddr.c.

◆ AcpiRsConvertAddress64

ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[]

Definition at line 138 of file rsaddr.c.

◆ AcpiRsConvertDma

ACPI_RSCONVERT_INFO AcpiRsConvertDma[]

Definition at line 258 of file rsirq.c.

◆ AcpiRsConvertEndDpf

ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[]

Definition at line 160 of file rsio.c.

◆ AcpiRsConvertEndTag

ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[]

Definition at line 178 of file rsio.c.

◆ AcpiRsConvertExtAddress64

ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[]

Definition at line 178 of file rsaddr.c.

◆ AcpiRsConvertExtIrq

ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[]

Definition at line 198 of file rsirq.c.

◆ AcpiRsConvertFixedDma

ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[]

Definition at line 296 of file rsirq.c.

◆ AcpiRsConvertFixedIo

ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[]

Definition at line 96 of file rsio.c.

◆ AcpiRsConvertFixedMemory32

ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[]

Definition at line 126 of file rsmemory.c.

◆ AcpiRsConvertGenericReg

ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[]

Definition at line 126 of file rsio.c.

◆ AcpiRsConvertGpio

ACPI_RSCONVERT_INFO AcpiRsConvertGpio[]

Definition at line 58 of file rsserial.c.

◆ AcpiRsConvertI2cSerialBus

ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[]

Definition at line 228 of file rsserial.c.

◆ AcpiRsConvertIo

ACPI_RSCONVERT_INFO AcpiRsConvertIo[]

Definition at line 58 of file rsio.c.

◆ AcpiRsConvertMemory24

ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[]

Definition at line 58 of file rsmemory.c.

◆ AcpiRsConvertMemory32

ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[]

Definition at line 92 of file rsmemory.c.

◆ AcpiRsConvertPinConfig

ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig[]

Definition at line 520 of file rsserial.c.

◆ AcpiRsConvertPinFunction

ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction[]

Definition at line 155 of file rsserial.c.

◆ AcpiRsConvertPinGroup

ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup[]

Definition at line 596 of file rsserial.c.

◆ AcpiRsConvertPinGroupConfig

ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig[]

Definition at line 723 of file rsserial.c.

◆ AcpiRsConvertPinGroupFunction

ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction[]

Definition at line 656 of file rsserial.c.

◆ AcpiRsConvertSpiSerialBus

ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[]

Definition at line 312 of file rsserial.c.

◆ AcpiRsConvertUartSerialBus

ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[]

Definition at line 412 of file rsserial.c.

◆ AcpiRsGetIrq

ACPI_RSCONVERT_INFO AcpiRsGetIrq[]

Definition at line 58 of file rsirq.c.

◆ AcpiRsGetStartDpf

ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[]

Definition at line 201 of file rsio.c.

◆ AcpiRsGetVendorLarge

ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[]

Definition at line 184 of file rsmemory.c.

◆ AcpiRsGetVendorSmall

ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[]

Definition at line 158 of file rsmemory.c.

◆ AcpiRsSetIrq

ACPI_RSCONVERT_INFO AcpiRsSetIrq[]

Definition at line 112 of file rsirq.c.

◆ AcpiRsSetStartDpf

ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[]

Definition at line 241 of file rsio.c.

◆ AcpiRsSetVendor

ACPI_RSCONVERT_INFO AcpiRsSetVendor[]

Definition at line 210 of file rsmemory.c.