pci: add mmio addr to #pci ctl files
authorAditya Basu <mitthu@google.com>
Fri, 16 Aug 2019 16:34:07 +0000 (12:34 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 19 Aug 2019 16:39:09 +0000 (12:39 -0400)
Before:
    $ cat /dev/pci/0.4.0ctl
    8.80.0 8086/2021  11 0:0x 16384

After:
    $ cat /dev/pci/0.4.0ctl
    8.80.0 8086/2021  11 0:0x    0/febf0000 16384

The mmio_base32 and mmio_base64 physical address mappings are now
printed. If the device is dma64 capable then it gets mapped to
mmio_base64 as is the case above. The PCI device information shown above
is for Intel CBDMA.

Signed-off-by: Aditya Basu <mitthu@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/dev/pci.c

index 73fe9d9..c062676 100644 (file)
@@ -168,8 +168,9 @@ static size_t pciread(struct chan *c, void *va, size_t n, off64_t offset)
                for (i = 0; i < COUNT_OF(p->bar); i++) {
                        if (p->bar[i].mmio_sz == 0)
                                continue;
-                       w = seprintf(w, ebuf, " %d:%.8lux %d", i,
-                                    p->bar[i].pio_base, p->bar[i].mmio_sz);
+                       w = seprintf(w, ebuf, " %d:%.8lux %4x/%8x %d", i,
+                                    p->bar[i].pio_base, p->bar[i].mmio_base32,
+                                    p->bar[i].mmio_base64, p->bar[i].mmio_sz);
                }
                *w++ = '\n';
                *w = '\0';