All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Marek Behún" <kabel@kernel.org>,
	"Russell King" <rmk+kernel@armlinux.org.uk>,
	"Gregory Clement" <gregory.clement@bootlin.com>,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] PCI: Add PCI_EXP_SLTCAP_*_SHIFT macros
Date: Fri, 25 Feb 2022 13:24:51 +0100	[thread overview]
Message-ID: <20220225122451.fa2fiyzohwme2d66@pali> (raw)
In-Reply-To: <20220224202843.GA291544@bhelgaas>

On Thursday 24 February 2022 14:28:43 Bjorn Helgaas wrote:
> On Tue, Feb 22, 2022 at 05:31:54PM +0100, Pali Rohár wrote:
> > These macros allows to easily compose and extract Slot Power Limit and
> > Physical Slot Number values from Slot Capability Register.
> >
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > Signed-off-by: Marek Behún <kabel@kernel.org>
> > ---
> >  include/uapi/linux/pci_regs.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> > index 108f8523fa04..3fc9a4cac630 100644
> > --- a/include/uapi/linux/pci_regs.h
> > +++ b/include/uapi/linux/pci_regs.h
> > @@ -591,10 +591,13 @@
> >  #define  PCI_EXP_SLTCAP_HPS	0x00000020 /* Hot-Plug Surprise */
> >  #define  PCI_EXP_SLTCAP_HPC	0x00000040 /* Hot-Plug Capable */
> >  #define  PCI_EXP_SLTCAP_SPLV	0x00007f80 /* Slot Power Limit Value */
> > +#define  PCI_EXP_SLTCAP_SPLV_SHIFT	7  /* Slot Power Limit Value shift */
> 
> Is there a way to use FIELD_PREP() and FIELD_GET() instead?  It seems
> like that's what the cool kids are doing now.

This is possible too.

I have proposed a patch with _SHIFT macros as this is the way how are
other macros in this file defined and used.

> At first I didn't really like them, but they do remove the need for
> adding _SHIFT macros that have to be manually related to the other.
> 
> >  #define  PCI_EXP_SLTCAP_SPLS	0x00018000 /* Slot Power Limit Scale */
> > +#define  PCI_EXP_SLTCAP_SPLS_SHIFT	15 /* Slot Power Limit Scale shift */
> >  #define  PCI_EXP_SLTCAP_EIP	0x00020000 /* Electromechanical Interlock Present */
> >  #define  PCI_EXP_SLTCAP_NCCS	0x00040000 /* No Command Completed Support */
> >  #define  PCI_EXP_SLTCAP_PSN	0xfff80000 /* Physical Slot Number */
> > +#define  PCI_EXP_SLTCAP_PSN_SHIFT	19 /* Physical Slot Number shift */
> >  #define PCI_EXP_SLTCTL		0x18	/* Slot Control */
> >  #define  PCI_EXP_SLTCTL_ABPE	0x0001	/* Attention Button Pressed Enable */
> >  #define  PCI_EXP_SLTCTL_PFDE	0x0002	/* Power Fault Detected Enable */
> > -- 
> > 2.20.1
> > 

WARNING: multiple messages have this Message-ID (diff)
From: "Pali Rohár" <pali@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Marek Behún" <kabel@kernel.org>,
	"Russell King" <rmk+kernel@armlinux.org.uk>,
	"Gregory Clement" <gregory.clement@bootlin.com>,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] PCI: Add PCI_EXP_SLTCAP_*_SHIFT macros
Date: Fri, 25 Feb 2022 13:24:51 +0100	[thread overview]
Message-ID: <20220225122451.fa2fiyzohwme2d66@pali> (raw)
In-Reply-To: <20220224202843.GA291544@bhelgaas>

On Thursday 24 February 2022 14:28:43 Bjorn Helgaas wrote:
> On Tue, Feb 22, 2022 at 05:31:54PM +0100, Pali Rohár wrote:
> > These macros allows to easily compose and extract Slot Power Limit and
> > Physical Slot Number values from Slot Capability Register.
> >
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > Signed-off-by: Marek Behún <kabel@kernel.org>
> > ---
> >  include/uapi/linux/pci_regs.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> > index 108f8523fa04..3fc9a4cac630 100644
> > --- a/include/uapi/linux/pci_regs.h
> > +++ b/include/uapi/linux/pci_regs.h
> > @@ -591,10 +591,13 @@
> >  #define  PCI_EXP_SLTCAP_HPS	0x00000020 /* Hot-Plug Surprise */
> >  #define  PCI_EXP_SLTCAP_HPC	0x00000040 /* Hot-Plug Capable */
> >  #define  PCI_EXP_SLTCAP_SPLV	0x00007f80 /* Slot Power Limit Value */
> > +#define  PCI_EXP_SLTCAP_SPLV_SHIFT	7  /* Slot Power Limit Value shift */
> 
> Is there a way to use FIELD_PREP() and FIELD_GET() instead?  It seems
> like that's what the cool kids are doing now.

This is possible too.

I have proposed a patch with _SHIFT macros as this is the way how are
other macros in this file defined and used.

> At first I didn't really like them, but they do remove the need for
> adding _SHIFT macros that have to be manually related to the other.
> 
> >  #define  PCI_EXP_SLTCAP_SPLS	0x00018000 /* Slot Power Limit Scale */
> > +#define  PCI_EXP_SLTCAP_SPLS_SHIFT	15 /* Slot Power Limit Scale shift */
> >  #define  PCI_EXP_SLTCAP_EIP	0x00020000 /* Electromechanical Interlock Present */
> >  #define  PCI_EXP_SLTCAP_NCCS	0x00040000 /* No Command Completed Support */
> >  #define  PCI_EXP_SLTCAP_PSN	0xfff80000 /* Physical Slot Number */
> > +#define  PCI_EXP_SLTCAP_PSN_SHIFT	19 /* Physical Slot Number shift */
> >  #define PCI_EXP_SLTCTL		0x18	/* Slot Control */
> >  #define  PCI_EXP_SLTCTL_ABPE	0x0001	/* Attention Button Pressed Enable */
> >  #define  PCI_EXP_SLTCTL_PFDE	0x0002	/* Power Fault Detected Enable */
> > -- 
> > 2.20.1
> > 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-02-25 12:25 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 16:31 [PATCH 0/6] PCI: mvebu: Slot support Pali Rohár
2022-02-22 16:31 ` Pali Rohár
2022-02-22 16:31 ` [PATCH 1/6] PCI: Add PCI_EXP_SLTCTL_ASPL_DISABLE macro Pali Rohár
2022-02-22 16:31   ` Pali Rohár
2022-02-24 20:13   ` Bjorn Helgaas
2022-02-24 20:13     ` Bjorn Helgaas
2022-02-22 16:31 ` [PATCH 2/6] PCI: Add PCI_EXP_SLTCAP_*_SHIFT macros Pali Rohár
2022-02-22 16:31   ` Pali Rohár
2022-02-24 20:28   ` Bjorn Helgaas
2022-02-24 20:28     ` Bjorn Helgaas
2022-02-25 12:24     ` Pali Rohár [this message]
2022-02-25 12:24       ` Pali Rohár
2022-02-25 15:37       ` Bjorn Helgaas
2022-02-25 15:37         ` Bjorn Helgaas
2022-02-25 17:22         ` Marek Behún
2022-02-25 17:22           ` Marek Behún
2022-02-25 17:51           ` Bjorn Helgaas
2022-02-25 17:51             ` Bjorn Helgaas
2022-02-22 16:31 ` [PATCH 3/6] dt-bindings: Add 'slot-power-limit-milliwatt' PCIe port property Pali Rohár
2022-02-22 16:31   ` Pali Rohár
2022-02-22 17:24   ` Marek Behún
2022-02-22 17:24     ` Marek Behún
2022-02-22 17:53     ` Pali Rohár
2022-02-22 17:53       ` Pali Rohár
2022-02-22 16:31 ` [PATCH 4/6] PCI: Add function for parsing 'slot-power-limit-milliwatt' DT property Pali Rohár
2022-02-22 16:31   ` Pali Rohár
2022-02-24 20:47   ` Bjorn Helgaas
2022-02-24 20:47     ` Bjorn Helgaas
2022-02-25 12:30     ` Pali Rohár
2022-02-25 12:30       ` Pali Rohár
2022-02-25 15:51       ` Bjorn Helgaas
2022-02-25 15:51         ` Bjorn Helgaas
2022-02-25 17:58         ` Pali Rohár
2022-02-25 17:58           ` Pali Rohár
2022-02-22 16:31 ` [PATCH 5/6] PCI: mvebu: Add support for sending Set_Slot_Power_Limit message Pali Rohár
2022-02-22 16:31   ` Pali Rohár
2022-02-24 21:28   ` Bjorn Helgaas
2022-02-24 21:28     ` Bjorn Helgaas
2022-02-25 12:54     ` Pali Rohár
2022-02-25 12:54       ` Pali Rohár
2022-02-25 16:57       ` Bjorn Helgaas
2022-02-25 16:57         ` Bjorn Helgaas
2022-03-01  9:47         ` Pali Rohár
2022-03-01  9:47           ` Pali Rohár
2022-02-25 17:02       ` Bjorn Helgaas
2022-02-25 17:02         ` Bjorn Helgaas
2022-03-01  9:50         ` Pali Rohár
2022-03-01  9:50           ` Pali Rohár
2022-02-22 16:31 ` [PATCH 6/6] ARM: dts: turris-omnia: Set PCIe slot-power-limit-milliwatt properties Pali Rohár
2022-02-22 16:31   ` Pali Rohár
2022-02-28 16:13   ` Gregory CLEMENT
2022-02-28 16:13     ` Gregory CLEMENT

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=20220225122451.fa2fiyzohwme2d66@pali \
    --to=pali@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=bhelgaas@google.com \
    --cc=gregory.clement@bootlin.com \
    --cc=helgaas@kernel.org \
    --cc=kabel@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robh+dt@kernel.org \
    --cc=thomas.petazzoni@bootlin.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 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.