aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/resources/rsmisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rsmisc.c')
-rw-r--r--drivers/acpi/resources/rsmisc.c711
1 files changed, 251 insertions, 460 deletions
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index fa7f5a85b61..337a0f01cb2 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -49,641 +49,432 @@ ACPI_MODULE_NAME("rsmisc")
/*******************************************************************************
*
- * FUNCTION: acpi_rs_generic_register_resource
+ * FUNCTION: acpi_rs_get_generic_reg
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_generic_register_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer,
- acpi_size * structure_size)
+acpi_rs_get_generic_reg(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16;
- u8 temp8;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg);
+ ACPI_FUNCTION_TRACE("rs_get_generic_reg");
- ACPI_FUNCTION_TRACE("rs_generic_register_resource");
-
- /* Byte 0 is the Descriptor Type */
-
- buffer += 1;
-
- /* Get the Descriptor Length field (Bytes 1-2) */
-
- ACPI_MOVE_16_TO_16(&temp16, buffer);
- buffer += 2;
-
- /* Validate the descriptor length */
-
- if (temp16 != 12) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
- }
-
- /* The number of bytes consumed is fixed (12 + 3) */
-
- *bytes_consumed = 15;
-
- /* Fill out the structure */
-
- output_struct->type = ACPI_RSTYPE_GENERIC_REG;
-
- /* Get space_id (Byte 3) */
-
- temp8 = *buffer;
- output_struct->data.generic_reg.space_id = temp8;
- buffer += 1;
-
- /* Get register_bit_width (Byte 4) */
-
- temp8 = *buffer;
- output_struct->data.generic_reg.bit_width = temp8;
- buffer += 1;
-
- /* Get register_bit_offset (Byte 5) */
-
- temp8 = *buffer;
- output_struct->data.generic_reg.bit_offset = temp8;
- buffer += 1;
-
- /* Get address_size (Byte 6) */
-
- temp8 = *buffer;
- output_struct->data.generic_reg.address_size = temp8;
- buffer += 1;
-
- /* Get register_address (Bytes 7-14) */
-
- ACPI_MOVE_64_TO_64(&output_struct->data.generic_reg.address, buffer);
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ /*
+ * Get the following fields from the AML descriptor:
+ * Address Space ID
+ * Register Bit Width
+ * Register Bit Offset
+ * Access Size
+ * Register Address
+ */
+ resource->data.generic_reg.space_id = aml->generic_reg.address_space_id;
+ resource->data.generic_reg.bit_width = aml->generic_reg.bit_width;
+ resource->data.generic_reg.bit_offset = aml->generic_reg.bit_offset;
+ resource->data.generic_reg.access_size = aml->generic_reg.access_size;
+ ACPI_MOVE_64_TO_64(&resource->data.generic_reg.address,
+ &aml->generic_reg.address);
+
+ /* Complete the resource header */
+
+ resource->type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER;
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_generic_register_stream
+ * FUNCTION: acpi_rs_set_generic_reg
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_generic_register_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_generic_reg(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16;
-
- ACPI_FUNCTION_TRACE("rs_generic_register_stream");
-
- /* Set the Descriptor Type (Byte 0) */
-
- *buffer = ACPI_RDESC_TYPE_GENERIC_REGISTER;
- buffer += 1;
-
- /* Set the Descriptor Length (Bytes 1-2) */
-
- temp16 = 12;
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
-
- /* Set space_id (Byte 3) */
-
- *buffer = (u8) resource->data.generic_reg.space_id;
- buffer += 1;
-
- /* Set register_bit_width (Byte 4) */
-
- *buffer = (u8) resource->data.generic_reg.bit_width;
- buffer += 1;
-
- /* Set register_bit_offset (Byte 5) */
-
- *buffer = (u8) resource->data.generic_reg.bit_offset;
- buffer += 1;
-
- /* Set address_size (Byte 6) */
-
- *buffer = (u8) resource->data.generic_reg.address_size;
- buffer += 1;
-
- /* Set register_address (Bytes 7-14) */
+ ACPI_FUNCTION_TRACE("rs_set_generic_reg");
- ACPI_MOVE_64_TO_64(buffer, &resource->data.generic_reg.address);
- buffer += 8;
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ /*
+ * Set the following fields in the AML descriptor:
+ * Address Space ID
+ * Register Bit Width
+ * Register Bit Offset
+ * Access Size
+ * Register Address
+ */
+ aml->generic_reg.address_space_id =
+ (u8) resource->data.generic_reg.space_id;
+ aml->generic_reg.bit_width = (u8) resource->data.generic_reg.bit_width;
+ aml->generic_reg.bit_offset =
+ (u8) resource->data.generic_reg.bit_offset;
+ aml->generic_reg.access_size =
+ (u8) resource->data.generic_reg.access_size;
+ ACPI_MOVE_64_TO_64(&aml->generic_reg.address,
+ &resource->data.generic_reg.address);
+
+ /* Complete the AML descriptor header */
+
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_GENERIC_REGISTER,
+ sizeof(struct
+ aml_resource_generic_register), aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_end_tag_resource
+ * FUNCTION: acpi_rs_get_vendor
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_vendor(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- struct acpi_resource *output_struct = (void *)*output_buffer;
- acpi_size struct_size = ACPI_RESOURCE_LENGTH;
-
- ACPI_FUNCTION_TRACE("rs_end_tag_resource");
+ u8 *aml_byte_data;
- /* The number of bytes consumed is static */
+ ACPI_FUNCTION_TRACE("rs_get_vendor");
- *bytes_consumed = 2;
+ /* Determine if this is a large or small vendor specific item */
- /* Fill out the structure */
+ if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large item, Point to the first vendor byte */
- output_struct->type = ACPI_RSTYPE_END_TAG;
+ aml_byte_data =
+ ((u8 *) aml) + sizeof(struct aml_resource_large_header);
+ } else {
+ /* Small item, Point to the first vendor byte */
- /* Set the Length parameter */
+ aml_byte_data =
+ ((u8 *) aml) + sizeof(struct aml_resource_small_header);
+ }
- output_struct->length = 0;
+ /* Copy the vendor-specific bytes */
- /* Return the final size of the structure */
+ ACPI_MEMCPY(resource->data.vendor.byte_data,
+ aml_byte_data, aml_resource_length);
+ resource->data.vendor.byte_length = aml_resource_length;
- *structure_size = struct_size;
+ /*
+ * In order for the struct_size to fall on a 32-bit boundary,
+ * calculate the length of the vendor string and expand the
+ * struct_size to the next 32-bit boundary.
+ */
+ resource->type = ACPI_RESOURCE_TYPE_VENDOR;
+ resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
+ ACPI_ROUND_UP_to_32_bITS(aml_resource_length);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_end_tag_stream
+ * FUNCTION: acpi_rs_set_vendor
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_end_tag_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u8 temp8 = 0;
+ u32 resource_length;
+ u8 *source;
+ u8 *destination;
- ACPI_FUNCTION_TRACE("rs_end_tag_stream");
+ ACPI_FUNCTION_TRACE("rs_set_vendor");
- /* The Descriptor Type field is static */
+ resource_length = resource->data.vendor.byte_length;
+ source = ACPI_CAST_PTR(u8, resource->data.vendor.byte_data);
- *buffer = ACPI_RDESC_TYPE_END_TAG | 0x01;
- buffer += 1;
+ /* Length determines if this is a large or small resource */
- /*
- * Set the Checksum - zero means that the resource data is treated as if
- * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
- */
- temp8 = 0;
+ if (resource_length > 7) {
+ /* Large item, get pointer to the data part of the descriptor */
+
+ destination =
+ ((u8 *) aml) + sizeof(struct aml_resource_large_header);
+
+ /* Complete the AML descriptor header */
+
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_LARGE,
+ (u32) (resource_length +
+ sizeof(struct
+ aml_resource_large_header)),
+ aml);
+ } else {
+ /* Small item, get pointer to the data part of the descriptor */
- *buffer = temp8;
- buffer += 1;
+ destination =
+ ((u8 *) aml) + sizeof(struct aml_resource_small_header);
- /* Return the number of bytes consumed in this operation */
+ /* Complete the AML descriptor header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_SMALL,
+ (u32) (resource_length +
+ sizeof(struct
+ aml_resource_small_header)),
+ aml);
+ }
+
+ /* Copy the vendor-specific bytes */
+
+ ACPI_MEMCPY(destination, source, resource_length);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_vendor_resource
+ * FUNCTION: acpi_rs_get_start_dpf
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_vendor_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_start_dpf(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- u8 index;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor);
-
- ACPI_FUNCTION_TRACE("rs_vendor_resource");
-
- /* Dereference the Descriptor to find if this is a large or small item. */
+ ACPI_FUNCTION_TRACE("rs_get_start_dpf");
- temp8 = *buffer;
+ /* Get the flags byte if present */
- if (temp8 & ACPI_RDESC_TYPE_LARGE) {
- /* Large Item, point to the length field */
+ if (aml_resource_length == 1) {
+ /* Get the Compatibility priority */
- buffer += 1;
+ resource->data.start_dpf.compatibility_priority =
+ (aml->start_dpf.flags & 0x03);
- /* Dereference */
-
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- /* Calculate bytes consumed */
+ if (resource->data.start_dpf.compatibility_priority >= 3) {
+ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
+ }
- *bytes_consumed = (acpi_size) temp16 + 3;
+ /* Get the Performance/Robustness preference */
- /* Point to the first vendor byte */
+ resource->data.start_dpf.performance_robustness =
+ ((aml->start_dpf.flags >> 2) & 0x03);
- buffer += 2;
+ if (resource->data.start_dpf.performance_robustness >= 3) {
+ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
+ }
} else {
- /* Small Item, dereference the size */
-
- temp16 = (u8) (*buffer & 0x07);
-
- /* Calculate bytes consumed */
+ /* start_dependent_no_pri(), no flags byte, set defaults */
- *bytes_consumed = (acpi_size) temp16 + 1;
-
- /* Point to the first vendor byte */
+ resource->data.start_dpf.compatibility_priority =
+ ACPI_ACCEPTABLE_CONFIGURATION;
- buffer += 1;
+ resource->data.start_dpf.performance_robustness =
+ ACPI_ACCEPTABLE_CONFIGURATION;
}
- output_struct->type = ACPI_RSTYPE_VENDOR;
- output_struct->data.vendor_specific.length = temp16;
-
- for (index = 0; index < temp16; index++) {
- output_struct->data.vendor_specific.reserved[index] = *buffer;
- buffer += 1;
- }
+ /* Complete the resource header */
- /*
- * In order for the struct_size to fall on a 32-bit boundary,
- * calculate the length of the vendor string and expand the
- * struct_size to the next 32-bit boundary.
- */
- struct_size += ACPI_ROUND_UP_to_32_bITS(temp16);
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_START_DEPENDENT;
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_vendor_stream
+ * FUNCTION: acpi_rs_set_start_dpf
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_vendor_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- u8 index;
-
- ACPI_FUNCTION_TRACE("rs_vendor_stream");
-
- /* Dereference the length to find if this is a large or small item. */
-
- if (resource->data.vendor_specific.length > 7) {
- /* Large Item, Set the descriptor field and length bytes */
+ ACPI_FUNCTION_TRACE("rs_set_start_dpf");
- *buffer = ACPI_RDESC_TYPE_LARGE_VENDOR;
- buffer += 1;
-
- temp16 = (u16) resource->data.vendor_specific.length;
-
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
+ /*
+ * The descriptor type field is set based upon whether a byte is needed
+ * to contain Priority data.
+ */
+ if (ACPI_ACCEPTABLE_CONFIGURATION ==
+ resource->data.start_dpf.compatibility_priority &&
+ ACPI_ACCEPTABLE_CONFIGURATION ==
+ resource->data.start_dpf.performance_robustness) {
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT,
+ sizeof(struct
+ aml_resource_start_dependent_noprio),
+ aml);
} else {
- /* Small Item, Set the descriptor field */
-
- temp8 = ACPI_RDESC_TYPE_SMALL_VENDOR;
- temp8 |= (u8) resource->data.vendor_specific.length;
-
- *buffer = temp8;
- buffer += 1;
- }
-
- /* Loop through all of the Vendor Specific fields */
-
- for (index = 0; index < resource->data.vendor_specific.length; index++) {
- temp8 = resource->data.vendor_specific.reserved[index];
-
- *buffer = temp8;
- buffer += 1;
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT,
+ sizeof(struct
+ aml_resource_start_dependent),
+ aml);
+
+ /* Set the Flags byte */
+
+ aml->start_dpf.flags = (u8)
+ (((resource->data.start_dpf.
+ performance_robustness & 0x03) << 2) | (resource->data.
+ start_dpf.
+ compatibility_priority
+ & 0x03));
}
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_start_depend_fns_resource
+ * FUNCTION: acpi_rs_get_end_dpf
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer,
- acpi_size * structure_size)
+acpi_rs_get_end_dpf(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u8 temp8 = 0;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf);
-
- ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource");
-
- /* The number of bytes consumed are found in the descriptor (Bits:0-1) */
-
- temp8 = *buffer;
-
- *bytes_consumed = (temp8 & 0x01) + 1;
-
- output_struct->type = ACPI_RSTYPE_START_DPF;
-
- /* Point to Byte 1 if it is used */
-
- if (2 == *bytes_consumed) {
- buffer += 1;
- temp8 = *buffer;
-
- /* Check Compatibility priority */
-
- output_struct->data.start_dpf.compatibility_priority =
- temp8 & 0x03;
-
- if (3 == output_struct->data.start_dpf.compatibility_priority) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
- }
+ ACPI_FUNCTION_TRACE("rs_get_end_dpf");
- /* Check Performance/Robustness preference */
+ /* Complete the resource header */
- output_struct->data.start_dpf.performance_robustness =
- (temp8 >> 2) & 0x03;
-
- if (3 == output_struct->data.start_dpf.performance_robustness) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
- }
- } else {
- output_struct->data.start_dpf.compatibility_priority =
- ACPI_ACCEPTABLE_CONFIGURATION;
-
- output_struct->data.start_dpf.performance_robustness =
- ACPI_ACCEPTABLE_CONFIGURATION;
- }
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_END_DEPENDENT;
+ resource->length = (u32) ACPI_RESOURCE_LENGTH;
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_end_depend_fns_resource
+ * FUNCTION: acpi_rs_set_end_dpf
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml)
{
- struct acpi_resource *output_struct = (void *)*output_buffer;
- acpi_size struct_size = ACPI_RESOURCE_LENGTH;
-
- ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource");
-
- /* The number of bytes consumed is static */
-
- *bytes_consumed = 1;
+ ACPI_FUNCTION_TRACE("rs_set_end_dpf");
- /* Fill out the structure */
+ /* Complete the AML descriptor header */
- output_struct->type = ACPI_RSTYPE_END_DPF;
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_DEPENDENT,
+ sizeof(struct aml_resource_end_dependent),
+ aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_start_depend_fns_stream
+ * FUNCTION: acpi_rs_get_end_tag
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * output_buffer used
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_start_depend_fns_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_get_end_tag(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = *output_buffer;
- u8 temp8 = 0;
-
- ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
+ ACPI_FUNCTION_TRACE("rs_get_end_tag");
- /*
- * The descriptor type field is set based upon whether a byte is needed
- * to contain Priority data.
- */
- if (ACPI_ACCEPTABLE_CONFIGURATION ==
- resource->data.start_dpf.compatibility_priority &&
- ACPI_ACCEPTABLE_CONFIGURATION ==
- resource->data.start_dpf.performance_robustness) {
- *buffer = ACPI_RDESC_TYPE_START_DEPENDENT;
- } else {
- *buffer = ACPI_RDESC_TYPE_START_DEPENDENT | 0x01;
- buffer += 1;
-
- /* Set the Priority Byte Definition */
+ /* Complete the resource header */
- temp8 = 0;
- temp8 = (u8) ((resource->data.start_dpf.performance_robustness &
- 0x03) << 2);
- temp8 |= (resource->data.start_dpf.compatibility_priority &
- 0x03);
- *buffer = temp8;
- }
-
- buffer += 1;
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ resource->type = ACPI_RESOURCE_TYPE_END_TAG;
+ resource->length = ACPI_RESOURCE_LENGTH;
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_end_depend_fns_stream
+ * FUNCTION: acpi_rs_set_end_tag
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_end_depend_fns_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
-
- ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
+ ACPI_FUNCTION_TRACE("rs_set_end_tag");
- /* The Descriptor Type field is static */
-
- *buffer = ACPI_RDESC_TYPE_END_DEPENDENT;
- buffer += 1;
+ /*
+ * Set the Checksum - zero means that the resource data is treated as if
+ * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
+ */
+ aml->end_tag.checksum = 0;
- /* Return the number of bytes consumed in this operation */
+ /* Complete the AML descriptor header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_TAG,
+ sizeof(struct aml_resource_end_tag), aml);
return_ACPI_STATUS(AE_OK);
}