aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pccbb/pccbb_pci.c
Commit message (Collapse)AuthorAgeFilesLines
* Regularize my copyright noticeWarner Losh2019-12-041-3/+2
| | | | | | | | | | | | o Remove All Rights Reserved from my notices o imp@FreeBSD.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Notes: svn path=/head/; revision=355394
* Add PNP info to PCI attachments of cbb, cxgb, ida, iwn, ixl, ixlv,Warner Losh2018-09-261-0/+2
| | | | | | | | | | | | | mfi, mps, mpr, mvs, my, oce, pcn, ral, rl. This only labels existing pci device tables, and has no probe / attach code changes. Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com> Sponsored by: Google, Inc. (GSoC 2018) Approved by: re (glen) Notes: svn path=/head/; revision=338949
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* "Buses" is the preferred plural of "bus"Conrad Meyer2017-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | Replace archaic "busses" with modern form "buses." Intentionally excluded: * Old/random drivers I didn't recognize * Old hardware in general * Use of "busses" in code as identifiers No functional change. http://grammarist.com/spelling/buses-busses/ PR: 216099 Reported by: bltsrc at mail.ru Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=312234
* Implement a proper detach method for the PCI-PCI bridge driver.John Baldwin2016-05-201-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a pcib_detach() function for the PCI-PCI bridge driver. It tears down the NEW_PCIB and hotplug state including destroying resource managers, deleting child devices, and disabling hotplug events. - Add a detach method to the ACPI PCI-PCI bridge driver which calls pcib_detach() and then frees the copy of the _PRT interrupt routing table. - Add a detach method to the PCI-Cardbus bridge driver which frees the PCI bus resources in addition to calling cbb_detach(). - Explicitly clear any pending hotplug events during attach to ensure future events will generate an interrupt. - If a the Command Completed bit is set in the slot status register when the command completion timeout fires, treat it as if the command completed and the completion interrupt was just lost rather than forcing a detach. - Don't wait for a Command Completed notification if Command Completion interrupts are disabled. The spec explicitly says no interrupt is enabled when clearing CCIE, and on my T400 no interrupt is generated when CCIE is changed from cleared to set, either. In addition, the T400 doesn't appear to set the Command Completed bit in the cases where it doesn't generate an interrupt, so don't schedule the timer either. (If the CC bit were always set, one could always set the timer and rely on the logic of treating CC set as a missed interrupt.) Reviewed by: imp (older version) Differential Revision: https://reviews.freebsd.org/D6424 Notes: svn path=/head/; revision=300249
* etc: minor spelling fixes.Pedro F. Giffuni2016-05-021-2/+2
| | | | | | | | | Mostly comments but also some user-visible strings. MFC after: 2 weeks Notes: svn path=/head/; revision=298931
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.Justin Hibbits2016-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some architectures, u_long isn't large enough for resource definitions. Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but type `long' is only 32-bit. This extends rman's resources to uintmax_t. With this change, any resource can feasibly be placed anywhere in physical memory (within the constraints of the driver). Why uintmax_t and not something machine dependent, or uint64_t? Though it's possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on 32-bit architectures. 64-bit architectures should have plenty of RAM to absorb the increase on resource sizes if and when this occurs, and the number of resources on memory-constrained systems should be sufficiently small as to not pose a drastic overhead. That being said, uintmax_t was chosen for source clarity. If it's specified as uint64_t, all printf()-like calls would either need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t aren't horrible, but it would also bake into the API for resource_list_print_type() either a hidden assumption that entries get cast to uintmax_t for printing, or these calls would need the PRI*64 macros. Since source code is meant to be read more often than written, I chose the clearest path of simply using uintmax_t. Tested on a PowerPC p5020-based board, which places all device resources in 0xfxxxxxxxx, and has 8GB RAM. Regression tested on qemu-system-i386 Regression tested on qemu-system-mips (malta profile) Tested PAE and devinfo on virtualbox (live CD) Special thanks to bz for his testing on ARM. Reviewed By: bz, jhb (previous) Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D4544 Notes: svn path=/head/; revision=297000
* Convert rman to use rman_res_t instead of u_longJustin Hibbits2016-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075 Notes: svn path=/head/; revision=294883
* Add some data found in TI's application note "SCPA035: PCI1510Warner Losh2015-05-051-0/+7
| | | | | | | Implementation Guide" about default values. Notes: svn path=/head/; revision=282447
* When dealing with the TI12XX family of parts, we sometimes need toWarner Losh2015-05-051-2/+12
| | | | | | | | | | | | | | | | | | | initialize the MFUNC registers. Our old test of assuming that if this register is set at all is not quite right. Many scenarios (including the power-on defaults for chips w/o EEPROMs) land us in trouble. The MFUNC0 pin should be set to signal #INTA and the MFUNC1 pin should be set to signal #INTB of multi-socketed devices. Since my memory recalls issues with blindly clearing the upper bytes of this register, perform the heuristic only when both MFUNC0 and 1 are clear. We won't work well using these pins for GPIO, and the serial interrupts won't save us because we go out of our way to generally disable them. They are needed to support legacy drivers for 16-bit PC Cards that are hard-wired to specific IRQ values. Since FreeBSD never had any of these, we configure the more reliable direct signaling. This was just one small piece of that which had been left out back in the day. Notes: svn path=/head/; revision=282446
* Update the pci_cfg_save/restore routines to operate on bridge devicesJohn Baldwin2015-04-221-42/+6
| | | | | | | | | | | | | | | | | | | | | (type 1 and type 2) as well as leaf devices (type 0). In particular, this allows the existing PCI bus logic to save and restore capability registers such as MSI and PCI-express work for bridge devices rather than requiring that code to be duplicated in bridge drivers. It also means that bridge drivers no longer need to save and restore basic registers such as the PCI command register or BARs nor manage powerstates for the bridge device. While here, pci_setup_secbus() has been changed to initialize the 'sec' and 'sub' fields in the 'secbus' structure instead of requiring the pcib and pccbb drivers to do this in the NEW_PCIB + PCI_RES_BUS case. Differential Revision: https://reviews.freebsd.org/D2240 Reviewed by: imp, jmg MFC after: 2 weeks Notes: svn path=/head/; revision=281874
* Cosmetic change: use PCIR_SECLAT_2 rather than PCIR_SECLAT_1.John Baldwin2015-04-221-2/+2
| | | | Notes: svn path=/head/; revision=281870
* Always enable I/O, memory and dma cycles. Some BIOSes don't enableWarner Losh2015-01-161-3/+3
| | | | | | | | | them, sometimes they are reset for power state transitions or during whatever happens while suspended. Also, it is good practice to always do this. Notes: svn path=/head/; revision=277235
* Move the suspsned and resume functions to the bus attachment. TheyWarner Losh2015-01-161-2/+57
| | | | | | | | were accessing PCI config registers, which won't work for the ISA version. Notes: svn path=/head/; revision=277234
* Back out the refactor. It turns out to cause interrupt storms onWarner Losh2015-01-161-69/+15
| | | | | | | | | | resume sometimes (but not others). On powerup, other wierd issues show up (sometimes the card comes up, but with really bogus pci config space stuff. There may be more, but given my experience of historical fussiness, stick to what works and make more minimal changes to that. Notes: svn path=/head/; revision=277232
* Various interrelated fixes to make suspend / resume work better. We nowWarner Losh2015-01-141-15/+69
| | | | | | | | | | | | | | | | | | | | | | | | | can suspend / resume and unload / load cbb and cardbus without errors on my Lenovo T400, which wasn't possible before. Cards suspending and resuming in the CardBus slot not yet tested. o Enable memory cycles to the bridge early (as part of the new cbb_pci_bridge_init). This fixes the Bad VCC errors which were caused by the code accessing the device registers with this cleared. The suspend / resume process clears it. o Refactor suspend / resume into bus specific code (though the ISA code is just stubbed). This isn't strictly necessary, but makes the initializaiton code more uniform and should be more bullet proof in the face of variant behavior among cardbus bridges. o Fixup comments in the power-up sequence to reflect reality. These comments were written for one regime of power-up, but not updated as things were revised. o Add a paranoid small delay (100ms) to cover noisy cards powering down. o Fix some debugging prints to be easier to grep from dmesg. Sponsored by: Netflix Notes: svn path=/head/; revision=277164
* 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
* Add support for managing PCI bus numbers. As with BARs and PCI-PCI bridgeJohn Baldwin2014-02-121-14/+81
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* - There's no need to overwrite the default device method with the defaultMarius Strobl2011-11-221-2/+1
| | | | | | | | | | | | | 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 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
* 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
* Hold off root mounting until we've gone through the loop of our threadWarner Losh2009-02-171-0/+1
| | | | | | | | | | 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-041-7/+4
| | | | 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
* 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-051-19/+15
| | | | | | | | | 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
* 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
* Rename the kthread_xxx (e.g. kthread_create()) callsJulian Elischer2007-10-201-1/+1
| | | | | | | | | | | | | | 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-301-0/+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) Notes: svn path=/head/; revision=172394
* Migrate from setting a CARD_OK flag in a shared word, to setting itsWarner Losh2007-06-041-2/+12
| | | | | | | | | | | | | | 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
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-1/+1
| | | | | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@ Notes: svn path=/head/; revision=166901
* Fix typo in commentWarner Losh2007-02-161-1/+1
| | | | Notes: svn path=/head/; revision=166785
* Batch of changes:Warner Losh2006-08-121-19/+25
| | | | | | | | | | | | | | | | | | | | | | o when turning off the socket for a 16-bit card, write 0 to INTR register rather than just tying to just clear the rest bit. this seems to fix card insert detection after an eject on TI bridges (ricoh bridges work either way, apparently). This is a MFp4. o Cope better with TOPIC95 bridges on powerup. According to NetBSD driver, these bridges don't set POWER_STATE, so cope accordingly in our power code. They also need a little extra time to settle, so do that as well. o It appears that we need to turn on/off one of the clocks to the card when we power up/down that socket on a TOPIC97, also from NetBSD. o TOPIC97 bridges need to specifically enable LV card support. Unconditionally do this in the hopes that all laptops that have these chips support LV voltages (they should, since they are required for CardBus). o TOPIC register name regularization. Registers specific to models of TOPIC are now called out as such. # I need a machine with a TOPIC95 for testing. Notes: svn path=/head/; revision=161241
* Move shutdown, and pci specific methods into pccbb_pci.c. Many moreWarner Losh2006-06-031-1/+66
| | | | | | | are needed still. Notes: svn path=/head/; revision=159197
* The interrupt routine is pci specific. Move it into pccbb_pci.c.Warner Losh2006-06-031-1/+71
| | | | Notes: svn path=/head/; revision=159196
* Fix a couple printf's to be properly terminated.Warner Losh2006-06-031-3/+3
| | | | | | | Use a better name for the cbb thread. Notes: svn path=/head/; revision=159195
* Export the pribus, secbus and subbus as sysctls for informationWarner Losh2006-05-241-18/+28
| | | | | | | purposes only. Additional information may be exported in the future. Notes: svn path=/head/; revision=158893
* Whitespace nitsWarner Losh2006-05-231-3/+3
| | | | Notes: svn path=/head/; revision=158865
* Since DELAY() was moved, most <machine/clock.h> #includes have beenPoul-Henning Kamp2006-05-161-1/+0
| | | | | | | unnecessary. Notes: svn path=/head/; revision=158651
* MFP4: More removal of unused stuff.Warner Losh2005-10-081-1/+0
| | | | Notes: svn path=/head/; revision=151081
* Fix bad compile. Pointy hat to: impWarner Losh2005-09-291-1/+1
| | | | Notes: svn path=/head/; revision=150730
* o Add a bunch of o2micro controller IDsWarner Losh2005-09-291-0/+7
| | | | | | | | o Add SMC34C90 to list as well, since I've found enough more data about it since my original research to know it is appropriate for this driver. Notes: svn path=/head/; revision=150728
* I added the device IDs to the header, but not to the table. Add themWarner Losh2005-09-291-0/+9
| | | | | | | | | to the table. MFC After: 3 days Notes: svn path=/head/; revision=150713
* Rename a bit to make it clearer that it enables routing of the functionWarner Losh2005-07-171-1/+1
| | | | | | | interrupts to the ISA bus. Notes: svn path=/head/; revision=148102
* Omnibus power and interrupt fixes:Warner Losh2005-07-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | o Don't busy wait on powerup. Instead, use the power up interrupt to wait for the card to power up. Don't wait when we're turning the card off, since no interrupt happens in that case. o Convert many of the long DELAYs to tsleeps. We do not run before the timer have stared, so DELAY isn't necessary. More DELAYs can likely be eliminated in the future. o When powering up the card, don't do anything if the card is already powered up (before we'd power cycle it). This means that for most cards we power them up once and then never change the power. o On card eject, mask (by clearing) the CD bit. Before we set it, which was wrong. We don't want to see any CD events past the first one since they need to be debounced. With these changes, I can insert/eject 16bit cards without glitching xmms' sound output. Something very important to the development of better pccard drivers :-) Notes: svn path=/head/; revision=148013
* Not yet ready to burn this, so unmark power stuff.... non-type 0 busses ↵Warner Losh2005-06-061-4/+0
| | | | | | | still need to do this Notes: svn path=/head/; revision=147047