ReactOS 0.4.15-dev-8339-g4028de8
rsmisc.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acresrc.h"
Include dependency graph for rsmisc.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_RESOURCES
 
#define INIT_RESOURCE_TYPE(i)   i->ResourceOffset
 
#define INIT_RESOURCE_LENGTH(i)   i->AmlOffset
 
#define INIT_TABLE_LENGTH(i)   i->Value
 
#define COMPARE_OPCODE(i)   i->ResourceOffset
 
#define COMPARE_TARGET(i)   i->AmlOffset
 
#define COMPARE_VALUE(i)   i->Value
 

Functions

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)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_RESOURCES

Definition at line 48 of file rsmisc.c.

◆ COMPARE_OPCODE

#define COMPARE_OPCODE (   i)    i->ResourceOffset

Definition at line 56 of file rsmisc.c.

◆ COMPARE_TARGET

#define COMPARE_TARGET (   i)    i->AmlOffset

Definition at line 57 of file rsmisc.c.

◆ COMPARE_VALUE

#define COMPARE_VALUE (   i)    i->Value

Definition at line 58 of file rsmisc.c.

◆ INIT_RESOURCE_LENGTH

#define INIT_RESOURCE_LENGTH (   i)    i->AmlOffset

Definition at line 53 of file rsmisc.c.

◆ INIT_RESOURCE_TYPE

#define INIT_RESOURCE_TYPE (   i)    i->ResourceOffset

Definition at line 52 of file rsmisc.c.

◆ INIT_TABLE_LENGTH

#define INIT_TABLE_LENGTH (   i)    i->Value

Definition at line 54 of file rsmisc.c.

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;
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 Target = NULL;
121
122 /*
123 * Source is the external AML byte stream buffer,
124 * destination is the internal resource descriptor
125 */
126 Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
127 Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
128
129 switch (Info->Opcode)
130 {
131 case ACPI_RSC_INITGET:
132 /*
133 * Get the resource type and the initial (minimum) length
134 */
138 break;
139
140 case ACPI_RSC_INITSET:
141 break;
142
144
145 FlagsMode = TRUE;
146 break;
147
149 /*
150 * Mask and shift the flag bit
151 */
153 ((ACPI_GET8 (Source) >> Info->Value) & 0x01));
154 break;
155
157 /*
158 * Mask and shift the flag bits
159 */
161 ((ACPI_GET8 (Source) >> Info->Value) & 0x03));
162 break;
163
165 /*
166 * Mask and shift the flag bits
167 */
169 ((ACPI_GET8 (Source) >> Info->Value) & 0x07));
170 break;
171
173 /*
174 * Mask and shift the flag bits
175 */
177 ((ACPI_GET8 (Source) >> Info->Value) & 0x3F));
178 break;
179
180 case ACPI_RSC_COUNT:
181
182 ItemCount = ACPI_GET8 (Source);
183 ACPI_SET8 (Destination, ItemCount);
184
185 Resource->Length = Resource->Length +
186 (Info->Value * (ItemCount - 1));
187 break;
188
189 case ACPI_RSC_COUNT16:
190
191 ItemCount = AmlResourceLength;
192 ACPI_SET16 (Destination, ItemCount);
193
194 Resource->Length = Resource->Length +
195 (Info->Value * (ItemCount - 1));
196 break;
197
199
200 Target = ACPI_ADD_PTR (void, Aml, Info->Value);
201 ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source);
202
203 Resource->Length = Resource->Length + ItemCount;
204 ItemCount = ItemCount / 2;
205 ACPI_SET16 (Destination, ItemCount);
206 break;
207
209
210 ItemCount = ACPI_GET8 (Source);
211 ACPI_SET8 (Destination, ItemCount);
212
213 Resource->Length = Resource->Length + (Info->Value * ItemCount);
214 break;
215
217 /*
218 * Vendor data is optional (length/offset may both be zero)
219 * Examine vendor data length field first
220 */
221 Target = ACPI_ADD_PTR (void, Aml, (Info->Value + 2));
222 if (ACPI_GET16 (Target))
223 {
224 /* Use vendor offset to get resource source length */
225
226 Target = ACPI_ADD_PTR (void, Aml, Info->Value);
227 ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source);
228 }
229 else
230 {
231 /* No vendor data to worry about */
232
233 ItemCount = Aml->LargeHeader.ResourceLength +
236 }
237
238 Resource->Length = Resource->Length + ItemCount;
239 ACPI_SET16 (Destination, ItemCount);
240 break;
241
243
244 ItemCount = ACPI_GET16 (Source) - Info->Value;
245
246 Resource->Length = Resource->Length + ItemCount;
247 ACPI_SET16 (Destination, ItemCount);
248 break;
249
251
252 ItemCount = (AmlResourceLength +
253 sizeof (AML_RESOURCE_LARGE_HEADER)) -
254 ACPI_GET16 (Source) - Info->Value;
255
256 Resource->Length = Resource->Length + ItemCount;
257 ACPI_SET16 (Destination, ItemCount);
258 break;
259
260 case ACPI_RSC_LENGTH:
261
262 Resource->Length = Resource->Length + Info->Value;
263 break;
264
265 case ACPI_RSC_MOVE8:
266 case ACPI_RSC_MOVE16:
267 case ACPI_RSC_MOVE32:
268 case ACPI_RSC_MOVE64:
269 /*
270 * Raw data move. Use the Info value field unless ItemCount has
271 * been previously initialized via a COUNT opcode
272 */
273 if (Info->Value)
274 {
275 ItemCount = Info->Value;
276 }
277 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
278 break;
279
281
282 /* Generate and set the PIN data pointer */
283
284 Target = (char *) ACPI_ADD_PTR (void, Resource,
285 (Resource->Length - ItemCount * 2));
287
288 /* Copy the PIN data */
289
291 AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
292 break;
293
295
296 /* Generate and set the ResourceSource string pointer */
297
298 Target = (char *) ACPI_ADD_PTR (void, Resource,
299 (Resource->Length - ItemCount));
301
302 /* Copy the ResourceSource string */
303
305 AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
306 break;
307
309
310 /* Generate and set the Vendor Data pointer */
311
312 Target = (char *) ACPI_ADD_PTR (void, Resource,
313 (Resource->Length - ItemCount));
315
316 /* Copy the Vendor Data */
317
318 Source = ACPI_ADD_PTR (void, Aml, Info->Value);
319 AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
320 break;
321
323
324 /* Generate and set the ResourceSource string pointer */
325
326 Target = (char *) ACPI_ADD_PTR (void, Resource,
327 (Resource->Length - ItemCount));
329
330 /* Copy the ResourceSource string */
331
333 void, Aml, (ACPI_GET16 (Source) + Info->Value));
334 AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
335 break;
336
337 case ACPI_RSC_SET8:
338
339 memset (Destination, Info->AmlOffset, Info->Value);
340 break;
341
342 case ACPI_RSC_DATA8:
343
344 Target = ACPI_ADD_PTR (char, Resource, Info->Value);
346 break;
347
348 case ACPI_RSC_ADDRESS:
349 /*
350 * Common handler for address descriptor flags
351 */
353 {
355 }
356 break;
357
358 case ACPI_RSC_SOURCE:
359 /*
360 * Optional ResourceSource (Index and String)
361 */
362 Resource->Length +=
363 AcpiRsGetResourceSource (AmlResourceLength, Info->Value,
365 break;
366
367 case ACPI_RSC_SOURCEX:
368 /*
369 * Optional ResourceSource (Index and String). This is the more
370 * complicated case used by the Interrupt() macro
371 */
373 Info->AmlOffset + (ItemCount * 4));
374
375 Resource->Length +=
376 AcpiRsGetResourceSource (AmlResourceLength, (ACPI_RS_LENGTH)
377 (((ItemCount - 1) * sizeof (UINT32)) + Info->Value),
379 break;
380
381 case ACPI_RSC_BITMASK:
382 /*
383 * 8-bit encoded bitmask (DMA macro)
384 */
386 if (ItemCount)
387 {
388 Resource->Length += (ItemCount - 1);
389 }
390
391 Target = ACPI_ADD_PTR (char, Resource, Info->Value);
392 ACPI_SET8 (Target, ItemCount);
393 break;
394
396 /*
397 * 16-bit encoded bitmask (IRQ macro)
398 */
399 ACPI_MOVE_16_TO_16 (&Temp16, Source);
400
401 ItemCount = AcpiRsDecodeBitmask (Temp16, Destination);
402 if (ItemCount)
403 {
404 Resource->Length += (ItemCount - 1);
405 }
406
407 Target = ACPI_ADD_PTR (char, Resource, Info->Value);
408 ACPI_SET8 (Target, ItemCount);
409 break;
410
411 case ACPI_RSC_EXIT_NE:
412 /*
413 * Control - Exit conversion if not equal
414 */
415 switch (Info->ResourceOffset)
416 {
418
419 if (AmlResourceLength != Info->Value)
420 {
421 goto Exit;
422 }
423 break;
424
426
427 if (ACPI_GET8 (Source) != Info->Value)
428 {
429 goto Exit;
430 }
431 break;
432
433 default:
434
435 ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
437 }
438 break;
439
440 default:
441
442 ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
444 }
445
446 Count--;
447 Info++;
448 }
449
450Exit:
451 if (!FlagsMode)
452 {
453 /* Round the resource struct length up to the next boundary (32 or 64) */
454
455 Resource->Length = (UINT32)
457 }
459}
unsigned short UINT16
unsigned char UINT8
unsigned int UINT32
#define AE_AML_INVALID_RESOURCE_TYPE
Definition: acexcep.h:202
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_OK
Definition: acexcep.h:97
#define ACPI_GET16(ptr)
Definition: acmacros.h:58
#define ACPI_SET8(ptr, val)
Definition: acmacros.h:61
#define ACPI_GET8(ptr)
Definition: acmacros.h:57
#define ACPI_MOVE_16_TO_16(d, s)
Definition: acmacros.h:141
#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)
Definition: acmacros.h:254
#define ACPI_SET16(ptr, val)
Definition: acmacros.h:62
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
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:1302
#define ACPI_RSC_COMPARE_AML_LENGTH
Definition: acresrc.h:118
@ ACPI_RSC_INITSET
Definition: acresrc.h:81
@ ACPI_RSC_COUNT_GPIO_PIN
Definition: acresrc.h:92
@ ACPI_RSC_COUNT_GPIO_RES
Definition: acresrc.h:93
@ ACPI_RSC_EXIT_NE
Definition: acresrc.h:100
@ ACPI_RSC_MOVE64
Definition: acresrc.h:109
@ ACPI_RSC_2BITFLAG
Definition: acresrc.h:84
@ ACPI_RSC_FLAGINIT
Definition: acresrc.h:82
@ ACPI_RSC_3BITFLAG
Definition: acresrc.h:85
@ ACPI_RSC_MOVE_SERIAL_VEN
Definition: acresrc.h:105
@ ACPI_RSC_BITMASK16
Definition: acresrc.h:89
@ ACPI_RSC_COUNT_SERIAL_VEN
Definition: acresrc.h:96
@ ACPI_RSC_LENGTH
Definition: acresrc.h:101
@ ACPI_RSC_DATA8
Definition: acresrc.h:97
@ ACPI_RSC_MOVE_GPIO_RES
Definition: acresrc.h:103
@ ACPI_RSC_MOVE8
Definition: acresrc.h:106
@ ACPI_RSC_6BITFLAG
Definition: acresrc.h:86
@ ACPI_RSC_SOURCE
Definition: acresrc.h:111
@ ACPI_RSC_SOURCEX
Definition: acresrc.h:112
@ ACPI_RSC_COUNT_SERIAL_RES
Definition: acresrc.h:95
@ ACPI_RSC_ADDRESS
Definition: acresrc.h:87
@ ACPI_RSC_COUNT_GPIO_VEN
Definition: acresrc.h:94
@ ACPI_RSC_COUNT16
Definition: acresrc.h:91
@ ACPI_RSC_COUNT
Definition: acresrc.h:90
@ ACPI_RSC_MOVE16
Definition: acresrc.h:107
@ ACPI_RSC_MOVE32
Definition: acresrc.h:108
@ ACPI_RSC_BITMASK
Definition: acresrc.h:88
@ ACPI_RSC_1BITFLAG
Definition: acresrc.h:83
@ ACPI_RSC_MOVE_SERIAL_RES
Definition: acresrc.h:104
@ ACPI_RSC_INITGET
Definition: acresrc.h:80
@ ACPI_RSC_SET8
Definition: acresrc.h:110
@ ACPI_RSC_MOVE_GPIO_PIN
Definition: acresrc.h:102
#define ACPI_RSC_COMPARE_VALUE
Definition: acresrc.h:119
UINT8 AcpiRsDecodeBitmask(UINT16 Mask, UINT8 *List)
Definition: rsutils.c:68
BOOLEAN AcpiRsGetAddressCommon(ACPI_RESOURCE *Resource, AML_RESOURCE *Aml)
Definition: rsaddr.c:322
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
void AcpiRsMoveData(void *Destination, void *Source, UINT16 ItemCount, UINT8 MoveType)
Definition: rsutils.c:150
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
UINT16 AcpiUtGetResourceLength(void *Aml)
Definition: utresrc.c:527
struct aml_resource_large_header AML_RESOURCE_LARGE_HEADER
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3016
int Count
Definition: noreturn.cpp:7
#define INIT_RESOURCE_LENGTH(i)
Definition: rsmisc.c:53
#define INIT_TABLE_LENGTH(i)
Definition: rsmisc.c:54
#define INIT_RESOURCE_TYPE(i)
Definition: rsmisc.c:52
#define memset(x, y, z)
Definition: compat.h:39
static void Exit(void)
Definition: sock.c:1330
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by AcpiRsConvertAmlToResources(), and AcpiRsGetAddressCommon().

◆ AcpiRsConvertResourceToAml()

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

Definition at line 478 of file rsmisc.c.

482{
483 void *Source = NULL;
484 void *Destination;
485 char *Target;
486 ACPI_RSDESC_SIZE AmlLength = 0;
487 UINT8 Count;
488 UINT16 Temp16 = 0;
489 UINT16 ItemCount = 0;
490
491
492 ACPI_FUNCTION_TRACE (RsConvertResourceToAml);
493
494
495 if (!Info)
496 {
498 }
499
500 /*
501 * First table entry must be ACPI_RSC_INITxxx and must contain the
502 * table length (# of table entries)
503 */
505
506 while (Count)
507 {
508 /*
509 * Source is the internal resource descriptor,
510 * destination is the external AML byte stream buffer
511 */
512 Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
513 Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
514
515 switch (Info->Opcode)
516 {
517 case ACPI_RSC_INITSET:
518
520 AmlLength = INIT_RESOURCE_LENGTH (Info);
522 INIT_RESOURCE_TYPE (Info), AmlLength, Aml);
523 break;
524
525 case ACPI_RSC_INITGET:
526 break;
527
529 /*
530 * Clear the flag byte
531 */
533 break;
534
536 /*
537 * Mask and shift the flag bit
538 */
540 ((ACPI_GET8 (Source) & 0x01) << Info->Value));
541 break;
542
544 /*
545 * Mask and shift the flag bits
546 */
548 ((ACPI_GET8 (Source) & 0x03) << Info->Value));
549 break;
550
552 /*
553 * Mask and shift the flag bits
554 */
556 ((ACPI_GET8 (Source) & 0x07) << Info->Value));
557 break;
558
560 /*
561 * Mask and shift the flag bits
562 */
564 ((ACPI_GET8 (Source) & 0x3F) << Info->Value));
565 break;
566
567 case ACPI_RSC_COUNT:
568
569 ItemCount = ACPI_GET8 (Source);
570 ACPI_SET8 (Destination, ItemCount);
571
572 AmlLength = (UINT16)
573 (AmlLength + (Info->Value * (ItemCount - 1)));
574 break;
575
576 case ACPI_RSC_COUNT16:
577
578 ItemCount = ACPI_GET16 (Source);
579 AmlLength = (UINT16) (AmlLength + ItemCount);
580 AcpiRsSetResourceLength (AmlLength, Aml);
581 break;
582
584
585 ItemCount = ACPI_GET16 (Source);
586 ACPI_SET16 (Destination, AmlLength);
587
588 AmlLength = (UINT16) (AmlLength + ItemCount * 2);
589 Target = ACPI_ADD_PTR (void, Aml, Info->Value);
590 ACPI_SET16 (Target, AmlLength);
591 AcpiRsSetResourceLength (AmlLength, Aml);
592 break;
593
595
596 ItemCount = ACPI_GET16 (Source);
597 ACPI_SET16 (Destination, ItemCount);
598
599 AmlLength = (UINT16) (
600 AmlLength + (Info->Value * ItemCount));
601 AcpiRsSetResourceLength (AmlLength, Aml);
602 break;
603
605
606 /* Set resource source string length */
607
608 ItemCount = ACPI_GET16 (Source);
609 ACPI_SET16 (Destination, AmlLength);
610
611 /* Compute offset for the Vendor Data */
612
613 AmlLength = (UINT16) (AmlLength + ItemCount);
614 Target = ACPI_ADD_PTR (void, Aml, Info->Value);
615
616 /* Set vendor offset only if there is vendor data */
617
618 ACPI_SET16 (Target, AmlLength);
619
620 AcpiRsSetResourceLength (AmlLength, Aml);
621 break;
622
624
625 ItemCount = ACPI_GET16 (Source);
626 ACPI_SET16 (Destination, ItemCount + Info->Value);
627 AmlLength = (UINT16) (AmlLength + ItemCount);
628 AcpiRsSetResourceLength (AmlLength, Aml);
629 break;
630
632
633 ItemCount = ACPI_GET16 (Source);
634 AmlLength = (UINT16) (AmlLength + ItemCount);
635 AcpiRsSetResourceLength (AmlLength, Aml);
636 break;
637
638 case ACPI_RSC_LENGTH:
639
641 break;
642
643 case ACPI_RSC_MOVE8:
644 case ACPI_RSC_MOVE16:
645 case ACPI_RSC_MOVE32:
646 case ACPI_RSC_MOVE64:
647
648 if (Info->Value)
649 {
650 ItemCount = Info->Value;
651 }
652 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
653 break;
654
656
657 Destination = (char *) ACPI_ADD_PTR (void, Aml,
659 Source = * (UINT16 **) Source;
660 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
661 break;
662
664
665 /* Used for both ResourceSource string and VendorData */
666
667 Destination = (char *) ACPI_ADD_PTR (void, Aml,
669 Source = * (UINT8 **) Source;
670 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
671 break;
672
674
675 Destination = (char *) ACPI_ADD_PTR (void, Aml,
676 (AmlLength - ItemCount));
677 Source = * (UINT8 **) Source;
678 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
679 break;
680
682
683 Destination = (char *) ACPI_ADD_PTR (void, Aml,
684 (AmlLength - ItemCount));
685 Source = * (UINT8 **) Source;
686 AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
687 break;
688
689 case ACPI_RSC_ADDRESS:
690
691 /* Set the Resource Type, General Flags, and Type-Specific Flags */
692
694 break;
695
696 case ACPI_RSC_SOURCEX:
697 /*
698 * Optional ResourceSource (Index and String)
699 */
700 AmlLength = AcpiRsSetResourceSource (
701 Aml, (ACPI_RS_LENGTH) AmlLength, Source);
702 AcpiRsSetResourceLength (AmlLength, Aml);
703 break;
704
705 case ACPI_RSC_SOURCE:
706 /*
707 * Optional ResourceSource (Index and String). This is the more
708 * complicated case used by the Interrupt() macro
709 */
710 AmlLength = AcpiRsSetResourceSource (Aml, Info->Value, Source);
711 AcpiRsSetResourceLength (AmlLength, Aml);
712 break;
713
714 case ACPI_RSC_BITMASK:
715 /*
716 * 8-bit encoded bitmask (DMA macro)
717 */
720 *ACPI_ADD_PTR (UINT8, Resource, Info->Value)));
721 break;
722
724 /*
725 * 16-bit encoded bitmask (IRQ macro)
726 */
727 Temp16 = AcpiRsEncodeBitmask (
728 Source, *ACPI_ADD_PTR (UINT8, Resource, Info->Value));
730 break;
731
732 case ACPI_RSC_EXIT_LE:
733 /*
734 * Control - Exit conversion if less than or equal
735 */
736 if (ItemCount <= Info->Value)
737 {
738 goto Exit;
739 }
740 break;
741
742 case ACPI_RSC_EXIT_NE:
743 /*
744 * Control - Exit conversion if not equal
745 */
746 switch (COMPARE_OPCODE (Info))
747 {
749
752 {
753 goto Exit;
754 }
755 break;
756
757 default:
758
759 ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
761 }
762 break;
763
764 case ACPI_RSC_EXIT_EQ:
765 /*
766 * Control - Exit conversion if equal
767 */
770 {
771 goto Exit;
772 }
773 break;
774
775 default:
776
777 ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
779 }
780
781 Count--;
782 Info++;
783 }
784
785Exit:
787}
#define ACPI_CAST8(ptr)
Definition: acmacros.h:53
void AcpiRsSetResourceLength(ACPI_RSDESC_SIZE TotalLength, AML_RESOURCE *Aml)
Definition: rsutils.c:233
@ ACPI_RSC_EXIT_LE
Definition: acresrc.h:99
@ ACPI_RSC_EXIT_EQ
Definition: acresrc.h:98
ACPI_RSDESC_SIZE AcpiRsSetResourceSource(AML_RESOURCE *Aml, ACPI_RS_LENGTH MinimumLength, ACPI_RESOURCE_SOURCE *ResourceSource)
Definition: rsutils.c:457
void AcpiRsSetResourceHeader(UINT8 DescriptorType, ACPI_RSDESC_SIZE TotalLength, AML_RESOURCE *Aml)
Definition: rsutils.c:289
UINT16 AcpiRsEncodeBitmask(UINT8 *List, UINT8 Count)
Definition: rsutils.c:110
void AcpiRsSetAddressCommon(AML_RESOURCE *Aml, ACPI_RESOURCE *Resource)
Definition: rsaddr.c:381
UINT32 ACPI_RSDESC_SIZE
Definition: acrestyp.h:52
#define ACPI_SET_BIT(target, bit)
Definition: actypes.h:533
#define COMPARE_TARGET(i)
Definition: rsmisc.c:57
#define COMPARE_OPCODE(i)
Definition: rsmisc.c:56
#define COMPARE_VALUE(i)
Definition: rsmisc.c:58
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by AcpiRsConvertResourcesToAml(), and AcpiRsSetAddressCommon().