From bc5873f78c6610fd39c456822e488df1e565aaa7 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 29 Sep 2020 13:10:05 +0200 Subject: [PATCH] tools/litex_server/pcie: allow passing pcie bar as reported by lspci. ex: $lspci [...] 06:00.0 RF controller: Xilinx Corporation Device 7022 (rev 01) sudo litex_server --pcie --pcie-bar=06:00.0 --- litex/tools/litex_server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litex/tools/litex_server.py b/litex/tools/litex_server.py index 1fe0b780c..d32055c97 100755 --- a/litex/tools/litex_server.py +++ b/litex/tools/litex_server.py @@ -218,11 +218,13 @@ def main(): elif args.pcie: from litex.tools.remote.comm_pcie import CommPCIe pcie_bar = args.pcie_bar - if args.pcie_bar is None: + if pcie_bar is None: print("Need to speficy --pcie-bar, exiting.") exit() - print("[CommPCIe] bar: {} / ".format(args.pcie_bar), end="") - comm = CommPCIe(args.pcie_bar) + if "/sys/bus/pci/devices" not in pcie_bar: + pcie_bar = f"/sys/bus/pci/devices/0000:{args.pcie_bar}/resource0" + print("[CommPCIe] bar: {} / ".format(pcie_bar), end="") + comm = CommPCIe(pcie_bar) elif args.usb: from litex.tools.remote.comm_usb import CommUSB if args.usb_pid is None and args.usb_vid is None: