[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220224202843.GA291544@bhelgaas>
Date: Thu, 24 Feb 2022 14:28:43 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: Pali Rohár <pali@...nel.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Rob Herring <robh+dt@...nel.org>, Andrew Lunn <andrew@...n.ch>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Krzysztof Wilczyński <kw@...ux.com>,
Marek Behún <kabel@...nel.org>,
Russell King <rmk+kernel@...linux.org.uk>,
Gregory Clement <gregory.clement@...tlin.com>,
linux-pci@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/6] PCI: Add PCI_EXP_SLTCAP_*_SHIFT macros
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@...nel.org>
> Signed-off-by: Marek Behún <kabel@...nel.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.
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
>
Powered by blists - more mailing lists