summaryrefslogtreecommitdiffstats
path: root/sys/dev/cardbus
Commit message (Collapse)AuthorAgeFilesLines
* MFC 261790:jhb2015-04-012-0/+22
| | | | | | | | | | | | | | | | | | | | | | Add support for managing PCI bus numbers. As with BARs and PCI-PCI bridge I/O windows, the default is to preserve the firmware-assigned resources. PCI bus numbers are only managed if NEW_PCIB is enabled and the architecture defines a PCI_RES_BUS resource type. - Add a helper API to create top-level PCI bus resource managers for each PCI domain/segment. Host-PCI bridge drivers use this API to allocate bus numbers from their associated domain. - Change the PCI bus and CardBus drivers to allocate a bus resource for their bus number from the parent PCI bridge device. - Change the PCI-PCI and PCI-CardBus bridge drivers to allocate the full range of bus numbers from secbus to subbus from their parent bridge. The drivers also always program their primary bus register. The bridge drivers also support growing their bus range by extending the bus resource and updating subbus to match the larger range. - Add support for managing PCI bus resources to the Host-PCI bridge drivers used for amd64 and i386 (acpi_pcib, mptable_pcib, legacy_pcib, and qpi_pcib). - Define a PCI_RES_BUS resource type for amd64 and i386. PR: 197076
* - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge.jhb2012-03-021-0/+1
| | | | | | | | | | | | | | | The tag enforces a single restriction that all DMA transactions must not cross a 4GB boundary. Note that while this restriction technically only applies to PCI-express, this change applies it to all PCI devices as it is simpler to implement that way and errs on the side of caution. - Add a softc structure for PCI bus devices to hold the bus_dma tag and a new pci_attach_common() routine that performs actions common to the attach phase of all PCI bus drivers. Right now this only consists of a bootverbose printf and the allocate of a bus_dma tag if necessary. - Adjust all PCI bus drivers to allocate a PCI bus softc and to call pci_attach_common() from their attach routines. MFC after: 2 weeks
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+1
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Partially revert 222753: If a CardBus card stores its CIS in a BAR, deletejhb2011-09-121-0/+1
| | | | | | | | | the BAR after parsing the CIS. This forces the resource range to be reallocated if the BAR is reused by the device. Submitted by: deischen Reviewed by: imp Approved by: re (kib)
* Minor cleanup:imp2011-06-211-5/+16
| | | | | | | | o Consider No CIS a normal event and stop whining about it so much (too many cards are like this, espeically usb/firewire cards). o Add comments to the cis reading code. o Made the read from config space a smidge easier to read and eliminate a loop that can be done mathematically.
* More properly handle Cardbus cards that that store their CIS in a BAR afterjhb2011-06-061-3/+2
| | | | | | | | | the recent changes to track BAR state explicitly. The code would now attempt to add the same BAR twice in this case. Instead, change this so that it recognizes this case and only adds it once and do not delete the BAR outright after parsing the CIS. Tested by: bschmidt
* Don't explicitly list pci_write_ivar() for bus_write_ivar, the method isjhb2011-05-021-1/+0
| | | | already inherited from the PCI bus driver.
* Move the PCI-specific logic of removing a cardbus device into ajhb2010-01-051-30/+1
| | | | | | | | | pci_delete_child() function called by the cardbus driver. The new function uses resource_list_unreserve() to release the BARs decoded by the device being removed. Reviewed by: imp Tested by: brooks
* Fix an error case I missed in the previous change so that the CIS resourcejhb2009-12-301-2/+2
| | | | is fully cleaned up if we fail to find the CIS in the devices ROM.
* Delete the CIS resource after releasing it. This is needed when the CIS isjhb2009-12-301-2/+3
| | | | | | stored in a BAR since the CIS BAR is mapped before the PCI bus driver enumerates all the BARs. Without this change, the PCI bus driver would attempt to initialize a BAR that was already allocated resulting in a panic.
* Teach the PCI bus driver to handle PCIR_BIOS BARs properly and remove specialjhb2009-12-301-6/+0
| | | | | | | | | handling for the PCIR_BIOS decoding enable bit from the cardbus driver. The PCIR_BIOS BAR does include type bits like other BARs. Instead, it is always a 32-bit non-prefetchable memory BAR where the low bit is used as a flag to enable decoding. Reviewed by: imp
* Use bus_*() rather than bus_space_*().jhb2009-12-301-17/+7
|
* Minorly improved debugging. Use the DEVPRINTF macro and report theimp2009-03-131-13/+7
| | | | offset for memory when mapping in the CIS.
* Move the deactivation of the device's BAR to before the loop where weimp2009-03-121-5/+5
| | | | | turn deactivate the resources. While this likely doesn't matter, it is likely to be safer.
* Restore blank line removed when fixing my earlier botch. Never doimp2009-03-101-0/+1
| | | | | | just one last change before bed... Pointy had to: imp
* Complete removal of cardbus_write_ivar which was left hanging.gnn2009-03-101-3/+0
|
* When freeing all the resources of the card, it is better to turn offimp2009-03-101-15/+11
| | | | | | | | | | | | the PORTEN and MEMEN bits in the command register than to zero the bars. Use pci_write_ivar directly instead of a one-line wrapper that adds no value. Track verbosity changes in pci. Remove a stray blank line.
* Remove unused variable.wkoszek2009-02-061-2/+0
| | | | | Found with: Coverity Prevent(tm) CID: 4138
* Goof, catch up to constant rename (I renamed it to match the overall PCIjhb2009-02-021-1/+1
| | | | | | style of having register offsets start with PCIR_* rather than PCI_*). Submitted by: rss
* When no driver attaches to a card, don't power down the card. We canimp2008-12-311-1/+2
| | | | | | now read config registers of cardbus cards that are inserted, but aren't attached to a driver. Also, add a power related comment...
* Don't call destroy_dev on the alias. This fixes half a dozen PRs I think.imp2008-12-022-7/+4
|
* Create a /dev/cardbus%d.cis, to be compatible with older versions ofimp2008-11-212-1/+6
| | | | | the software. This is a trivial amount of code to keep wireless monitoring software working... I plan on removing it in 9.0.
* Overhaul of CIS parsing, next step: keep a cached copy of the CIS,imp2008-11-174-73/+68
| | | | | | | | | read before we configure the card, so we can implement /dev/cardbus*.cis. Also, do this on a per-child basis, so we now have a different name than before. I think i'll have to fix that for some legacy tools to keep working. I can now do a dumpcis on my running atheros card and have it still work!
* First step in cleaning up CIS parsing and /dev/cardbus*.cis: removeimp2008-11-153-38/+42
| | | | | | redundant malloc/free. Add comments about how this should really be done. Fix an overly verbose comment about under 1MB mapping: go ahead and set the bits, but we ignore them.
* Turns out this isn't even used at all... The bogon that I was tracing wasimp2008-11-031-6/+0
| | | | in code from my p4 tree, not -current. Delete it here.
* Use child (the card) in preference to cbdev (the bridge) whenimp2008-11-031-2/+4
| | | | | | | | | | | allocating resources to read the CIS. I'm not sure when this changed, but it is totally wrong. Also, add a minor improvement to the debugging. This should help everybody trying to run dumpcis on atheros wireless card as well. MFC after: 2 days
* We can't mask out the higher order bits and have the size come outimp2008-11-031-1/+1
| | | | | | | | right... Good thing the size was ignored... Where this macro is used, there's no reason to do it anyway. There seems to have been some old-time confusion between the CIS pointer definition, and the BAR definitions at the base of this bug.
* Make the PCI code aware of PCI domains (aka PCI segments) so we canmarius2007-09-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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)
* gcc 4.2 thinks that tupleid is uninitialized. Or might be usedimp2007-06-081-1/+1
| | | | | | | uninitialized. It gets passed into other routines that initialize it... Cope by initializing. Submitted by: mjacob
* Fix interrupt routing for some cards after the previous fix to clear BARsjhb2007-05-161-6/+7
| | | | | | | in cardbus cards: update the saved copy of the PCIR_INTLINE register in the PCI ivars in addition to the actual register. Reviewed by: imp
* Write 0 to all the bars in cardbus_cardbus_setup_regs. This is neededimp2007-05-161-19/+18
| | | | | | | | because on at least my dc based cards there's garbage in there. The recent changes in the resource code appears to have unmasked this problem... At least dc now probes/attaches better than it did before. Also, we no longer need to write to the cfg for the other registers.
* Change PCIM_CIS_ASI_TUPLE to _CONFIG.imp2007-05-161-1/+1
| | | | | | Add PCI_MAX_BAR_0 minor style nit. Add PCIM_CIS_CONFIG_MASK
* Cope gracefully with device_get_children returning an error.imp2007-01-191-2/+5
| | | | | Obtained from: Hans Petter Selasky P4: http://perforce.freebsd.org/chv.cgi?CH=112957
* Minor cleanup of CIS parsing.imp2006-06-121-5/+1
|
* Better error message when the CIS is a non-standards conforming '0'.imp2006-06-121-1/+3
|
* When we can't parse the CIS, note with a warning that the bogus CISimp2006-06-121-5/+2
| | | | | was ignored, rather than freaking out. In the past, it wasn't possible to not parse the CIS, so this changes no behavior.
* Make the 'pci_devclass' pointer variable private (drivers really shouldn'tjhb2006-01-201-1/+0
| | | | | | share devclass pointers, a mistake I've encouraged in the past) and move the declaration of the pci_driver kobj class from cardbus.c to pci_private.h so that other drivers can inherit from pci_driver.
* Use the child to allocate the resource rather than bridge, since we'reimp2006-01-031-41/+6
| | | | | | | | | | allocating a resource that's in the card itself. Remove more now-redundant resource_list_add, and now-redunant code that lives in the pci layer. # This fixes the atheros card that I have which had its CIS in one of # the BARs. Don't know yet if this fixes the amd64 issues reported.
* Minor style(9) hacking, plus use a macro in place of (struct resource *)~0ULimp2006-01-031-6/+7
| | | | (what the heck does that mean?).
* Fixing build bustage.avatar2005-12-311-1/+1
|
* Remove now-obsolete printf warning.imp2005-12-301-7/+2
|
* Move all of the resource allocation into the pci layer. The resourceimp2005-12-301-321/+15
| | | | allocation here just duplicated it (badly).
* The RID2BAR macro returns a number, not a bitmask. Fix this.imp2005-12-301-4/+6
| | | | Spotted by: ru, jhb
* - Retire BARBIT in favor of new PCI_RID2BAR.glebius2005-12-301-5/+5
| | | | - Fix build.
* Retire BARBIT in favor of new PCI_RID2BAR.imp2005-12-292-5/+4
|
* Help Warner with merge from p4.glebius2005-12-291-1/+2
|
* Implement /dev/cardbus%d.cis, same thing as /dev/pccard%d.cis. Thereimp2005-12-294-71/+268
| | | | | are some rough edges with this still, but it seems to work well enough to commit.
* When in rev. 1.47 cardbus_alloc_resources() function was moved fromglebius2005-12-281-15/+40
| | | | | | | | | | | | | | | | | | | | cardbus_cis.c to this file, some code was not merged and thus resource list entries were invalid. They didn't have a resources attached to them. However, the problem was masked for some time later, because newer resources list entries were added to the head of the list, and resource_list_find() always returned the first matching resource list entry. Usually the underlying driver allocated a valid resource and added it to the head of the list, and invalid one wasn't used. In rev. 1.174 of subr_bus.c the sorting of resource list entries was reversed demasking the problem in cardbus_alloc_resources(). This commit fixes the problem returning back some code from cardbus_cis.c, pre-1.49 revisions. PR: kern/87114 PR: kern/90441 Hardware provided by: Vasily Olekhov <olekhov yandex.ru> Reviewed by: imp
* Cardbus has only 1 slot, so simplify a little.imp2005-10-282-44/+37
|
* Eliminate even more duplication, and move some definitions into pcireg.himp2005-10-282-45/+19
|
OpenPOWER on IntegriCloud