* [U-Boot] [PATCH] pci: Add comment to mention difference in DEVFN usage in U-Boot vs Linux
@ 2019-02-11 7:43 Stefan Roese
2019-02-21 2:47 ` Simon Glass
2019-03-22 23:16 ` [U-Boot] " Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Roese @ 2019-02-11 7:43 UTC (permalink / raw)
To: u-boot
This patch adds a comment to the header with the PCI_foo macros related
to DEVFN to explain the difference in U-Boot vs Linux.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
---
include/pci.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/pci.h b/include/pci.h
index 041f8e3747..93fdd8fe6a 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -499,9 +499,20 @@ static inline void pci_set_region(struct pci_region *reg,
typedef int pci_dev_t;
#define PCI_BUS(d) (((d) >> 16) & 0xff)
+
+/*
+ * Please note the difference in DEVFN usage in U-Boot vs Linux. U-Boot
+ * uses DEVFN in bits 15-8 but Linux instead expects DEVFN in bits 7-0.
+ * Please see the Linux header include/uapi/linux/pci.h for more details.
+ * This is relevant for the following macros:
+ * PCI_DEV, PCI_FUNC, PCI_DEVFN
+ * The U-Boot macro PCI_DEV is equivalent to the Linux PCI_SLOT version with
+ * the remark from above (input d in bits 15-8 instead of 7-0.
+ */
#define PCI_DEV(d) (((d) >> 11) & 0x1f)
#define PCI_FUNC(d) (((d) >> 8) & 0x7)
#define PCI_DEVFN(d, f) ((d) << 11 | (f) << 8)
+
#define PCI_MASK_BUS(bdf) ((bdf) & 0xffff)
#define PCI_ADD_BUS(bus, devfn) (((bus) << 16) | (devfn))
#define PCI_BDF(b, d, f) ((b) << 16 | PCI_DEVFN(d, f))
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] pci: Add comment to mention difference in DEVFN usage in U-Boot vs Linux
2019-02-11 7:43 [U-Boot] [PATCH] pci: Add comment to mention difference in DEVFN usage in U-Boot vs Linux Stefan Roese
@ 2019-02-21 2:47 ` Simon Glass
2019-03-22 23:16 ` [U-Boot] " Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2019-02-21 2:47 UTC (permalink / raw)
To: u-boot
On Mon, 11 Feb 2019 at 00:43, Stefan Roese <sr@denx.de> wrote:
>
> This patch adds a comment to the header with the PCI_foo macros related
> to DEVFN to explain the difference in U-Boot vs Linux.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> ---
> include/pci.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] pci: Add comment to mention difference in DEVFN usage in U-Boot vs Linux
2019-02-11 7:43 [U-Boot] [PATCH] pci: Add comment to mention difference in DEVFN usage in U-Boot vs Linux Stefan Roese
2019-02-21 2:47 ` Simon Glass
@ 2019-03-22 23:16 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2019-03-22 23:16 UTC (permalink / raw)
To: u-boot
On Mon, Feb 11, 2019 at 08:43:25AM +0100, Stefan Roese wrote:
> This patch adds a comment to the header with the PCI_foo macros related
> to DEVFN to explain the difference in U-Boot vs Linux.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190322/adb38f42/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-22 23:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 7:43 [U-Boot] [PATCH] pci: Add comment to mention difference in DEVFN usage in U-Boot vs Linux Stefan Roese
2019-02-21 2:47 ` Simon Glass
2019-03-22 23:16 ` [U-Boot] " Tom Rini
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.