* Re: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
@ 2016-04-14 15:18 Anthony Jenkins
0 siblings, 0 replies; 6+ messages in thread
From: Anthony Jenkins @ 2016-04-14 15:18 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 1842 bytes --]
On Thu Feb 18 08:05:56 PST 2016, Robert Moore wrote:
> 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
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
@ 2016-04-14 15:49 Moore, Robert
0 siblings, 0 replies; 6+ messages in thread
From: Moore, Robert @ 2016-04-14 15:49 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 2535 bytes --]
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
> -----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 AcpiExCmosSpaceHandler
>
> On Thu Feb 18 08:05:56 PST 2016, Robert Moore wrote:
> > 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
>
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
@ 2016-02-18 16:05 Moore, Robert
0 siblings, 0 replies; 6+ messages in thread
From: Moore, Robert @ 2016-02-18 16:05 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 17152 bytes --]
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
> -----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 AcpiExCmosSpaceHandler
>
> The problem has usually been that there are actually multiple types of
> CMOS devices, and they are identified by different _HID values.
>
>
> > -----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 AcpiExCmosSpaceHandler
> >
> > 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
> >
> > > 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 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(-)
> > >
> > > 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
> > > _______________________________________________
> > > 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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
@ 2016-02-17 15:30 Moore, Robert
0 siblings, 0 replies; 6+ messages in thread
From: Moore, Robert @ 2016-02-17 15:30 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 14687 bytes --]
The problem has usually been that there are actually multiple types of CMOS devices, and they are identified by different _HID values.
> -----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 AcpiExCmosSpaceHandler
>
> 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
>
> > 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 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(-)
> >
> > 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
> > _______________________________________________
> > 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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
@ 2016-02-17 6:03 Zheng, Lv
0 siblings, 0 replies; 6+ messages in thread
From: Zheng, Lv @ 2016-02-17 6:03 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 13222 bytes --]
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
> 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 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(-)
>
> 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
> _______________________________________________
> Devel mailing list
> Devel(a)acpica.org
> https://lists.acpica.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 6+ messages in thread* [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
@ 2015-05-02 1:01 Adam Goode
0 siblings, 0 replies; 6+ messages in thread
From: Adam Goode @ 2015-05-02 1:01 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 11605 bytes --]
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-14 15:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-14 15:18 [Devel] [PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler Anthony Jenkins
-- strict thread matches above, loose matches on Subject: below --
2016-04-14 15:49 Moore, Robert
2016-02-18 16:05 Moore, Robert
2016-02-17 15:30 Moore, Robert
2016-02-17 6:03 Zheng, Lv
2015-05-02 1:01 Adam Goode
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.