All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	qemu-ppc@nongnu.org, qemu-trivial@nongnu.org,
	"Paul Durrant" <paul@xen.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	qemu-arm@nongnu.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Cédric Le Goater" <clg@kaod.org>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Helge Deller" <deller@gmx.de>,
	"Anthony Perard" <anthony.perard@citrix.com>,
	"Richard Henderson" <rth@twiddle.net>,
	"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
	xen-devel@lists.xenproject.org,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Huacai Chen" <chenhc@lemote.com>
Subject: [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
Date: Mon, 12 Oct 2020 14:45:02 +0200	[thread overview]
Message-ID: <20201012124506.3406909-2-philmd@redhat.com> (raw)
In-Reply-To: <20201012124506.3406909-1-philmd@redhat.com>

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
Rewrite it extracting the shift operation one layer.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/bonito.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index a99eced0657..abb3ee86769 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
 
 #define PCI_ADDR(busno , devno , funno , regno)  \
-    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
-    (((funno) << 8) & 0x700) + (regno))
+    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
+    (((funno) & 0x7) << 8) + (regno))
 
 typedef struct BonitoState BonitoState;
 
-- 
2.26.2



WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Paul Durrant" <paul@xen.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Huacai Chen" <chenhc@lemote.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	qemu-trivial@nongnu.org, "Helge Deller" <deller@gmx.de>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Anthony Perard" <anthony.perard@citrix.com>,
	xen-devel@lists.xenproject.org,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	qemu-arm@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	"Richard Henderson" <rth@twiddle.net>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
Date: Mon, 12 Oct 2020 14:45:02 +0200	[thread overview]
Message-ID: <20201012124506.3406909-2-philmd@redhat.com> (raw)
In-Reply-To: <20201012124506.3406909-1-philmd@redhat.com>

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
Rewrite it extracting the shift operation one layer.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/bonito.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index a99eced0657..abb3ee86769 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
 
 #define PCI_ADDR(busno , devno , funno , regno)  \
-    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
-    (((funno) << 8) & 0x700) + (regno))
+    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
+    (((funno) & 0x7) << 8) + (regno))
 
 typedef struct BonitoState BonitoState;
 
-- 
2.26.2


WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Paul Durrant" <paul@xen.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Huacai Chen" <chenhc@lemote.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	qemu-trivial@nongnu.org, "Helge Deller" <deller@gmx.de>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
	"Anthony Perard" <anthony.perard@citrix.com>,
	xen-devel@lists.xenproject.org,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	qemu-arm@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	"Richard Henderson" <rth@twiddle.net>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable
Date: Mon, 12 Oct 2020 14:45:02 +0200	[thread overview]
Message-ID: <20201012124506.3406909-2-philmd@redhat.com> (raw)
In-Reply-To: <20201012124506.3406909-1-philmd@redhat.com>

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The PCI_ADDR() macro use generic PCI fields shifted by 8-bit.
Rewrite it extracting the shift operation one layer.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/bonito.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index a99eced0657..abb3ee86769 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 #define PCI_IDSEL_VIA686B          (1 << PCI_IDSEL_VIA686B_BIT)
 
 #define PCI_ADDR(busno , devno , funno , regno)  \
-    ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \
-    (((funno) << 8) & 0x700) + (regno))
+    ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \
+    (((funno) & 0x7) << 8) + (regno))
 
 typedef struct BonitoState BonitoState;
 
-- 
2.26.2



  reply	other threads:[~2020-10-12 12:45 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 12:45 [PATCH 0/5] hw: Use PCI macros from 'hw/pci/pci.h' Philippe Mathieu-Daudé
2020-10-12 12:45 ` Philippe Mathieu-Daudé
2020-10-12 12:45 ` Philippe Mathieu-Daudé
2020-10-12 12:45 ` Philippe Mathieu-Daudé [this message]
2020-10-12 12:45   ` [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable Philippe Mathieu-Daudé
2020-10-12 12:45   ` Philippe Mathieu-Daudé
2020-10-12 13:55   ` BALATON Zoltan
2020-10-12 13:55     ` BALATON Zoltan via
2020-10-12 13:55     ` BALATON Zoltan via
2020-10-12 14:27     ` Philippe Mathieu-Daudé
2020-10-12 14:27       ` Philippe Mathieu-Daudé
2020-10-12 14:27       ` Philippe Mathieu-Daudé
2020-10-12 12:45 ` [PATCH 2/5] hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h' Philippe Mathieu-Daudé
2020-10-12 12:45   ` Philippe Mathieu-Daudé
2020-10-12 12:45   ` Philippe Mathieu-Daudé
2020-10-13  0:42   ` David Gibson
2020-10-13  0:42     ` David Gibson
2020-10-13  0:42     ` David Gibson
2020-10-12 12:45 ` [PATCH 3/5] hw/pci-host/uninorth: Use the PCI_FUNC() " Philippe Mathieu-Daudé
2020-10-12 12:45   ` Philippe Mathieu-Daudé
2020-10-13  0:42   ` David Gibson
2020-10-13  0:42     ` David Gibson
2020-10-13  0:42     ` David Gibson
2020-10-12 12:45 ` [PATCH 4/5] hw: Use the PCI_SLOT() " Philippe Mathieu-Daudé
2020-10-12 12:45   ` Philippe Mathieu-Daudé
2020-10-12 12:52   ` Paul Durrant
2020-10-12 12:52     ` Paul Durrant
2020-10-12 12:52     ` Paul Durrant
2020-10-13  0:43   ` David Gibson
2020-10-13  0:43     ` David Gibson
2020-10-13  0:43     ` David Gibson
2020-10-12 12:45 ` [PATCH 5/5] hw: Use the PCI_DEVFN() " Philippe Mathieu-Daudé
2020-10-12 12:45   ` Philippe Mathieu-Daudé
2020-10-12 12:45   ` Philippe Mathieu-Daudé
2020-10-13  0:45   ` David Gibson
2020-10-13  0:45     ` David Gibson
2021-01-03 13:04 ` [PATCH 0/5] hw: Use PCI macros " Philippe Mathieu-Daudé
2021-01-03 13:04   ` Philippe Mathieu-Daudé
2021-01-03 13:04   ` Philippe Mathieu-Daudé
2021-01-04  9:32   ` Michael S. Tsirkin
2021-01-04  9:32     ` Michael S. Tsirkin

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=20201012124506.3406909-2-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=anthony.perard@citrix.com \
    --cc=aurelien@aurel32.net \
    --cc=chenhc@lemote.com \
    --cc=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=deller@gmx.de \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=ysato@users.sourceforge.jp \
    /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.