All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v5 5/6] pci: Add a macro to convert BDF from linux to U-Boot
Date: Wed,  8 Apr 2020 08:32:59 -0600	[thread overview]
Message-ID: <20200408083251.v5.5.Ifb213e62095edbb017224d889263bb63c982c112@changeid> (raw)
In-Reply-To: <20200408143300.52636-1-sjg@chromium.org>

U-Boot's BDF format has its bits in the same position as the device tree
PCI definition.

Some x86 devices use linux format in their register format and it is
useful to be able to convert to U-Boot format. Add a macro for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v5: None
Changes in v4: None

 include/pci.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/pci.h b/include/pci.h
index 174ddd4460d..aff56b24f92 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -543,6 +543,9 @@ typedef int pci_dev_t;
 #define PCI_VENDEV(v, d)	(((v) << 16) | (d))
 #define PCI_ANY_ID		(~0)
 
+/* Convert from Linux format to U-Boot format */
+#define PCI_TO_BDF(val)		((val) << 8)
+
 struct pci_device_id {
 	unsigned int vendor, device;	/* Vendor and device ID or PCI_ANY_ID */
 	unsigned int subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
-- 
2.26.0.292.g33ef6b2f38-goog

  parent reply	other threads:[~2020-04-08 14:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 14:32 [PATCH v5 0/6] A few little patches Simon Glass
2020-04-08 14:32 ` [PATCH v5 1/6] test: Add the beginnings of some string tests Simon Glass
2020-04-08 17:53   ` Heinrich Schuchardt
2020-04-26 11:26   ` Tom Rini
2020-04-08 14:32 ` [PATCH v5 2/6] lib: Add a function to convert a string to upper case Simon Glass
2020-04-08 18:17   ` Heinrich Schuchardt
2020-04-26 11:26   ` Tom Rini
2020-04-08 14:32 ` [PATCH v5 3/6] usb: Update struct usb_device to indicate speed enum Simon Glass
2020-04-08 14:43   ` Marek Vasut
2020-04-08 14:32 ` [PATCH v5 4/6] uuid: Use const char * where possible Simon Glass
2020-04-26 11:26   ` Tom Rini
2020-04-08 14:32 ` Simon Glass [this message]
2020-04-26 11:26   ` [PATCH v5 5/6] pci: Add a macro to convert BDF from linux to U-Boot Tom Rini
2020-04-08 14:33 ` [PATCH v5 6/6] dm: mmc: Update mmc_get_mmc_dev() to use const * Simon Glass
2020-04-10  1:34   ` Jaehoon Chung
2020-04-26 11:26   ` Tom Rini

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=20200408083251.v5.5.Ifb213e62095edbb017224d889263bb63c982c112@changeid \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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.