summaryrefslogtreecommitdiff
path: root/src/freebsd_pci.c
AgeCommit message (Collapse)Author
2019-07-10freebsd_pci: remove old probe methodNiclas Zeising
Remove the old probe method. The PCIOCGETBAR ioctl has been in FreeBSD since 8.0 release, if not earlier. Remove the old way of doing it. This is done using unifdef -DPCIOCGETBAR and cleaning up whitespace. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2019-07-10freebsd_pci: format freebsd_pci_methodsNiclas Zeising
Format freebsd_pci_methods a bit, adding some whitespace and assigning NULL to methods not implemented. This makes it easier to see the names of various methods, as well as which methods are not implemented. Idea from src/linux_sysfs.c Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2019-07-10freebsd_pci: Add has_kernel_driver functionNiclas Zeising
Add a has_kernel_driver function to the FreeBSD libpciaccess functions. This uses the PCIOCATTACHED ioctl to check if a driver is attached to a specific PCI device. Idea taken from the FreeBSD system utility pciconf. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2019-07-10freebsd_pci: Remove unused variableNiclas Zeising
Remove unused variable, it's written to, but never used. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2019-07-10freebsd_pci: Make this work on sparc64Niclas Zeising
Make the FreeBSD libpciaccess routines work on FreeBSD. The FreeBSD sparc64 architecture needs special treatment, similar to the PCI_MAGIC_IO_RANGE code. However, PCI_MAGIC_IO_RANGE has been gone for some time. Give this a chance to work on sparc64 anyway. This code has been in the FreeBSD ports tree for some time.
2019-07-10freebsd_pci: update legacy I/O for new architecturesNiclas Zeising
Update FreeBSD legacy I/O routines for new architectures. When we're not on amd64 or i386, and PCI_MAGIC_IO_RANGE is not defined, use IOCTLs to handle reads and writes through /dev/io. This is accomplished by opening /dev/io and using IOCTLs from dev/io/iodev.h, an interface that exists on most FreeBSD architectures. This change has been in the FreeBSD ports tree for quite some time.
2019-07-10freebsd_pci: Fix types in write functionsNiclas Zeising
Fix the type used in write functions to match the size of the write. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2019-07-10Don't check for struct pci_io.pi_sel.pc_domainNiclas Zeising
Autoconf has a check that pci_io.pi_sel.pc_domain exists. This is only used on FreeBSD. pc_domain was added to pci_io.pi_sel on FreeBSD many many releases ago, and exists on all current FreeBSD releases. Remove the check, and the corresponding HAVE_PCI_IO_PC_DOMAIN, and update the code to take into account that #ifdef HAVE_PCI_IO_PC_DOMAIN is now always true. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2019-07-10freebsd_pci: Try to conform to uniform styleNiclas Zeising
Try to make freebsd_pci.c conform to a more uniform style. This change is whitespace only, no functional change intended. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2019-06-16freebsd: Add !legacy open_device_io implementationConrad Meyer
Some drivers, such as QXL, rely on this method and do not check for errors when it is unavailable. FreeBSD's legacy method can enumerate any d/b/s/f just fine, so it should be adequate for the !legacy API, as far as I can tell. With this change, QXL doesn't crash on startup on FreeBSD. Signed-off-by: Conrad Meyer <cem@FreeBSD.org>
2015-02-12Include config.h before any other headers.Emil Velikov
The former has a series of defines which in some cases are crusial to be set before including any system headers. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-02-12Add missing guards around config.h inclusionChih-Wei Huang
In some cases the header may not exist, leading to compilation issues. Add the ifdef HAVE_CONFIG_H, as it is those in other parts of the project. [Emil Velikov: Split out from a larger commit, rework commit message] Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-02-11Fix IO access functions on linux+sysfs.Marcin Ko?cielnicki
The offsets on the resourceX files are relative to BAR base - don't add the base address ourselves. Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-06-07Bug 63583 - add legacy IO routines for FreeBSDAlan Coopersmith
https://bugs.freedesktop.org/show_bug.cgi?id=63583 Reviewed-by: Mark Kettenis <kettenis@openbsd.org> Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-02-27Use O_CLOEXEC for internal file descriptorsAdam Jackson
Well, almost all of them. zlib doesn't support "e" in the mode string in gzopen() though it will silently accept and ignore it, and Solaris appears not to support "e" in the mode string at all. Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-09-16Strip trailing whitespaceAlan Coopersmith
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2009-02-27FreeBSD: Incorporate several fixes that have accumulated.Robert Noland
-Don't frob the BARs while they are enabled -Find proper pci bios address / length -Use the new PCIOCGETBAR ioctl if it exists rather than frob the BARs ourself -Write must also be a power of two
2008-10-29Fix FreeBSD systems which support pci domains.Robert Noland
Support for FreeBSD based systems which support pci domains was broken in the commit to support kFreeBSD. Include config.h so that things are happy again.
2008-10-11Add support for GNU/kFreeBSDPetr Salinger
We need to initialize the FreeBSD backend on GNU/kFreeBSD and detect whether pci_io.pi_sel.pc_domain member exists. X.Org bug#17882 <http://bugs.freedesktop.org/show_bug.cgi?id=17882>
2008-07-08Hide one more private symbolJulien Cristau
2008-02-27Don't export private symbols.Julien Cristau
2007-10-10FreeBSD: for 64-bit BARs, skip the resource slot used for the upper 32 bits.Eric Anholt
This gets us the same resource numbering as on Linux.
2007-10-10FreeBSD: Don't try to unset an MTRR if we didn't set it.Eric Anholt
2007-10-10FreeBSD: Add support for multiple PCI domains.Eric Anholt
2007-10-09FreeBSD: Fix unmap_range to return an error value.Eric Anholt
2007-10-09FreeBSD: don't set the MTRR if it's the default mode (uncacheable).Eric Anholt
2007-09-11Add FreeBSD MTRR setting support.Eric Anholt
2007-08-30New interfaces to map memory with MTRR (or similar) support.Ian Romanick
Added new functions pci_device_map_range and pci_device_unmap_range to handle mapping of PCI device BARs. These new interfaces allow the possiblity of MTRRs on platforms that support them. These additional APIs necessitated changing some internal interfaces. The code for FreeBSD and Solaris has been updated but has not been compiled or tested. Old interfaces are marked deprecated and will eventually be removed.
2007-08-03FreeBSD: Add VGA rom reading through /dev/mem.Eric Anholt
2007-08-03FreeBSD: Fill in the subdevice ID.Eric Anholt
2007-03-06FreeBSD: Fix a couple of minor issues in cleanup paths.Eric Anholt
2007-03-01FreeBSD: Add system cleanup function.Eric Anholt
2007-02-28FreeBSD: When mapping regions, use the region's base address, not 0.Eric Anholt
2007-02-28Fix inverted protection typo for mmap in region mapping.Eric Anholt
2007-02-28Update freebsd code for pci_device_cfg_write API change.Eric Anholt
2007-01-12Add support for getting region information on FreeBSD.Eric Anholt
This could stand a lot more testing -- all it has received is visual inspection of scanpci output on one machine, with some differing results from XFree86 scanpci output.
2007-01-12Open the pci device read-write so we can read and write config regs.Eric Anholt
With this, we can hook up the IRQ line information. It would probably be nice to have an unpriveleged mode, but for now, write access is required.
2007-01-12Fix many warnings and bugs in the freebsd implementation.Eric Anholt
With this, scanpci gives partially-sane results.
2006-11-14Add the beginnings of a FreeBSD port.Eric Anholt