Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
Adam Goode
PATCH v2 1/1 Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
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(-)
source/components/events/evhandler.c +1 -0
@@ -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 };
source/components/executer/exregion.c +23 -0
@@ -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); }
source/include/acconfig.h +1 -1
@@ -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 */
source/include/acpiosxf.h +18 -0
@@ -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
source/os_specific/service_layers/osunixxf.c +64 -0
70 lines not on this page · raw message
source/os_specific/service_layers/oswinxf.c +64 -0
70 lines not on this page · raw message
tests/aapits/atosxfctrl.c +2 -0
@@ -160,6 +160,8 @@ const char *OsxfNames[] = {"AcpiOsDerivePciId" ,"AcpiOsReadPort" ,"AcpiOsWritePort" , +"AcpiOsReadCmos" , +"AcpiOsWriteCmos" ,"AcpiOsReadMemory" ,"AcpiOsWriteMemory" , "AcpiOsSignal"};
tests/aapits/atosxfctrl.h +3 -0
@@ -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
tests/aapits/atosxfwrap.c +76 -0
82 lines not on this page · raw message
tests/aapits/atosxfwrap.h +16 -0
@@ -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
Signature · 1 line
2.3.7
Zheng
Hi,
As I commented before, the support of Cmos opregion should be done in Linux side. After Linux applied this commit:
https://patchwork.kernel.org/patch/8241491/
You should be able to install the default operation region handlers near acpi_ec_ecdt_probe().
So IMO you could wait a while for the pending patches to be merged before trying again.
Thanks and best regards
-Lv
Quoted 445 lines
From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Adam Goode
Subject: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandlerThis 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(-)source/components/events/evhandler.c +0
-0@@ -139,6 +139,7 @@ UINT8AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
ACPI_ADR_SPACE_SYSTEM_MEMORY,ACPI_ADR_SPACE_SYSTEM_IO,ACPI_ADR_SPACE_PCI_CONFIG,source/components/events/evhandler.c +1
-0+ACPI_ADR_SPACE_CMOS , ACPI_ADR_SPACE_DATA_TABLE };source/components/executer/exregion.c +23
-0@@ -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); }source/include/acconfig.h +1
-1@@ -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 */ source/include/acpiosxf.h +18
-0@@ -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 source/os_specific/service_layers/osunixxf.c +40
-0@@ -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
+ *
+
****************************************************************
*************/source/os_specific/service_layers/osunixxf.c +12
-0+ +ACPI_STATUS +AcpiOsWriteCmos ( +ACPI_PHYSICAL_ADDRESS Address, +UINT64 Value, +UINT32 Width) +{ + +return (AE_OK ); +} + +/***************************************************************
***************
*
* FUNCTION: AcpiOsReadMemorysource/os_specific/service_layers/oswinxf.c +40
-0@@ -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
+ *
+
****************************************************************
*************/source/os_specific/service_layers/oswinxf.c +12
-0+ +ACPI_STATUS +AcpiOsWriteCmos ( +ACPI_PHYSICAL_ADDRESS Address, +UINT64 Value, +UINT32 Width) +{ + +return (AE_OK ); +} + +/***************************************************************
***************
*
* FUNCTION: AcpiOsReadMemorytests/aapits/atosxfctrl.c +2
-0@@ -160,6 +160,8 @@ const char *OsxfNames[] = {"AcpiOsDerivePciId" ,"AcpiOsReadPort" ,"AcpiOsWritePort" , +"AcpiOsReadCmos" , +"AcpiOsWriteCmos" ,"AcpiOsReadMemory" ,"AcpiOsWriteMemory" , "AcpiOsSignal"};tests/aapits/atosxfctrl.h +3
-0@@ -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 tests/aapits/atosxfwrap.c +39
-0@@ -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
+ *
+
****************************************************************
*************/tests/aapits/atosxfwrap.c +25
-0+ +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: AcpiOsReadMemorytests/aapits/atosxfwrap.h +16
-1@@ -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
_______________________________________________
Devel mailing list
Devel(a)acpica.org
https://lists.acpica.org/mailman/listinfo/devel
Moore
The problem has usually been that there are actually multiple types of CMOS devices, and they are identified by different _HID values.
Quoted 468 lines
-----Original Message-----
From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Zheng, Lv
Sent: Tuesday, February 16, 2016 10:03 PM
To: Adam Goode; devel(a)acpica.org
Subject: Re: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandlerHi,
As I commented before, the support of Cmos opregion should be done in Linux side.
After Linux applied this commit:
https://patchwork.kernel.org/patch/8241491/
You should be able to install the default operation region handlers nearacpi_ec_ecdt_probe().So IMO you could wait a while for the pending patches to be merged before trying again.
Thanks and best regards
-LvQuoted 11 lines
From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Adam Goode
Subject: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandlerThis 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).
Quoted 7 lines
--- 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 +++++++++++++++++++++++
Quoted 3 lines
tests/aapits/atosxfctrl.c | 2 + tests/aapits/atosxfctrl.h | 3 ++ tests/aapits/atosxfwrap.c | 76++++++++++++++++++++++++++++
Quoted 364 lines
tests/aapits/atosxfwrap.h | 16 ++++++ 10 files changed, 268 insertions(+), 1 deletion(-)source/components/events/evhandler.c +0
-0@@ -139,6 +139,7 @@ UINT8AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
ACPI_ADR_SPACE_SYSTEM_MEMORY,ACPI_ADR_SPACE_SYSTEM_IO,ACPI_ADR_SPACE_PCI_CONFIG,source/components/events/evhandler.c +1
-0+ACPI_ADR_SPACE_CMOS , ACPI_ADR_SPACE_DATA_TABLE };source/components/executer/exregion.c +23
-0@@ -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); }source/include/acconfig.h +1
-1@@ -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 */ source/include/acpiosxf.h +17
-1@@ -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 100644source/os_specific/service_layers/osunixxf.c +52
-0@@ -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 +* +****************************************************************
*************/source/os_specific/service_layers/osunixxf.c +12
-0+ +ACPI_STATUS +AcpiOsWriteCmos ( +ACPI_PHYSICAL_ADDRESS Address, +UINT64 Value, +UINT32 Width) +{ + +return (AE_OK ); +} + +/***************************************************************
***************
*
* FUNCTION: AcpiOsReadMemorysource/os_specific/service_layers/oswinxf.c +52
-0@@ -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 +* +****************************************************************
*************/source/os_specific/service_layers/oswinxf.c +12
-0+ +ACPI_STATUS +AcpiOsWriteCmos ( +ACPI_PHYSICAL_ADDRESS Address, +UINT64 Value, +UINT32 Width) +{ + +return (AE_OK ); +} + +/***************************************************************
***************
*
* FUNCTION: AcpiOsReadMemorytests/aapits/atosxfctrl.c +2
-0@@ -160,6 +160,8 @@ const char *OsxfNames[] = {"AcpiOsDerivePciId" ,"AcpiOsReadPort" ,"AcpiOsWritePort" , +"AcpiOsReadCmos" , +"AcpiOsWriteCmos" ,"AcpiOsReadMemory" ,"AcpiOsWriteMemory" , "AcpiOsSignal"};tests/aapits/atosxfctrl.h +3
-0@@ -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.cb/tests/aapits/atosxfwrap.cindex 7c5de39..0088212 100644tests/aapits/atosxfwrap.c +51
-0@@ -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 +* +****************************************************************
*************/tests/aapits/atosxfwrap.c +7
-0+ +ACPI_STATUS +AcpiOsWriteCmos ( +ACPI_PHYSICAL_ADDRESS Address, +UINT64 Value, +UINT32 Width) +{tests/aapits/atosxfwrap.c AcpiOsWritePort (
Quoted 10 lines
tests/aapits/atosxfwrap.c +10
-0+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);
Quoted 39 lines
tests/aapits/atosxfwrap.c +8
-0+ } + +AT_CTRL_SUCCESS (AcpiOsWriteCmos); + +return (Status); +} + +/***************************************************************
***************
*
* FUNCTION: AcpiOsReadMemorytests/aapits/atosxfwrap.h +14
-1@@ -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 --Quoted 5 lines
2.3.7
_______________________________________________
Devel mailing list
Devel(a)acpica.org
https://lists.acpica.org/mailman/listinfo/devel_______________________________________________
Devel mailing list
Devel(a)acpica.org
https://lists.acpica.org/mailman/listinfo/devel
Moore
To clarify:
The ACPI specification defines three _HID values for the supported RTC/CMOS devices:
1) PNP0B00 (PC/AT-compatible)
2) PNP0B01 (Intel PIIX4-compatible)
3) PNP0B02 (Dallas Semiconductor-compatible)
This is the reason that ACPICA has never defined low-level CMOS interfaces, since there are 3 different devices. Therefore, the model that is used by ACPICA is this:
The host OS scans the ACPI namespace for the various devices with _HIDs.
Upon detection of _HID PNP0B00, PNP0B01, or PNP0B02, the host loads the appropriate CMOS driver. The driver installs an operation region handler that hands off all CMOS requests to the driver. ACPICA will invoke the handler on any CMOS address space access.
The driver then accesses the CMOS device as appropriate.
It appears that the first 64 bytes of the CMOS may be common between the chips. Accessing anything past 64 bytes seems to be device-dependent. So, any "common" CMOS code is playing with fire, I would think. For example, For PNP0B01, the ACPI specification has this to say: "The upper 192 bytes are accessed through an interface that is only used on Intel chips. (See 82371AB PCI-TO-ISA / IDEXCELERATOR (PIIX4) for details)"
Bob
Quoted 482 lines
-----Original Message-----
From: Moore, Robert
Sent: Wednesday, February 17, 2016 7:31 AM
To: Zheng, Lv; Adam Goode; devel(a)acpica.org
Subject: RE: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandlerThe problem has usually been that there are actually multiple types of CMOS devices, and they are identified by different
_HIDvalues.Quoted 372 lines
-----Original Message-----
From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Zheng, Lv
Sent: Tuesday, February 16, 2016 10:03 PM
To: Adam Goode; devel(a)acpica.org
Subject: Re: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandlerHi,
As I commented before, the support of Cmos opregion should be done in Linux side.
After Linux applied this commit:
https://patchwork.kernel.org/patch/8241491/
You should be able to install the default operation region handlers nearacpi_ec_ecdt_probe().So IMO you could wait a while for the pending patches to be merged before trying again.
Thanks and best regards
-LvQuoted 12 lines
From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Adam Goode
Subject: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandlerThis 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).
Quoted 8 lines
--- 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 +++++++++++++++++++++++
Quoted 3 lines
tests/aapits/atosxfctrl.c | 2 + tests/aapits/atosxfctrl.h | 3 ++ tests/aapits/atosxfwrap.c | 76++++++++++++++++++++++++++++
Quoted 325 lines
tests/aapits/atosxfwrap.h | 16 ++++++ 10 files changed, 268 insertions(+), 1 deletion(-)source/components/events/evhandler.c +0
-0@@ -139,6 +139,7 @@ UINT8AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
ACPI_ADR_SPACE_SYSTEM_MEMORY,ACPI_ADR_SPACE_SYSTEM_IO,ACPI_ADR_SPACE_PCI_CONFIG,source/components/events/evhandler.c +1
-0+ACPI_ADR_SPACE_CMOS , ACPI_ADR_SPACE_DATA_TABLE };source/components/executer/exregion.c +23
-0@@ -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); }source/include/acconfig.h +1
-1@@ -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 */ source/include/acpiosxf.h +17
-0@@ -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 source/os_specific/service_layers/osunixxf.c +52
-0@@ -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 +* +****************************************************************
*************/source/os_specific/service_layers/osunixxf.c +12
-0+ +ACPI_STATUS +AcpiOsWriteCmos ( +ACPI_PHYSICAL_ADDRESS Address, +UINT64 Value, +UINT32 Width) +{ + +return (AE_OK ); +} + +/***************************************************************
***************
*
* FUNCTION: AcpiOsReadMemorysource/os_specific/service_layers/oswinxf.c +52
-0@@ -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 +* +****************************************************************
*************/source/os_specific/service_layers/oswinxf.c +12
-0+ +ACPI_STATUS +AcpiOsWriteCmos ( +ACPI_PHYSICAL_ADDRESS Address, +UINT64 Value, +UINT32 Width) +{ + +return (AE_OK ); +} + +/***************************************************************
***************
*
* FUNCTION: AcpiOsReadMemorytests/aapits/atosxfctrl.c +2
-0@@ -160,6 +160,8 @@ const char *OsxfNames[] = {"AcpiOsDerivePciId" ,"AcpiOsReadPort" ,"AcpiOsWritePort" , +"AcpiOsReadCmos" , +"AcpiOsWriteCmos" ,"AcpiOsReadMemory" ,"AcpiOsWriteMemory" , "AcpiOsSignal"};tests/aapits/atosxfctrl.h +3
-0@@ -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.cb/tests/aapits/atosxfwrap.cindex 7c5de39..0088212 100644tests/aapits/atosxfwrap.c +22
-0@@ -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); +Quoted 8 lines
tests/aapits/atosxfwrap.c AcpiOsWritePort (
Quoted 8 lines
tests/aapits/atosxfwrap.c +8
-0+AT_CHCK_RET_STATUS (AcpiOsReadCmos); + +if (!EMUL_REG_MODE ) { + Status =AcpiOsActualReadCmos (Address, Value, Width); + } +else + { + Status = OsxfCtrlReadReg(EMUL_REG_CMOS, Address, Value,Width);
Quoted 90 lines
Quoted 31 lines
tests/aapits/atosxfwrap.c +21
-0+ } + +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 +* +****************************************************************
*************/tests/aapits/atosxfwrap.c +7
-0+ +ACPI_STATUS +AcpiOsWriteCmos ( +ACPI_PHYSICAL_ADDRESS Address, +UINT64 Value, +UINT32 Width) +{tests/aapits/atosxfwrap.c AcpiOsWritePort (
Quoted 10 lines
tests/aapits/atosxfwrap.c +10
-0+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);
Quoted 39 lines
tests/aapits/atosxfwrap.c +8
-0+ } + +AT_CTRL_SUCCESS (AcpiOsWriteCmos); + +return (Status); +} + +/***************************************************************
***************
*
* FUNCTION: AcpiOsReadMemorytests/aapits/atosxfwrap.h +14
-1@@ -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 --Quoted 5 lines
2.3.7
_______________________________________________
Devel mailing list
Devel(a)acpica.org
https://lists.acpica.org/mailman/listinfo/devel_______________________________________________
Devel mailing list
Devel(a)acpica.org
https://lists.acpica.org/mailman/listinfo/devel
Anthony Jenkins
Quoted 16 lines · Robert Moore
To clarify:
The ACPI specification defines three
_HIDvalues for the supported RTC/CMOS devices:1) PNP0B00 (PC/AT-compatible)
2) PNP0B01 (Intel PIIX4-compatible)
3) PNP0B02 (Dallas Semiconductor-compatible)This is the reason that ACPICA has never defined low-level CMOS interfaces, since there are 3 different devices. Therefore, the model that is used by ACPICA is this:
The host OS scans the ACPI namespace for the various devices with
_HIDs.
Upon detection of_HIDPNP0B00, PNP0B01, or PNP0B02, the host loads the appropriate CMOS driver. The driver installs an operation region handler that hands off all CMOS requests to the driver. ACPICA will invoke the handler on any CMOS address space access.
The driver then accesses the CMOS device as appropriate.
Quoted 3 lines
It appears that the first 64 bytes of the CMOS may be common between the chips. Accessing anything past 64 bytes seems to be device-dependent. So, any "common" CMOS code is playing with fire, I would think. For example, For PNP0B01, the ACPI specification has this to say: "The upper 192 bytes are accessed through an interface that is only used on Intel chips. (See 82371AB PCI-TO-ISA / IDEXCELERATOR (PIIX4) for details)"
Bob
Hi,
I've proposed a patch to FreeBSD-11(CURRENT) to add an ACPI CMOS region handler to its atrtc(4) device, which supports PNP0B00 devices, exactly as you've suggested in your model. Is there anything ACPICA can/will provide to support this effort, or should my patch represent the the complete implementation of CMOS region support in our OSPM (at least for this particular CMOS device)? At least the HP Envy line of laptops requires this support to enable FreeBSD to suspend/power-down.
Thanks,
Signature · 1 line
Anthony Jenkins
Moore
I'm not sure what the status of this is in ACPICA. But it does sound like we could supply a default handler that only accesses the addresses 0-63
Quoted 57 lines
-----Original Message-----
From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Anthony Jenkins
Sent: Thursday, April 14, 2016 8:19 AM
To: devel(a)acpica.org
Subject: Re: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandlerQuoted 3 lines · Robert Moore
To clarify:
The ACPI specification defines three
_HIDvalues for the supportedRTC/CMOS devices:
Quoted 6 lines
1) PNP0B00 (PC/AT-compatible)
2) PNP0B01 (Intel PIIX4-compatible)
3) PNP0B02 (Dallas Semiconductor-compatible)This is the reason that ACPICA has never defined low-level CMOS
interfaces, since there are 3 different devices. Therefore, the model that is used by ACPICA is this:
Quoted 3 lines
The host OS scans the ACPI namespace for the various devices with
_HIDs. Upon detection of_HIDPNP0B00, PNP0B01, or PNP0B02, the host loads theappropriate CMOS driver.
Quoted 1 line
The driver installs an operation region handler that hands off all CMOS
requests to the driver.
Quoted 4 lines
ACPICA will invoke the handler on any CMOS address space access. The driver then accesses the CMOS device as appropriate.
It appears that the first 64 bytes of the CMOS may be common between the
chips. Accessing anything past 64 bytes seems to be device-dependent. So, any "common" CMOS code is playing with fire, I would think. For example, For PNP0B01, the ACPI specification has this to say: "The upper 192 bytes are accessed through an interface that is only used on Intel chips. (See 82371AB PCI-TO-ISA / IDEXCELERATOR (PIIX4) for details)"
Quoted 2 lines
Bob
Hi,
I've proposed a patch to FreeBSD-11(CURRENT) to add an ACPI CMOS region handler to its atrtc(4) device, which supports PNP0B00 devices, exactly as you've suggested in your model. Is there anything ACPICA can/will provide to support this effort, or should my patch represent the the complete implementation of CMOS region support in our OSPM (at least for this particular CMOS device)? At least the HP Envy line of laptops requires this support to enable FreeBSD to suspend/power-down.
Thanks,
--
Anthony Jenkins_______________________________________________
Devel mailing list
Devel(a)acpica.org
https://lists.acpica.org/mailman/listinfo/devel