Skip to content

Commit

Permalink
[ACPI] ACPICA 20050916
Browse files Browse the repository at this point in the history
Fixed a problem within the Resource Manager where
support for the Generic Register descriptor was not fully
implemented.  This descriptor is now fully recognized,
parsed, disassembled, and displayed.

Restructured the Resource Manager code to utilize
table-driven dispatch and lookup, eliminating many of the
large switch() statements.  This reduces overall subsystem
code size and code complexity.  Affects the resource parsing
and construction, disassembly, and debug dump output.

Cleaned up and restructured the debug dump output for all
resource descriptors.  Improved readability of the output
and reduced code size.

Fixed a problem where changes to internal data structures
caused the optional ACPI_MUTEX_DEBUG code to fail
compilation if specified.

Signed-off-by: Robert Moore <Robert.Moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Robert Moore authored and Len Brown committed Sep 22, 2005
1 parent efb0372 commit bda663d
Show file tree
Hide file tree
Showing 18 changed files with 1,701 additions and 1,808 deletions.
99 changes: 45 additions & 54 deletions drivers/acpi/resources/rsaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
}

*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS16;
output_struct->type = ACPI_RSTYPE_ADDRESS16;

/* Get the Resource Type (Byte3) */

Expand Down Expand Up @@ -400,7 +400,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_address16_stream
*
* PARAMETERS: linked_list - Pointer to the resource linked list
* 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
Expand All @@ -413,7 +413,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
******************************************************************************/

acpi_status
acpi_rs_address16_stream(struct acpi_resource *linked_list,
acpi_rs_address16_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
Expand All @@ -434,59 +434,56 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list,

/* Set the Resource Type (Memory, Io, bus_number) */

*buffer = (u8) (linked_list->data.address16.resource_type & 0x03);
*buffer = (u8) (resource->data.address16.resource_type & 0x03);
buffer += 1;

/* Set the general flags */

*buffer = acpi_rs_encode_general_flags(&linked_list->data);
*buffer = acpi_rs_encode_general_flags(&resource->data);
buffer += 1;

/* Set the type specific flags */

*buffer = acpi_rs_encode_specific_flags(&linked_list->data);
*buffer = acpi_rs_encode_specific_flags(&resource->data);
buffer += 1;

/* Set the address space granularity */

ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity);
ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.granularity);
buffer += 2;

/* Set the address range minimum */

ACPI_MOVE_32_TO_16(buffer,
&linked_list->data.address16.min_address_range);
ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.min_address_range);
buffer += 2;

/* Set the address range maximum */

ACPI_MOVE_32_TO_16(buffer,
&linked_list->data.address16.max_address_range);
ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.max_address_range);
buffer += 2;

/* Set the address translation offset */

ACPI_MOVE_32_TO_16(buffer,
&linked_list->data.address16.
&resource->data.address16.
address_translation_offset);
buffer += 2;

/* Set the address length */

ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length);
ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.address_length);
buffer += 2;

/* Resource Source Index and Resource Source are optional */

if (linked_list->data.address16.resource_source.string_length) {
*buffer =
(u8) linked_list->data.address16.resource_source.index;
if (resource->data.address16.resource_source.string_length) {
*buffer = (u8) resource->data.address16.resource_source.index;
buffer += 1;

/* Copy the resource_source string */

ACPI_STRCPY((char *)buffer,
linked_list->data.address16.resource_source.
resource->data.address16.resource_source.
string_ptr);

/*
Expand All @@ -495,7 +492,7 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list,
*/
buffer +=
(acpi_size) (ACPI_STRLEN
(linked_list->data.address16.resource_source.
(resource->data.address16.resource_source.
string_ptr) + 1);
}

Expand Down Expand Up @@ -562,7 +559,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
}

*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS32;
output_struct->type = ACPI_RSTYPE_ADDRESS32;

/* Get the Resource Type (Byte3) */

Expand Down Expand Up @@ -690,7 +687,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_address32_stream
*
* PARAMETERS: linked_list - Pointer to the resource linked list
* 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
Expand All @@ -703,7 +700,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
******************************************************************************/

acpi_status
acpi_rs_address32_stream(struct acpi_resource *linked_list,
acpi_rs_address32_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer;
Expand All @@ -725,59 +722,56 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list,

/* Set the Resource Type (Memory, Io, bus_number) */

*buffer = (u8) (linked_list->data.address32.resource_type & 0x03);
*buffer = (u8) (resource->data.address32.resource_type & 0x03);
buffer += 1;

/* Set the general flags */

*buffer = acpi_rs_encode_general_flags(&linked_list->data);
*buffer = acpi_rs_encode_general_flags(&resource->data);
buffer += 1;

/* Set the type specific flags */

*buffer = acpi_rs_encode_specific_flags(&linked_list->data);
*buffer = acpi_rs_encode_specific_flags(&resource->data);
buffer += 1;

/* Set the address space granularity */

ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity);
ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.granularity);
buffer += 4;

/* Set the address range minimum */

ACPI_MOVE_32_TO_32(buffer,
&linked_list->data.address32.min_address_range);
ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.min_address_range);
buffer += 4;

/* Set the address range maximum */

ACPI_MOVE_32_TO_32(buffer,
&linked_list->data.address32.max_address_range);
ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.max_address_range);
buffer += 4;

/* Set the address translation offset */

ACPI_MOVE_32_TO_32(buffer,
&linked_list->data.address32.
&resource->data.address32.
address_translation_offset);
buffer += 4;

/* Set the address length */

ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length);
ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.address_length);
buffer += 4;

/* Resource Source Index and Resource Source are optional */

if (linked_list->data.address32.resource_source.string_length) {
*buffer =
(u8) linked_list->data.address32.resource_source.index;
if (resource->data.address32.resource_source.string_length) {
*buffer = (u8) resource->data.address32.resource_source.index;
buffer += 1;

/* Copy the resource_source string */

ACPI_STRCPY((char *)buffer,
linked_list->data.address32.resource_source.
resource->data.address32.resource_source.
string_ptr);

/*
Expand All @@ -786,7 +780,7 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list,
*/
buffer +=
(acpi_size) (ACPI_STRLEN
(linked_list->data.address32.resource_source.
(resource->data.address32.resource_source.
string_ptr) + 1);
}

Expand Down Expand Up @@ -856,7 +850,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
}

*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS64;
output_struct->type = ACPI_RSTYPE_ADDRESS64;

/* Get the Resource Type (Byte3) */

Expand Down Expand Up @@ -1005,7 +999,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_address64_stream
*
* PARAMETERS: linked_list - Pointer to the resource linked list
* 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
Expand All @@ -1018,7 +1012,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
******************************************************************************/

acpi_status
acpi_rs_address64_stream(struct acpi_resource *linked_list,
acpi_rs_address64_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer;
Expand All @@ -1040,59 +1034,56 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list,

/* Set the Resource Type (Memory, Io, bus_number) */

*buffer = (u8) (linked_list->data.address64.resource_type & 0x03);
*buffer = (u8) (resource->data.address64.resource_type & 0x03);
buffer += 1;

/* Set the general flags */

*buffer = acpi_rs_encode_general_flags(&linked_list->data);
*buffer = acpi_rs_encode_general_flags(&resource->data);
buffer += 1;

/* Set the type specific flags */

*buffer = acpi_rs_encode_specific_flags(&linked_list->data);
*buffer = acpi_rs_encode_specific_flags(&resource->data);
buffer += 1;

/* Set the address space granularity */

ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity);
ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.granularity);
buffer += 8;

/* Set the address range minimum */

ACPI_MOVE_64_TO_64(buffer,
&linked_list->data.address64.min_address_range);
ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.min_address_range);
buffer += 8;

/* Set the address range maximum */

ACPI_MOVE_64_TO_64(buffer,
&linked_list->data.address64.max_address_range);
ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.max_address_range);
buffer += 8;

/* Set the address translation offset */

ACPI_MOVE_64_TO_64(buffer,
&linked_list->data.address64.
&resource->data.address64.
address_translation_offset);
buffer += 8;

/* Set the address length */

ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length);
ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.address_length);
buffer += 8;

/* Resource Source Index and Resource Source are optional */

if (linked_list->data.address64.resource_source.string_length) {
*buffer =
(u8) linked_list->data.address64.resource_source.index;
if (resource->data.address64.resource_source.string_length) {
*buffer = (u8) resource->data.address64.resource_source.index;
buffer += 1;

/* Copy the resource_source string */

ACPI_STRCPY((char *)buffer,
linked_list->data.address64.resource_source.
resource->data.address64.resource_source.
string_ptr);

/*
Expand All @@ -1101,7 +1092,7 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list,
*/
buffer +=
(acpi_size) (ACPI_STRLEN
(linked_list->data.address64.resource_source.
(resource->data.address64.resource_source.
string_ptr) + 1);
}

Expand Down
Loading

0 comments on commit bda663d

Please sign in to comment.