aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/executer/exfldio.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-06-23 17:04:00 -0400
committerLen Brown <len.brown@intel.com>2006-06-28 03:11:38 -0400
commit967440e3be1af06ad4dc7bb18d2e3c16130fe067 (patch)
treec9bbf70475333f4f169838ed88233f8410010677 /drivers/acpi/executer/exfldio.c
parent95b38b3f453c16de0f8cddcde3e71050bbfb37b9 (diff)
ACPI: ACPICA 20060623
Implemented a new acpi_spinlock type for the OSL lock interfaces. This allows the type to be customized to the host OS for improved efficiency (since a spinlock is usually a very small object.) Implemented support for "ignored" bits in the ACPI registers. According to the ACPI specification, these bits should be preserved when writing the registers via a read/modify/write cycle. There are 3 bits preserved in this manner: PM1_CONTROL[0] (SCI_EN), PM1_CONTROL[9], and PM1_STATUS[11]. http://bugzilla.kernel.org/show_bug.cgi?id=3691 Implemented the initial deployment of new OSL mutex interfaces. Since some host operating systems have separate mutex and semaphore objects, this feature was requested. The base code now uses mutexes (and the new mutex interfaces) wherever a binary semaphore was used previously. However, for the current release, the mutex interfaces are defined as macros to map them to the existing semaphore interfaces. Fixed several problems with the support for the control method SyncLevel parameter. The SyncLevel now works according to the ACPI specification and in concert with the Mutex SyncLevel parameter, since the current SyncLevel is a property of the executing thread. Mutual exclusion for control methods is now implemented with a mutex instead of a semaphore. Fixed three instances of the use of the C shift operator in the bitfield support code (exfldio.c) to avoid the use of a shift value larger than the target data width. The behavior of C compilers is undefined in this case and can cause unpredictable results, and therefore the case must be detected and avoided. (Fiodor Suietov) Added an info message whenever an SSDT or OEM table is loaded dynamically via the Load() or LoadTable() ASL operators. This should improve debugging capability since it will show exactly what tables have been loaded (beyond the tables present in the RSDT/XSDT.) Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer/exfldio.c')
-rw-r--r--drivers/acpi/executer/exfldio.c71
1 files changed, 55 insertions, 16 deletions
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index 051053f7ccc..40f0bee6faa 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -727,11 +727,23 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(status);
}
- /* Merge with previous datum if necessary */
-
- merged_datum |= raw_datum <<
- (obj_desc->common_field.access_bit_width -
- obj_desc->common_field.start_field_bit_offset);
+ /*
+ * Merge with previous datum if necessary.
+ *
+ * Note: Before the shift, check if the shift value will be larger than
+ * the integer size. If so, there is no need to perform the operation.
+ * This avoids the differences in behavior between different compilers
+ * concerning shift values larger than the target data width.
+ */
+ if ((obj_desc->common_field.access_bit_width -
+ obj_desc->common_field.start_field_bit_offset) <
+ ACPI_INTEGER_BIT_SIZE) {
+ merged_datum |=
+ raw_datum << (obj_desc->common_field.
+ access_bit_width -
+ obj_desc->common_field.
+ start_field_bit_offset);
+ }
if (i == datum_count) {
break;
@@ -808,13 +820,23 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
}
- /* Compute the number of datums (access width data items) */
+ /*
+ * Create the bitmasks used for bit insertion.
+ * Note: This if/else is used to bypass compiler differences with the
+ * shift operator
+ */
+ if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) {
+ width_mask = ACPI_INTEGER_MAX;
+ } else {
+ width_mask =
+ ACPI_MASK_BITS_ABOVE(obj_desc->common_field.
+ access_bit_width);
+ }
- width_mask =
- ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width);
- mask =
- width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field.
- start_field_bit_offset);
+ mask = width_mask &
+ ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
+
+ /* Compute the number of datums (access width data items) */
datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
obj_desc->common_field.access_bit_width);
@@ -848,12 +870,29 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(status);
}
- /* Start new output datum by merging with previous input datum */
-
field_offset += obj_desc->common_field.access_byte_width;
- merged_datum = raw_datum >>
- (obj_desc->common_field.access_bit_width -
- obj_desc->common_field.start_field_bit_offset);
+
+ /*
+ * Start new output datum by merging with previous input datum
+ * if necessary.
+ *
+ * Note: Before the shift, check if the shift value will be larger than
+ * the integer size. If so, there is no need to perform the operation.
+ * This avoids the differences in behavior between different compilers
+ * concerning shift values larger than the target data width.
+ */
+ if ((obj_desc->common_field.access_bit_width -
+ obj_desc->common_field.start_field_bit_offset) <
+ ACPI_INTEGER_BIT_SIZE) {
+ merged_datum =
+ raw_datum >> (obj_desc->common_field.
+ access_bit_width -
+ obj_desc->common_field.
+ start_field_bit_offset);
+ } else {
+ merged_datum = 0;
+ }
+
mask = width_mask;
if (i == datum_count) {