提交 bda663d3 编写于 作者: R Robert Moore 提交者: Len Brown

[ACPI] ACPICA 20050916

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: NRobert Moore <Robert.Moore@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 efb0372b
......@@ -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) */
......@@ -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
......@@ -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;
......@@ -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);
/*
......@@ -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);
}
......@@ -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) */
......@@ -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
......@@ -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;
......@@ -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);
/*
......@@ -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);
}
......@@ -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) */
......@@ -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
......@@ -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;
......@@ -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);
/*
......@@ -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);
}
......
此差异已折叠。
此差异已折叠。
......@@ -84,7 +84,7 @@ acpi_rs_io_resource(u8 * byte_stream_buffer,
*bytes_consumed = 8;
output_struct->id = ACPI_RSTYPE_IO;
output_struct->type = ACPI_RSTYPE_IO;
/* Check Decode */
......@@ -170,7 +170,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
*bytes_consumed = 4;
output_struct->id = ACPI_RSTYPE_FIXED_IO;
output_struct->type = ACPI_RSTYPE_FIXED_IO;
/* Check Range Base Address */
......@@ -200,7 +200,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_io_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
......@@ -213,7 +213,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_io_stream(struct acpi_resource *linked_list,
acpi_rs_io_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -222,42 +222,42 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_io_stream");
/* The descriptor field is static */
/* The Descriptor Type field is static */
*buffer = 0x47;
*buffer = ACPI_RDESC_TYPE_IO_PORT | 0x07;
buffer += 1;
/* Io Information Byte */
temp8 = (u8) (linked_list->data.io.io_decode & 0x01);
temp8 = (u8) (resource->data.io.io_decode & 0x01);
*buffer = temp8;
buffer += 1;
/* Set the Range minimum base address */
temp16 = (u16) linked_list->data.io.min_base_address;
temp16 = (u16) resource->data.io.min_base_address;
ACPI_MOVE_16_TO_16(buffer, &temp16);
buffer += 2;
/* Set the Range maximum base address */
temp16 = (u16) linked_list->data.io.max_base_address;
temp16 = (u16) resource->data.io.max_base_address;
ACPI_MOVE_16_TO_16(buffer, &temp16);
buffer += 2;
/* Set the base alignment */
temp8 = (u8) linked_list->data.io.alignment;
temp8 = (u8) resource->data.io.alignment;
*buffer = temp8;
buffer += 1;
/* Set the range length */
temp8 = (u8) linked_list->data.io.range_length;
temp8 = (u8) resource->data.io.range_length;
*buffer = temp8;
buffer += 1;
......@@ -272,7 +272,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
*
* FUNCTION: acpi_rs_fixed_io_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
......@@ -285,7 +285,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
******************************************************************************/
acpi_status
acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
acpi_rs_fixed_io_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -294,22 +294,21 @@ acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_fixed_io_stream");
/* The descriptor field is static */
*buffer = 0x4B;
/* The Descriptor Type field is static */
*buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03;
buffer += 1;
/* Set the Range base address */
temp16 = (u16) linked_list->data.fixed_io.base_address;
temp16 = (u16) resource->data.fixed_io.base_address;
ACPI_MOVE_16_TO_16(buffer, &temp16);
buffer += 2;
/* Set the range length */
temp8 = (u8) linked_list->data.fixed_io.range_length;
temp8 = (u8) resource->data.fixed_io.range_length;
*buffer = temp8;
buffer += 1;
......@@ -358,7 +357,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
/* The number of bytes consumed are Constant */
*bytes_consumed = 3;
output_struct->id = ACPI_RSTYPE_DMA;
output_struct->type = ACPI_RSTYPE_DMA;
/* Point to the 8-bits of Byte 1 */
......@@ -420,7 +419,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_dma_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
......@@ -433,7 +432,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_dma_stream(struct acpi_resource *linked_list,
acpi_rs_dma_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -443,17 +442,16 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_dma_stream");
/* The descriptor field is static */
/* The Descriptor Type field is static */
*buffer = 0x2A;
*buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02;
buffer += 1;
temp8 = 0;
/* Loop through all of the Channels and set the mask bits */
for (index = 0;
index < linked_list->data.dma.number_of_channels; index++) {
temp16 = (u16) linked_list->data.dma.channels[index];
for (index = 0; index < resource->data.dma.number_of_channels; index++) {
temp16 = (u16) resource->data.dma.channels[index];
temp8 |= 0x1 << temp16;
}
......@@ -462,9 +460,9 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list,
/* Set the DMA Info */
temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5);
temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2);
temp8 |= (linked_list->data.dma.transfer & 0x03);
temp8 = (u8) ((resource->data.dma.type & 0x03) << 5);
temp8 |= ((resource->data.dma.bus_master & 0x01) << 2);
temp8 |= (resource->data.dma.transfer & 0x03);
*buffer = temp8;
buffer += 1;
......
......@@ -88,7 +88,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
*/
temp8 = *buffer;
*bytes_consumed = (temp8 & 0x03) + 1;
output_struct->id = ACPI_RSTYPE_IRQ;
output_struct->type = ACPI_RSTYPE_IRQ;
/* Point to the 16-bits of Bytes 1 and 2 */
......@@ -177,7 +177,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_irq_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
......@@ -190,7 +190,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_irq_stream(struct acpi_resource *linked_list,
acpi_rs_irq_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -205,13 +205,13 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
* The descriptor field is set based upon whether a third byte is
* needed to contain the IRQ Information.
*/
if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level &&
ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low &&
ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) {
*buffer = 0x22;
if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level &&
ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low &&
ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) {
*buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02;
IRqinfo_byte_needed = FALSE;
} else {
*buffer = 0x23;
*buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03;
IRqinfo_byte_needed = TRUE;
}
......@@ -221,8 +221,8 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
/* Loop through all of the interrupts and set the mask bits */
for (index = 0;
index < linked_list->data.irq.number_of_interrupts; index++) {
temp8 = (u8) linked_list->data.irq.interrupts[index];
index < resource->data.irq.number_of_interrupts; index++) {
temp8 = (u8) resource->data.irq.interrupts[index];
temp16 |= 0x1 << temp8;
}
......@@ -233,11 +233,11 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
if (IRqinfo_byte_needed) {
temp8 = 0;
temp8 = (u8) ((linked_list->data.irq.shared_exclusive &
temp8 = (u8) ((resource->data.irq.shared_exclusive &
0x01) << 4);
if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level &&
ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) {
if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level &&
ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) {
temp8 |= 0x08;
} else {
temp8 |= 0x01;
......@@ -302,7 +302,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
}
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_EXT_IRQ;
output_struct->type = ACPI_RSTYPE_EXT_IRQ;
/* Point to the Byte3 */
......@@ -441,7 +441,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_extended_irq_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
......@@ -454,7 +454,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
acpi_rs_extended_irq_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -476,9 +476,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
/* Set the Interrupt vector flags */
temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01);
temp8 |=
((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
temp8 = (u8) (resource->data.extended_irq.producer_consumer & 0x01);
temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3);
/*
* Set the Interrupt Mode
......@@ -489,44 +488,44 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
*
* - Edge/Level are defined opposite in the table vs the headers
*/
if (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) {
if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) {
temp8 |= 0x2;
}
/* Set the Interrupt Polarity */
temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2);
temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2);
*buffer = temp8;
buffer += 1;
/* Set the Interrupt table length */
temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts;
temp8 = (u8) resource->data.extended_irq.number_of_interrupts;
*buffer = temp8;
buffer += 1;
for (index = 0;
index < linked_list->data.extended_irq.number_of_interrupts;
index < resource->data.extended_irq.number_of_interrupts;
index++) {
ACPI_MOVE_32_TO_32(buffer,
&linked_list->data.extended_irq.
&resource->data.extended_irq.
interrupts[index]);
buffer += 4;
}
/* Resource Source Index and Resource Source are optional */
if (0 != linked_list->data.extended_irq.resource_source.string_length) {
if (0 != resource->data.extended_irq.resource_source.string_length) {
*buffer =
(u8) linked_list->data.extended_irq.resource_source.index;
(u8) resource->data.extended_irq.resource_source.index;
buffer += 1;
/* Copy the string */
ACPI_STRCPY((char *)buffer,
linked_list->data.extended_irq.resource_source.
resource->data.extended_irq.resource_source.
string_ptr);
/*
......@@ -535,8 +534,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
*/
buffer +=
(acpi_size) (ACPI_STRLEN
(linked_list->data.extended_irq.
resource_source.string_ptr) + 1);
(resource->data.extended_irq.resource_source.
string_ptr) + 1);
}
/* Return the number of bytes consumed in this operation */
......
......@@ -47,44 +47,143 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rslist")
/* Dispatch table for convert-to-stream functions */
typedef
acpi_status(*ACPI_STREAM_HANDLER) (struct acpi_resource * resource,
u8 ** output_buffer,
acpi_size * bytes_consumed);
static ACPI_STREAM_HANDLER acpi_gbl_stream_dispatch[] = {
acpi_rs_irq_stream, /* ACPI_RSTYPE_IRQ */
acpi_rs_dma_stream, /* ACPI_RSTYPE_DMA */
acpi_rs_start_depend_fns_stream, /* ACPI_RSTYPE_START_DPF */
acpi_rs_end_depend_fns_stream, /* ACPI_RSTYPE_END_DPF */
acpi_rs_io_stream, /* ACPI_RSTYPE_IO */
acpi_rs_fixed_io_stream, /* ACPI_RSTYPE_FIXED_IO */
acpi_rs_vendor_stream, /* ACPI_RSTYPE_VENDOR */
acpi_rs_end_tag_stream, /* ACPI_RSTYPE_END_TAG */
acpi_rs_memory24_stream, /* ACPI_RSTYPE_MEM24 */
acpi_rs_memory32_range_stream, /* ACPI_RSTYPE_MEM32 */
acpi_rs_fixed_memory32_stream, /* ACPI_RSTYPE_FIXED_MEM32 */
acpi_rs_address16_stream, /* ACPI_RSTYPE_ADDRESS16 */
acpi_rs_address32_stream, /* ACPI_RSTYPE_ADDRESS32 */
acpi_rs_address64_stream, /* ACPI_RSTYPE_ADDRESS64 */
acpi_rs_extended_irq_stream, /* ACPI_RSTYPE_EXT_IRQ */
acpi_rs_generic_register_stream /* ACPI_RSTYPE_GENERIC_REG */
};
/* Dispatch tables for convert-to-resource functions */
typedef
acpi_status(*ACPI_RESOURCE_HANDLER) (u8 * byte_stream_buffer,
acpi_size * bytes_consumed,
u8 ** output_buffer,
acpi_size * structure_size);
static ACPI_RESOURCE_HANDLER acpi_gbl_sm_resource_dispatch[] = {
NULL, /* 0x00, Reserved */
NULL, /* 0x01, Reserved */
NULL, /* 0x02, Reserved */
NULL, /* 0x03, Reserved */
acpi_rs_irq_resource, /* ACPI_RDESC_TYPE_IRQ_FORMAT */
acpi_rs_dma_resource, /* ACPI_RDESC_TYPE_DMA_FORMAT */
acpi_rs_start_depend_fns_resource, /* ACPI_RDESC_TYPE_START_DEPENDENT */
acpi_rs_end_depend_fns_resource, /* ACPI_RDESC_TYPE_END_DEPENDENT */
acpi_rs_io_resource, /* ACPI_RDESC_TYPE_IO_PORT */
acpi_rs_fixed_io_resource, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */
NULL, /* 0x0A, Reserved */
NULL, /* 0x0B, Reserved */
NULL, /* 0x0C, Reserved */
NULL, /* 0x0D, Reserved */
acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_SMALL_VENDOR */
acpi_rs_end_tag_resource /* ACPI_RDESC_TYPE_END_TAG */
};
static ACPI_RESOURCE_HANDLER acpi_gbl_lg_resource_dispatch[] = {
NULL, /* 0x00, Reserved */
acpi_rs_memory24_resource, /* ACPI_RDESC_TYPE_MEMORY_24 */
acpi_rs_generic_register_resource, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */
NULL, /* 0x03, Reserved */
acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_LARGE_VENDOR */
acpi_rs_memory32_range_resource, /* ACPI_RDESC_TYPE_MEMORY_32 */
acpi_rs_fixed_memory32_resource, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */
acpi_rs_address32_resource, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */
acpi_rs_address16_resource, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */
acpi_rs_extended_irq_resource, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */
acpi_rs_address64_resource, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */
acpi_rs_address64_resource /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */
};
/* Local prototypes */
static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type);
/*******************************************************************************
*
* FUNCTION: acpi_rs_get_resource_type
*
* PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor
* PARAMETERS: resource_type - Byte 0 of a resource descriptor
*
* RETURN: The Resource Type with no extraneous bits
* RETURN: The Resource Type with no extraneous bits (except the large/
* small bit -- left alone)
*
* DESCRIPTION: Extract the Resource Type/Name from the first byte of
* a resource descriptor.
*
******************************************************************************/
u8 acpi_rs_get_resource_type(u8 resource_start_byte)
{
u8 acpi_rs_get_resource_type(u8 resource_type)
{
ACPI_FUNCTION_ENTRY();
/* Determine if this is a small or large resource */
switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) {
case ACPI_RDESC_TYPE_SMALL:
if (resource_type & ACPI_RDESC_TYPE_LARGE) {
/* Large Resource Type -- bits 6:0 contain the name */
return (resource_type);
} else {
/* Small Resource Type -- bits 6:3 contain the name */
return ((u8) (resource_type & ACPI_RDESC_SMALL_MASK));
}
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_get_resource_handler
*
* PARAMETERS: resource_type - Byte 0 of a resource descriptor
*
* RETURN: Pointer to the resource conversion handler
*
* DESCRIPTION: Extract the Resource Type/Name from the first byte of
* a resource descriptor.
*
******************************************************************************/
/* Small Resource Type -- Only bits 6:3 are valid */
static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type)
{
ACPI_FUNCTION_ENTRY();
return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK));
/* Determine if this is a small or large resource */
case ACPI_RDESC_TYPE_LARGE:
if (resource_type & ACPI_RDESC_TYPE_LARGE) {
/* Large Resource Type -- bits 6:0 contain the name */
/* Large Resource Type -- All bits are valid */
if (resource_type > ACPI_RDESC_LARGE_MAX) {
return (NULL);
}
return (resource_start_byte);
return (acpi_gbl_lg_resource_dispatch[(resource_type &
ACPI_RDESC_LARGE_MASK)]);
} else {
/* Small Resource Type -- bits 6:3 contain the name */
default:
/* Invalid type */
break;
return (acpi_gbl_sm_resource_dispatch[((resource_type &
ACPI_RDESC_SMALL_MASK)
>> 3)]);
}
return (0xFF);
}
/*******************************************************************************
......@@ -107,228 +206,70 @@ acpi_status
acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
u32 byte_stream_buffer_length, u8 * output_buffer)
{
u8 *buffer = output_buffer;
acpi_status status;
acpi_size bytes_parsed = 0;
u8 resource_type = 0;
acpi_size bytes_consumed = 0;
u8 *buffer = output_buffer;
acpi_size structure_size = 0;
u8 end_tag_processed = FALSE;
struct acpi_resource *resource;
ACPI_RESOURCE_HANDLER handler;
ACPI_FUNCTION_TRACE("rs_byte_stream_to_list");
while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) {
/* The next byte in the stream is the resource type */
resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
switch (resource_type) {
case ACPI_RDESC_TYPE_MEMORY_24:
/*
* 24-Bit Memory Resource
*/
status = acpi_rs_memory24_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_LARGE_VENDOR:
/*
* Vendor Defined Resource
*/
status = acpi_rs_vendor_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_MEMORY_32:
/*
* 32-Bit Memory Range Resource
*/
status =
acpi_rs_memory32_range_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
/*
* 32-Bit Fixed Memory Resource
*/
status =
acpi_rs_fixed_memory32_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE:
/*
* 64-Bit Address Resource
*/
status = acpi_rs_address64_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
/*
* 32-Bit Address Resource
*/
status = acpi_rs_address32_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
/*
* 16-Bit Address Resource
*/
status = acpi_rs_address16_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
/*
* Extended IRQ
*/
status =
acpi_rs_extended_irq_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_IRQ_FORMAT:
/*
* IRQ Resource
*/
status = acpi_rs_irq_resource(byte_stream_buffer,
&bytes_consumed, &buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_DMA_FORMAT:
/*
* DMA Resource
*/
status = acpi_rs_dma_resource(byte_stream_buffer,
&bytes_consumed, &buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_START_DEPENDENT:
/*
* Start Dependent Functions Resource
*/
status =
acpi_rs_start_depend_fns_resource
(byte_stream_buffer, &bytes_consumed, &buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_END_DEPENDENT:
/*
* End Dependent Functions Resource
*/
status =
acpi_rs_end_depend_fns_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_IO_PORT:
/*
* IO Port Resource
*/
status = acpi_rs_io_resource(byte_stream_buffer,
&bytes_consumed, &buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_FIXED_IO_PORT:
/*
* Fixed IO Port Resource
*/
status = acpi_rs_fixed_io_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_SMALL_VENDOR:
/*
* Vendor Specific Resource
*/
status = acpi_rs_vendor_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
case ACPI_RDESC_TYPE_END_TAG:
/*
* End Tag
*/
end_tag_processed = TRUE;
status = acpi_rs_end_tag_resource(byte_stream_buffer,
&bytes_consumed,
&buffer,
&structure_size);
break;
default:
/*
* Invalid/Unknown resource type
*/
/* Loop until end-of-buffer or an end_tag is found */
while (bytes_parsed < byte_stream_buffer_length) {
/* Get the handler associated with this Descriptor Type */
handler = acpi_rs_get_resource_handler(*byte_stream_buffer);
if (handler) {
/* Convert a byte stream resource to local resource struct */
status = handler(byte_stream_buffer, &bytes_consumed,
&buffer, &structure_size);
} else {
/* Invalid resource type */
status = AE_AML_INVALID_RESOURCE_TYPE;
break;
}
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Update the return value and counter */
/* Set the aligned length of the new resource descriptor */
bytes_parsed += bytes_consumed;
resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
resource->length =
(u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
/* Set the byte stream to point to the next resource */
/* Normal exit on completion of an end_tag resource descriptor */
if (acpi_rs_get_resource_type(*byte_stream_buffer) ==
ACPI_RDESC_TYPE_END_TAG) {
return_ACPI_STATUS(AE_OK);
}
/* Update counter and point to the next input resource */
bytes_parsed += bytes_consumed;
byte_stream_buffer += bytes_consumed;
/* Set the Buffer to the next structure */
/* Point to the next structure in the output buffer */
resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
resource->length =
(u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
}
/* Check the reason for exiting the while loop */
/* Completed buffer, but did not find an end_tag resource descriptor */
if (!end_tag_processed) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
return_ACPI_STATUS(AE_OK);
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_list_to_byte_stream
*
* PARAMETERS: linked_list - Pointer to the resource linked list
* PARAMETERS: Resource - Pointer to the resource linked list
* byte_steam_size_needed - Calculated size of the byte stream
* needed from calling
* acpi_rs_get_byte_stream_length()
......@@ -346,180 +287,52 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list,
acpi_rs_list_to_byte_stream(struct acpi_resource *resource,
acpi_size byte_stream_size_needed,
u8 * output_buffer)
{
acpi_status status;
u8 *buffer = output_buffer;
acpi_size bytes_consumed = 0;
u8 done = FALSE;
acpi_status status;
ACPI_FUNCTION_TRACE("rs_list_to_byte_stream");
while (!done) {
switch (linked_list->id) {
case ACPI_RSTYPE_IRQ:
/*
* IRQ Resource
*/
status =
acpi_rs_irq_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_DMA:
/*
* DMA Resource
*/
status =
acpi_rs_dma_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_START_DPF:
/*
* Start Dependent Functions Resource
*/
status = acpi_rs_start_depend_fns_stream(linked_list,
&buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_END_DPF:
/*
* End Dependent Functions Resource
*/
status = acpi_rs_end_depend_fns_stream(linked_list,
&buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_IO:
/*
* IO Port Resource
*/
status =
acpi_rs_io_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_FIXED_IO:
/*
* Fixed IO Port Resource
*/
status =
acpi_rs_fixed_io_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_VENDOR:
/*
* Vendor Defined Resource
*/
status =
acpi_rs_vendor_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_END_TAG:
/*
* End Tag
*/
status =
acpi_rs_end_tag_stream(linked_list, &buffer,
&bytes_consumed);
/* Convert each resource descriptor in the list */
/* An End Tag indicates the end of the Resource Template */
while (1) {
/* Validate Type before dispatch */
done = TRUE;
break;
case ACPI_RSTYPE_MEM24:
/*
* 24-Bit Memory Resource
*/
status =
acpi_rs_memory24_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_MEM32:
/*
* 32-Bit Memory Range Resource
*/
status =
acpi_rs_memory32_range_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_FIXED_MEM32:
/*
* 32-Bit Fixed Memory Resource
*/
status =
acpi_rs_fixed_memory32_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_ADDRESS16:
/*
* 16-Bit Address Descriptor Resource
*/
status = acpi_rs_address16_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_ADDRESS32:
/*
* 32-Bit Address Descriptor Resource
*/
status = acpi_rs_address32_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_ADDRESS64:
/*
* 64-Bit Address Descriptor Resource
*/
status = acpi_rs_address64_stream(linked_list, &buffer,
&bytes_consumed);
break;
case ACPI_RSTYPE_EXT_IRQ:
/*
* Extended IRQ Resource
*/
status =
acpi_rs_extended_irq_stream(linked_list, &buffer,
&bytes_consumed);
break;
default:
/*
* If we get here, everything is out of sync,
* so exit with an error
*/
if (resource->type > ACPI_RSTYPE_MAX) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid descriptor type (%X) in resource list\n",
linked_list->id));
status = AE_BAD_DATA;
break;
resource->type));
return_ACPI_STATUS(AE_BAD_DATA);
}
/* Perform the conversion, per resource type */
status = acpi_gbl_stream_dispatch[resource->type] (resource,
&buffer,
&bytes_consumed);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Set the Buffer to point to the open byte */
/* Check for end-of-list */
if (resource->type == ACPI_RSTYPE_END_TAG) {
/* An End Tag indicates the end of the Resource Template */
return_ACPI_STATUS(AE_OK);
}
/* Set the Buffer to point to the next (output) resource descriptor */
buffer += bytes_consumed;
/* Point to the next object */
/* Point to the next input resource object */
linked_list = ACPI_PTR_ADD(struct acpi_resource,
linked_list, linked_list->length);
resource = ACPI_PTR_ADD(struct acpi_resource,
resource, resource->length);
}
return_ACPI_STATUS(AE_OK);
}
......@@ -84,11 +84,11 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
/* Point past the Descriptor to get the number of bytes consumed */
buffer += 1;
ACPI_MOVE_16_TO_16(&temp16, buffer);
buffer += 2;
*bytes_consumed = (acpi_size) temp16 + 3;
output_struct->id = ACPI_RSTYPE_MEM24;
output_struct->type = ACPI_RSTYPE_MEM24;
/* Check Byte 3 the Read/Write bit */
......@@ -133,7 +133,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_memory24_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
......@@ -146,7 +146,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_memory24_stream(struct acpi_resource *linked_list,
acpi_rs_memory24_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -155,9 +155,9 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_memory24_stream");
/* The descriptor field is static */
/* The Descriptor Type field is static */
*buffer = 0x81;
*buffer = ACPI_RDESC_TYPE_MEMORY_24;
buffer += 1;
/* The length field is static */
......@@ -168,30 +168,28 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list,
/* Set the Information Byte */
temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01);
temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01);
*buffer = temp8;
buffer += 1;
/* Set the Range minimum base address */
ACPI_MOVE_32_TO_16(buffer,
&linked_list->data.memory24.min_base_address);
ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.min_base_address);
buffer += 2;
/* Set the Range maximum base address */
ACPI_MOVE_32_TO_16(buffer,
&linked_list->data.memory24.max_base_address);
ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.max_base_address);
buffer += 2;
/* Set the base alignment */
ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment);
ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.alignment);
buffer += 2;
/* Set the range length */
ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length);
ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.range_length);
buffer += 2;
/* Return the number of bytes consumed in this operation */
......@@ -238,12 +236,11 @@ acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
/* Point past the Descriptor to get the number of bytes consumed */
buffer += 1;
ACPI_MOVE_16_TO_16(&temp16, buffer);
buffer += 2;
*bytes_consumed = (acpi_size) temp16 + 3;
output_struct->id = ACPI_RSTYPE_MEM32;
output_struct->type = ACPI_RSTYPE_MEM32;
/*
* Point to the place in the output buffer where the data portion will
......@@ -335,8 +332,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
buffer += 2;
*bytes_consumed = (acpi_size) temp16 + 3;
output_struct->id = ACPI_RSTYPE_FIXED_MEM32;
output_struct->type = ACPI_RSTYPE_FIXED_MEM32;
/* Check Byte 3 the Read/Write bit */
......@@ -369,7 +365,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_memory32_range_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
......@@ -382,7 +378,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
acpi_rs_memory32_range_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -391,9 +387,9 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
/* The descriptor field is static */
/* The Descriptor Type field is static */
*buffer = 0x85;
*buffer = ACPI_RDESC_TYPE_MEMORY_32;
buffer += 1;
/* The length field is static */
......@@ -405,30 +401,28 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
/* Set the Information Byte */
temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01);
temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01);
*buffer = temp8;
buffer += 1;
/* Set the Range minimum base address */
ACPI_MOVE_32_TO_32(buffer,
&linked_list->data.memory32.min_base_address);
ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.min_base_address);
buffer += 4;
/* Set the Range maximum base address */
ACPI_MOVE_32_TO_32(buffer,
&linked_list->data.memory32.max_base_address);
ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.max_base_address);
buffer += 4;
/* Set the base alignment */
ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment);
ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.alignment);
buffer += 4;
/* Set the range length */
ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length);
ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.range_length);
buffer += 4;
/* Return the number of bytes consumed in this operation */
......@@ -441,7 +435,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
*
* FUNCTION: acpi_rs_fixed_memory32_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
......@@ -454,7 +448,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
******************************************************************************/
acpi_status
acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
acpi_rs_fixed_memory32_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -463,9 +457,9 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
/* The descriptor field is static */
/* The Descriptor Type field is static */
*buffer = 0x86;
*buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
buffer += 1;
/* The length field is static */
......@@ -478,21 +472,19 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
/* Set the Information Byte */
temp8 =
(u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01);
(u8) (resource->data.fixed_memory32.read_write_attribute & 0x01);
*buffer = temp8;
buffer += 1;
/* Set the Range base address */
ACPI_MOVE_32_TO_32(buffer,
&linked_list->data.fixed_memory32.
range_base_address);
&resource->data.fixed_memory32.range_base_address);
buffer += 4;
/* Set the range length */
ACPI_MOVE_32_TO_32(buffer,
&linked_list->data.fixed_memory32.range_length);
ACPI_MOVE_32_TO_32(buffer, &resource->data.fixed_memory32.range_length);
buffer += 4;
/* Return the number of bytes consumed in this operation */
......
......@@ -47,6 +47,169 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rsmisc")
/*******************************************************************************
*
* FUNCTION: acpi_rs_generic_register_resource
*
* 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
*
* 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.
*
******************************************************************************/
acpi_status
acpi_rs_generic_register_resource(u8 * byte_stream_buffer,
acpi_size * bytes_consumed,
u8 ** output_buffer,
acpi_size * structure_size)
{
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_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;
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_generic_register_stream
*
* 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
*
* RETURN: Status
*
* DESCRIPTION: Take the linked list resource structure and fills in the
* the appropriate bytes in a byte stream
*
******************************************************************************/
acpi_status
acpi_rs_generic_register_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
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_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);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_end_tag_resource
......@@ -67,6 +230,7 @@ ACPI_MODULE_NAME("rsmisc")
* number of bytes consumed from the byte stream.
*
******************************************************************************/
acpi_status
acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
acpi_size * bytes_consumed,
......@@ -81,9 +245,9 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
*bytes_consumed = 2;
/* Fill out the structure */
/* Fill out the structure */
output_struct->id = ACPI_RSTYPE_END_TAG;
output_struct->type = ACPI_RSTYPE_END_TAG;
/* Set the Length parameter */
......@@ -99,7 +263,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_end_tag_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
......@@ -112,7 +276,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
acpi_rs_end_tag_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -120,9 +284,9 @@ acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_end_tag_stream");
/* The descriptor field is static */
/* The Descriptor Type field is static */
*buffer = 0x79;
*buffer = ACPI_RDESC_TYPE_END_TAG | 0x01;
buffer += 1;
/*
......@@ -180,7 +344,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
temp8 = *buffer;
if (temp8 & 0x80) {
if (temp8 & ACPI_RDESC_TYPE_LARGE) {
/* Large Item, point to the length field */
buffer += 1;
......@@ -210,7 +374,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
buffer += 1;
}
output_struct->id = ACPI_RSTYPE_VENDOR;
output_struct->type = ACPI_RSTYPE_VENDOR;
output_struct->data.vendor_specific.length = temp16;
for (index = 0; index < temp16; index++) {
......@@ -239,7 +403,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_vendor_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
......@@ -252,7 +416,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_vendor_stream(struct acpi_resource *linked_list,
acpi_rs_vendor_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -264,21 +428,21 @@ acpi_rs_vendor_stream(struct acpi_resource *linked_list,
/* Dereference the length to find if this is a large or small item. */
if (linked_list->data.vendor_specific.length > 7) {
if (resource->data.vendor_specific.length > 7) {
/* Large Item, Set the descriptor field and length bytes */
*buffer = 0x84;
*buffer = ACPI_RDESC_TYPE_LARGE_VENDOR;
buffer += 1;
temp16 = (u16) linked_list->data.vendor_specific.length;
temp16 = (u16) resource->data.vendor_specific.length;
ACPI_MOVE_16_TO_16(buffer, &temp16);
buffer += 2;
} else {
/* Small Item, Set the descriptor field */
temp8 = 0x70;
temp8 |= (u8) linked_list->data.vendor_specific.length;
temp8 = ACPI_RDESC_TYPE_SMALL_VENDOR;
temp8 |= (u8) resource->data.vendor_specific.length;
*buffer = temp8;
buffer += 1;
......@@ -286,9 +450,8 @@ acpi_rs_vendor_stream(struct acpi_resource *linked_list,
/* Loop through all of the Vendor Specific fields */
for (index = 0; index < linked_list->data.vendor_specific.length;
index++) {
temp8 = linked_list->data.vendor_specific.reserved[index];
for (index = 0; index < resource->data.vendor_specific.length; index++) {
temp8 = resource->data.vendor_specific.reserved[index];
*buffer = temp8;
buffer += 1;
......@@ -341,7 +504,7 @@ acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
*bytes_consumed = (temp8 & 0x01) + 1;
output_struct->id = ACPI_RSTYPE_START_DPF;
output_struct->type = ACPI_RSTYPE_START_DPF;
/* Point to Byte 1 if it is used */
......@@ -421,7 +584,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
/* Fill out the structure */
output_struct->id = ACPI_RSTYPE_END_DPF;
output_struct->type = ACPI_RSTYPE_END_DPF;
/* Set the Length parameter */
......@@ -437,7 +600,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_start_depend_fns_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 - u32 pointer that is filled with
* the number of bytes of the
......@@ -451,7 +614,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
acpi_rs_start_depend_fns_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
......@@ -460,26 +623,25 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
/*
* The descriptor field is set based upon whether a byte is needed
* The descriptor type field is set based upon whether a byte is needed
* to contain Priority data.
*/
if (ACPI_ACCEPTABLE_CONFIGURATION ==
linked_list->data.start_dpf.compatibility_priority &&
resource->data.start_dpf.compatibility_priority &&
ACPI_ACCEPTABLE_CONFIGURATION ==
linked_list->data.start_dpf.performance_robustness) {
*buffer = 0x30;
resource->data.start_dpf.performance_robustness) {
*buffer = ACPI_RDESC_TYPE_START_DEPENDENT;
} else {
*buffer = 0x31;
*buffer = ACPI_RDESC_TYPE_START_DEPENDENT | 0x01;
buffer += 1;
/* Set the Priority Byte Definition */
temp8 = 0;
temp8 =
(u8) ((linked_list->data.start_dpf.
performance_robustness & 0x03) << 2);
temp8 |=
(linked_list->data.start_dpf.compatibility_priority & 0x03);
temp8 = (u8) ((resource->data.start_dpf.performance_robustness &
0x03) << 2);
temp8 |= (resource->data.start_dpf.compatibility_priority &
0x03);
*buffer = temp8;
}
......@@ -495,7 +657,7 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
*
* FUNCTION: acpi_rs_end_depend_fns_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
......@@ -508,16 +670,16 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
******************************************************************************/
acpi_status
acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
acpi_rs_end_depend_fns_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
/* The descriptor field is static */
/* The Descriptor Type field is static */
*buffer = 0x38;
*buffer = ACPI_RDESC_TYPE_END_DEPENDENT;
buffer += 1;
/* Return the number of bytes consumed in this operation */
......
......@@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle,
/* Walk the resource list */
for (;;) {
if (!resource || resource->id == ACPI_RSTYPE_END_TAG) {
if (!resource || resource->type == ACPI_RSTYPE_END_TAG) {
break;
}
......@@ -360,8 +360,8 @@ EXPORT_SYMBOL(acpi_set_current_resources);
*
* FUNCTION: acpi_resource_to_address64
*
* PARAMETERS: resource - Pointer to a resource
* out - Pointer to the users's return
* PARAMETERS: Resource - Pointer to a resource
* Out - Pointer to the users's return
* buffer (a struct
* struct acpi_resource_address64)
*
......@@ -381,7 +381,7 @@ acpi_resource_to_address64(struct acpi_resource *resource,
struct acpi_resource_address16 *address16;
struct acpi_resource_address32 *address32;
switch (resource->id) {
switch (resource->type) {
case ACPI_RSTYPE_ADDRESS16:
address16 = (struct acpi_resource_address16 *)&resource->data;
......
......@@ -811,7 +811,7 @@ u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc)
while (buffer < end_buffer) {
buffer_byte = *buffer;
if (buffer_byte & ACPI_RDESC_TYPE_MASK) {
if (buffer_byte & ACPI_RDESC_TYPE_LARGE) {
/* Large Descriptor - Length is next 2 bytes */
buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3);
......
......@@ -214,7 +214,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
* the ACPI subsystem code.
*/
for (i = mutex_id; i < MAX_MUTEX; i++) {
if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
if (i == mutex_id) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Mutex [%s] already acquired by this thread [%X]\n",
......@@ -313,7 +313,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
* the ACPI subsystem code.
*/
for (i = mutex_id; i < MAX_MUTEX; i++) {
if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
if (i == mutex_id) {
continue;
}
......
......@@ -61,9 +61,9 @@
*
*/
/* Version string */
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20050902
#define ACPI_CA_VERSION 0x20050916
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
......
......@@ -187,73 +187,73 @@ void acpi_dm_decode_attribute(u8 attribute);
* dmresrcl
*/
void
acpi_dm_word_descriptor(struct asl_word_address_desc *resource,
acpi_dm_word_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource,
acpi_dm_dword_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource,
acpi_dm_extended_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource,
acpi_dm_qword_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource,
acpi_dm_memory24_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource,
acpi_dm_memory32_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource,
u32 length, u32 level);
acpi_dm_fixed_memory32_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource,
acpi_dm_generic_register_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource,
acpi_dm_interrupt_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource,
acpi_dm_vendor_large_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
/*
* dmresrcs
*/
void
acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource,
acpi_dm_irq_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource,
acpi_dm_dma_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level);
acpi_dm_io_descriptor(union asl_resource_desc *resource, u32 length, u32 level);
void
acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource,
acpi_dm_fixed_io_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource,
acpi_dm_start_dependent_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource,
acpi_dm_end_dependent_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource,
acpi_dm_vendor_small_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
/*
......
......@@ -744,12 +744,13 @@ struct acpi_bit_register_info {
#define ACPI_RDESC_TYPE_LARGE 0x80
#define ACPI_RDESC_TYPE_SMALL 0x00
#define ACPI_RDESC_TYPE_MASK 0x80
#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
#define ACPI_RDESC_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
#define ACPI_RDESC_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
#define ACPI_RDESC_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
/*
* Small resource descriptor types
* Note: The 3 length bits (2:0) must be zero
* Note: Bits 2:0 are used for the descriptor length
*/
#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
......@@ -757,6 +758,10 @@ struct acpi_bit_register_info {
#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
#define ACPI_RDESC_TYPE_IO_PORT 0x40
#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
#define ACPI_RDESC_TYPE_RESERVED_S1 0x50
#define ACPI_RDESC_TYPE_RESERVED_S2 0x58
#define ACPI_RDESC_TYPE_RESERVED_S3 0x60
#define ACPI_RDESC_TYPE_RESERVED_S4 0x68
#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
#define ACPI_RDESC_TYPE_END_TAG 0x78
......@@ -764,7 +769,8 @@ struct acpi_bit_register_info {
* Large resource descriptor types
*/
#define ACPI_RDESC_TYPE_MEMORY_24 0x81
#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
#define ACPI_RDESC_TYPE_GENERIC_REGISTER 0x82
#define ACPI_RDESC_TYPE_RESERVED_L1 0x83
#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
#define ACPI_RDESC_TYPE_MEMORY_32 0x85
#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
......@@ -773,6 +779,15 @@ struct acpi_bit_register_info {
#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B
#define ACPI_RDESC_LARGE_MAX 0x8B
/*
* Minimum lengths for descriptors with optional fields
*/
#define ACPI_RDESC_QWORD_MIN 43
#define ACPI_RDESC_DWORD_MIN 23
#define ACPI_RDESC_WORD_MIN 13
#define ACPI_RDESC_EXT_XRUPT_MIN 6
/*****************************************************************************
*
......
此差异已折叠。
......@@ -1125,6 +1125,14 @@ struct acpi_resource_ext_irq {
u32 interrupts[1];
};
struct acpi_resource_generic_reg {
u32 space_id;
u32 bit_width;
u32 bit_offset;
u32 address_size;
u64 address;
};
/* ACPI_RESOURCE_TYPEs */
#define ACPI_RSTYPE_IRQ 0
......@@ -1142,6 +1150,8 @@ struct acpi_resource_ext_irq {
#define ACPI_RSTYPE_ADDRESS32 12
#define ACPI_RSTYPE_ADDRESS64 13
#define ACPI_RSTYPE_EXT_IRQ 14
#define ACPI_RSTYPE_GENERIC_REG 15
#define ACPI_RSTYPE_MAX 15
typedef u32 acpi_resource_type;
......@@ -1161,10 +1171,11 @@ union acpi_resource_data {
struct acpi_resource_address32 address32;
struct acpi_resource_address64 address64;
struct acpi_resource_ext_irq extended_irq;
struct acpi_resource_generic_reg generic_reg;
};
struct acpi_resource {
acpi_resource_type id;
acpi_resource_type type;
u32 length;
union acpi_resource_data data;
};
......
此差异已折叠。
......@@ -68,6 +68,7 @@
#define ACPI_APPLICATION
#define ACPI_DEBUGGER
#define ACPI_DISASSEMBLER
#define ACPI_MUTEX_DEBUG
#endif
#ifdef ACPI_ASL_COMPILER
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册