[PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
by Adam Goode
This introduces a generic OSL interface for reading and writing
SystemCMOS spaces. It is needed on Linux for registering a generic
handler for SystemCMOS because some firmware accesses CMOS in _INI.
(The first time I sent a somewhat corrupted patch file. This one should
be better).
---
source/components/events/evhandler.c | 1 +
source/components/executer/exregion.c | 23 +++++++++
source/include/acconfig.h | 2 +-
source/include/acpiosxf.h | 18 +++++++
source/os_specific/service_layers/osunixxf.c | 64 +++++++++++++++++++++++
source/os_specific/service_layers/oswinxf.c | 64 +++++++++++++++++++++++
tests/aapits/atosxfctrl.c | 2 +
tests/aapits/atosxfctrl.h | 3 ++
tests/aapits/atosxfwrap.c | 76 ++++++++++++++++++++++++++++
tests/aapits/atosxfwrap.h | 16 ++++++
10 files changed, 268 insertions(+), 1 deletion(-)
diff --git a/source/components/events/evhandler.c b/source/components/events/evhandler.c
index d02ea53..634c18e 100644
--- a/source/components/events/evhandler.c
+++ b/source/components/events/evhandler.c
@@ -139,6 +139,7 @@ UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_DATA_TABLE
};
diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c
index 31bbb60..bd9addd 100644
--- a/source/components/executer/exregion.c
+++ b/source/components/executer/exregion.c
@@ -551,6 +551,29 @@ AcpiExCmosSpaceHandler (
ACPI_FUNCTION_TRACE (ExCmosSpaceHandler);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "System-CMOS (width %u) R/W %u Address=%8.8X%8.8X\n",
+ BitWidth, Function, ACPI_FORMAT_UINT64(Address)));
+
+ switch (Function)
+ {
+ case ACPI_READ:
+
+ *Value = 0;
+ Status = AcpiOsReadCmos(Address, Value, BitWidth);
+ break;
+
+ case ACPI_WRITE:
+
+ Status = AcpiOsWriteCmos(Address, *Value, BitWidth);
+ break;
+
+ default:
+
+ Status = AE_BAD_PARAMETER;
+ break;
+ }
+
return_ACPI_STATUS (Status);
}
diff --git a/source/include/acconfig.h b/source/include/acconfig.h
index 41fa33d..dcecfa7 100644
--- a/source/include/acconfig.h
+++ b/source/include/acconfig.h
@@ -270,7 +270,7 @@
/* Maximum SpaceIds for Operation Regions */
#define ACPI_MAX_ADDRESS_SPACE 255
-#define ACPI_NUM_DEFAULT_SPACES 4
+#define ACPI_NUM_DEFAULT_SPACES 5
/* Array sizes. Used for range checking also */
diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h
index 68d79c7..31523ea 100644
--- a/source/include/acpiosxf.h
+++ b/source/include/acpiosxf.h
@@ -452,6 +452,24 @@ AcpiOsWritePort (
UINT32 Width);
#endif
+/*
+ * Platform and hardware-independent CMOS memory interfaces
+ */
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadCmos
+ACPI_STATUS
+AcpiOsReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteCmos
+ACPI_STATUS
+AcpiOsWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width);
+#endif
/*
* Platform and hardware-independent physical memory interfaces
diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index c48f581..b763ddc 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -1361,6 +1361,70 @@ AcpiOsWritePort (
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiOsReadCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to read
+ * Value - Where value is placed
+ * Width - Number of bits
+ *
+ * RETURN: Value read from CMOS memory
+ *
+ * DESCRIPTION: Read data from CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width)
+{
+
+ switch (Width)
+ {
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+
+ *Value = 0;
+ break;
+
+ default:
+
+ return (AE_BAD_PARAMETER);
+ }
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWriteCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to write
+ * Value - Value to write
+ * Width - Number of bits
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiOsReadMemory
diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c
index 66ce8c8..80086fd 100644
--- a/source/os_specific/service_layers/oswinxf.c
+++ b/source/os_specific/service_layers/oswinxf.c
@@ -1356,6 +1356,70 @@ AcpiOsWritePort (
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiOsReadCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to read
+ * Value - Where value is placed
+ * Width - Number of bits
+ *
+ * RETURN: Value read from CMOS memory
+ *
+ * DESCRIPTION: Read data from CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width)
+{
+
+ switch (Width)
+ {
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+
+ *Value = 0;
+ break;
+
+ default:
+
+ return (AE_BAD_PARAMETER);
+ }
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWriteCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to write
+ * Value - Value to write
+ * Width - Number of bits
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiOsReadMemory
diff --git a/tests/aapits/atosxfctrl.c b/tests/aapits/atosxfctrl.c
index fe8b562..9a6b41c 100644
--- a/tests/aapits/atosxfctrl.c
+++ b/tests/aapits/atosxfctrl.c
@@ -160,6 +160,8 @@ const char *OsxfNames[] = {
"AcpiOsDerivePciId",
"AcpiOsReadPort",
"AcpiOsWritePort",
+ "AcpiOsReadCmos",
+ "AcpiOsWriteCmos",
"AcpiOsReadMemory",
"AcpiOsWriteMemory",
"AcpiOsSignal"};
diff --git a/tests/aapits/atosxfctrl.h b/tests/aapits/atosxfctrl.h
index 66a361d..2c8b9e5 100644
--- a/tests/aapits/atosxfctrl.h
+++ b/tests/aapits/atosxfctrl.h
@@ -162,6 +162,8 @@ typedef enum
AcpiOsDerivePciIdC,
AcpiOsReadPortC,
AcpiOsWritePortC,
+ AcpiOsReadCmosC,
+ AcpiOsWriteCmosC,
AcpiOsReadMemoryC,
AcpiOsWriteMemoryC,
AcpiOsSignalC,
@@ -229,6 +231,7 @@ typedef struct acpi_os_emul_reg
*/
#define EMUL_REG_SYS 0x01
#define EMUL_REG_IO 0x02
+#define EMUL_REG_CMOS 0x03
/*
* Fixed ACPI h/w emulated registers numbers
diff --git a/tests/aapits/atosxfwrap.c b/tests/aapits/atosxfwrap.c
index 7c5de39..0088212 100644
--- a/tests/aapits/atosxfwrap.c
+++ b/tests/aapits/atosxfwrap.c
@@ -1272,6 +1272,82 @@ AcpiOsWritePort (
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiOsReadCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to read
+ * Value - Where value is placed
+ * Width - Number of bits
+ *
+ * RETURN: Value read from CMOS memory
+ *
+ * DESCRIPTION: Read data from CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width)
+{
+ AT_CTRL_DECL(AcpiOsReadCmos);
+
+ AT_CHCK_RET_STATUS(AcpiOsReadCmos);
+
+ if (!EMUL_REG_MODE) {
+ Status = AcpiOsActualReadCmos(Address, Value, Width);
+ }
+ else
+ {
+ Status = OsxfCtrlReadReg(EMUL_REG_CMOS, Address, Value, Width);
+ }
+
+ AT_CTRL_SUCCESS(AcpiOsReadCmos);
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWriteCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to write
+ * Value - Value to write
+ * Width - Number of bits
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width)
+{
+ AT_CTRL_DECL(AcpiOsWriteCmos);
+
+ AT_CHCK_RET_STATUS(AcpiOsWriteCmos);
+
+ if (!EMUL_REG_MODE) {
+ Status = AcpiOsActualWriteCmos(Address, Value, Width);
+ }
+ else
+ {
+ Status = OsxfCtrlWriteReg(EMUL_REG_CMOS, Address, Value, Width);
+ }
+
+ AT_CTRL_SUCCESS(AcpiOsWriteCmos);
+
+ return (Status);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiOsReadMemory
diff --git a/tests/aapits/atosxfwrap.h b/tests/aapits/atosxfwrap.h
index 27224d0..48e2100 100644
--- a/tests/aapits/atosxfwrap.h
+++ b/tests/aapits/atosxfwrap.h
@@ -324,6 +324,22 @@ AcpiOsActualWritePort (
/*
+ * Platform and hardware-independent CMOS memory interfaces
+ */
+ACPI_STATUS
+AcpiOsActualReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width);
+
+ACPI_STATUS
+AcpiOsActualWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width);
+
+
+/*
* Platform and hardware-independent physical memory interfaces
*/
ACPI_STATUS
--
2.3.7
4 years, 10 months
Re: [Devel] [PATCH] ACPICA: fix Thunderbolt hotplug
by Moore, Robert
This patch looks familiar, we may have it fixed already.
Lv should know.
Bob
>
> Cc: Robert Moore <robert.moore(a)intel.com>
> Cc: Lv Zheng <lv.zheng(a)intel.com>
> Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
> ---
> source/components/dispatcher/dsmethod.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/source/components/dispatcher/dsmethod.c
> b/source/components/dispatcher/dsmethod.c
> index a861838..ceb6c75 100644
> --- a/source/components/dispatcher/dsmethod.c
> +++ b/source/components/dispatcher/dsmethod.c
> @@ -532,6 +532,9 @@ AcpiDsBeginMethodExecution (
> {
> ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
> ObjDesc->Method.Mutex->Mutex.SyncLevel;
> +
> + ObjDesc->Method.Mutex->Mutex.ThreadId =
> + AcpiOsGetThreadId();
> }
> }
>
> --
> 1.7.9.3
4 years, 11 months
Re: [Devel] [PATCH] ACPICA: Remove unnecessary "\n" from an ACPI_INFO boot message
by Moore, Robert
Actually, I did in fact put that there to break up the output after the tables are loaded. Is this a problem?
> -----Original Message-----
> From: Daniel Bristot de Oliveira [mailto:bristot@redhat.com]
> Sent: Monday, March 28, 2016 10:59 AM
> To: Moore, Robert; Zheng, Lv; Wysocki, Rafael J; Len Brown
> Cc: linux-acpi(a)vger.kernel.org; devel(a)acpica.org; linux-
> kernel(a)vger.kernel.org
> Subject: [PATCH] ACPICA: Remove unnecessary "\n" from an ACPI_INFO boot
> message
>
> A "\n" at the end of bellow ACPI_INFO message is causing a blank line in
> the kernel log:
>
> ACPI_INFO(("%u ACPI AML tables successfully acquired and loaded\n",
> tables_loaded));
>
> This patch removes the "\n".
>
> Kernel log before this patch:
> ACPI: Core revision 20160108
> ACPI: 2 ACPI AML tables successfully acquired and loaded
>
> Security Framework initialized
>
> Kernel log after this patch:
> ACPI: Core revision 20160108
> ACPI: 2 ACPI AML tables successfully acquired and loaded
> Security Framework initialized
>
> Signed-off-by: Daniel Bristot de Oliveira <bristot(a)redhat.com>
>
> diff --git a/drivers/acpi/acpica/tbxfload.c
> b/drivers/acpi/acpica/tbxfload.c index 3151968..e435b84 100644
> --- a/drivers/acpi/acpica/tbxfload.c
> +++ b/drivers/acpi/acpica/tbxfload.c
> @@ -240,7 +240,8 @@ acpi_status acpi_tb_load_namespace(void)
> }
>
> if (!tables_failed) {
> - ACPI_INFO(("%u ACPI AML tables successfully acquired and
> loaded\n", tables_loaded));
> + ACPI_INFO(("%u ACPI AML tables successfully acquired and
> loaded",
> + tables_loaded));
> } else {
> ACPI_ERROR((AE_INFO,
> "%u table load failures, %u successful",
> --
> 2.5.0
4 years, 11 months
Re: [Devel] [RFC PATCH] acpi: Use a more normal logging style for ACPI_<LEVEL> calls
by Moore, Robert
> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Tuesday, March 29, 2016 9:57 AM
> To: Moore, Robert; Zheng, Lv; Wysocki, Rafael J; Len Brown
> Cc: linux-acpi(a)vger.kernel.org; linux-kernel; devel(a)acpica.org
> Subject: Re: [RFC PATCH] acpi: Use a more normal logging style for
> ACPI_<LEVEL> calls
>
> On Tue, 2016-03-29 at 15:34 +0000, Moore, Robert wrote:
> > On the other hand, we removed AE_INFO from ACPI_INFO a while back, and
> > this may remove the necessity for the double parens.
>
> Hmm, maybe not. It may be that MSVC's support for __VA_ARGS__ is a bit
> unusual. What's the minimum ACPICA msvc version required?
6 I think.
The AE_INFO automatically injects the module name, line number, etc.
Compatibility across compilers is a major requirement for us.
4 years, 11 months
Re: [Devel] [RFC PATCH] acpi: Use a more normal logging style for ACPI_<LEVEL> calls
by Moore, Robert
Probably not, because ACPI_INFO is a public (and documented) macro, and ACPICA is used in many operating systems.
The double parens are there to allow for variable-length arguments, I believe.
Bob
> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Monday, March 28, 2016 8:30 PM
> To: Moore, Robert; Zheng, Lv; Wysocki, Rafael J; Len Brown
> Cc: linux-acpi(a)vger.kernel.org; devel(a)acpica.org; linux-kernel
> Subject: [RFC PATCH] acpi: Use a more normal logging style for
> ACPI_<LEVEL> calls
>
> This is just an example of a conversion of ACPI_INFO to a more typical
> kernel use style. All of the other ACPI_<LEVEL> calls would also need
> conversion.
>
> Almost all logging functions and macros in the kernel are lower case and
> nearly all use formats with terminating newlines.
>
> ACPI uses upper case macros and no terminating newline in the format.
>
> Some of the uses though _do_ have newlines. This can cause undesired
> newlines in dmesg output.
>
> Also, the ACPI_<LEVEL> macros use a somewhat odd and unpleasant style with
> double parentheses.
>
> Convert this to a lower case macro, add terminating newlines to formats
> and remove the unnecessary extra parentheses.
>
> Rename the logging function to _acpi_info and have the acpi_info macros
> call this _acpi_info function.
>
> Remove the newline from the _acpi_info call.
>
> This means that all calls to acpi_info are complete and it is not possible
> for any other message to be interleaved into this message.
>
> Miscellanea:
>
> o Coalesce formats
> o Realign arguments
> o Coalesce arguments even if > 80 columns
> ---
> drivers/acpi/acpica/dbcmds.c | 4 ++--
> drivers/acpi/acpica/dsmethod.c | 6 ++----
> drivers/acpi/acpica/dsobject.c | 5 ++---
> drivers/acpi/acpica/evgpeblk.c | 8 ++++----
> drivers/acpi/acpica/evgpeinit.c | 2 +-
> drivers/acpi/acpica/exconfig.c | 4 ++--
> drivers/acpi/acpica/nseval.c | 4 ++--
> drivers/acpi/acpica/tbinstal.c | 15 +++++++--------
> drivers/acpi/acpica/tbprint.c | 36 ++++++++++++++++--------------------
> drivers/acpi/acpica/tbutils.c | 3 ++-
> drivers/acpi/acpica/tbxfload.c | 5 +++--
> drivers/acpi/acpica/uttrack.c | 2 +-
> drivers/acpi/acpica/utxferror.c | 7 +++----
> include/acpi/acoutput.h | 6 +++---
> include/acpi/acpixf.h | 2 +-
> 15 files changed, 51 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/acpi/acpica/dbcmds.c b/drivers/acpi/acpica/dbcmds.c
> index 772178c..1ef21be 100644
> --- a/drivers/acpi/acpica/dbcmds.c
> +++ b/drivers/acpi/acpica/dbcmds.c
> @@ -348,8 +348,8 @@ void acpi_db_display_table_info(char *table_arg)
> } else {
> /* If the pointer is null, the table has been unloaded
> */
>
> - ACPI_INFO(("%4.4s - Table has been unloaded",
> - table_desc->signature.ascii));
> + acpi_info("%4.4s - Table has been unloaded\n",
> + table_desc->signature.ascii);
> }
> }
> }
> diff --git a/drivers/acpi/acpica/dsmethod.c
> b/drivers/acpi/acpica/dsmethod.c index 1982310..4730b0a 100644
> --- a/drivers/acpi/acpica/dsmethod.c
> +++ b/drivers/acpi/acpica/dsmethod.c
> @@ -809,10 +809,8 @@ acpi_ds_terminate_control_method(union
> acpi_operand_object *method_desc,
> if (method_desc->method.
> info_flags & ACPI_METHOD_SERIALIZED_PENDING) {
> if (walk_state) {
> - ACPI_INFO(("Marking method %4.4s as Serialized "
> - "because of AE_ALREADY_EXISTS error",
> - walk_state->method_node->name.
> - ascii));
> + acpi_info("Marking method %4.4s as Serialized
> because of AE_ALREADY_EXISTS error\n",
> + walk_state->method_node->name.ascii);
> }
>
> /*
> diff --git a/drivers/acpi/acpica/dsobject.c
> b/drivers/acpi/acpica/dsobject.c index a91de2b..6787274 100644
> --- a/drivers/acpi/acpica/dsobject.c
> +++ b/drivers/acpi/acpica/dsobject.c
> @@ -524,9 +524,8 @@ acpi_ds_build_internal_package_obj(struct
> acpi_walk_state *walk_state,
> arg = arg->common.next;
> }
>
> - ACPI_INFO(("Actual Package length (%u) is larger than "
> - "NumElements field (%u), truncated",
> - i, element_count));
> + acpi_info("Actual Package length (%u) is larger than
> NumElements field (%u), truncated\n",
> + i, element_count);
> } else if (i < element_count) {
> /*
> * Arg list (elements) was exhausted, but we did not reach
> num_elements count.
> diff --git a/drivers/acpi/acpica/evgpeblk.c
> b/drivers/acpi/acpica/evgpeblk.c index 447fa1c..2244ed8 100644
> --- a/drivers/acpi/acpica/evgpeblk.c
> +++ b/drivers/acpi/acpica/evgpeblk.c
> @@ -499,10 +499,10 @@ acpi_ev_initialize_gpe_block(struct
> acpi_gpe_xrupt_info *gpe_xrupt_info,
> }
>
> if (gpe_enabled_count) {
> - ACPI_INFO(("Enabled %u GPEs in block %02X to %02X",
> - gpe_enabled_count, (u32)gpe_block->block_base_number,
> - (u32)(gpe_block->block_base_number +
> - (gpe_block->gpe_count - 1))));
> + acpi_info("Enabled %u GPEs in block %02X to %02X\n",
> + gpe_enabled_count, (u32)gpe_block->block_base_number,
> + (u32)(gpe_block->block_base_number +
> + gpe_block->gpe_count - 1));
> }
>
> gpe_block->initialized = TRUE;
> diff --git a/drivers/acpi/acpica/evgpeinit.c
> b/drivers/acpi/acpica/evgpeinit.c index 7dc7547..3a6d717 100644
> --- a/drivers/acpi/acpica/evgpeinit.c
> +++ b/drivers/acpi/acpica/evgpeinit.c
> @@ -281,7 +281,7 @@ void acpi_ev_update_gpes(acpi_owner_id table_owner_id)
> }
>
> if (walk_info.count) {
> - ACPI_INFO(("Enabled %u new GPEs", walk_info.count));
> + acpi_info("Enabled %u new GPEs\n", walk_info.count);
> }
>
> (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
> diff --git a/drivers/acpi/acpica/exconfig.c
> b/drivers/acpi/acpica/exconfig.c index f741613..99916fe 100644
> --- a/drivers/acpi/acpica/exconfig.c
> +++ b/drivers/acpi/acpica/exconfig.c
> @@ -252,7 +252,7 @@ acpi_ex_load_table_op(struct acpi_walk_state
> *walk_state,
>
> status = acpi_get_table_by_index(table_index, &table);
> if (ACPI_SUCCESS(status)) {
> - ACPI_INFO(("Dynamic OEM Table Load:"));
> + acpi_info("Dynamic OEM Table Load:\n");
> acpi_tb_print_table_header(0, table);
> }
>
> @@ -472,7 +472,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
>
> /* Install the new table into the local data structures */
>
> - ACPI_INFO(("Dynamic OEM Table Load:"));
> + acpi_info("Dynamic OEM Table Load:\n");
> (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
>
> status = acpi_tb_install_standard_table(ACPI_PTR_TO_PHYSADDR(table),
> diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
> index 5d59cfc..18777f0 100644
> --- a/drivers/acpi/acpica/nseval.c
> +++ b/drivers/acpi/acpica/nseval.c
> @@ -378,8 +378,8 @@ void acpi_ns_exec_module_code_list(void)
> acpi_ut_remove_reference(prev);
> }
>
> - ACPI_INFO(("Executed %u blocks of module-level executable AML code",
> - method_count));
> + acpi_info("Executed %u blocks of module-level executable AML
> code\n",
> + method_count);
>
> ACPI_FREE(info);
> acpi_gbl_module_code_list = NULL;
> diff --git a/drivers/acpi/acpica/tbinstal.c
> b/drivers/acpi/acpica/tbinstal.c index 4dc6108..28f2ab7 100644
> --- a/drivers/acpi/acpica/tbinstal.c
> +++ b/drivers/acpi/acpica/tbinstal.c
> @@ -267,9 +267,9 @@ acpi_tb_install_standard_table(acpi_physical_address
> address,
> if (!reload &&
> acpi_gbl_disable_ssdt_table_install &&
> ACPI_COMPARE_NAME(&new_table_desc.signature, ACPI_SIG_SSDT)) {
> - ACPI_INFO(("Ignoring installation of %4.4s at %8.8X%8.8X",
> - new_table_desc.signature.ascii,
> - ACPI_FORMAT_UINT64(address)));
> + acpi_info("Ignoring installation of %4.4s at %8.8X%8.8X\n",
> + new_table_desc.signature.ascii,
> + ACPI_FORMAT_UINT64(address));
> goto release_and_exit;
> }
>
> @@ -431,11 +431,10 @@ finish_override:
> return;
> }
>
> - ACPI_INFO(("%4.4s 0x%8.8X%8.8X"
> - " %s table override, new table: 0x%8.8X%8.8X",
> - old_table_desc->signature.ascii,
> - ACPI_FORMAT_UINT64(old_table_desc->address),
> - override_type,
> ACPI_FORMAT_UINT64(new_table_desc.address)));
> + acpi_info("%4.4s 0x%8.8X%8.8X %s table override, new table:
> 0x%8.8X%8.8X\n",
> + old_table_desc->signature.ascii,
> + ACPI_FORMAT_UINT64(old_table_desc->address),
> + override_type, ACPI_FORMAT_UINT64(new_table_desc.address));
>
> /* We can now uninstall the original table */
>
> diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c
> index 26d61db..030d610 100644
> --- a/drivers/acpi/acpica/tbprint.c
> +++ b/drivers/acpi/acpica/tbprint.c
> @@ -132,9 +132,9 @@ acpi_tb_print_table_header(acpi_physical_address
> address,
>
> /* FACS only has signature and length fields */
>
> - ACPI_INFO(("%-4.4s 0x%8.8X%8.8X %06X",
> - header->signature, ACPI_FORMAT_UINT64(address),
> - header->length));
> + acpi_info("%-4.4s 0x%8.8X%8.8X %06X\n",
> + header->signature, ACPI_FORMAT_UINT64(address),
> + header->length);
> } else if (ACPI_VALIDATE_RSDP_SIG(header->signature)) {
>
> /* RSDP has no common fields */
> @@ -144,28 +144,24 @@ acpi_tb_print_table_header(acpi_physical_address
> address,
> ACPI_OEM_ID_SIZE);
> acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
>
> - ACPI_INFO(("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
> - ACPI_FORMAT_UINT64(address),
> - (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
> - revision >
> - 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
> - header)->length : 20,
> - ACPI_CAST_PTR(struct acpi_table_rsdp,
> - header)->revision,
> - local_header.oem_id));
> + acpi_info("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)\n",
> + ACPI_FORMAT_UINT64(address),
> + ACPI_CAST_PTR(struct acpi_table_rsdp, header)-
> >revision > 0 ?
> + ACPI_CAST_PTR(struct acpi_table_rsdp, header)->length
> : 20,
> + ACPI_CAST_PTR(struct acpi_table_rsdp, header)-
> >revision,
> + local_header.oem_id);
> } else {
> /* Standard ACPI table with full common header */
>
> acpi_tb_cleanup_table_header(&local_header, header);
>
> - ACPI_INFO(("%-4.4s 0x%8.8X%8.8X"
> - " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
> - local_header.signature, ACPI_FORMAT_UINT64(address),
> - local_header.length, local_header.revision,
> - local_header.oem_id, local_header.oem_table_id,
> - local_header.oem_revision,
> - local_header.asl_compiler_id,
> - local_header.asl_compiler_revision));
> + acpi_info("%-4.4s 0x%8.8X%8.8X %06X (v%.2d %-6.6s %-8.8s %08X
> %-4.4s %08X)\n",
> + local_header.signature, ACPI_FORMAT_UINT64(address),
> + local_header.length, local_header.revision,
> + local_header.oem_id, local_header.oem_table_id,
> + local_header.oem_revision,
> + local_header.asl_compiler_id,
> + local_header.asl_compiler_revision);
> }
> }
>
> diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
> index 9240c76..8f64b38 100644
> --- a/drivers/acpi/acpica/tbutils.c
> +++ b/drivers/acpi/acpica/tbutils.c
> @@ -174,7 +174,8 @@ struct acpi_table_header *acpi_tb_copy_dsdt(u32
> table_index)
> ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL,
> new_table);
>
> - ACPI_INFO(("Forced DSDT copy: length 0x%05X copied locally, original
> unmapped", new_table->length));
> + acpi_info("Forced DSDT copy: length 0x%05X copied locally, original
> unmapped\n",
> + new_table->length);
>
> return (new_table);
> }
> diff --git a/drivers/acpi/acpica/tbxfload.c
> b/drivers/acpi/acpica/tbxfload.c index 3151968..0827d17 100644
> --- a/drivers/acpi/acpica/tbxfload.c
> +++ b/drivers/acpi/acpica/tbxfload.c
> @@ -240,7 +240,8 @@ acpi_status acpi_tb_load_namespace(void)
> }
>
> if (!tables_failed) {
> - ACPI_INFO(("%u ACPI AML tables successfully acquired and
> loaded\n", tables_loaded));
> + acpi_info("%u ACPI AML tables successfully acquired and
> loaded\n",
> + tables_loaded);
> } else {
> ACPI_ERROR((AE_INFO,
> "%u table load failures, %u successful", @@ -333,7
> +334,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table)
>
> /* Install the table and load it into the namespace */
>
> - ACPI_INFO(("Host-directed Dynamic ACPI Table Load:"));
> + acpi_info("Host-directed Dynamic ACPI Table Load:\n");
> (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
>
> status = acpi_tb_install_standard_table(ACPI_PTR_TO_PHYSADDR(table),
> diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
> index 60c406a..b1d6f4a 100644
> --- a/drivers/acpi/acpica/uttrack.c
> +++ b/drivers/acpi/acpica/uttrack.c
> @@ -712,7 +712,7 @@ void acpi_ut_dump_allocations(u32 component, const
> char *module)
> /* Print summary */
>
> if (!num_outstanding) {
> - ACPI_INFO(("No outstanding allocations"));
> + acpi_info("No outstanding allocations\n");
> } else {
> ACPI_ERROR((AE_INFO, "%u(0x%X) Outstanding allocations",
> num_outstanding, num_outstanding)); diff --git
> a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index
> d9f15cb..e9a80c2 100644
> --- a/drivers/acpi/acpica/utxferror.c
> +++ b/drivers/acpi/acpica/utxferror.c
> @@ -161,7 +161,7 @@ ACPI_EXPORT_SYMBOL(acpi_warning)
>
> /************************************************************************
> *******
> *
> - * FUNCTION: acpi_info
> + * FUNCTION: _acpi_info
> *
> * PARAMETERS: module_name - Caller's module name (for error
> output)
> * line_number - Caller's line number (for error
> output) @@ -175,7 +175,7 @@ ACPI_EXPORT_SYMBOL(acpi_warning)
> * TBD: module_name and line_number args are not needed, should be
> removed.
> *
> ************************************************************************
> ******/
> -void ACPI_INTERNAL_VAR_XFACE acpi_info(const char *format, ...)
> +void ACPI_INTERNAL_VAR_XFACE _acpi_info(const char *format, ...)
> {
> va_list arg_list;
>
> @@ -184,13 +184,12 @@ void ACPI_INTERNAL_VAR_XFACE acpi_info(const char
> *format, ...)
>
> va_start(arg_list, format);
> acpi_os_vprintf(format, arg_list);
> - acpi_os_printf("\n");
> va_end(arg_list);
>
> ACPI_MSG_REDIRECT_END;
> }
>
> -ACPI_EXPORT_SYMBOL(acpi_info)
> +ACPI_EXPORT_SYMBOL(_acpi_info)
>
> /************************************************************************
> *******
> *
> diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index
> 34f601e..4812992 100644
> --- a/include/acpi/acoutput.h
> +++ b/include/acpi/acoutput.h
> @@ -223,10 +223,9 @@
>
> /*
> * Error reporting. Callers module and line number are inserted by
> AE_INFO,
> - * the plist contains a set of parens to allow variable-length lists.
> * These macros are used for both the debug and non-debug versions of the
> code.
> */
> -#define ACPI_INFO(plist) acpi_info plist
> +#define acpi_info(fmt, ...) _acpi_info(fmt, ##__VA_ARGS__)
> #define ACPI_WARNING(plist) acpi_warning plist
> #define ACPI_EXCEPTION(plist) acpi_exception plist
> #define ACPI_ERROR(plist) acpi_error plist @@ -238,7 +237,8
> @@
>
> /* No error messages */
>
> -#define ACPI_INFO(plist)
> +#define acpi_info(fmt, ...) \
> + do { if (0) _acpi_info(fmt, ##__VA_ARGS__); } while (0)
> #define ACPI_WARNING(plist)
> #define ACPI_EXCEPTION(plist)
> #define ACPI_ERROR(plist)
> diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index
> 1755697..f5f96ac 100644
> --- a/include/acpi/acpixf.h
> +++ b/include/acpi/acpixf.h
> @@ -899,7 +899,7 @@ ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
> const char *format, ...))
> ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
> void ACPI_INTERNAL_VAR_XFACE
> - acpi_info(const char *format, ...))
> + _acpi_info(const char *format, ...))
> ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
> void ACPI_INTERNAL_VAR_XFACE
> acpi_bios_error(const char *module_name,
4 years, 11 months
[PATCH] Check for failed string allocation and set Status accordingly
by Colin King
From: Colin Ian King <colin.king(a)canonical.com>
It is possible that AcpiUtCreateStringObject fails to allocate a
string object, so check for this condition and set Status to
AE_NO_MEMORY to indicate a memory allocation failure.
Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
---
source/components/dispatcher/dsutils.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c
index 52e9ca8..124dc67 100644
--- a/source/components/dispatcher/dsutils.c
+++ b/source/components/dispatcher/dsutils.c
@@ -678,9 +678,15 @@ AcpiDsCreateOperand (
/* TBD: May only be temporary */
ObjDesc = AcpiUtCreateStringObject ((ACPI_SIZE) NameLength);
-
- strncpy (ObjDesc->String.Pointer, NameString, NameLength);
- Status = AE_OK;
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ }
+ else
+ {
+ strncpy (ObjDesc->String.Pointer, NameString, NameLength);
+ Status = AE_OK;
+ }
}
else
{
--
2.7.3
4 years, 11 months
Re: [Devel] [PATCH v6 2/5] ACPI: add definitions of DBG2 subtypes
by Moore, Robert
We implemented all of these in ACPICA version 20160318.
> -----Original Message-----
> From: Aleksey Makarov [mailto:aleksey.makarov@linaro.org]
> Sent: Thursday, March 24, 2016 5:52 AM
> To: Greg Kroah-Hartman; Rafael J . Wysocki; Len Brown
> Cc: linux-serial(a)vger.kernel.org; linux-acpi(a)vger.kernel.org; linux-
> kernel(a)vger.kernel.org; linux-arm-kernel(a)lists.infradead.org; Aleksey
> Makarov; Russell King; Leif Lindholm; Graeme Gregory; Al Stone;
> Christopher Covington; Yury Norov; Peter Hurley; Zheng, Lv; Moore, Robert;
> Wysocki, Rafael J; devel(a)acpica.org
> Subject: [PATCH v6 2/5] ACPI: add definitions of DBG2 subtypes
>
> The recent version of Microsoft Debug Port Table 2 (DBG2) [1] specifies
> additional serial debug port subtypes. These constants are also referred
> by Serial Port Console Redirection Table (SPCR) [2]
>
> Add these constants.
>
> [1] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639131(v=vs.85).aspx
> [2] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639132(v=vs.85).aspx
>
> Signed-off-by: Aleksey Makarov <aleksey.makarov(a)linaro.org>
> ---
> include/acpi/actbl2.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
> a4ef625..652f747 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -371,6 +371,11 @@ struct acpi_dbg2_device {
>
> #define ACPI_DBG2_16550_COMPATIBLE 0x0000
> #define ACPI_DBG2_16550_SUBSET 0x0001
> +#define ACPI_DBG2_ARM_PL011 0x0003
> +#define ACPI_DBG2_ARM_SBSA_32BIT 0x000D
> +#define ACPI_DBG2_ARM_SBSA_GENERIC 0x000E
> +#define ACPI_DBG2_ARM_DCC 0x000F
> +#define ACPI_DBG2_BCM2835 0x0010
>
> #define ACPI_DBG2_1394_STANDARD 0x0000
>
> --
> 2.7.4
4 years, 11 months
ACPICA version 20160318 released
by Moore, Robert
18 March 2016. Summary of changes for version 20160318:
This release is available at https://acpica.org/downloads
1) ACPICA kernel-resident subsystem:
Added support for arbitrary bit lengths and bit offsets for registers defined by the Generic Address Structure. Previously, only aligned bit lengths of 8/16/32/64 were supported. This was sufficient for many years, but recently some machines have been seen that require arbitrary bit-level support. ACPICA BZ 1240. Lv Zheng.
Fixed an issue where the \_SB._INI method sometimes must be evaluated before any _REG methods are evaluated. Lv Zheng.
Implemented several changes related to ACPI table support (Headers/Disassembler/TableCompiler):
NFIT: For ACPI 6.1, updated to add some additional new fields and constants.
FADT: Updated a warning message and set compliance to ACPI 6.1 (Version 6).
DMAR: Added new constants per the 10/2014 DMAR spec.
IORT: Added new subtable per the 10/2015 IORT spec.
HEST: For ACPI 6.1, added new constants and new subtable.
DBG2: Added new constants per the 12/2015 DBG2 spec.
FPDT: Fixed several incorrect fields, add the FPDT boot record structure. ACPICA BZ 1249.
ERST/EINJ: Updated disassembler with new "Execute Timings" actions.
Updated header support for the DMAR table to match the current version of the related spec.
Added extensions to the ASL Concatenate operator to allow any ACPI object to be passed as an operand. Any object other than Integer/String/Buffer simply returns a string containing the object type. This extends the usefulness of the Printf macros. Previously, Concatenate would abort the control method if a non-data object was encountered.
ACPICA source code: Deployed the C "const" keyword across the source code where appropriate. ACPICA BZ 732. Joerg Sonnenberger (NetBSD).
Example Code and Data Size: These are the sizes for the OS-independent acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug version of the code includes the debug output trace mechanism and has a much larger code and data size.
Current Release:
Non-Debug Version: 137.1K Code, 51.5K Data, 188.6K Total
Debug Version: 201.0K Code, 82.0K Data, 283.0K Total
Previous Release:
Non-Debug Version: 136.2K Code, 51.5K Data, 187.7K Total
Debug Version: 200.4K Code, 82.0K Data, 282.4K Total
2) iASL Compiler/Disassembler and Tools:
iASL/Disassembler: Improved the heuristic used to determine the number of arguments for an externally defined control method (a method in another table). Although this is an improvement, there is no deterministic way to "guess" the number of method arguments. Only the ACPI 6.0 External opcode will completely solve this problem as it is deployed (automatically) in newer BIOS code.
iASL/Disassembler: Fixed an ordering issue for emitted External() ASL statements that could cause errors when the disassembled file is compiled. ACPICA BZ 1243. David Box.
iASL: Fixed a regression caused by the merger of the two versions of the local strtoul64. Because of a dependency on a global variable, strtoul64 could return an error for integers greater than a 32-bit value. ACPICA BZ 1260.
iASL: Fixed a regression where a fault could occur for an ASL Return statement if it invokes a control method that is not resolved. ACPICA BZ 1264.
AcpiXtract: Improved input file validation: detection of binary files and non-acpidump text files.
d
4 years, 11 months
[PATCH] ACPI / util: cast data to u64 before shifting to fix sign extension
by Colin King
From: Colin Ian King <colin.king(a)canonical.com>
obj->buffer.pointer[i] should be cast to u64 to prevent an unintentional
sign extension. For example, if pointer[7] is 0x80, then the value
0xffffffffff000000 is or'd into mask rather than the intended value
0xff00000000000000
Detected with static analysis by CoverityScan
Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
---
drivers/acpi/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index f12a724..050673f 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -692,7 +692,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs)
mask = obj->integer.value;
else if (obj->type == ACPI_TYPE_BUFFER)
for (i = 0; i < obj->buffer.length && i < 8; i++)
- mask |= (((u8)obj->buffer.pointer[i]) << (i * 8));
+ mask |= (((u64)obj->buffer.pointer[i]) << (i * 8));
ACPI_FREE(obj);
/*
--
2.7.3
4 years, 11 months
[PATCH] tools/power/acpi: close file only if it is open
by Colin King
From: Colin Ian King <colin.king(a)canonical.com>
the logic on the test for a valid fd to close is incorrect and
the current code will close -ve fd's which is not was intended.
Since the only path to the exit label is on a failed open, we
may as well just close fd if it has been opened successfully
before the exit label and also remove the valid fd check.
Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
---
tools/power/acpi/tools/acpidbg/acpidbg.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/power/acpi/tools/acpidbg/acpidbg.c b/tools/power/acpi/tools/acpidbg/acpidbg.c
index d070fcc..38ccac9 100644
--- a/tools/power/acpi/tools/acpidbg/acpidbg.c
+++ b/tools/power/acpi/tools/acpidbg/acpidbg.c
@@ -429,9 +429,8 @@ int main(int argc, char **argv)
acpi_aml_flush(fd);
acpi_aml_loop(fd);
+ close(fd);
exit:
- if (fd < 0)
- close(fd);
if (acpi_aml_batch_cmd)
free(acpi_aml_batch_cmd);
return ret;
--
2.7.3
4 years, 11 months