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
Copy Markdown

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
Copy Markdown
Author

yamt pushed a commit to yamt/netbsd-src that referenced this pull request Mar 28, 2026
):

	sys/arch/evbppc/wii/dev/wiifb.c: revision 1.8
	sys/arch/evbppc/wii/dev/gxreg.h: revision 1.1
	sys/arch/evbppc/include/wii.h: revision 1.11
	sys/arch/evbppc/wii/machdep.c: revision 1.11
	sys/arch/evbppc/wii/dev/viio.h: file removal

wii: Use GX to accelerate RGB to YUY2 conversion.

Allocate a 640x480x32 RGB buffer in memory, and when not in EMUL mode,
use the CPU to copy from the RGB buffer to EFB (taking advantage of the
pixel engine to do RGB -> YUY2 for us) and then use the GX to copy from
EFB to XFB.

Not only does this improve performance significantly in X, it also results
in better colour reproduction. The previous software method employed by
xf86-video-wsfb had some corner cases where eg. dark colours would display
as bright pink.
yamt pushed a commit to yamt/netbsd-src that referenced this pull request Mar 28, 2026
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