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
This commit is contained in:
Florent Kermarrec 2020-09-29 13:10:05 +02:00
parent 6d07f01f5b
commit bc5873f78c
1 changed files with 5 additions and 3 deletions

View File

@ -218,11 +218,13 @@ def main():
elif args.pcie: elif args.pcie:
from litex.tools.remote.comm_pcie import CommPCIe from litex.tools.remote.comm_pcie import CommPCIe
pcie_bar = args.pcie_bar pcie_bar = args.pcie_bar
if args.pcie_bar is None: if pcie_bar is None:
print("Need to speficy --pcie-bar, exiting.") print("Need to speficy --pcie-bar, exiting.")
exit() exit()
print("[CommPCIe] bar: {} / ".format(args.pcie_bar), end="") if "/sys/bus/pci/devices" not in pcie_bar:
comm = CommPCIe(args.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: elif args.usb:
from litex.tools.remote.comm_usb import CommUSB from litex.tools.remote.comm_usb import CommUSB
if args.usb_pid is None and args.usb_vid is None: if args.usb_pid is None and args.usb_vid is None: