[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
Re: [Devel] [PATCH]: acpica/nfit: Rename not-armed bit definition
by Moore, Robert
+#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device observed to be not armed */
I'll add this to ACPICA immediately, for the next release in mid-september.
> -----Original Message-----
> From: Toshi Kani [mailto:toshi.kani@hp.com]
> Sent: Friday, August 28, 2015 7:40 AM
> To: Williams, Dan J; Wysocki, Rafael J; Moore, Robert
> Cc: devel(a)acpica.org; linux-nvdimm(a)lists.01.org; linux-
> acpi(a)vger.kernel.org; linux-kernel(a)vger.kernel.org; Toshi Kani
> Subject: [PATCH]: acpica/nfit: Rename not-armed bit definition
>
> ACPI 6.0 NFIT Memory Device State Flags in Table 5-129 defines bit 3 as
> follows.
>
> Bit [3] set to 1 to indicate that the Memory Device is observed
> to be not armed prior to OSPM hand off. A Memory Device is
> considered armed if it is able to accept persistent writes.
>
> This bit is currently defined as ACPI_NFIT_MEM_ARMED, which can be
> confusing as if the Memory Device is armed when this bit is set.
>
> Change the name to ACPI_NFIT_MEM_NOT_ARMED per the spec.
>
> Signed-off-by: Toshi Kani <toshi.kani(a)hp.com>
> Cc: Bob Moore <robert.moore(a)intel.com>
> Cc: Dan Williams <dan.j.williams(a)intel.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
> ---
> This patch is based on the linus's tree.
> ---
> drivers/acpi/nfit.c | 6 +++---
> drivers/acpi/nfit.h | 2 +-
> include/acpi/actbl1.h | 2 +-
> tools/testing/nvdimm/test/nfit.c | 2 +-
> 4 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index
> cf0fd96..4596e0a 100644
> --- a/drivers/acpi/nfit.c
> +++ b/drivers/acpi/nfit.c
> @@ -705,7 +705,7 @@ static ssize_t flags_show(struct device *dev,
> flags & ACPI_NFIT_MEM_SAVE_FAILED ? "save_fail " : "",
> flags & ACPI_NFIT_MEM_RESTORE_FAILED ? "restore_fail " : "",
> flags & ACPI_NFIT_MEM_FLUSH_FAILED ? "flush_fail " : "",
> - flags & ACPI_NFIT_MEM_ARMED ? "not_armed " : "",
> + flags & ACPI_NFIT_MEM_NOT_ARMED ? "not_armed " : "",
> flags & ACPI_NFIT_MEM_HEALTH_OBSERVED ? "smart_event " : "");
> } static DEVICE_ATTR_RO(flags); @@ -830,7 +830,7 @@ static int
> acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
> flags |= NDD_ALIASING;
>
> mem_flags = __to_nfit_memdev(nfit_mem)->flags;
> - if (mem_flags & ACPI_NFIT_MEM_ARMED)
> + if (mem_flags & ACPI_NFIT_MEM_NOT_ARMED)
> flags |= NDD_UNARMED;
>
> rc = acpi_nfit_add_dimm(acpi_desc, nfit_mem, device_handle);
> @@ -854,7 +854,7 @@ static int acpi_nfit_register_dimms(struct
> acpi_nfit_desc *acpi_desc)
> mem_flags & ACPI_NFIT_MEM_SAVE_FAILED ? " save_fail" : "",
> mem_flags & ACPI_NFIT_MEM_RESTORE_FAILED ? "
> restore_fail":"",
> mem_flags & ACPI_NFIT_MEM_FLUSH_FAILED ? " flush_fail" : "",
> - mem_flags & ACPI_NFIT_MEM_ARMED ? " not_armed" : "");
> + mem_flags & ACPI_NFIT_MEM_NOT_ARMED ? " not_armed" : "");
>
> }
>
> diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h index
> 79b6d83..90505e3 100644
> --- a/drivers/acpi/nfit.h
> +++ b/drivers/acpi/nfit.h
> @@ -24,7 +24,7 @@
> #define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66"
> #define ACPI_NFIT_MEM_FAILED_MASK (ACPI_NFIT_MEM_SAVE_FAILED \
> | ACPI_NFIT_MEM_RESTORE_FAILED | ACPI_NFIT_MEM_FLUSH_FAILED \
> - | ACPI_NFIT_MEM_ARMED)
> + | ACPI_NFIT_MEM_NOT_ARMED)
>
> enum nfit_uuids {
> NFIT_SPA_VOLATILE,
> diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index
> fcd5709..238754e 100644
> --- a/include/acpi/actbl1.h
> +++ b/include/acpi/actbl1.h
> @@ -1012,7 +1012,7 @@ struct acpi_nfit_memory_map {
> #define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory
> Device failed */
> #define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from
> Memory Device failed */
> #define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush
> failed */
> -#define ACPI_NFIT_MEM_ARMED (1<<3) /* 03: Memory Device
> observed to be not armed */
> +#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device
> observed to be not armed */
> #define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device
> observed SMART/health events */
> #define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events
> enabled */
>
> diff --git a/tools/testing/nvdimm/test/nfit.c
> b/tools/testing/nvdimm/test/nfit.c
> index d0bdae4..ed271ba 100644
> --- a/tools/testing/nvdimm/test/nfit.c
> +++ b/tools/testing/nvdimm/test/nfit.c
> @@ -917,7 +917,7 @@ static void nfit_test1_setup(struct nfit_test *t)
> memdev->interleave_ways = 1;
> memdev->flags = ACPI_NFIT_MEM_SAVE_FAILED |
> ACPI_NFIT_MEM_RESTORE_FAILED
> | ACPI_NFIT_MEM_FLUSH_FAILED | ACPI_NFIT_MEM_HEALTH_OBSERVED
> - | ACPI_NFIT_MEM_ARMED;
> + | ACPI_NFIT_MEM_NOT_ARMED;
>
> offset += sizeof(*memdev);
> /* dcr-descriptor0 */
6 years, 10 months
ACPICA version 20150818 released
by Moore, Robert
18 August 2015. Summary of changes for version 20150818:
This release is available at https://acpica.org/downloads
1) ACPICA kernel-resident subsystem:
Fix a regression for AcpiGetTableByIndex interface causing it to fail. Lv Zheng. ACPICA BZ 1186.
Completed development to ensure that the ACPICA Disassembler and Debugger are fully standalone components of ACPICA. Removed cross-component dependences. Lv Zheng.
The max-number-of-AML-loops is now runtime configurable (previously was compile-time only). This is essentially a loop timeout to force-abort infinite AML loops. ACPCIA BZ 1192.
Debugger: Cleanup output to dump ACPI names and namepaths without any trailing underscores. Lv Zheng. ACPICA BZ 1135.
Removed unnecessary conditional compilations across the Debugger and Disassembler components where entire modules could be left uncompiled.
The aapits test is deprecated and has been removed from the ACPICA git tree. The test has never been completed and has not been maintained, thus becoming rather useless. ACPICA BZ 1015, 794.
A batch of small changes to close bugzilla and other reports:
- Remove duplicate code for _PLD processing. ACPICA BZ 1176.
- Correctly cleanup after a ACPI table load failure. ACPICA BZ 1185.
- iASL: Support POSIX yacc again in makefile. Jung-uk Kim.
- ACPI table support: general cleanup and simplification. Lv Zheng, Bob Moore.
- ACPI table support: fix for a buffer read overrun in AcpiTbFindTable. ACPICA BZ 1184.
- Enhance parameter validation for DataTableRegion and LoadTable ASL/AML operators.
- Debugger: Split debugger initialization/termination interfaces. Lv Zheng.
- AcpiExec: Emit OemTableId for SSDTs during the load phase for table identification.
- AcpiExec: Add debug message during _REG method phase during table load/init.
- AcpiNames: Fix a regression where some output was missing and no longer emitted.
- Debugger: General cleanup and simplification. Lv Zheng.
- Disassembler: Cleanup use of several global option variables. Lv Zheng.
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: 101.3K Code, 27.7K Data, 129.0K Total
Debug Version: 198.6K Code, 80.9K Data, 279.5K Total
Previous Release:
Non-Debug Version: 100.9K Code, 24.5K Data, 125.4K Total
Debug Version: 197.8K Code, 81.5K Data, 279.3K Total
2) iASL Compiler/Disassembler and Tools:
AcpiExec: Fixed a problem where any more than 32 ACPI tables in the XSDT were not handled properly and caused load errors. Now, properly invoke and use the ACPICA auto-reallocate mechanism for ACPI table data structures. ACPICA BZ 1188
AcpiNames: Add command-line wildcard support for ACPI table files. ACPICA BZ 1190.
AcpiExec and AcpiNames: Add -l option to load ACPI tables only. For AcpiExec, this means that no control methods (like _REG/_INI/_STA) are executed during initialization. ACPICA BZ 1187, 1189.
iASL/Disassembler: Implemented a prototype "listing" mode that emits AML that corresponds to each disassembled ASL statement, to simplify debugging. ACPICA BZ 1191.
Debugger: Add option to the "objects" command to display a summary of the current namespace objects (Object type and count). This is displayed if the command is entered with no arguments.
AcpiNames: Add -x option to specify debug level, similar to AcpiExec.
6 years, 10 months