aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pccbb
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix typo pointed out by avg@ and Joerg Sonnenberger. Add a clarifyingWarner Losh2014-11-181-4/+4
| | | | | | | | | sentence too. Sponsored by: Netflix Notes: svn path=/head/; revision=274663
* Modernize comments about BIOSes being lame since in this detail theyWarner Losh2014-11-181-6/+10
| | | | | | | | aren't lame, the rules changed along the way. Catch up to 1999 or so with the new rules. Notes: svn path=/head/; revision=274639
* Remove stray empty comment. The code is adequately explained in theWarner Losh2014-11-171-2/+0
| | | | | | | block comment above, so there's nothing to add here. Notes: svn path=/head/; revision=274633
* For reasons which are not clear, r254263 broke some PCMCIA and CardBusGavin Atkinson2014-08-031-0/+2
| | | | | | | | | | | | | | | | | | | | bridges in strange ways, either rendering them unable to detect insertion and removal events, or possibly unable to read from the device behind the bridge. This fixes at least one laptop, a Toshiba Tecra M5 with a Texas Instruments PCxx12 (d=0x8039 v=0c104c) bridge. The very similar Tecra M9 has the same bridge, but worked fine without this change. The bridge chip has no I/O port BAR, and there is nothing in the spec to suggest I/O decoding should be enabled; however enabling it fixes the issue. Add an XXX comment to this effect. Discussed with: jhb, imp MFC after: 2 weeks Notes: svn path=/head/; revision=269488
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-282-11/+5
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-272-5/+11
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-272-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* Add support for managing PCI bus numbers. As with BARs and PCI-PCI bridgeJohn Baldwin2014-02-124-20/+88
| | | | | | | | | | | | | | | | | | | | | | | | | 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. Reviewed by: imp MFC after: 1 month Notes: svn path=/head/; revision=261790
* Explicitly enable I/O and memory decoding in the bridge's command registerJohn Baldwin2014-01-271-1/+15
| | | | | | | | | | | when activating an I/O or memory window on the CardBus bridge. Tested by: Olivier Cochard-Labbe <olivier@cochard.me> Reviewed by: imp MFC after: 3 days Notes: svn path=/head/; revision=261216
* Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIScott Long2013-08-121-4/+1
| | | | | | | | | | | | | | | | | | | | command register. The lazy BAR allocation code in FreeBSD sometimes disables this bit when it detects a range conflict, and will re-enable it on demand when a driver allocates the BAR. Thus, the bit is no longer a reliable indication of capability, and should not be checked. This results in the elimination of a lot of code from drivers, and also gives the opportunity to simplify a lot of drivers to use a helper API to set the busmaster enable bit. This changes fixes some recent reports of disk controllers and their associated drives/enclosures disappearing during boot. Submitted by: jhb Reviewed by: jfv, marius, achadd, achim MFC after: 1 day Notes: svn path=/head/; revision=254263
* Restore the PCI bridge configuration upon resume.Adrian Chadd2012-07-311-0/+5
| | | | | | | | | | | | | | This allows my TI1510 cardbus/PCI bridge to work after a suspend/resume, without having to unload/reload the cbb driver. I've also tested this on stable/9. I'll MFC it shortly. PR: kern/170058 Reviewed by: jhb MFC after: 1 day Notes: svn path=/head/; revision=238954
* Some laptops have weak power controllers that cannot tolerate multipleWarner Losh2012-01-271-0/+7
| | | | | | | | | cards powering up at once. Work around the easy case (multiple cards inserted on boot) with a short sleep and a long comment. This improves reliability on those laptops with power hungry cards. Notes: svn path=/head/; revision=230626
* - There's no need to overwrite the default device method with the defaultMarius Strobl2011-11-222-4/+2
| | | | | | | | | | | | | one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID. Notes: svn path=/head/; revision=227843
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-072-2/+2
| | | | | | | | | 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. Notes: svn path=/head/; revision=227309
* Mark the card as bad on shutdown. This means that bus_child_presentWarner Losh2011-06-211-0/+6
| | | | | | | | will return false on shutdown and massive spewage from usb disappears for usb cardbus adapters. Notes: svn path=/head/; revision=223352
* More expeirmentation suggests that 10ms isn't as reliable asWarner Losh2011-06-181-2/+2
| | | | | | | | previously thought, but 100ms seems to be. Likely there's a good middle ground, but for now be conservative. Notes: svn path=/head/; revision=223219
* After we get a good power signal, always wait about 10ms beforeWarner Losh2011-06-181-4/+16
| | | | | | | | | | | | | | proceeding. On boot, some laptops with certain cards in them sometimes fail on boot, but if the card is inserted after boot it works. Experiments show that small delays here makes things more reliable. It is believed that some combinations need a little more time before the power on the card is really stable enough to be reliable once the power is stable in the bridge. Notes: svn path=/head/; revision=223218
* sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.Matthew D Fleming2011-01-121-1/+1
| | | | | | | Commit the rest of the devices. Notes: svn path=/head/; revision=217323
* Temporarily revert the new-bus locking for 8.0 release. It will beJohn Baldwin2009-08-201-2/+9
| | | | | | | | | reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio Notes: svn path=/head/; revision=196403
* Make the newbus subsystem Giant free by adding the new newbus sxlock.Attilio Rao2009-08-021-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith) Notes: svn path=/head/; revision=196037
* Revert r190676,190677Andrew Thompson2009-04-101-1/+1
| | | | | | | | | | The geom and CAM changes for root_hold are the wrong solution for USB design quirks. Requested by: scottl Notes: svn path=/head/; revision=190878
* Add a how argument to root_mount_hold() so it can be passed NOWAIT and be calledAndrew Thompson2009-04-031-1/+1
| | | | | | | in situations where sleeping isnt allowed. Notes: svn path=/head/; revision=190676
* Better name for this routine... it doesn't reset the card, but resetsWarner Losh2009-03-121-4/+4
| | | | | | | the power to the card... Notes: svn path=/head/; revision=189723
* Hold off root mounting until we've gone through the loop of our threadWarner Losh2009-02-173-0/+11
| | | | | | | | | | almost once. After we've configured the devices that were present the first time through, then we know that we're done. If the device has other devices that are deferred, then it must do a similar dance. This catches both PC Cards and CardBus cards. Notes: svn path=/head/; revision=188701
* Correct signatures to match kobj function definitions.Warner Losh2009-02-043-22/+19
| | | | Notes: svn path=/head/; revision=188129
* Update to the interrupt handling code:Warner Losh2008-12-111-35/+58
| | | | | | | | | | | | | | | | | | | o Try to be smarter about reading the ExCA CSC register. Now, we only do it for 16-bit cards. Add some experimental code to treat it like a power interrupt, but I'm not 100% sure that I like it. It may be removed upon further testing. It seemed to help in one test case, but the evidence may be inconclusive. This may be beneficial for cleaning up exca_reset and exca_wait_ready. o Check for CSTS events on the socket event register. We ask for it when we're powering up a card, but I don't think we're otherwise using it. Just ACK the interrupt for now. In theory, we can use it instead of the busy wait we do in cbb_cardbus_reset. More research is necessary to see if we can optimize things there when we're waiting for the DEVVENDOR register to become valid. o Rework the comments a bit. Minor tidying up. Etc. Notes: svn path=/head/; revision=185910
* Minor tweaks to some of the comments. Also, add a XXX wondering if weWarner Losh2008-12-071-17/+18
| | | | | | | | need to frob the 16-bit EXCA registers during the new interrupt-driven power-up sequence. Notes: svn path=/head/; revision=185749
* Use '0' rather than PZERO to not change the priority that I'm waitingWarner Losh2008-12-071-3/+3
| | | | | | | | | | | | | at. I don't think this will make a huge difference, but I have received a report of a interrupt storm on one 16-bit card that this might fix (chances are it won't, since I think that we may need to check both the CBB registers for the 16-bit card as well as the PCIC registers for power state change). Submitted by: jhb@ Notes: svn path=/head/; revision=185741
* Use atomic_add_int rather than a simple ++ to ensure no cache races ifWarner Losh2008-12-071-1/+1
| | | | | | | | | | | the power interrupt and init code waiting for the interrupt are running on different CPUs. I haven't seen this make any real difference, but I've also had some reports of odd behavior I can't otherwise explain. It is an infrequent operation, and certainly wouldn't hurt. Notes: svn path=/head/; revision=185740
* Move to using filter for the change interrupts. Also rework the powerWarner Losh2008-12-053-37/+24
| | | | | | | | | interrupt code to be more robust. I've been running these changes for over a year... With these changes, I don't see the ath card going into reset like the code in the tree. Notes: svn path=/head/; revision=185625
* Minor style nit.Warner Losh2008-12-051-2/+2
| | | | Notes: svn path=/head/; revision=185624
* Augment comments, and move things around a smidge.Warner Losh2008-12-051-17/+17
| | | | Notes: svn path=/head/; revision=185623
* Implement a method described in NetBSD PR 36652 for coping with theWarner Losh2008-12-051-1/+12
| | | | | | | BAD VCC bit. Notes: svn path=/head/; revision=185622
* Return BUS_PROBE_GENERIC rather BUS_PROBE_DEFAULT for generic CBB we match.Warner Losh2008-10-021-1/+1
| | | | | | | Reviewed by: jhb@ Notes: svn path=/head/; revision=183558
* Don't forget to match on a CLASS of PCIC_BRIDGE as well as subclassWarner Losh2008-10-021-1/+4
| | | | | | | PCIS_BRIDGE_CARDBUS. Otherwise, we may hit a few false positives.... Notes: svn path=/head/; revision=183539
* Read the config space of the child, not the bridge, to determine whenWarner Losh2008-08-101-5/+5
| | | | | | | the child is out of reset... <blush> Notes: svn path=/head/; revision=181523
* fix typoWarner Losh2008-08-091-1/+1
| | | | | | | Submitted by: N.J. Mann Notes: svn path=/head/; revision=181472
* It turns out that checking the first DWORD register is more reliableWarner Losh2008-08-091-15/+17
| | | | | | | | | | on a variety of cards. Adjust the comments accordingly to match the code. Even if the vendor chose 0xffff for the device ID, the vendor ID can't be 0xffff, so the test is still valid from a standards perspective. Notes: svn path=/head/; revision=181470
* After some intial testing, there are even slower cards than the onesWarner Losh2008-08-091-13/+24
| | | | | | | | | | | | | | | | | | | | | that I have. Wait up to 1.1s for the card to become ready. Document what the standards say, and use that to justify the behavior in the code: PCI standard says that a card must respond to configuration cycles within 2^25 cycles after reset goes high, which is approximately 1s. Therefore, give cards a little break and wait for up to 1.1s for VENDOR to become valid. Only look at the vendor part of the ID, since only it can't be 0xffff (although in practice vendor/device will always be != 0xfffffffff). Include detailed pointers to standards so epople understand why we're doing what we're doing and why it just might be OK. Make it clear in the timeout message that it is just a warning, sinc we try to soldier on as best we can anyway. This should eliminate an error message that r181453 produced on certain Atheros cards. Notes: svn path=/head/; revision=181458
* Rather than waiting a fixed amount of time, which might not be enoughWarner Losh2008-08-091-12/+23
| | | | | | | | | | | | | | | and also holds things up, check every 20ms to see if we can read the vendor of device 0.0. It will be 0xffffffff until the card is out of reset. Always wait at least 20ms, for safety. I think this is a better fix to the reset problem. However, I did it as a separate commit in case something bad happens, people can roll back to the commit before this one to see if that gives them reliable behavior. I don't have FreeBSD up on enough machines to do exhaustive testing on all known bridges... Notes: svn path=/head/; revision=181453
* While most bridges can bring a card out of reset in 20ms, there areWarner Losh2008-08-091-3/+4
| | | | | | | | | | | | | | | | | | | some bridge + card combinations that take longer for reasons unknown. Adjust the timeout to be 100ms on all !RICOH bridges, but leave RICOH at 400ms. The 400ms is "lore" from other open source projects, and I've never see my ricoh bridge chips take this long. Maybe it is the same thing? Maybe a bit should be read instead of a hard-wired pause? After this adjustment, a few cards that I'd insert and get only: cbb0: card_power: 3V cbb0: card_power: 0V with full debugging enabled would actually try to attach. Reported by: sam@ (I think) MFC after: 3 days Notes: svn path=/head/; revision=181451
* Rename the kthread_xxx (e.g. kthread_create()) callsJulian Elischer2007-10-202-4/+4
| | | | | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls. Notes: svn path=/head/; revision=172836
* Make the PCI code aware of PCI domains (aka PCI segments) so we canMarius Strobl2007-09-303-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=172394
* Migrate from setting a CARD_OK flag in a shared word, to setting itsWarner Losh2007-06-043-32/+21
| | | | | | | | | | | | | | own entry in the softc. This should allow more of cbb_pci_intr() to migrate to a new cbb_pci_filt() so that we don't have to run cbb's ISR in almost every case we get an interrupt. We can't just move cbb_pci_intr into cbb_pci_filt because it does things that aren't safe to do from a fast interrupt handler, err I mean from a filter. This is an important first step. # I wonder if I need to make cardok volatile or not. Notes: svn path=/head/; revision=170272
* Don't register cb_func_filt if the client driver doesn't have a filter.Warner Losh2007-06-041-4/+3
| | | | | | | | | ditto for the isr. Reviewed/Suggested by: simokawa-san Notes: svn path=/head/; revision=170270
* Minor filter tweaks:Warner Losh2007-06-031-26/+47
| | | | | | | | | | | | | | | | | | | | o If we don't have a filter, also check to make sure the card is there before calling the scheduled ISR. This is necessary to help old drivers whose ISRs can't cope with being called with the hardware missing, which sadly still exist in the tree. This is the main reason why we have an extra layer of indirection for cardbus interrupts. o If the card is no longer present, mark the interrupt as 'handled' rather than 'stray' because this accounts for why the interrupt happened. Stray isn't all bad, since there are other filters that would claim it... o Fix some comments + Add comment about why we check for CARD_OK and touch the hardware in both the filter and ISR. + add a note about why we don't care about Giant + also note that giant can't be taken out in a filter... + Some minor formatting nits on very long comments. Notes: svn path=/head/; revision=170232
* Make the interrupt handler wrapper capable of correctly support ↵Paolo Pisati2007-05-312-8/+22
| | | | | | | | | filter+ithread handler. Discussed and reviewed with: bsdimp, simokawa Notes: svn path=/head/; revision=170163
* o Don't hold lock over bus_teardown_intr when we're waiting for theWarner Losh2007-05-161-5/+3
| | | | | | | | | thread to die, since that can cause deadlock with the ISR (in theory). o Minor cleanup o comment nit Notes: svn path=/head/; revision=169618
* Better message on cbb resource alloc failureWarner Losh2007-05-161-1/+1
| | | | Notes: svn path=/head/; revision=169617
* Use different wait channel name for second of two sleeps. Minor commentaryWarner Losh2007-03-051-2/+2
| | | | | | | addition. Notes: svn path=/head/; revision=167217