Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp171613pxm; Fri, 25 Feb 2022 06:03:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxBtnDHdTJSYKSsLbN1tCStkpo5jVRLpE0l/XPCkLygQeg9tGyafjl4Pl6pGI1KBWdOi3Q X-Received: by 2002:a17:906:b1d0:b0:6cd:fa02:b427 with SMTP id bv16-20020a170906b1d000b006cdfa02b427mr6255414ejb.99.1645797787331; Fri, 25 Feb 2022 06:03:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645797787; cv=none; d=google.com; s=arc-20160816; b=Iyg0AnxY/RkMOSVN7ZU595VDvynFqevpn++A34q93sm60ubZmBYP4eNbnB6KXEWv4g x01OBtZLzx/vgW2qurlYx/7EnMB/2bgGqpIa2VeLUdoeWX035SyeYADk0jEdf1ExvWyQ AE2PnRyAGZQtCyycqWGXhDMcuFqq9RlivHke2b1k2QNmMUu2QDUwTj7dgGGYgUF0gIQK wSaitUIbbRBLVGc6kT9yzXwkjTjjNOosott/VVETmej6HZiZNZhBjLNTCySWl9FBCRlA k4aD8X/RtoackVyvI1BpXaZh02z2WHtDmEQ1b3Nt86vKMxXu7D63dN3xK34sBcBbHaLS G6Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Z+/UdT1t3h+gK9fArDUk/fgXWskZdsCRcv/aFV6DL+s=; b=hyRnMbmGUJj8bRKI9lAZNIiMpOa48j/gcPmDR6B07EAbW5id6YXZvmfQup9WeyTNEP 0cbzWruwQlhP4nDpXFr39Wjcg6x5u8YQEVFYqab+Qts9BdwJdeBicxmC9IaZefppT85J RVsA1Px9zwIuedprYHFsTuy88IiGxdUkfkRbaw7pBH4b3jwuQaTFCm8v/OORS9fIKPHL dC42E5oetv7bM6o/UCdP0gTn1E/jagKIN+I7YozDQb/frdhh8aRCpVB/cMuwNY9wImsI nEUrcz0NW86e3pnVy1ifpw/oedIvHxJeFgpZr4anifw7CYTHabZ1k/2feR3GwztoRrBd 9s0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TwGZUaoC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w17-20020a17090633d100b006d09b5ea458si1598079eja.535.2022.02.25.06.02.39; Fri, 25 Feb 2022 06:03:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TwGZUaoC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240626AbiBYMZa (ORCPT + 99 others); Fri, 25 Feb 2022 07:25:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238094AbiBYMZ3 (ORCPT ); Fri, 25 Feb 2022 07:25:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E12C320E7AE; Fri, 25 Feb 2022 04:24:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96CCFB82F7B; Fri, 25 Feb 2022 12:24:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00583C340E7; Fri, 25 Feb 2022 12:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645791895; bh=cSQNpBISw0MlYXiiY3XgnX1pKxAMGAwP//OJtPfreTQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TwGZUaoCOgsdUuXBm54rN2MROfbhe7Ixmm084Pw0jBXJyna/O+U1jQSHYm06O6XsI ZjDDwyiDRgZ10heeyYGUj1hjK3QjZ2miuFKOv0WhLXW0Y69Jr0FpA4OA6rSWNs8LuZ RossxCTPTzuTcqs/tFVhRTkvcrYCVvYWCe+Xp0X/48OzIyRybuJh9vlFx4hCdso88i iWAf7mQt0a841UqiANX8P2Ew8SJRJLVX+ZlmvOHs++qTPIR/l23yCdHTvx3kkaBAg9 kWZ9CgRX/LI28ljzOivmW+CCdWBBhgvNJQdghuIGOqmKWih9aIOVAV4X/SAbG4API0 P+6c5feTQNTdw== Received: by pali.im (Postfix) id 109B37EF; Fri, 25 Feb 2022 13:24:51 +0100 (CET) Date: Fri, 25 Feb 2022 13:24:51 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Bjorn Helgaas Cc: Lorenzo Pieralisi , Bjorn Helgaas , Rob Herring , Andrew Lunn , Thomas Petazzoni , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Marek =?utf-8?B?QmVow7pu?= , Russell King , Gregory Clement , 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 Message-ID: <20220225122451.fa2fiyzohwme2d66@pali> References: <20220222163158.1666-3-pali@kernel.org> <20220224202843.GA291544@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220224202843.GA291544@bhelgaas> User-Agent: NeoMutt/20180716 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > Signed-off-by: Marek Behún > > --- > > 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 > >