From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>, Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> Cc: Jonathan Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>, Vidya Saga <vidyas-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>, Manikanta Maddireddy <mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH 2/4] PCI: tegra: Reorder parameters in offset computations Date: Thu, 14 Dec 2017 14:45:43 +0100 [thread overview] Message-ID: <20171214134545.11143-3-thierry.reding@gmail.com> (raw) In-Reply-To: <20171214134545.11143-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> The current computation of the configuration space offset is slightly difficult to read because the fields aren't naturally ordered. This is no doubt done to put extended register and register fields together, but that's confusing because they are separate in the address mapping given in the comment above the computations. Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- drivers/pci/host/pci-tegra.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 8a07c6f9e1b0..26b734c84850 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -372,11 +372,11 @@ static inline u32 pads_readl(struct tegra_pcie *pcie, unsigned long offset) * address (access to which generates correct config transaction) falls in * this 4 KiB region. */ -static unsigned long tegra_pcie_conf_offset(unsigned char b, unsigned int devfn, - int where) +static unsigned int tegra_pcie_conf_offset(u8 bus, unsigned int devfn, + unsigned int where) { - return (b << 16) | (PCI_SLOT(devfn) << 11) | (PCI_FUNC(devfn) << 8) | - (((where & 0xf00) >> 8) << 24) | (where & 0xff); + return ((where & 0xf00) << 16) | (bus << 16) | (PCI_SLOT(devfn) << 11) | + (PCI_FUNC(devfn) << 8) | (where & 0xff); } static int tegra_pcie_add_bus(struct pci_bus *bus) -- 2.15.1
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com> To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Bjorn Helgaas <bhelgaas@google.com> Cc: Jonathan Hunter <jonathanh@nvidia.com>, Vidya Saga <vidyas@nvidia.com>, Manikanta Maddireddy <mmaddireddy@nvidia.com>, linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH 2/4] PCI: tegra: Reorder parameters in offset computations Date: Thu, 14 Dec 2017 14:45:43 +0100 [thread overview] Message-ID: <20171214134545.11143-3-thierry.reding@gmail.com> (raw) In-Reply-To: <20171214134545.11143-1-thierry.reding@gmail.com> From: Thierry Reding <treding@nvidia.com> The current computation of the configuration space offset is slightly difficult to read because the fields aren't naturally ordered. This is no doubt done to put extended register and register fields together, but that's confusing because they are separate in the address mapping given in the comment above the computations. Signed-off-by: Thierry Reding <treding@nvidia.com> --- drivers/pci/host/pci-tegra.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 8a07c6f9e1b0..26b734c84850 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -372,11 +372,11 @@ static inline u32 pads_readl(struct tegra_pcie *pcie, unsigned long offset) * address (access to which generates correct config transaction) falls in * this 4 KiB region. */ -static unsigned long tegra_pcie_conf_offset(unsigned char b, unsigned int devfn, - int where) +static unsigned int tegra_pcie_conf_offset(u8 bus, unsigned int devfn, + unsigned int where) { - return (b << 16) | (PCI_SLOT(devfn) << 11) | (PCI_FUNC(devfn) << 8) | - (((where & 0xf00) >> 8) << 24) | (where & 0xff); + return ((where & 0xf00) << 16) | (bus << 16) | (PCI_SLOT(devfn) << 11) | + (PCI_FUNC(devfn) << 8) | (where & 0xff); } static int tegra_pcie_add_bus(struct pci_bus *bus) -- 2.15.1
next prev parent reply other threads:[~2017-12-14 13:45 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-12-14 13:45 [PATCH 0/4] PCI: tegra: Configuration space mapping cleanups and fixes Thierry Reding 2017-12-14 13:45 ` Thierry Reding [not found] ` <20171214134545.11143-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2017-12-14 13:45 ` [PATCH 1/4] PCI: tegra: Clarify configuration space address computations Thierry Reding 2017-12-14 13:45 ` Thierry Reding 2017-12-14 13:45 ` Thierry Reding [this message] 2017-12-14 13:45 ` [PATCH 2/4] PCI: tegra: Reorder parameters in offset computations Thierry Reding 2017-12-14 13:45 ` [PATCH 3/4] PCI: tegra: Consolidate I/O register variables Thierry Reding 2017-12-14 13:45 ` Thierry Reding 2017-12-14 13:45 ` [PATCH 4/4] PCI: tegra: Remove artificial mapping restriction Thierry Reding 2017-12-14 13:45 ` Thierry Reding 2017-12-14 17:37 ` [PATCH 0/4] PCI: tegra: Configuration space mapping cleanups and fixes Lorenzo Pieralisi 2017-12-20 20:39 ` Thierry Reding 2017-12-20 20:39 ` Thierry Reding
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=20171214134545.11143-3-thierry.reding@gmail.com \ --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \ --cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \ --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \ --cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org \ --cc=mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \ --cc=vidyas-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \ /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: linkBe 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.