summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/pci_user.c
Commit message (Collapse)AuthorAgeFilesLines
* pci(4): don't perform maximum register number checkavg2009-09-111-2/+1
| | | | | | | | | | | | | Different sub-kinds of PCI buses may have different rules and thus it is up for the bus backends to do proper input checks. For example, PCIe allows configuration register numbers < 0x1000, while for PCI proper the limit is 0x100. And, in fact, the buses already do the checks. Reviewed by: jhb MFC after: 1 week X-ToDo: add check for negative value to bus backends X-ToDo: use named constant for maximum PCIe register
* - Add a new ioctl to /dev/pci to fetch details on an individual BAR of ajhb2009-02-021-3/+70
| | | | | | | | | | | | | | device. The details include the current value of the BAR (including all the flag bits and the current base address), its length, and whether or not it is enabled. Since this operation is not invasive, non-root users are allowed to use it (unlike manual config register access which requires root). The intention is that userland apps (such as Xorg) will use this interface rather than dangerously frobbing the BARs from userland to obtain this information. - Add a new sub-mode to the 'list' mode of pciconf. The -b flag when used with -l will now list all the active BARs for each device. MFC after: 1 month
* Don't cache the new-bus name of a PCI device in the PCI conf structure,jhb2008-01-151-1/+4
| | | | | | | | | | | but reread it from the device_t every time the device list is fetched. Previously the device name in pciconf -l would not be updated when a driver was unloaded or if a device was detached and attached to a different driver. MFC after: 1 week PR: kern/104777 Submitted by: "Iasen Kostoff" tbyte | otel net
* Fix some bugs in the FreeBSD 4/5/6 pci(4) IOCTLs compatibility code:marius2007-12-261-12/+9
| | | | | | | | | | | | | | | | - Use the correct offsets when copying out the results of PCIOCGETCONF_OLD. This happened to not affect the 64-bit architectures because there the addition of pc_domain to struct pcisel didn't change the overall size of struct pci_conf. [1] - Always copy the name and unit information to conf_old so it's also part of the output once this information is cached in dinfo. - Use the correct type for flags in struct pci_match_conf_old. This change is more or less cosmetic though. Reported and tested by: bde [1] Reviewed by: imp MFC after: 3 days Committed from: 24C3
* Simplify the old compat #ifdefs.imp2007-10-261-22/+12
|
* Add ABI backwards compatibility to the FreeBSD 4/5/6 versions ofmarius2007-10-241-51/+295
| | | | | | | | | | | | | | the PCIOCGETCONF, PCIOCREAD and PCIOCWRITE IOCTLs, which was broken with the introduction of PCI domain support. As the size of struct pci_conf_io wasn't changed with that commit, this unfortunately requires the ABI of PCIOCGETCONF to be broken again in order to be able to provide backwards compatibility to the old version of that IOCTL. Requested by: imp Discussed with: re (kensmith) Reviewed by: PCI maintainers (imp, jhb) MFC after: 5 days
* Make the PCI code aware of PCI domains (aka PCI segments) so we canmarius2007-09-301-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | support machines having multiple independently numbered PCI domains and don't support reenumeration without ambiguity amongst the devices as seen by the OS and represented by PCI location strings. This includes introducing a function pci_find_dbsf(9) which works like pci_find_bsf(9) but additionally takes a domain number argument and limiting pci_find_bsf(9) to only search devices in domain 0 (the only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order to no longer report false positives when searching for siblings and dupe devices in the same domain respectively. Along with this change the sole host-PCI bridge driver converted to actually make use of PCI domain support is uninorth(4), the others continue to use domain 0 only for now and need to be converted as appropriate later on. Note that this means that the format of the location strings as used by pciconf(8) has been changed and that consumers of <sys/pciio.h> potentially need to be recompiled. Suggested by: jhb Reviewed by: grehan, jhb, marcel Approved by: re (kensmith), jhb (PCI maintainer hat)
* Actually make bounds checking for PCIOCREAD and PCIOCWRITE work.ru2006-10-061-6/+8
|
* For FreeBSD 4 binaries, when trying to read from a device that doesps2005-08-261-1/+8
| | | | | | | | not exsist, do not have ioctl return an error, but instead set -1 in the data returned to the user. This allows the HP bios flash utilities to work without requiring changes to their code. Reviewed by: jhb
* Use pci_find_bsf() to retrieve the PCI device associated withbms2005-04-131-13/+16
| | | | | | | a bus/device/function tuple. This change enables pciconf(8) to work with CardBus devices. Reviewed by: imp
* Use dynamic major number allocation.phk2005-02-271-7/+0
|
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-3/+3
| | | | Bump __FreeBSD_version accordingly.
* Device megapatch 4/6:phk2004-02-211-0/+2
| | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
* MF-p4/diff reduction:imp2004-01-111-1/+0
| | | | Eliminate trailing blank line in this file.
* The code that was meant to test alignment of the register offsetse2003-10-111-46/+24
| | | | | | | | | | | | | | | | | | | | | | parameter in the read and write case dereferenced an unitialized pointer and can't possibly ever have catched an actual invalid argument. This was apparently true for the read/write and getconf cases. The latter does not even receive the paramter that is to be verified. I'm surprised that this did not cause kernel panics, but it seems that the uninitialized local variable happens to contain data that may be used as a pointer to memory that satisfies the test condition. Make the code work as intended by moving the test inside the switch case where the pointer has been properly initialized. Since the read and write case shared just about all code (except for the single call to PCIB_READ_CONFIG resp. PCIB_WRITE_CONFIG) I have merged both cases. Noticed by: trhodes@FreeBSD.org (Tom Rhodes)
* Use __FBSDID().obrien2003-08-241-4/+4
| | | | Also some minor style cleanups.
* Prefer new location of pci include files (which have only been in theimp2003-08-221-2/+2
| | | | | tree for two or more years now), except in a few places where there's code to be compatible with older versions of FreeBSD.
* prevent the number of patterns from exceeding the number of pci devices.jmg2003-06-231-1/+1
| | | | Submitted by: rwatson
* cleanup /dev/pci code some:jmg2003-06-231-54/+20
| | | | | | | | | read permision only required for listing, read/write required for read/write to registers fix a possible memory leak clean up error handling a bit Reviewed by: silence
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-13/+5
| | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl)
* Make /dev/pci use MAJOR_AUTO.se2003-03-011-0/+4
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-1/+1
| | | | reference.
* o Modify access control code for /dev/pci device to use securelevel_gt()rwatson2001-09-261-3/+9
| | | | | | instead of direct securelevel variable test. Obtained from: TrustedBSD Project
* KSE Milestone 2julian2001-09-121-6/+6
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
* Next round of PCI subsystem updates:msmith2000-12-131-0/+487
- Break out the /dev/pci driver into a separate file. - Kill the COMPAT_OLDPCI support. - Make the EISA bridge attach a bit more like the old code; explicitly check for the existence of eisa0/isa0 and only attach if they don't already exist. Only make one bus_generic_attach() pass over the bridge, once both busses are attached. Note that the stupid Intel bridge's class is entirely unpredictable. - Add prototypes and re-layout the core PCI modules in line with current coding standards (not a major whitespace change, just moving the module data to the top of the file). - Remove redundant type-2 bridge support from the core PCI code; the PCI-CardBus code does this itself internally. Remove the now entirely redundant header-class-specific support, as well as the secondary and subordinate bus number fields. These are bridge attributes now. - Add support for PCI Extended Capabilities. - Add support for PCI Power Management. The interface currently allows a driver to query and set the power state of a device. - Add helper functions to allow drivers to enable/disable busmastering and the decoding of I/O and memory ranges. - Use PCI_SLOTMAX and PCI_FUNCMAX rather than magic numbers in some places. - Make the PCI-PCI bridge code a little more paranoid about valid I/O and memory decodes. - Add some more PCI register definitions for the command and status registers. Correct another bogus definition for type-1 bridges.
OpenPOWER on IntegriCloud