[PATCH v2] Introduce AcpiOs(Read|Write)Cmos and enable these in AcpiExCmosSpaceHandler
by Adam Goode
This introduces a generic OSL interface for reading and writing
SystemCMOS spaces. It is needed on Linux for registering a generic
handler for SystemCMOS because some firmware accesses CMOS in _INI.
(The first time I sent a somewhat corrupted patch file. This one should
be better).
---
source/components/events/evhandler.c | 1 +
source/components/executer/exregion.c | 23 +++++++++
source/include/acconfig.h | 2 +-
source/include/acpiosxf.h | 18 +++++++
source/os_specific/service_layers/osunixxf.c | 64 +++++++++++++++++++++++
source/os_specific/service_layers/oswinxf.c | 64 +++++++++++++++++++++++
tests/aapits/atosxfctrl.c | 2 +
tests/aapits/atosxfctrl.h | 3 ++
tests/aapits/atosxfwrap.c | 76 ++++++++++++++++++++++++++++
tests/aapits/atosxfwrap.h | 16 ++++++
10 files changed, 268 insertions(+), 1 deletion(-)
diff --git a/source/components/events/evhandler.c b/source/components/events/evhandler.c
index d02ea53..634c18e 100644
--- a/source/components/events/evhandler.c
+++ b/source/components/events/evhandler.c
@@ -139,6 +139,7 @@ UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_DATA_TABLE
};
diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c
index 31bbb60..bd9addd 100644
--- a/source/components/executer/exregion.c
+++ b/source/components/executer/exregion.c
@@ -551,6 +551,29 @@ AcpiExCmosSpaceHandler (
ACPI_FUNCTION_TRACE (ExCmosSpaceHandler);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "System-CMOS (width %u) R/W %u Address=%8.8X%8.8X\n",
+ BitWidth, Function, ACPI_FORMAT_UINT64(Address)));
+
+ switch (Function)
+ {
+ case ACPI_READ:
+
+ *Value = 0;
+ Status = AcpiOsReadCmos(Address, Value, BitWidth);
+ break;
+
+ case ACPI_WRITE:
+
+ Status = AcpiOsWriteCmos(Address, *Value, BitWidth);
+ break;
+
+ default:
+
+ Status = AE_BAD_PARAMETER;
+ break;
+ }
+
return_ACPI_STATUS (Status);
}
diff --git a/source/include/acconfig.h b/source/include/acconfig.h
index 41fa33d..dcecfa7 100644
--- a/source/include/acconfig.h
+++ b/source/include/acconfig.h
@@ -270,7 +270,7 @@
/* Maximum SpaceIds for Operation Regions */
#define ACPI_MAX_ADDRESS_SPACE 255
-#define ACPI_NUM_DEFAULT_SPACES 4
+#define ACPI_NUM_DEFAULT_SPACES 5
/* Array sizes. Used for range checking also */
diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h
index 68d79c7..31523ea 100644
--- a/source/include/acpiosxf.h
+++ b/source/include/acpiosxf.h
@@ -452,6 +452,24 @@ AcpiOsWritePort (
UINT32 Width);
#endif
+/*
+ * Platform and hardware-independent CMOS memory interfaces
+ */
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadCmos
+ACPI_STATUS
+AcpiOsReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteCmos
+ACPI_STATUS
+AcpiOsWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width);
+#endif
/*
* Platform and hardware-independent physical memory interfaces
diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index c48f581..b763ddc 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -1361,6 +1361,70 @@ AcpiOsWritePort (
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiOsReadCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to read
+ * Value - Where value is placed
+ * Width - Number of bits
+ *
+ * RETURN: Value read from CMOS memory
+ *
+ * DESCRIPTION: Read data from CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width)
+{
+
+ switch (Width)
+ {
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+
+ *Value = 0;
+ break;
+
+ default:
+
+ return (AE_BAD_PARAMETER);
+ }
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWriteCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to write
+ * Value - Value to write
+ * Width - Number of bits
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiOsReadMemory
diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c
index 66ce8c8..80086fd 100644
--- a/source/os_specific/service_layers/oswinxf.c
+++ b/source/os_specific/service_layers/oswinxf.c
@@ -1356,6 +1356,70 @@ AcpiOsWritePort (
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiOsReadCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to read
+ * Value - Where value is placed
+ * Width - Number of bits
+ *
+ * RETURN: Value read from CMOS memory
+ *
+ * DESCRIPTION: Read data from CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width)
+{
+
+ switch (Width)
+ {
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+
+ *Value = 0;
+ break;
+
+ default:
+
+ return (AE_BAD_PARAMETER);
+ }
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWriteCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to write
+ * Value - Value to write
+ * Width - Number of bits
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiOsReadMemory
diff --git a/tests/aapits/atosxfctrl.c b/tests/aapits/atosxfctrl.c
index fe8b562..9a6b41c 100644
--- a/tests/aapits/atosxfctrl.c
+++ b/tests/aapits/atosxfctrl.c
@@ -160,6 +160,8 @@ const char *OsxfNames[] = {
"AcpiOsDerivePciId",
"AcpiOsReadPort",
"AcpiOsWritePort",
+ "AcpiOsReadCmos",
+ "AcpiOsWriteCmos",
"AcpiOsReadMemory",
"AcpiOsWriteMemory",
"AcpiOsSignal"};
diff --git a/tests/aapits/atosxfctrl.h b/tests/aapits/atosxfctrl.h
index 66a361d..2c8b9e5 100644
--- a/tests/aapits/atosxfctrl.h
+++ b/tests/aapits/atosxfctrl.h
@@ -162,6 +162,8 @@ typedef enum
AcpiOsDerivePciIdC,
AcpiOsReadPortC,
AcpiOsWritePortC,
+ AcpiOsReadCmosC,
+ AcpiOsWriteCmosC,
AcpiOsReadMemoryC,
AcpiOsWriteMemoryC,
AcpiOsSignalC,
@@ -229,6 +231,7 @@ typedef struct acpi_os_emul_reg
*/
#define EMUL_REG_SYS 0x01
#define EMUL_REG_IO 0x02
+#define EMUL_REG_CMOS 0x03
/*
* Fixed ACPI h/w emulated registers numbers
diff --git a/tests/aapits/atosxfwrap.c b/tests/aapits/atosxfwrap.c
index 7c5de39..0088212 100644
--- a/tests/aapits/atosxfwrap.c
+++ b/tests/aapits/atosxfwrap.c
@@ -1272,6 +1272,82 @@ AcpiOsWritePort (
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiOsReadCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to read
+ * Value - Where value is placed
+ * Width - Number of bits
+ *
+ * RETURN: Value read from CMOS memory
+ *
+ * DESCRIPTION: Read data from CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width)
+{
+ AT_CTRL_DECL(AcpiOsReadCmos);
+
+ AT_CHCK_RET_STATUS(AcpiOsReadCmos);
+
+ if (!EMUL_REG_MODE) {
+ Status = AcpiOsActualReadCmos(Address, Value, Width);
+ }
+ else
+ {
+ Status = OsxfCtrlReadReg(EMUL_REG_CMOS, Address, Value, Width);
+ }
+
+ AT_CTRL_SUCCESS(AcpiOsReadCmos);
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWriteCmos
+ *
+ * PARAMETERS: Address - Address of CMOS memory to write
+ * Value - Value to write
+ * Width - Number of bits
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to CMOS memory
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width)
+{
+ AT_CTRL_DECL(AcpiOsWriteCmos);
+
+ AT_CHCK_RET_STATUS(AcpiOsWriteCmos);
+
+ if (!EMUL_REG_MODE) {
+ Status = AcpiOsActualWriteCmos(Address, Value, Width);
+ }
+ else
+ {
+ Status = OsxfCtrlWriteReg(EMUL_REG_CMOS, Address, Value, Width);
+ }
+
+ AT_CTRL_SUCCESS(AcpiOsWriteCmos);
+
+ return (Status);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiOsReadMemory
diff --git a/tests/aapits/atosxfwrap.h b/tests/aapits/atosxfwrap.h
index 27224d0..48e2100 100644
--- a/tests/aapits/atosxfwrap.h
+++ b/tests/aapits/atosxfwrap.h
@@ -324,6 +324,22 @@ AcpiOsActualWritePort (
/*
+ * Platform and hardware-independent CMOS memory interfaces
+ */
+ACPI_STATUS
+AcpiOsActualReadCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width);
+
+ACPI_STATUS
+AcpiOsActualWriteCmos (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width);
+
+
+/*
* Platform and hardware-independent physical memory interfaces
*/
ACPI_STATUS
--
2.3.7
4 years, 10 months
ACPICA version 20151124 released
by Moore, Robert
24 November 2015. Summary of changes for version 20151124:
This release is available at https://acpica.org/downloads
1) ACPICA kernel-resident subsystem:
Fixed a possible regression for a previous update to FADT handling. The FADT no longer has a fixed table ID, causing some issues with code that was hardwired to a specific ID. Lv Zheng.
Fixed a problem where the method auto-serialization could interfere with the current SyncLevel. This change makes the auto-serialization support transparent to the SyncLevel support and management.
Removed support for the _SUB predefined name in AcpiGetObjectInfo. This interface is intended for early access to the namespace during the initial namespace device discovery walk. The _SUB method has been seen to access operation regions in some cases, causing errors because the operation regions are not fully initialized.
AML Debugger: Fixed some issues with the terminate/quit/exit commands that can cause faults. Lv Zheng.
AML Debugger: Add thread ID support so that single-step mode only applies to the AML Debugger thread. This prevents runtime errors within some kernels. Lv Zheng.
Eliminated extraneous warnings from AcpiGetSleepTypeData. Since the _Sx methods that are invoked by this interface are optional, removed warnings emitted for the case where one or more of these methods do not exist. ACPICA BZ 1208, original change by Prarit Bhargava.
Made a major pass through the entire ACPICA source code base to standardize formatting that has diverged a bit over time. There are no functional changes, but this will of course cause quite a few code differences from the previous ACPICA release.
Example Code and Data Size: These are the sizes for the OS-independent acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug version of the code includes the debug output trace mechanism and has a much larger code and data size.
Current Release:
Non-Debug Version: 102.0K Code, 28.3K Data, 130.3K Total
Debug Version: 199.6K Code, 81.8K Data, 281.4K Total
Previous Release:
Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total
Debug Version: 199.3K Code, 81.4K Data, 280.7K Total
2) iASL Compiler/Disassembler and Tools:
iASL/acpiexec/acpixtract/disassembler: Added support to allow multiple definition blocks within a single ASL file and the resulting AML file. Support for this type of file was also added to the various tools that use binary AML files: acpiexec, acpixtract, and the AML disassembler. The example code below shows two definition blocks within the same file:
DefinitionBlock ("dsdt.aml", "DSDT", 2, "Intel", "Template", 0x12345678)
{
}
DefinitionBlock ("", "SSDT", 2, "Intel", "Template", 0xABCDEF01)
{
}
iASL: Enhanced typechecking for the Name() operator. All expressions for the value of the named object must be reduced/folded to a single constant at compile time, as per the ACPI specification (the AML definition of Name()).
iASL: Fixed some code indentation issues for the -ic and -ia options (C and assembly headers). Now all emitted code correctly begins in column 1.
iASL: Added an error message for an attempt to open a Scope() on an object defined in an SSDT. The DSDT is always loaded into the namespace first, so any attempt to open a Scope on an SSDT object will fail at runtime.
5 years, 2 months
[PATCH v2 0/2] Add acpi_dev_present
by Lukas Wunner
Hi,
On Tue, Nov 24, 2015 at 12:40:51 +0800, Hanjun Guo wrote:
> I think those IDs already cached, in acpi_init_device_object(),
> INIT_LIST_HEAD(&device->pnp.ids);
> ...
> acpi_set_pnp_ids(handle, &device->pnp, type);
> please see API acpi_device_hid(), so I think you can introduce a API with
> acpi_device and HID passed as arguments in scan.c
Thank you for your feedback, I've reworked the patch to iterate over
acpi_bus_id_list instead of walking the namespace.
An alternative approach would have been to traverse the acpi_device
tree but it would have been more code. If you would prefer that over
the solution I've settled on please let me know. It would be useful
for stuff like this to have a function that traverses the acpi_device
tree and invokes a callback for each node, à la acpi_ns_walk_namespace().
Does such a thing exist already? If so I've missed it.
> Will those drivers be loaded before the acpi namespace is scanned?
I verified that all 7 existing users invoke the new API from initcall
level "device". The bus is scanned in initcall level "subsystem",
i.e. earlier. So we're on the safe side here. I added a note in the
kernel-doc that the function may not be called from a subsys_initcall()
or earlier, this will hopefully make it foolproof. (If you feel this is
over the top then just leave it out if/when merging.)
On Tue, Nov 24, 2015 at 15:22:18 +0100, Rafael J. Wysocki wrote:
> I'd prefer that to go to utils.c to be honest, even if the namespace
> needs to be walked.
Done. Since this is not part of ACPICA, would it be okay to merge via
ASoC as requested by Mark Brown?
I've pushed the new version of the series to GitHub for more convenient
reviewing. All driver patches except the one for Mark have acks now:
https://github.com/l1k/linux/commits/acpi_dev_present
Thanks,
Lukas
Lukas Wunner (2):
ACPI / scan: Fix acpi_bus_id_list bookkeeping
ACPI / utils: Add acpi_dev_present()
drivers/acpi/internal.h | 8 ++++++++
drivers/acpi/scan.c | 22 +++++++++++++++-------
drivers/acpi/utils.c | 31 +++++++++++++++++++++++++++++++
include/acpi/acpi_bus.h | 2 ++
4 files changed, 56 insertions(+), 7 deletions(-)
--
1.8.5.2 (Apple Git-48)
5 years, 3 months
Re: [Devel] [PATCH 1/5] ACPICA: Add acpi_dev_present
by Hanjun Guo
On 11/24/2015 10:22 PM, Rafael J. Wysocki wrote:
> On Tuesday, November 24, 2015 12:40:51 PM Hanjun Guo wrote:
>> On 2015/11/24 7:32, Lukas Wunner wrote:
>>> Hi Robert,
>>>
>>> On Mon, Nov 23, 2015 at 10:22:27PM +0000, Moore, Robert wrote:
>>>>>> acpi_dev_present
>>>> Do you really want to be walking the ACPICA namespace for every call?
>>> That's what the drivers currently do. Typically this is called only once
>>> on initialization by the driver's ->probe callback.
>>>
>>> What did you have in mind instead, cache the result? Or store the HIDs
>>> in the namespace in a hash that can be queried faster?
>>
>> Will those drivers be loaded before the acpi namespace is scanned? if not, I think
>> those IDs already cached, in acpi_init_device_object(),
>>
>> INIT_LIST_HEAD(&device->pnp.ids);
>> ...
>> acpi_set_pnp_ids(handle, &device->pnp, type);
>>
>> please see API acpi_device_hid(), so I think you can introduce a API with
>> acpi_device and HID passed as arguments in scan.c
>
> I'd prefer that to go to utils.c to be honest, even if the namespace needs to
> be walked.
I agree, utils.c is the better place to go.
Thanks
Hanjun
5 years, 3 months
Re: [Devel] [PATCH 1/5] ACPICA: Add acpi_dev_present
by Moore, Robert
> -----Original Message-----
> From: Hanjun Guo [mailto:guohanjun@huawei.com]
> Sent: Monday, November 23, 2015 8:41 PM
> To: Lukas Wunner; Moore, Robert
> Cc: Rafael J. Wysocki; linux-acpi(a)vger.kernel.org; devel(a)acpica.org;
> platform-driver-x86(a)vger.kernel.org; Darren Hart; Corentin Chary; Lee,
> Chun-Yi; alsa-devel(a)alsa-project.org; Takashi Iwai; Hui Wang; Mark Brown;
> Zheng, Lv; David Box
> Subject: Re: [PATCH 1/5] ACPICA: Add acpi_dev_present
>
> On 2015/11/24 7:32, Lukas Wunner wrote:
> > Hi Robert,
> >
> > On Mon, Nov 23, 2015 at 10:22:27PM +0000, Moore, Robert wrote:
> >>>> acpi_dev_present
> >> Do you really want to be walking the ACPICA namespace for every call?
> > That's what the drivers currently do. Typically this is called only
> > once on initialization by the driver's ->probe callback.
> >
> > What did you have in mind instead, cache the result? Or store the HIDs
> > in the namespace in a hash that can be queried faster?
>
> Will those drivers be loaded before the acpi namespace is scanned? if not,
> I think those IDs already cached, in acpi_init_device_object(),
I was thinking about something like this. Traversing the namespace over and over is truly brute force.
>
> INIT_LIST_HEAD(&device->pnp.ids);
> ...
> acpi_set_pnp_ids(handle, &device->pnp, type);
>
> please see API acpi_device_hid(), so I think you can introduce a API with
> acpi_device and HID passed as arguments in scan.c
>
> Thanks
> Hanjun
5 years, 3 months
Re: [Devel] [PATCH 1/5] ACPICA: Add acpi_dev_present
by Moore, Robert
>>acpi_dev_present
Do you really want to be walking the ACPICA namespace for every call?
> -----Original Message-----
> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Monday, November 23, 2015 2:35 PM
> To: Lukas Wunner
> Cc: linux-acpi(a)vger.kernel.org; devel(a)acpica.org; platform-driver-
> x86(a)vger.kernel.org; Darren Hart; Corentin Chary; Lee, Chun-Yi; alsa-
> devel(a)alsa-project.org; Takashi Iwai; Hui Wang; Mark Brown; Zheng, Lv;
> Moore, Robert; David Box
> Subject: Re: [PATCH 1/5] ACPICA: Add acpi_dev_present
>
> On Monday, November 23, 2015 03:34:55 PM Lukas Wunner wrote:
> > There are 7 drivers which call acpi_get_devices to check for the
> > presence of a particular ACPI HID, each defining its own copy of a
> > mostly identical callback.
> >
> > Add acpi_dev_present, the ACPI equivalent to pci_dev_present, allowing
> > us to deduplicate all that boilerplate in the drivers.
> >
> > Signed-off-by: Lukas Wunner <lukas(a)wunner.de>
>
> We have a general rule for ACPICA patches that they go in through upstream
> ACPICA.
>
> So if you really want this changes in ACPICA, this is the way to handle
> it.
>
> Now, of course, for that to happen, you should have CCed the ACPICA
> maintainers too (now done).
>
> Thanks,
> Rafael
>
>
> > ---
> > drivers/acpi/acpica/nsxfeval.c | 46
> ++++++++++++++++++++++++++++++++++++++++++
> > include/acpi/acpixf.h | 7 +++++++
> > 2 files changed, 53 insertions(+)
> >
> > diff --git a/drivers/acpi/acpica/nsxfeval.c
> > b/drivers/acpi/acpica/nsxfeval.c index 6ee1e52..19293fa 100644
> > --- a/drivers/acpi/acpica/nsxfeval.c
> > +++ b/drivers/acpi/acpica/nsxfeval.c
> > @@ -828,6 +828,52 @@ ACPI_EXPORT_SYMBOL(acpi_get_devices)
> >
> >
> /*************************************************************************
> ******
> > *
> > + * FUNCTION: acpi_ns_dev_present_callback
> > + *
> > + * PARAMETERS: Callback from acpi_get_devices
> > + *
> > + * RETURN: Status
> > + *
> > + * DESCRIPTION: Minimal callback to be passed to acpi_get_devices which
> > + * performs no further filtering and terminates the search
> > + * immediately.
> > + *
> > +
> > +*********************************************************************
> > +*********/ static acpi_status
> > +acpi_ns_dev_present_callback(acpi_handle handle, u32 level,
> > + void *context, void **retval)
> > +{
> > + *(bool *)context = true;
> > + return AE_CTRL_TERMINATE;
> > +}
> > +
> > +/********************************************************************
> > +***********
> > + *
> > + * FUNCTION: acpi_dev_present
> > + *
> > + * PARAMETERS: HID - HID to search for.
> > + *
> > + * RETURNS True if a matching object of type Device was found.
> > + *
> > + * DESCRIPTION: Performs a walk of the namespace tree. When a matching
> object
> > + * of type Device is found, the search is terminated
> immediately.
> > + *
> > +
> > +*********************************************************************
> > +*********/
> > +
> > +bool
> > +acpi_dev_present(const char *HID)
> > +{
> > + acpi_status status;
> > + bool found = false;
> > +
> > + status = acpi_get_devices(HID, acpi_ns_dev_present_callback, &found,
> > + NULL);
> > + return ACPI_SUCCESS(status) && found; }
> > +
> > +ACPI_EXPORT_SYMBOL(acpi_dev_present)
> > +
> > +/********************************************************************
> > +***********
> > + *
> > * FUNCTION: acpi_attach_data
> > *
> > * PARAMETERS: obj_handle - Namespace node
> > diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index
> > 3aaaa86..f299347 100644
> > --- a/include/acpi/acpixf.h
> > +++ b/include/acpi/acpixf.h
> > @@ -115,6 +115,11 @@
> > prototype;
> > #endif
> >
> > +#ifndef ACPI_EXTERNAL_RETURN_BOOL
> > +#define ACPI_EXTERNAL_RETURN_BOOL(prototype) \
> > + prototype;
> > +#endif
> > +
> >
> /*************************************************************************
> ****
> > *
> > * Public globals and runtime configuration options @@ -483,6 +488,8
> > @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
> > acpi_walk_callback user_function,
> > void *context,
> > void **return_value))
> > +ACPI_EXTERNAL_RETURN_BOOL(bool
> > + acpi_dev_present(const char *HID))
> > ACPI_EXTERNAL_RETURN_STATUS(acpi_status
> > acpi_get_name(acpi_handle object, u32 name_type,
> > struct acpi_buffer *ret_path_ptr))
> >
5 years, 3 months
Re: [Devel] [PATCH 2/5] eeepc-wmi: Use acpi_dev_present
by Lukas Wunner
Hi Darren,
On Mon, Nov 23, 2015 at 11:04:13AM -0800, Darren Hart wrote:
> On Mon, Nov 23, 2015 at 03:34:55PM +0100, Lukas Wunner wrote:
> > Use shiny new acpi_dev_present and remove all the boilerplate to search
> > for a particular ACPI device. No functional change.
>
> You did add a pr_warn, which is technically a functional change. Did you intend
> to leave that in?
That's not an addition of mine, I moved it from eeepc_wmi_parse_device()
to eeepc_wmi_probe() so that everything behaves exactly as before.
(See the deleted lines further up in the patch.)
> Rafael, I assume you will pick this up along with the acpi_dev_present ACPI
> change if you take that. Pleaes let me know if not.
The last patch in the series concerned Intel ASoC (sound/soc/intel/)
and the maintainer Mark Brown <broonie(a)kernel.org> has replied that
"This will collide with some other work done on the Intel code in -next I
expect, probably best to merge this via ASoC (so pulling a shared branch
for the new API) or just wait till 4.5 to do the conversion."
[full quote of his message as it wasn't cc: platform-driver-x86]
So I guess Mark might pull it in, haven't heard back from the ACPI
maintainers yet.
> Otherwise,
> Acked-by: Darren Hart <dvhart(a)linux.intel.com>
Awesome, thanks!
Best regards,
Lukas
5 years, 3 months
[PATCH 0/5] Add acpi_dev_present
by Lukas Wunner
Hi everyone,
I need to detect the presence of apple-gmux (ACPI HID "APP000B")
in several DRM drivers to handle backlight, runtime pm and
deferred probing properly.
There's an idiom in use by 7 other drivers to detect presence of
a particular ACPI HID which involves calling acpi_get_devices()
and passing it a minimal callback that does no further filtering.
However this approach results in lots of duplicate code.
This series adds acpi_dev_present(), the ACPI equivalent to
pci_dev_present(). It takes a HID string and returns a bool,
allowing us to simplify the drivers considerably by removing
all the duplicate callbacks and other boilerplate.
I've pushed these patches to GitHub to ease reviewing:
https://github.com/l1k/linux/commits/acpi_dev_present
Should this series find acceptance, it would probably be best if
we could agree to merge everything through a single repository,
e.g. acpi (git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm).
or alternatively alsa (which contains 5 of the 7 drivers involved).
Consequently I would like to invite the driver maintainers to
kindly provide acks (or raise objections, if any).
The series should not result in any functional changes, however
I lack the hardware to actually verify this for every driver
involved. I did test it with apple-gmux though.
Thanks,
Lukas
Lukas Wunner (5):
ACPICA: Add acpi_dev_present
eeepc-wmi: Use acpi_dev_present
acer-wmi: Use acpi_dev_present
ALSA: hda - Use acpi_dev_present
ASoC: Intel: Use acpi_dev_present
drivers/acpi/acpica/nsxfeval.c | 46 ++++++++++++++++++++++++++++
drivers/platform/x86/acer-wmi.c | 16 +++-------
drivers/platform/x86/eeepc-wmi.c | 24 ++-------------
include/acpi/acpixf.h | 7 +++++
sound/pci/hda/thinkpad_helper.c | 17 ++--------
sound/soc/intel/atom/sst/sst_acpi.c | 12 +-------
sound/soc/intel/boards/cht_bsw_max98090_ti.c | 17 ++--------
sound/soc/intel/boards/cht_bsw_rt5645.c | 13 +-------
sound/soc/intel/common/sst-acpi.c | 12 +-------
9 files changed, 66 insertions(+), 98 deletions(-)
--
1.8.5.2 (Apple Git-48)
5 years, 3 months
ASPT ACPI table
by Moore, Robert
Anyone know where we can find the actual definition of this ACPI table?
+ { "ASPT", "ACPI System Performance Tuning Table" },
5 years, 3 months