summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsmisc.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-11-17 13:07:00 -0500
committerLen Brown <len.brown@intel.com>2005-12-10 00:27:56 -0500
commitc51a4de85de720670f2fbc592a6f8040af72ad87 (patch)
treeccaa60c483fcc904abd63d936ff7dc380bf28e7b /drivers/acpi/resources/rsmisc.c
parent96db255c8f014ae3497507104e8df809785a619f (diff)
[ACPI] ACPICA 20051117
Fixed a problem in the AML parser where the method thread count could be decremented below zero if any errors occurred during the method parse phase. This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during table load. Related to the problem above, this was causing unwind issues if any errors occurred during the parse, and it seemed to be overkill. A table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. Fixed a problem with the new table-driven resource manager where an internal buffer overflow could occur for small resource templates. Implemented a new external interface, acpi_get_vendor_resource() This interface will find and return a vendor-defined resource descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID match. (from Bjorn Helgaas) Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) any implicit conversion of a Buffer to a String, 2) a String object result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rsmisc.c')
-rw-r--r--drivers/acpi/resources/rsmisc.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index 16ad3bfbee2..e1b5aa2af9a 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -104,8 +104,9 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
* Source is the external AML byte stream buffer,
* destination is the internal resource descriptor
*/
- source = ((u8 *) aml) + info->aml_offset;
- destination = ((u8 *) resource) + info->resource_offset;
+ source = ACPI_ADD_PTR(void, aml, info->aml_offset);
+ destination =
+ ACPI_ADD_PTR(void, resource, info->resource_offset);
switch (info->opcode) {
case ACPI_RSC_INITGET:
@@ -129,22 +130,22 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
/*
* Mask and shift the flag bit
*/
- *((u8 *) destination) = (u8)
- ((*((u8 *) source) >> info->value) & 0x01);
+ ACPI_SET8(destination) = (u8)
+ ((ACPI_GET8(source) >> info->value) & 0x01);
break;
case ACPI_RSC_2BITFLAG:
/*
* Mask and shift the flag bits
*/
- *((u8 *) destination) = (u8)
- ((*((u8 *) source) >> info->value) & 0x03);
+ ACPI_SET8(destination) = (u8)
+ ((ACPI_GET8(source) >> info->value) & 0x03);
break;
case ACPI_RSC_COUNT:
- item_count = *((u8 *) source);
- *((u8 *) destination) = (u8) item_count;
+ item_count = ACPI_GET8(source);
+ ACPI_SET8(destination) = (u8) item_count;
resource->length = resource->length +
(info->value * (item_count - 1));
@@ -153,7 +154,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
case ACPI_RSC_COUNT16:
item_count = aml_resource_length;
- *((u16 *) destination) = item_count;
+ ACPI_SET16(destination) = item_count;
resource->length = resource->length +
(info->value * (item_count - 1));
@@ -186,9 +187,8 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
case ACPI_RSC_DATA8:
- target = ((char *)resource) + info->value;
- ACPI_MEMCPY(destination, source,
- *(ACPI_CAST_PTR(u16, target)));
+ target = ACPI_ADD_PTR(char, resource, info->value);
+ ACPI_MEMCPY(destination, source, ACPI_GET16(target));
break;
case ACPI_RSC_ADDRESS:
@@ -217,8 +217,8 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
* complicated case used by the Interrupt() macro
*/
target =
- ((char *)resource) + info->aml_offset +
- (item_count * 4);
+ ACPI_ADD_PTR(char, resource,
+ info->aml_offset + (item_count * 4));
resource->length +=
acpi_rs_get_resource_source(aml_resource_length,
@@ -230,15 +230,14 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
* 8-bit encoded bitmask (DMA macro)
*/
item_count =
- acpi_rs_decode_bitmask(*((u8 *) source),
+ acpi_rs_decode_bitmask(ACPI_GET8(source),
destination);
if (item_count) {
- resource->length +=
- resource->length + (item_count - 1);
+ resource->length += (item_count - 1);
}
- target = ((char *)resource) + info->value;
- *((u8 *) target) = (u8) item_count;
+ target = ACPI_ADD_PTR(char, resource, info->value);
+ ACPI_SET8(target) = (u8) item_count;
break;
case ACPI_RSC_BITMASK16:
@@ -250,12 +249,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
item_count =
acpi_rs_decode_bitmask(temp16, destination);
if (item_count) {
- resource->length =
- resource->length + (item_count - 1);
+ resource->length += (item_count - 1);
}
- target = ((char *)resource) + info->value;
- *((u8 *) target) = (u8) item_count;
+ target = ACPI_ADD_PTR(char, resource, info->value);
+ ACPI_SET8(target) = (u8) item_count;
break;
case ACPI_RSC_EXIT_NE:
@@ -270,7 +268,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
break;
case ACPI_RSC_COMPARE_VALUE:
- if (*((u8 *) source) != info->value) {
+ if (ACPI_GET8(source) != info->value) {
goto exit;
}
break;
@@ -349,8 +347,8 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
* Source is the internal resource descriptor,
* destination is the external AML byte stream buffer
*/
- source = ((u8 *) resource) + info->resource_offset;
- destination = ((u8 *) aml) + info->aml_offset;
+ source = ACPI_ADD_PTR(void, resource, info->resource_offset);
+ destination = ACPI_ADD_PTR(void, aml, info->aml_offset);
switch (info->opcode) {
case ACPI_RSC_INITSET:
@@ -368,37 +366,38 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
/*
* Clear the flag byte
*/
- *((u8 *) destination) = 0;
+ ACPI_SET8(destination) = 0;
break;
case ACPI_RSC_1BITFLAG:
/*
* Mask and shift the flag bit
*/
- *((u8 *) destination) |= (u8)
- ((*((u8 *) source) & 0x01) << info->value);
+ ACPI_SET8(destination) |= (u8)
+ ((ACPI_GET8(source) & 0x01) << info->value);
break;
case ACPI_RSC_2BITFLAG:
/*
* Mask and shift the flag bits
*/
- *((u8 *) destination) |= (u8)
- ((*((u8 *) source) & 0x03) << info->value);
+ ACPI_SET8(destination) |= (u8)
+ ((ACPI_GET8(source) & 0x03) << info->value);
break;
case ACPI_RSC_COUNT:
- item_count = *((u8 *) source);
- *((u8 *) destination) = (u8) item_count;
+ item_count = ACPI_GET8(source);
+ ACPI_SET8(destination) = (u8) item_count;
- aml_length = (u16) (aml_length +
- (info->value * (item_count - 1)));
+ aml_length =
+ (u16) (aml_length +
+ (info->value * (item_count - 1)));
break;
case ACPI_RSC_COUNT16:
- item_count = *((u16 *) source);
+ item_count = ACPI_GET16(source);
aml_length = (u16) (aml_length + item_count);
acpi_rs_set_resource_length(aml_length, aml);
break;
@@ -453,20 +452,21 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
/*
* 8-bit encoded bitmask (DMA macro)
*/
- *((u8 *) destination) = (u8)
+ ACPI_SET8(destination) = (u8)
acpi_rs_encode_bitmask(source,
- *(((u8 *) resource) +
- info->value));
+ *ACPI_ADD_PTR(u8, resource,
+ info->value));
break;
case ACPI_RSC_BITMASK16:
/*
* 16-bit encoded bitmask (IRQ macro)
*/
- temp16 =
- acpi_rs_encode_bitmask(source,
- *(((u8 *) resource) +
- info->value));
+ temp16 = acpi_rs_encode_bitmask(source,
+ *ACPI_ADD_PTR(u8,
+ resource,
+ info->
+ value));
ACPI_MOVE_16_TO_16(destination, &temp16);
break;
@@ -485,9 +485,9 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
*/
switch (COMPARE_OPCODE(info)) {
case ACPI_RSC_COMPARE_VALUE:
- if (*
- ((u8 *) (((u8 *) resource) +
- COMPARE_TARGET(info))) !=
+
+ if (*ACPI_ADD_PTR(u8, resource,
+ COMPARE_TARGET(info)) !=
COMPARE_VALUE(info)) {
goto exit;
}