Accessing PCI Regions

PCI devices contain three addressable regions: configuration space, I/O ports, and device memory

Configuration Space

pci_read_config_[byte|word|dword](struct pci_dev *pdev, int offset, int *value);

and

pci_write_config_[byte|word|dword](struct pci_dev *pdev, int offset, int value);

 

Only the first 64 bytes of the configuration space are standardized. The device manufacturer defines desired semantics to the rest.

 

I/O and Memory

PCI cards have up to six I/O or memory regions. I/O regions contain registers, and memory regions hold data. Video cards, for example, have I/O spaces that accommodate control registers and memory regions that map to frame buffers.

 

unsigned long pci_resource_[start|len|end|flags] (struct pci_dev *pdev, int bar);

1. Get the I/O base address from the appropriate base address register (bar) in the configuration space:

unsigned long io_base = pci_resource_start(pdev, bar);

相关文章:

  • 2022-12-23
  • 2021-11-04
  • 2021-05-26
  • 2021-08-24
  • 2022-02-08
  • 2021-06-20
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2021-09-01
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-11-07
  • 2021-12-11
相关资源
相似解决方案