49 #define _COMPONENT ACPI_RESOURCES
53 static
u8 acpi_rs_count_set_bits(
u16 bit_field);
59 acpi_rs_stream_option_length(
u32 resource_length,
u32 minimum_total_length);
74 static
u8 acpi_rs_count_set_bits(
u16 bit_field)
80 for (bits_set = 0; bit_field; bits_set++) {
84 bit_field &= (
u16) (bit_field - 1);
138 acpi_rs_stream_option_length(
u32 resource_length,
139 u32 minimum_aml_resource_length)
141 u32 string_length = 0;
157 if (resource_length > minimum_aml_resource_length) {
162 resource_length - minimum_aml_resource_length - 1;
190 acpi_size aml_size_needed = 0;
213 switch (resource->
type) {
218 if (resource->
data.
irq.descriptor_length == 2) {
227 if (resource->
data.
irq.descriptor_length == 0) {
250 (total_size + resource->
data.
vendor.byte_length);
271 acpi_rs_struct_option_length(&resource->
data.
283 acpi_rs_struct_option_length(&resource->
data.
295 acpi_rs_struct_option_length(&resource->
data.
311 acpi_rs_struct_option_length(&resource->
data.
321 pin_table_length * 2) +
386 u32 aml_buffer_length, acpi_size * size_needed)
394 u32 extra_struct_bytes;
396 u8 minimum_aml_resource_length;
402 end_aml = aml_buffer + aml_buffer_length;
406 while (aml_buffer < end_aml) {
419 aml_resource = (
void *)aml_buffer;
424 minimum_aml_resource_length =
431 extra_struct_bytes = 0;
442 extra_struct_bytes = acpi_rs_count_set_bits(temp16);
450 extra_struct_bytes = acpi_rs_count_set_bits(*buffer);
459 extra_struct_bytes = resource_length;
476 acpi_rs_stream_option_length(resource_length,
477 minimum_aml_resource_length);
487 extra_struct_bytes = (buffer[1] - 1) *
sizeof(
u32);
491 extra_struct_bytes +=
492 acpi_rs_stream_option_length(resource_length -
494 minimum_aml_resource_length);
501 if (aml_resource->
gpio.vendor_length) {
502 extra_struct_bytes +=
503 aml_resource->
gpio.vendor_offset -
504 aml_resource->
gpio.pin_table_offset +
505 aml_resource->
gpio.vendor_length;
507 extra_struct_bytes +=
510 aml_resource->gpio.pin_table_offset;
516 minimum_aml_resource_length =
519 extra_struct_bytes +=
521 minimum_aml_resource_length;
547 *size_needed += buffer_size;
550 "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
586 acpi_size * buffer_size_needed)
588 u32 number_of_elements;
589 acpi_size temp_size_needed = 0;
599 number_of_elements = package_object->
package.count;
611 top_object_list = package_object->
package.elements;
613 for (index = 0; index < number_of_elements; index++) {
617 package_element = *top_object_list;
621 if (!package_element ||
630 sub_object_list = package_element->
package.elements;
636 for (table_index = 0; table_index < 4 && !name_found;
638 if (*sub_object_list &&
640 (*sub_object_list)->common.type) ||
642 (*sub_object_list)->common.type) &&
643 ((*sub_object_list)->reference.class ==
663 temp_size_needed += ((acpi_size)
664 (*sub_object_list)->string.
675 temp_size_needed +=
sizeof(
u32);
691 *buffer_size_needed =