Skip to content

PCI_IOC_MAP_BAR ioctl for userspace BAR mapping#74

Draft
OliverMiyarUgarte wants to merge 1 commit intoNetBSD:trunkfrom
OliverMiyarUgarte:userland-pci
Draft

PCI_IOC_MAP_BAR ioctl for userspace BAR mapping#74
OliverMiyarUgarte wants to merge 1 commit intoNetBSD:trunkfrom
OliverMiyarUgarte:userland-pci

Conversation

@OliverMiyarUgarte
Copy link

PCI_IOC_MAP_BAR ioctl for userspace BAR mapping

Added a new ioctl to /dev/pci that allows userspace drivers to map PCI BARs.

What was done:

  • Adds struct pciio_bar_map to pciio.h
  • Implements PCI_IOC_MAP_BAR handler in pci_usrreq.c

Testing performed:

  • Tested with QEMU's edu device
  • Mapped BAR0 and read device ID register
  • Verified correct size and offset from kernel ranges

What's Next:

  • Expose PCI interrupts as events that can be read from a pci(4) (/dev/pciN) device instance, and use that to implement the pci_intr(9) API in userland.
  • Devise a scheme for userland allocate and map memory for DMA in order to implement bus_dma(9).

Note: This is a draft PR to get early feedback before adding documentation and final polish. All feedback welcome!

Add struct pciio_bar_map to pciio.h
@OliverMiyarUgarte
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant