rsmisc.c (3e8214e5c2bd449b30109d4a098597ab1b7c9fb9) rsmisc.c (57bf6aefc2b9c89b89bb3fca54725ceea797bb63)
1/*******************************************************************************
2 *
3 * Module Name: rsmisc - Miscellaneous resource descriptors
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.

--- 122 unchanged lines hidden (view full) ---

131
132 flags_mode = TRUE;
133 break;
134
135 case ACPI_RSC_1BITFLAG:
136 /*
137 * Mask and shift the flag bit
138 */
1/*******************************************************************************
2 *
3 * Module Name: rsmisc - Miscellaneous resource descriptors
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.

--- 122 unchanged lines hidden (view full) ---

131
132 flags_mode = TRUE;
133 break;
134
135 case ACPI_RSC_1BITFLAG:
136 /*
137 * Mask and shift the flag bit
138 */
139 ACPI_SET8(destination) = (u8)
140 ((ACPI_GET8(source) >> info->value) & 0x01);
139 ACPI_SET8(destination,
140 ((ACPI_GET8(source) >> info->value) & 0x01));
141 break;
142
143 case ACPI_RSC_2BITFLAG:
144 /*
145 * Mask and shift the flag bits
146 */
141 break;
142
143 case ACPI_RSC_2BITFLAG:
144 /*
145 * Mask and shift the flag bits
146 */
147 ACPI_SET8(destination) = (u8)
148 ((ACPI_GET8(source) >> info->value) & 0x03);
147 ACPI_SET8(destination,
148 ((ACPI_GET8(source) >> info->value) & 0x03));
149 break;
150
151 case ACPI_RSC_3BITFLAG:
152 /*
153 * Mask and shift the flag bits
154 */
149 break;
150
151 case ACPI_RSC_3BITFLAG:
152 /*
153 * Mask and shift the flag bits
154 */
155 ACPI_SET8(destination) = (u8)
156 ((ACPI_GET8(source) >> info->value) & 0x07);
155 ACPI_SET8(destination,
156 ((ACPI_GET8(source) >> info->value) & 0x07));
157 break;
158
159 case ACPI_RSC_COUNT:
160
161 item_count = ACPI_GET8(source);
157 break;
158
159 case ACPI_RSC_COUNT:
160
161 item_count = ACPI_GET8(source);
162 ACPI_SET8(destination) = (u8)item_count;
162 ACPI_SET8(destination, item_count);
163
164 resource->length = resource->length +
165 (info->value * (item_count - 1));
166 break;
167
168 case ACPI_RSC_COUNT16:
169
170 item_count = aml_resource_length;
163
164 resource->length = resource->length +
165 (info->value * (item_count - 1));
166 break;
167
168 case ACPI_RSC_COUNT16:
169
170 item_count = aml_resource_length;
171 ACPI_SET16(destination) = item_count;
171 ACPI_SET16(destination, item_count);
172
173 resource->length = resource->length +
174 (info->value * (item_count - 1));
175 break;
176
177 case ACPI_RSC_COUNT_GPIO_PIN:
178
179 target = ACPI_ADD_PTR(void, aml, info->value);
180 item_count = ACPI_GET16(target) - ACPI_GET16(source);
181
182 resource->length = resource->length + item_count;
183 item_count = item_count / 2;
172
173 resource->length = resource->length +
174 (info->value * (item_count - 1));
175 break;
176
177 case ACPI_RSC_COUNT_GPIO_PIN:
178
179 target = ACPI_ADD_PTR(void, aml, info->value);
180 item_count = ACPI_GET16(target) - ACPI_GET16(source);
181
182 resource->length = resource->length + item_count;
183 item_count = item_count / 2;
184 ACPI_SET16(destination) = item_count;
184 ACPI_SET16(destination, item_count);
185 break;
186
187 case ACPI_RSC_COUNT_GPIO_VEN:
188
189 item_count = ACPI_GET8(source);
185 break;
186
187 case ACPI_RSC_COUNT_GPIO_VEN:
188
189 item_count = ACPI_GET8(source);
190 ACPI_SET8(destination) = (u8)item_count;
190 ACPI_SET8(destination, item_count);
191
192 resource->length = resource->length +
193 (info->value * item_count);
194 break;
195
196 case ACPI_RSC_COUNT_GPIO_RES:
197
198 /*

--- 12 unchanged lines hidden (view full) ---

211 /* No vendor data to worry about */
212
213 item_count = aml->large_header.resource_length +
214 sizeof(struct aml_resource_large_header) -
215 ACPI_GET16(source);
216 }
217
218 resource->length = resource->length + item_count;
191
192 resource->length = resource->length +
193 (info->value * item_count);
194 break;
195
196 case ACPI_RSC_COUNT_GPIO_RES:
197
198 /*

--- 12 unchanged lines hidden (view full) ---

211 /* No vendor data to worry about */
212
213 item_count = aml->large_header.resource_length +
214 sizeof(struct aml_resource_large_header) -
215 ACPI_GET16(source);
216 }
217
218 resource->length = resource->length + item_count;
219 ACPI_SET16(destination) = item_count;
219 ACPI_SET16(destination, item_count);
220 break;
221
222 case ACPI_RSC_COUNT_SERIAL_VEN:
223
224 item_count = ACPI_GET16(source) - info->value;
225
226 resource->length = resource->length + item_count;
220 break;
221
222 case ACPI_RSC_COUNT_SERIAL_VEN:
223
224 item_count = ACPI_GET16(source) - info->value;
225
226 resource->length = resource->length + item_count;
227 ACPI_SET16(destination) = item_count;
227 ACPI_SET16(destination, item_count);
228 break;
229
230 case ACPI_RSC_COUNT_SERIAL_RES:
231
232 item_count = (aml_resource_length +
233 sizeof(struct aml_resource_large_header))
234 - ACPI_GET16(source) - info->value;
235
236 resource->length = resource->length + item_count;
228 break;
229
230 case ACPI_RSC_COUNT_SERIAL_RES:
231
232 item_count = (aml_resource_length +
233 sizeof(struct aml_resource_large_header))
234 - ACPI_GET16(source) - info->value;
235
236 resource->length = resource->length + item_count;
237 ACPI_SET16(destination) = item_count;
237 ACPI_SET16(destination, item_count);
238 break;
239
240 case ACPI_RSC_LENGTH:
241
242 resource->length = resource->length + info->value;
243 break;
244
245 case ACPI_RSC_MOVE8:

--- 134 unchanged lines hidden (view full) ---

380 item_count =
381 acpi_rs_decode_bitmask(ACPI_GET8(source),
382 destination);
383 if (item_count) {
384 resource->length += (item_count - 1);
385 }
386
387 target = ACPI_ADD_PTR(char, resource, info->value);
238 break;
239
240 case ACPI_RSC_LENGTH:
241
242 resource->length = resource->length + info->value;
243 break;
244
245 case ACPI_RSC_MOVE8:

--- 134 unchanged lines hidden (view full) ---

380 item_count =
381 acpi_rs_decode_bitmask(ACPI_GET8(source),
382 destination);
383 if (item_count) {
384 resource->length += (item_count - 1);
385 }
386
387 target = ACPI_ADD_PTR(char, resource, info->value);
388 ACPI_SET8(target) = (u8)item_count;
388 ACPI_SET8(target, item_count);
389 break;
390
391 case ACPI_RSC_BITMASK16:
392 /*
393 * 16-bit encoded bitmask (IRQ macro)
394 */
395 ACPI_MOVE_16_TO_16(&temp16, source);
396
397 item_count =
398 acpi_rs_decode_bitmask(temp16, destination);
399 if (item_count) {
400 resource->length += (item_count - 1);
401 }
402
403 target = ACPI_ADD_PTR(char, resource, info->value);
389 break;
390
391 case ACPI_RSC_BITMASK16:
392 /*
393 * 16-bit encoded bitmask (IRQ macro)
394 */
395 ACPI_MOVE_16_TO_16(&temp16, source);
396
397 item_count =
398 acpi_rs_decode_bitmask(temp16, destination);
399 if (item_count) {
400 resource->length += (item_count - 1);
401 }
402
403 target = ACPI_ADD_PTR(char, resource, info->value);
404 ACPI_SET8(target) = (u8)item_count;
404 ACPI_SET8(target, item_count);
405 break;
406
407 case ACPI_RSC_EXIT_NE:
408 /*
409 * control - Exit conversion if not equal
410 */
411 switch (info->resource_offset) {
412 case ACPI_RSC_COMPARE_AML_LENGTH:

--- 96 unchanged lines hidden (view full) ---

509
510 case ACPI_RSC_INITGET:
511 break;
512
513 case ACPI_RSC_FLAGINIT:
514 /*
515 * Clear the flag byte
516 */
405 break;
406
407 case ACPI_RSC_EXIT_NE:
408 /*
409 * control - Exit conversion if not equal
410 */
411 switch (info->resource_offset) {
412 case ACPI_RSC_COMPARE_AML_LENGTH:

--- 96 unchanged lines hidden (view full) ---

509
510 case ACPI_RSC_INITGET:
511 break;
512
513 case ACPI_RSC_FLAGINIT:
514 /*
515 * Clear the flag byte
516 */
517 ACPI_SET8(destination) = 0;
517 ACPI_SET8(destination, 0);
518 break;
519
520 case ACPI_RSC_1BITFLAG:
521 /*
522 * Mask and shift the flag bit
523 */
518 break;
519
520 case ACPI_RSC_1BITFLAG:
521 /*
522 * Mask and shift the flag bit
523 */
524 ACPI_SET8(destination) |= (u8)
525 ((ACPI_GET8(source) & 0x01) << info->value);
524 ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
525 ((ACPI_GET8(source) & 0x01) << info->
526 value));
526 break;
527
528 case ACPI_RSC_2BITFLAG:
529 /*
530 * Mask and shift the flag bits
531 */
527 break;
528
529 case ACPI_RSC_2BITFLAG:
530 /*
531 * Mask and shift the flag bits
532 */
532 ACPI_SET8(destination) |= (u8)
533 ((ACPI_GET8(source) & 0x03) << info->value);
533 ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
534 ((ACPI_GET8(source) & 0x03) << info->
535 value));
534 break;
535
536 case ACPI_RSC_3BITFLAG:
537 /*
538 * Mask and shift the flag bits
539 */
536 break;
537
538 case ACPI_RSC_3BITFLAG:
539 /*
540 * Mask and shift the flag bits
541 */
540 ACPI_SET8(destination) |= (u8)
541 ((ACPI_GET8(source) & 0x07) << info->value);
542 ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
543 ((ACPI_GET8(source) & 0x07) << info->
544 value));
542 break;
543
544 case ACPI_RSC_COUNT:
545
546 item_count = ACPI_GET8(source);
545 break;
546
547 case ACPI_RSC_COUNT:
548
549 item_count = ACPI_GET8(source);
547 ACPI_SET8(destination) = (u8)item_count;
550 ACPI_SET8(destination, item_count);
548
549 aml_length =
550 (u16) (aml_length +
551 (info->value * (item_count - 1)));
552 break;
553
554 case ACPI_RSC_COUNT16:
555
556 item_count = ACPI_GET16(source);
557 aml_length = (u16) (aml_length + item_count);
558 acpi_rs_set_resource_length(aml_length, aml);
559 break;
560
561 case ACPI_RSC_COUNT_GPIO_PIN:
562
563 item_count = ACPI_GET16(source);
551
552 aml_length =
553 (u16) (aml_length +
554 (info->value * (item_count - 1)));
555 break;
556
557 case ACPI_RSC_COUNT16:
558
559 item_count = ACPI_GET16(source);
560 aml_length = (u16) (aml_length + item_count);
561 acpi_rs_set_resource_length(aml_length, aml);
562 break;
563
564 case ACPI_RSC_COUNT_GPIO_PIN:
565
566 item_count = ACPI_GET16(source);
564 ACPI_SET16(destination) = (u16)aml_length;
567 ACPI_SET16(destination, aml_length);
565
566 aml_length = (u16)(aml_length + item_count * 2);
567 target = ACPI_ADD_PTR(void, aml, info->value);
568
569 aml_length = (u16)(aml_length + item_count * 2);
570 target = ACPI_ADD_PTR(void, aml, info->value);
568 ACPI_SET16(target) = (u16)aml_length;
571 ACPI_SET16(target, aml_length);
569 acpi_rs_set_resource_length(aml_length, aml);
570 break;
571
572 case ACPI_RSC_COUNT_GPIO_VEN:
573
574 item_count = ACPI_GET16(source);
572 acpi_rs_set_resource_length(aml_length, aml);
573 break;
574
575 case ACPI_RSC_COUNT_GPIO_VEN:
576
577 item_count = ACPI_GET16(source);
575 ACPI_SET16(destination) = (u16)item_count;
578 ACPI_SET16(destination, item_count);
576
577 aml_length =
578 (u16)(aml_length + (info->value * item_count));
579 acpi_rs_set_resource_length(aml_length, aml);
580 break;
581
582 case ACPI_RSC_COUNT_GPIO_RES:
583
584 /* Set resource source string length */
585
586 item_count = ACPI_GET16(source);
579
580 aml_length =
581 (u16)(aml_length + (info->value * item_count));
582 acpi_rs_set_resource_length(aml_length, aml);
583 break;
584
585 case ACPI_RSC_COUNT_GPIO_RES:
586
587 /* Set resource source string length */
588
589 item_count = ACPI_GET16(source);
587 ACPI_SET16(destination) = (u16)aml_length;
590 ACPI_SET16(destination, aml_length);
588
589 /* Compute offset for the Vendor Data */
590
591 aml_length = (u16)(aml_length + item_count);
592 target = ACPI_ADD_PTR(void, aml, info->value);
593
594 /* Set vendor offset only if there is vendor data */
595
596 if (resource->data.gpio.vendor_length) {
591
592 /* Compute offset for the Vendor Data */
593
594 aml_length = (u16)(aml_length + item_count);
595 target = ACPI_ADD_PTR(void, aml, info->value);
596
597 /* Set vendor offset only if there is vendor data */
598
599 if (resource->data.gpio.vendor_length) {
597 ACPI_SET16(target) = (u16)aml_length;
600 ACPI_SET16(target, aml_length);
598 }
599
600 acpi_rs_set_resource_length(aml_length, aml);
601 break;
602
603 case ACPI_RSC_COUNT_SERIAL_VEN:
604
605 item_count = ACPI_GET16(source);
601 }
602
603 acpi_rs_set_resource_length(aml_length, aml);
604 break;
605
606 case ACPI_RSC_COUNT_SERIAL_VEN:
607
608 item_count = ACPI_GET16(source);
606 ACPI_SET16(destination) = item_count + info->value;
609 ACPI_SET16(destination, item_count + info->value);
607 aml_length = (u16)(aml_length + item_count);
608 acpi_rs_set_resource_length(aml_length, aml);
609 break;
610
611 case ACPI_RSC_COUNT_SERIAL_RES:
612
613 item_count = ACPI_GET16(source);
614 aml_length = (u16)(aml_length + item_count);

--- 87 unchanged lines hidden (view full) ---

702 source);
703 acpi_rs_set_resource_length(aml_length, aml);
704 break;
705
706 case ACPI_RSC_BITMASK:
707 /*
708 * 8-bit encoded bitmask (DMA macro)
709 */
610 aml_length = (u16)(aml_length + item_count);
611 acpi_rs_set_resource_length(aml_length, aml);
612 break;
613
614 case ACPI_RSC_COUNT_SERIAL_RES:
615
616 item_count = ACPI_GET16(source);
617 aml_length = (u16)(aml_length + item_count);

--- 87 unchanged lines hidden (view full) ---

705 source);
706 acpi_rs_set_resource_length(aml_length, aml);
707 break;
708
709 case ACPI_RSC_BITMASK:
710 /*
711 * 8-bit encoded bitmask (DMA macro)
712 */
710 ACPI_SET8(destination) = (u8)
711 acpi_rs_encode_bitmask(source,
712 *ACPI_ADD_PTR(u8, resource,
713 info->value));
713 ACPI_SET8(destination,
714 acpi_rs_encode_bitmask(source,
715 *ACPI_ADD_PTR(u8,
716 resource,
717 info->
718 value)));
714 break;
715
716 case ACPI_RSC_BITMASK16:
717 /*
718 * 16-bit encoded bitmask (IRQ macro)
719 */
720 temp16 = acpi_rs_encode_bitmask(source,
721 *ACPI_ADD_PTR(u8,

--- 98 unchanged lines hidden ---
719 break;
720
721 case ACPI_RSC_BITMASK16:
722 /*
723 * 16-bit encoded bitmask (IRQ macro)
724 */
725 temp16 = acpi_rs_encode_bitmask(source,
726 *ACPI_ADD_PTR(u8,

--- 98 unchanged lines hidden ---