Linux-ACPI Archive on lore.kernel.org
 help / color / Atom feed
* Help on named object in kernel 
@ 2019-06-12 11:48 Udit Kumar
  2019-06-12 16:37 ` Schmauss, Erik
  0 siblings, 1 reply; 6+ messages in thread
From: Udit Kumar @ 2019-06-12 11:48 UTC (permalink / raw)
  To: ACPI Devel Maling List; +Cc: lenb, Rafael J. Wysocki

Dear ACPI experts, 
I need your help on defining named objected in ACPI under _CRS. 
In my firmware, I have defined two addresses for my device using 
Memory32Fixed and QwordMemory under _CRS.  
These  two addresses are 32-bit and 64-bit long respectively. 
For Memory32Fixed, I gave DescriptorName name as REG0
and for QwordMemory I gave DescriptorName as SATA.

In Linux, all of resource of this device is added under its name 
(NXP0003:00).  Reading r-> name for all resource of this device 
is giving name as NXP0003:00. 
So I am not able to use existing OS driver using call 
platform_get_resource_byname, I have to use platform_get_resource
API with index to get above addresses.

Could you help me, if there is way to use named resource in acpi.
Fyi, I am on kernel 4.14.122

Many Thanks 
Udit 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Help on named object in kernel 
  2019-06-12 11:48 Help on named object in kernel Udit Kumar
@ 2019-06-12 16:37 ` Schmauss, Erik
  2019-06-12 17:00   ` [EXT] " Udit Kumar
  2019-06-12 17:00   ` Sudeep Holla
  0 siblings, 2 replies; 6+ messages in thread
From: Schmauss, Erik @ 2019-06-12 16:37 UTC (permalink / raw)
  To: Udit Kumar, ACPI Devel Maling List; +Cc: lenb, Rafael J. Wysocki



> -----Original Message-----
> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> owner@vger.kernel.org] On Behalf Of Udit Kumar
> Sent: Wednesday, June 12, 2019 4:48 AM
> To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
> Cc: lenb@kernel.org; Rafael J. Wysocki <rafael@kernel.org>
> Subject: Help on named object in kernel
> 
> Dear ACPI experts,
> I need your help on defining named objected in ACPI under _CRS.
> In my firmware, I have defined two addresses for my device using
> Memory32Fixed and QwordMemory under _CRS.
> These  two addresses are 32-bit and 64-bit long respectively.
> For Memory32Fixed, I gave DescriptorName name as REG0 and for
> QwordMemory I gave DescriptorName as SATA.

Could you give us the ASL for the code snippet that you're talking about?

Erik
> 
> In Linux, all of resource of this device is added under its name (NXP0003:00).
> Reading r-> name for all resource of this device is giving name as NXP0003:00.
> So I am not able to use existing OS driver using call
> platform_get_resource_byname, I have to use platform_get_resource API
> with index to get above addresses.
> 
> Could you help me, if there is way to use named resource in acpi.
> Fyi, I am on kernel 4.14.122
> 
> Many Thanks
> Udit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [EXT] RE: Help on named object in kernel 
  2019-06-12 16:37 ` Schmauss, Erik
@ 2019-06-12 17:00   ` " Udit Kumar
  2019-06-12 17:00   ` Sudeep Holla
  1 sibling, 0 replies; 6+ messages in thread
From: Udit Kumar @ 2019-06-12 17:00 UTC (permalink / raw)
  To: Schmauss, Erik, ACPI Devel Maling List; +Cc: lenb, Rafael J. Wysocki

Thanks Eric 

> -----Original Message-----
> From: Schmauss, Erik <erik.schmauss@intel.com>
> Sent: Wednesday, June 12, 2019 10:07 PM
> To: Udit Kumar <udit.kumar@nxp.com>; ACPI Devel Maling List <linux-
> acpi@vger.kernel.org>
> Cc: lenb@kernel.org; Rafael J. Wysocki <rafael@kernel.org>
> Subject: [EXT] RE: Help on named object in kernel
> 
> Caution: EXT Email
> 
> > -----Original Message-----
> > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> > owner@vger.kernel.org] On Behalf Of Udit Kumar
> > Sent: Wednesday, June 12, 2019 4:48 AM
> > To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
> > Cc: lenb@kernel.org; Rafael J. Wysocki <rafael@kernel.org>
> > Subject: Help on named object in kernel
> >
> > Dear ACPI experts,
> > I need your help on defining named objected in ACPI under _CRS.
> > In my firmware, I have defined two addresses for my device using
> > Memory32Fixed and QwordMemory under _CRS.
> > These  two addresses are 32-bit and 64-bit long respectively.
> > For Memory32Fixed, I gave DescriptorName name as REG0 and for
> > QwordMemory I gave DescriptorName as SATA.
> 
> Could you give us the ASL for the code snippet that you're talking about?

Below is actual ASL 

Scope(_SB)
{
  Device(SAT0) {
    Name(_HID, "NXP0004")
    Name(_CCA, 1)
    Name(_UID, 0)
    Name(_CRS, ResourceTemplate() {
      Memory32Fixed(ReadWrite, SATA0_BASE, SATA_LEN, REG0)
      Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive)
       {
         SATA0_IT_1, SATA0_IT_2, SATA0_IT_3
       }
    QwordMemory (
      ResourceConsumer,
      PosDecode,         // _DEC
      MinFixed,          // _MIF
      MaxFixed,          // _MAF
      NonCacheable,      // _MEM
      ReadWrite,         // _RW
      0,                 // _GRA
      0x700100520,       // _MIN MinAddress
      0x700100523,       // _MAX MaxAddress
      0,                 // _TRA
      0x4,               // _LEN
        ,               //ResourceSourceIndex,
        ,               //ResourceSource,
        SATA,           //DescriptorName
      ,)
    })
  }
 
Driver code is 
https://elixir.bootlin.com/linux/latest/source/drivers/ata/ahci_qoriq.c#L267 

For time being I changed 
platform_get_resource_byname to 
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 

for sure sata-err will fail, when I added few prints in platform_get_resource_byname to print each resource's name and start . 
I got below 
[    3.013921] Udit res 3200000 name NXP0004:00
[    3.018190] Udit res 10 name NXP0004:00
[    3.022016] Udit res 11 name NXP0004:00
[    3.025842] Udit res 12 name NXP0004:00
[    3.029668] Udit res 700100520 name NXP0004:00

I am looking help on two here
1) how DescriptorName can be associated with resource name 
2) is there any way to use resource name just as string 

Many Thanks
Udit

> Erik
> >
> > In Linux, all of resource of this device is added under its name (NXP0003:00).
> > Reading r-> name for all resource of this device is giving name as NXP0003:00.
> > So I am not able to use existing OS driver using call
> > platform_get_resource_byname, I have to use platform_get_resource API
> > with index to get above addresses.
> >
> > Could you help me, if there is way to use named resource in acpi.
> > Fyi, I am on kernel 4.14.122
> >
> > Many Thanks
> > Udit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help on named object in kernel
  2019-06-12 16:37 ` Schmauss, Erik
  2019-06-12 17:00   ` [EXT] " Udit Kumar
@ 2019-06-12 17:00   ` Sudeep Holla
  2019-06-13  1:20     ` [EXT] " Udit Kumar
  1 sibling, 1 reply; 6+ messages in thread
From: Sudeep Holla @ 2019-06-12 17:00 UTC (permalink / raw)
  To: Schmauss, Erik
  Cc: Udit Kumar, ACPI Devel Maling List, lenb, Sudeep Holla,
	Rafael J. Wysocki

On Wed, Jun 12, 2019 at 04:37:09PM +0000, Schmauss, Erik wrote:
> 
> 
> > -----Original Message-----
> > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> > owner@vger.kernel.org] On Behalf Of Udit Kumar
> > Sent: Wednesday, June 12, 2019 4:48 AM
> > To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
> > Cc: lenb@kernel.org; Rafael J. Wysocki <rafael@kernel.org>
> > Subject: Help on named object in kernel
> > 
> > Dear ACPI experts,
> > I need your help on defining named objected in ACPI under _CRS.
> > In my firmware, I have defined two addresses for my device using
> > Memory32Fixed and QwordMemory under _CRS.
> > These  two addresses are 32-bit and 64-bit long respectively.
> > For Memory32Fixed, I gave DescriptorName name as REG0 and for
> > QwordMemory I gave DescriptorName as SATA.
> 
> Could you give us the ASL for the code snippet that you're talking about?
>

IIUC, something like below(a very rough example based on the description
above):

    Name (_CRS, ResourceTemplate (){
      QwordMemory (
        ResourceConsumer, PosDecode, MinFixed, MaxFixed, NonCacheable,
        ReadWrite, 0x0, 0x700100520, 0x700100523, 0x0, 4, , , "SATA",)
      Memory32Fixed(ReadWrite, 0x3200000, 0x10000, "REG0")
    }

Basically 2 or more entries of Memory/Address Space Resource Descriptor
which can be identified in OSPM by DescriptorName. IOW if a device has
2 sets of registers/memory/address space associated with it, instead of
relying on the order of declaration, identify them by the descriptor
name provided in ASL namespace.

--
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [EXT] Re: Help on named object in kernel
  2019-06-12 17:00   ` Sudeep Holla
@ 2019-06-13  1:20     ` " Udit Kumar
  2019-06-13 17:08       ` Sudeep Holla
  0 siblings, 1 reply; 6+ messages in thread
From: Udit Kumar @ 2019-06-13  1:20 UTC (permalink / raw)
  To: Sudeep Holla, Schmauss, Erik
  Cc: ACPI Devel Maling List, lenb, Rafael J. Wysocki



> -----Original Message-----
> From: linux-acpi-owner@vger.kernel.org <linux-acpi-owner@vger.kernel.org>
> On Behalf Of Sudeep Holla
> Sent: Wednesday, June 12, 2019 10:31 PM
> To: Schmauss, Erik <erik.schmauss@intel.com>
> Cc: Udit Kumar <udit.kumar@nxp.com>; ACPI Devel Maling List <linux-
> acpi@vger.kernel.org>; lenb@kernel.org; Sudeep Holla
> <sudeep.holla@arm.com>; Rafael J. Wysocki <rafael@kernel.org>
> Subject: [EXT] Re: Help on named object in kernel
> 
> Caution: EXT Email
> 
> On Wed, Jun 12, 2019 at 04:37:09PM +0000, Schmauss, Erik wrote:
> >
> >
> > > -----Original Message-----
> > > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> > > owner@vger.kernel.org] On Behalf Of Udit Kumar
> > > Sent: Wednesday, June 12, 2019 4:48 AM
> > > To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
> > > Cc: lenb@kernel.org; Rafael J. Wysocki <rafael@kernel.org>
> > > Subject: Help on named object in kernel
> > >
> > > Dear ACPI experts,
> > > I need your help on defining named objected in ACPI under _CRS.
> > > In my firmware, I have defined two addresses for my device using
> > > Memory32Fixed and QwordMemory under _CRS.
> > > These  two addresses are 32-bit and 64-bit long respectively.
> > > For Memory32Fixed, I gave DescriptorName name as REG0 and for
> > > QwordMemory I gave DescriptorName as SATA.
> >
> > Could you give us the ASL for the code snippet that you're talking about?
> >
> 
> IIUC, something like below(a very rough example based on the description
> above):
> 
>     Name (_CRS, ResourceTemplate (){
>       QwordMemory (
>         ResourceConsumer, PosDecode, MinFixed, MaxFixed, NonCacheable,
>         ReadWrite, 0x0, 0x700100520, 0x700100523, 0x0, 4, , , "SATA",)
>       Memory32Fixed(ReadWrite, 0x3200000, 0x10000, "REG0")
>     }
> 
> Basically 2 or more entries of Memory/Address Space Resource Descriptor
> which can be identified in OSPM by DescriptorName. IOW if a device has
> 2 sets of registers/memory/address space associated with it, instead of relying
> on the order of declaration, identify them by the descriptor name provided in
> ASL namespace.

Thanks Sudeep, 
Shouldn't acpi frame work encapsulate descriptor name  while adding resource.
So that driver can rely on platform_get_resource_byname . 
In such way, same driver could be used with device tree and acpi based systems. 

I am not sure, if acpi_evaluate_xx sort of api would work for descriptor-name , even if this does it will be limited to acpi only.
 
> --
> Regards,
> Sudeep

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [EXT] Re: Help on named object in kernel
  2019-06-13  1:20     ` [EXT] " Udit Kumar
@ 2019-06-13 17:08       ` Sudeep Holla
  0 siblings, 0 replies; 6+ messages in thread
From: Sudeep Holla @ 2019-06-13 17:08 UTC (permalink / raw)
  To: Udit Kumar
  Cc: Schmauss, Erik, ACPI Devel Maling List, lenb, Sudeep Holla,
	Rafael J. Wysocki

On Thu, Jun 13, 2019 at 01:20:32AM +0000, Udit Kumar wrote:
>
>
> > -----Original Message-----
> > From: linux-acpi-owner@vger.kernel.org <linux-acpi-owner@vger.kernel.org>
> > On Behalf Of Sudeep Holla
> > Sent: Wednesday, June 12, 2019 10:31 PM
> > To: Schmauss, Erik <erik.schmauss@intel.com>
> > Cc: Udit Kumar <udit.kumar@nxp.com>; ACPI Devel Maling List <linux-
> > acpi@vger.kernel.org>; lenb@kernel.org; Sudeep Holla
> > <sudeep.holla@arm.com>; Rafael J. Wysocki <rafael@kernel.org>
> > Subject: [EXT] Re: Help on named object in kernel
> >
> > Caution: EXT Email
> >
> > On Wed, Jun 12, 2019 at 04:37:09PM +0000, Schmauss, Erik wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> > > > owner@vger.kernel.org] On Behalf Of Udit Kumar
> > > > Sent: Wednesday, June 12, 2019 4:48 AM
> > > > To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
> > > > Cc: lenb@kernel.org; Rafael J. Wysocki <rafael@kernel.org>
> > > > Subject: Help on named object in kernel
> > > >
> > > > Dear ACPI experts,
> > > > I need your help on defining named objected in ACPI under _CRS.
> > > > In my firmware, I have defined two addresses for my device using
> > > > Memory32Fixed and QwordMemory under _CRS.
> > > > These  two addresses are 32-bit and 64-bit long respectively.
> > > > For Memory32Fixed, I gave DescriptorName name as REG0 and for
> > > > QwordMemory I gave DescriptorName as SATA.
> > >
> > > Could you give us the ASL for the code snippet that you're talking about?
> > >
> >
> > IIUC, something like below(a very rough example based on the description
> > above):
> >
> >     Name (_CRS, ResourceTemplate (){
> >       QwordMemory (
> >         ResourceConsumer, PosDecode, MinFixed, MaxFixed, NonCacheable,
> >         ReadWrite, 0x0, 0x700100520, 0x700100523, 0x0, 4, , , "SATA",)
> >       Memory32Fixed(ReadWrite, 0x3200000, 0x10000, "REG0")
> >     }
> >
> > Basically 2 or more entries of Memory/Address Space Resource Descriptor
> > which can be identified in OSPM by DescriptorName. IOW if a device has
> > 2 sets of registers/memory/address space associated with it, instead of relying
> > on the order of declaration, identify them by the descriptor name provided in
> > ASL namespace.
>
> Thanks Sudeep,
> Shouldn't acpi frame work encapsulate descriptor name  while adding resource.
> So that driver can rely on platform_get_resource_byname .
> In such way, same driver could be used with device tree and acpi based systems.
>
> I am not sure, if acpi_evaluate_xx sort of api would work for
> descriptor-name , even if this does it will be limited to acpi only.
>

IIUC acpi_resource_source should have all the information, just not
used for this purpose yet. I do see some uses of string_ptr in that
elsewhere. I haven't tried it, but looking at the code I think the
support is there already.

But the question is who/where will the list of names for such resource
is listed for a given HID/CID/... ?
--
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 11:48 Help on named object in kernel Udit Kumar
2019-06-12 16:37 ` Schmauss, Erik
2019-06-12 17:00   ` [EXT] " Udit Kumar
2019-06-12 17:00   ` Sudeep Holla
2019-06-13  1:20     ` [EXT] " Udit Kumar
2019-06-13 17:08       ` Sudeep Holla

Linux-ACPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-acpi/0 linux-acpi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-acpi linux-acpi/ https://lore.kernel.org/linux-acpi \
		linux-acpi@vger.kernel.org linux-acpi@archiver.kernel.org
	public-inbox-index linux-acpi


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-acpi


AGPL code for this site: git clone https://public-inbox.org/ public-inbox