[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
6 years, 2 months
[PATCH] compiler: remove unnecessary zero check on Length before zero'ing it
by Colin King
From: Colin Ian King <colin.king(a)canonical.com>
Length is being checked to see if the contents is non-zero before
setting it to zero. It would be simpler to just set this to zero
without doing the non-zero check as it saves a load and a jmp
(~14 bytes in x86 object code). This also fixes a static analysis
warning in DtCompileIort:
CID 1298707 (#1 of 1): Uninitialized scalar variable (UNINIT).
uninit_use_in_call: Using uninitialized value PaddingLength
when calling DtCompileGeneric.
..since the length is not being intitialized in this code before
calling DtCompileGeneric.
Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
---
source/compiler/dttable2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
index b281b5c..1add6f7 100644
--- a/source/compiler/dttable2.c
+++ b/source/compiler/dttable2.c
@@ -1707,7 +1707,7 @@ DtCompileGeneric (
/* Now we can actually compile the parse tree */
- if (Length && *Length)
+ if (Length)
{
*Length = 0;
}
--
2.7.0.rc3
6 years, 4 months
ACPICA version 20160108 released
by Moore, Robert
8 January 2016. Summary of changes for version 20160108:
This release is available at https://acpica.org/downloads
1) ACPICA kernel-resident subsystem:
Updated all ACPICA copyrights and signons to 2016: Added the 2016 copyright to all source code module headers and utility/tool signons. This includes the standard Linux dual-license header. This affects virtually every file in the ACPICA core subsystem, iASL compiler, all ACPICA utilities, and the ACPICA test suite.
Fixed a regression introduced in version 20151218 concerning the execution of so-called module-level ASL/AML code. Namespace objects created under a module-level If() construct were not properly/fully entered into the namespace and could cause an interpreter fault when accessed.
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: 102.7K Code, 28.4K Data, 131.1K Total
Debug Version: 200.4K Code, 81.9K Data, 282.4K Total
Previous Release:
Non-Debug Version: 102.6K Code, 28.4K Data, 131.0K Total
Debug Version: 200.3K Code, 81.9K Data, 282.3K Total
2) iASL Compiler/Disassembler and Tools:
Fixed a problem with the compilation of the GpioIo and GpioInt resource descriptors. The _PIN field name was incorrectly defined to be an array of 32-bit values, but the _PIN values are in fact 16 bits each. This would cause incorrect bit width warnings when using Word (16-bit) fields to access the descriptors.
6 years, 5 months