linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "Zheng, Lv" <lv.zheng@intel.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Moore, Robert" <robert.moore@intel.com>,
	"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	Len Brown <lenb@kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"devel@acpica.org" <devel@acpica.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Box, David E" <david.e.box@intel.com>
Subject: Re: [PATCH] ACPICA: Export mutex functions
Date: Tue, 18 Apr 2017 16:15:09 +0200	[thread overview]
Message-ID: <1773950.yRmmpX2ztC@aspire.rjw.lan> (raw)
In-Reply-To: <03d661cb-a561-cfce-2c0e-f81ff73e6653@roeck-us.net>

On Tuesday, April 18, 2017 06:50:26 AM Guenter Roeck wrote:
> On 04/18/2017 12:14 AM, Zheng, Lv wrote:
> > Hi,

[cut]

> >
> > Maybe I should provide more detailed examples for this solution.
> >
> > For example:
> > OperationRegion (SIOT, SuperIOAddressSpace, Zero, 100)
> > Field (SIOT, ByteAcc, Lock, Preserve)
> > {
> >     FNC1, 8,
> >     FNC2, 8,
> >     ...
> > }
> >
> > Acquire (MUX0)
> > Store (0, FNC1)
> > Release (MUX0)
> >
> > Then you can call (let me use casual pseudo code)
> > acpi_install_operation_region(SuperIOAddressSpace, superio_opregion_handler) from OS side.
> > In its callback superio_opregion_handler(), you can:
> >
> > superio_enter();
> > If (address == 0) {
> >    /* mean FNC1 */
> >    Perform the locked superior accesses
> > } else if (address == 1) {
> >    /* mean FNC2 */
> >    Perform the locked superior accesses
> > }
> > superio_exit();
> >
> > Are there similar approach in your DSDT?
> >
> 
> Some snippets from the DSDT:
> 
> 	Device (SIO1)
>             {
>          	Name (_HID, EisaId ("PNP0C02") /* PNP Motherboard Resources */)  // _HID: Hardware ID
>          	Name (_UID, Zero)  // _UID: Unique ID
> 		...
> 		Mutex (MUT0, 0x00)
> 		Method (ENFG, 1, NotSerialized)
>                      {
>                          Acquire (MUT0, 0x0FFF)
>                          INDX = 0x87
>                          INDX = One
>                          INDX = 0x55
>                          If ((SP1O == 0x2E))
>                          {
>                              INDX = 0x55
>                          }
>                          Else
>                          {
>                              INDX = 0xAA
>                          }
> 
>                          LDN = Arg0
>                      }
> 
>                      Method (EXFG, 0, NotSerialized)
>                      {
>                          INDX = 0x02
>                          DATA = 0x02
>                          Release (MUT0)
>                      }
> 
> 		    OperationRegion (IOID, SystemIO, SP1O, 0x02)	/* SP1O is 0x2e */
>                      Field (IOID, ByteAcc, NoLock, Preserve)
>                      {
>                          INDX,   8,
>                          DATA,   8
>                      }
> 		    ...
> 
> Example for use:
> 		Method (DCNT, 2, NotSerialized)
>                      {
>                          ENFG (CGLD (Arg0))
>                          If (((DMCH < 0x04) && ((Local1 = (DMCH & 0x03)) != Zero)))
>                          {
>                              RDMA (Arg0, Arg1, Local1++)
>                          }
> 
>                          ACTR = Arg1
>                          Local1 = (IOAH << 0x08)
>                          Local1 |= IOAL
>                          RRIO (Arg0, Arg1, Local1, 0x08)
>                          EXFG ()
>                      }
> 
> Can there be more than one address space handler for a given region ?
> Each driver accessing the resource would need that handler.

Rather, every driver accessing the resource would need to be aware of the
existence of the operation region handler and would need to use the mutual
exclusion mechanism used by that handler, if my understanding here is correct.

The existence of an operation region for a specific section of address space is
a declaration that AML is going to access locations in that section.  It allows
the OS to install a handler for that region to intercept AML accesses and do
what it likes with them.

Thanks,
Rafael

  reply	other threads:[~2017-04-18 14:21 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12 15:13 [PATCH] ACPICA: Export mutex functions Guenter Roeck
2017-04-12 15:29 ` Moore, Robert
2017-04-12 21:22   ` Guenter Roeck
2017-04-12 21:56     ` Moore, Robert
2017-04-13  0:55       ` Guenter Roeck
2017-04-14 22:30       ` Rafael J. Wysocki
2017-04-14 23:32         ` Moore, Robert
2017-04-17  9:39     ` Zheng, Lv
2017-04-17  9:48       ` Zheng, Lv
2017-04-17 14:05         ` Guenter Roeck
2017-04-17 23:35           ` Zheng, Lv
2017-04-17 15:56       ` Guenter Roeck
2017-04-17 17:12         ` Moore, Robert
2017-04-17 19:27           ` Moore, Robert
2017-04-17 19:45             ` Guenter Roeck
2017-04-17 20:40               ` Moore, Robert
2017-04-17 21:03                 ` Guenter Roeck
2017-04-17 21:29                   ` Rafael J. Wysocki
2017-04-17 22:32                     ` Guenter Roeck
2017-04-17 22:56                       ` Rafael J. Wysocki
2017-04-17 23:53                       ` Zheng, Lv
2017-04-18  4:35                         ` Guenter Roeck
2017-04-18  7:06                           ` Zheng, Lv
2017-04-18  7:14                           ` Zheng, Lv
2017-04-18 13:50                             ` Guenter Roeck
2017-04-18 14:15                               ` Rafael J. Wysocki [this message]
2017-04-18 16:07                                 ` Moore, Robert
2017-04-19  1:26                               ` Zheng, Lv
2017-04-19  1:35                                 ` Zheng, Lv
2017-04-17 23:46               ` Zheng, Lv
2017-04-17 23:43             ` Zheng, Lv
2017-04-17 19:35           ` Moore, Robert
2017-04-17 23:37         ` Zheng, Lv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1773950.yRmmpX2ztC@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=david.e.box@intel.com \
    --cc=devel@acpica.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lv.zheng@intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).