All of lore.kernel.org
 help / color / mirror / Atom feed
* None of the virtual/physical/bus address matches the (base) BAR-0 register
@ 2021-10-01 14:51 Ajay Garg
  2021-10-01 15:13 ` Keith Busch
  0 siblings, 1 reply; 10+ messages in thread
From: Ajay Garg @ 2021-10-01 14:51 UTC (permalink / raw)
  To: linux-pci

Hi All.

I have a SD/MMC reader over PCI, which displays the following (amongst
others) when we do "lspci -vv" :

#########################################################
Region 0: Memory at e2c20000 (32-bit, non-prefetchable) [size=512]
#########################################################

Above shows that e2c20000 is the physical (base-)address of BAR0.



Now, in the device driver, I do the following :

########################################################
.....
struct pci_dev *ptr;
void __iomem *bar0_ptr;
......

......
pci_request_region(ptr, 0, "ajay_sd_mmc_BAR0_region");
bar0_ptr = pci_iomap(ptr, 0, pci_resource_len(ptr, 0));

printk("Base virtual-address = [%p]\n", bar0_ptr);
printk("Base physical-address = [%p]\n", virt_to_phys(bar0_ptr));
printk("Base bus-address = [%p]\n", virt_to_bus(bar0_ptr));
....
########################################################


I have removed error-checking, but I confirm that pci_request_region()
and pci_iomap calls are successful.

Now, in the 3 printk's, none of the value is printed as e2c20000.
I was expecting that the 2nd result, of virt_to_phys() translation,
would be equal to the base-address of BAR0 register, as reported by
lspci.


What am I missing?
Will be grateful for pointers.


Thanks and Regards,
Ajay

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-05  7:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 14:51 None of the virtual/physical/bus address matches the (base) BAR-0 register Ajay Garg
2021-10-01 15:13 ` Keith Busch
2021-10-02  4:06   ` Ajay Garg
2021-10-02  7:49     ` Ajay Garg
2021-10-02 15:55     ` Bjorn Helgaas
2021-10-02 17:12       ` Ajay Garg
2021-10-02 19:33         ` Bjorn Helgaas
2021-10-03  2:05           ` Ajay Garg
2021-10-03 17:05             ` Bjorn Helgaas
2021-10-05  7:32               ` Ajay Garg

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.