I’m trying to talk to a PCI Express device that’s got oldschool I/O registers defined, not MEM registers. (BAR[0] is 0x1001 and I want to read/write bytes to 0x1000).
<asm/io.h> or <sys/io.h> or <system/io.h> hold the inb/outp functions, do they work on the TX2 and how can I prove it to myself?
The ARM architecture doesn’t directly have “port” addressing modes, but some bus controllers may be able to translate certain memory ranges to port ranges.
If everything is set up correctly, then the kernel should handle translation, and inb()/outb() should work (from a kernel mode module, at least.)
Alternatively, have you tried using ioport_map()?
Or are you trying to do this from user space?
You probably already know this, but it’s a reasonable resource:
You can attach a serial debugger to the kernel and trace through the code side to see what it does.
(Also see if other drivers hit the same code path, which should indicate that it works.)
You can also add a logic analyzer or bus scope on the PCI-Ex bus to see what’s going on. This is unfortunately somewhat expensive for a hobbyist :-(
I’d probably go looking for the other drivers that work on the Jetson in the kernel source, and see if any of them use inb()/outb().
Okay, if I open “/dev/ports” O_RDWR | O_SYNC, lseek to my assigned PCI I/O memory address, then read 1 byte I get a segmentation fault, at least as “sudo”: I haven’t tried from “root” – I’m scared.
If I try to use ioperm, iopl, io_remap, or pci_iomap et al it can’t find the include file.
I would serial-debug the kernel but it would be my first Linux kernel debug, let alone via serial. (kgdb, right? I have the serial cable connected and can see dmesg on it, now I just need to learn non-IDE kernel debugging. whee!) (Do I sound excited? sorry. I’m not.)
I come from almost 30 years driver programming on PCs, but all in DOS/Windows, using Borland IDEs, not Microsoft nor Linux, so I’m handicapped.