331722 |
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re) |
330897 |
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg |
302408 |
08-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
298955 |
03-May-2016 |
pfg |
sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
|
298712 |
27-Apr-2016 |
jhb |
Add a bus_null_rescan() method that always fails with an error.
Use this in place of kobj_error_method to disable BUS_RESCAN() on PCI drivers that do not use the "standard" scanning algorithm.
|
298708 |
27-Apr-2016 |
jhb |
Implement a PCI bus rescan method.
Rescanning a PCI bus uses the following steps: - Fetch the current set of child devices and save it in the 'devlist' array. - Allocate a parallel array 'unchanged' initalized with NULL pointers. - Scan the bus checking each slot (and each function on slots with a multifunction device). - If a valid function is found, look for a matching device in the 'devlist' array. If a device is found, save the pointer in the 'unchanged' array. If a device is not found, add a new device. - After the scan has finished, walk the 'devlist' array deleting any devices that do not have a matching pointer in the 'unchanged' array. - Finally, fetch an updated set of child devices and explicitly attach any devices that are not present in the 'unchanged' array.
This builds on the previous changes to move subclass data management into pci_alloc_devinfo(), pci_child_added(), and bus_child_deleted().
Subclasses of the PCI bus use custom rescan logic explicitly override the rescan method to disable rescans.
Differential Revision: https://reviews.freebsd.org/D6018
|
298307 |
19-Apr-2016 |
pfg |
sys/dev: use our nitems() macro when it is avaliable through param.h.
No functional change, only trivial cases are done in this sweep, Drivers that can get further enhancements will be done independently.
Discussed in: freebsd-current
|
298029 |
15-Apr-2016 |
jhb |
Add a new PCI bus interface method to alloc the ivars (dinfo) for a device.
The ACPI and OFW PCI bus drivers as well as CardBus override this to allocate the larger ivars to hold additional info beyond the stock PCI ivars.
This removes the need to pass the size to functions like pci_add_iov_child() and pci_read_device() simplifying IOV and bus rescanning implementations.
As a result of this and earlier changes, the ACPI PCI bus driver no longer needs its own device_attach and pci_create_iov_child methods but can use the methods in the stock PCI bus driver instead.
Differential Revision: https://reviews.freebsd.org/D5891
|
297608 |
06-Apr-2016 |
jhb |
Convert pci_delete_child() to a bus_child_deleted() method.
Instead of providing a wrapper around device_delete_child() that the PCI bus and child bus drivers must call explicitly, move the bulk of the logic from pci_delete_child() into a bus_child_deleted() method (pci_child_deleted()). This allows PCI devices to be safely deleted via device_delete_child(). - Add a bus_child_deleted method to the ACPI PCI bus which clears the device_t associated with the corresponding ACPI handle in addition to the normal PCI bus cleanup. - Change cardbus_detach_card to call device_delete_children() and move CardBus-specific delete logic into a new cardbus_child_deleted() method. - Use device_delete_child() instead of pci_delete_child() in the SRIOV code. - Add a bus_child_deleted method to the OpenFirmware PCI bus drivers which frees the OpenFirmware device info for each PCI device.
Reviewed by: imp Tested on: amd64 (CardBus and PCI-e hotplug) Differential Revision: https://reviews.freebsd.org/D5831
|
297000 |
18-Mar-2016 |
jhibbits |
Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.
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
|
278936 |
18-Feb-2015 |
imp |
On my Lenovo T400, a Atheros 2413 has a problem powering up sometimes. It will power up wrong and identify itself badly:
cardbus0: <network, ethernet> at device 0.0 (no driver attached) cardbus0: <simple comms, UART> at device 0.1 (no driver attached) cardbus0: <old, non-VGA display device> at device 0.2 (no driver attached) cardbus0: <old, non-VGA display device> at device 0.3 (no driver attached) cardbus0: <old, non-VGA display device> at device 0.4 (no driver attached) cardbus0: <old, non-VGA display device> at device 0.5 (no driver attached) cardbus0: <old, non-VGA display device> at device 0.6 (no driver attached) cardbus0: <old, non-VGA display device> at device 0.7 (no driver attached)
All the higher numbered functions (.2 and above) have a config space of all 0's. This smells a bit like a special debug mode, but the current atheros driver doesn't cope. It is unclear if this card is just a flake, or if we're doing something wrong in the power-up sequence.
Put a work around into the code that tests for this rather unusual condition. If we power a CardBus device up, and the device says it is multi-function, and any of the functions have a 0 device ID, try the power-up sequence again.
|
277163 |
14-Jan-2015 |
imp |
Add a rather obnoxious warning if you don't have NEW_PCIB defined since it's a total crap shoot if things will work.
|
267992 |
28-Jun-2014 |
hselasky |
Pull in r267961 and r267973 again. Fix for issues reported will follow.
|
267985 |
27-Jun-2014 |
gjb |
Revert r267961, r267973:
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
|
267961 |
27-Jun-2014 |
hselasky |
Extend the meaning of the CTLFLAG_TUN flag to automatically check if 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
|
261790 |
12-Feb-2014 |
jhb |
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.
Reviewed by: imp MFC after: 1 month
|
232403 |
02-Mar-2012 |
jhb |
- Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge. 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
|
227309 |
07-Nov-2011 |
ed |
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
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.
|
225515 |
12-Sep-2011 |
jhb |
Partially revert 222753: If a CardBus card stores its CIS in a BAR, delete 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)
|
223386 |
21-Jun-2011 |
imp |
Minor cleanup: 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.
|
222753 |
06-Jun-2011 |
jhb |
More properly handle Cardbus cards that that store their CIS in a BAR after 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
|
221327 |
02-May-2011 |
jhb |
Don't explicitly list pci_write_ivar() for bus_write_ivar, the method is already inherited from the PCI bus driver.
|
201609 |
05-Jan-2010 |
jhb |
Move the PCI-specific logic of removing a cardbus device into a 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
|
201286 |
30-Dec-2009 |
jhb |
Fix an error case I missed in the previous change so that the CIS resource is fully cleaned up if we fail to find the CIS in the devices ROM.
|
201280 |
30-Dec-2009 |
jhb |
Delete the CIS resource after releasing it. This is needed when the CIS is 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.
|
201279 |
30-Dec-2009 |
jhb |
Teach the PCI bus driver to handle PCIR_BIOS BARs properly and remove special 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
|
201278 |
30-Dec-2009 |
jhb |
Use bus_*() rather than bus_space_*().
|
189755 |
13-Mar-2009 |
imp |
Minorly improved debugging. Use the DEVPRINTF macro and report the offset for memory when mapping in the CIS.
|
189731 |
12-Mar-2009 |
imp |
Move the deactivation of the device's BAR to before the loop where we turn deactivate the resources. While this likely doesn't matter, it is likely to be safer.
|
189653 |
10-Mar-2009 |
imp |
Restore blank line removed when fixing my earlier botch. Never do just one last change before bed...
Pointy had to: imp
|
189636 |
10-Mar-2009 |
gnn |
Complete removal of cardbus_write_ivar which was left hanging.
|
189619 |
10-Mar-2009 |
imp |
When freeing all the resources of the card, it is better to turn off 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.
|
188216 |
06-Feb-2009 |
wkoszek |
Remove unused variable.
Found with: Coverity Prevent(tm) CID: 4138
|
188033 |
02-Feb-2009 |
jhb |
Goof, catch up to constant rename (I renamed it to match the overall PCI style of having register offsets start with PCIR_* rather than PCI_*).
Submitted by: rss
|
186642 |
31-Dec-2008 |
imp |
When no driver attaches to a card, don't power down the card. We can now read config registers of cardbus cards that are inserted, but aren't attached to a driver. Also, add a power related comment...
|
185545 |
02-Dec-2008 |
imp |
Don't call destroy_dev on the alias. This fixes half a dozen PRs I think.
|
185140 |
21-Nov-2008 |
imp |
Create a /dev/cardbus%d.cis, to be compatible with older versions of the software. This is a trivial amount of code to keep wireless monitoring software working... I plan on removing it in 9.0.
|
185015 |
17-Nov-2008 |
imp |
Overhaul of CIS parsing, next step: keep a cached copy of the CIS, 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!
|
184981 |
15-Nov-2008 |
imp |
First step in cleaning up CIS parsing and /dev/cardbus*.cis: remove 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.
|
184584 |
03-Nov-2008 |
imp |
Turns out this isn't even used at all... The bogon that I was tracing was in code from my p4 tree, not -current. Delete it here.
|
184581 |
03-Nov-2008 |
imp |
Use child (the card) in preference to cbdev (the bridge) when 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
|
184579 |
03-Nov-2008 |
imp |
We can't mask out the higher order bits and have the size come out 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.
|
172394 |
30-Sep-2007 |
marius |
Make the PCI code aware of PCI domains (aka PCI segments) so we can 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)
|
170419 |
08-Jun-2007 |
imp |
gcc 4.2 thinks that tupleid is uninitialized. Or might be used uninitialized. It gets passed into other routines that initialize it... Cope by initializing.
Submitted by: mjacob
|
169633 |
16-May-2007 |
jhb |
Fix interrupt routing for some cards after the previous fix to clear BARs 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
|
169620 |
16-May-2007 |
imp |
Write 0 to all the bars in cardbus_cardbus_setup_regs. This is needed 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.
|
169616 |
16-May-2007 |
imp |
Change PCIM_CIS_ASI_TUPLE to _CONFIG. Add PCI_MAX_BAR_0 minor style nit. Add PCIM_CIS_CONFIG_MASK
|
166104 |
19-Jan-2007 |
imp |
Cope gracefully with device_get_children returning an error.
Obtained from: Hans Petter Selasky P4: http://perforce.freebsd.org/chv.cgi?CH=112957
|
159534 |
12-Jun-2006 |
imp |
Minor cleanup of CIS parsing.
|
159533 |
12-Jun-2006 |
imp |
Better error message when the CIS is a non-standards conforming '0'.
|
159532 |
12-Jun-2006 |
imp |
When we can't parse the CIS, note with a warning that the bogus CIS was ignored, rather than freaking out. In the past, it wasn't possible to not parse the CIS, so this changes no behavior.
|
154599 |
20-Jan-2006 |
jhb |
Make the 'pci_devclass' pointer variable private (drivers really shouldn't 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.
|
153981 |
03-Jan-2006 |
imp |
Use the child to allocate the resource rather than bridge, since we're 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.
|
153980 |
03-Jan-2006 |
imp |
Minor style(9) hacking, plus use a macro in place of (struct resource *)~0UL (what the heck does that mean?).
|
153920 |
31-Dec-2005 |
avatar |
Fixing build bustage.
|
153900 |
30-Dec-2005 |
imp |
Remove now-obsolete printf warning.
|
153896 |
30-Dec-2005 |
imp |
Move all of the resource allocation into the pci layer. The resource allocation here just duplicated it (badly).
|
153895 |
30-Dec-2005 |
imp |
The RID2BAR macro returns a number, not a bitmask. Fix this.
Spotted by: ru, jhb
|
153875 |
30-Dec-2005 |
glebius |
- Retire BARBIT in favor of new PCI_RID2BAR. - Fix build.
|
153862 |
29-Dec-2005 |
imp |
Retire BARBIT in favor of new PCI_RID2BAR.
|
153832 |
29-Dec-2005 |
glebius |
Help Warner with merge from p4.
|
153811 |
29-Dec-2005 |
imp |
Implement /dev/cardbus%d.cis, same thing as /dev/pccard%d.cis. There are some rough edges with this still, but it seems to work well enough to commit.
|
153788 |
28-Dec-2005 |
glebius |
When in rev. 1.47 cardbus_alloc_resources() function was moved from 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
|
151789 |
28-Oct-2005 |
imp |
Cardbus has only 1 slot, so simplify a little.
|
151785 |
28-Oct-2005 |
imp |
Eliminate even more duplication, and move some definitions into pcireg.h
|
151784 |
28-Oct-2005 |
imp |
Remove now redundant defines.
|
151783 |
28-Oct-2005 |
imp |
Simplify code a little, prefer PCI?_FOO registers where possible.
|
151782 |
28-Oct-2005 |
imp |
Use PCIR_BARS rather than CARDBUS_BASE0_REG Style nit.
|
150616 |
27-Sep-2005 |
ru |
Calling rman_get_start() after bus_release_resource() is evil. It became fatal after a recent "struct resource" split change.
|
143785 |
18-Mar-2005 |
imp |
Use STAILQ in preference to SLIST for the resources. Insert new resources last in the list rather than first.
This makes the resouces print in the 4.x order rather than the 5.x order (eg fdc0 at 0x3f0-0x3f5,0x3f7 is 4.x, but 0x3f7,0x3f0-0x3f5 is 5.x). This also means that the pci code will once again print the resources in BAR ascending order.
|
143395 |
11-Mar-2005 |
imp |
Doh! silly typo precludes compiling
|
143394 |
11-Mar-2005 |
imp |
Revert changes of 1.49. Lots-a-people broke with it, for reasons unknown (since my sony vaio didn't :-(.
Instead, fix the problem described by 1.49 in a different way: just add the two calls I'd hoped I'd avoid in 1.49 by doing the (wrong) gymnastics there. While 1.49 is a good direction to go in, each step of the way should work :-(.
|
142736 |
28-Feb-2005 |
imp |
There were two calls to cardbus_do_cis when cardbus_do_cis changed, yet I only changed one of them. So when we loaded drivers, we'd fail to allocate resources correct.
This pointed out that we were doing the wrong thing when we failed to attach a child. We released all the resources and almost deleted the child. Instead, we should keep the resources allocated so when/if a driver is loaded, we can go w/o having to allocate them. We use pci_cfg_save/restore to restore the BARs with these resources.
This seems to fix the problems that we were seeing that I thought might have magically gone away in the last revision of cardbus.c (but really didn't).
Noticed by: avatar (nicely done!)
|
142144 |
20-Feb-2005 |
imp |
Be more verbose on errors with CIS reading. This should be a noop, but appears to fix the ath problem that had been reported. I don't see how it can, so there's likely some other hidden bug.
|
142143 |
20-Feb-2005 |
imp |
style(9) nit
|
141412 |
06-Feb-2005 |
imp |
Move resource allocation routines from cardbus_cis.c to cardbus.c. They have nothing at all to do with CIS parsing.
Remove some unused funce parsing: nothing used the results.
Use more of pccard_cis.h's deifnitions for the cardbus specific cis parsing we do. More work is needed in this area.
This reduces the size of the cardbus module by 380 bytes or so...
|
140198 |
13-Jan-2005 |
imp |
Use the standard FreeBSD license
Approved by: imp, jon
|
139749 |
06-Jan-2005 |
imp |
Start each of the license/copyright comments with /*-, minor shuffle of lines
|
131190 |
27-Jun-2004 |
imp |
MFp4:
The hack for setting the bus has been moved down into the cbb driver. I've been running without this hack in my tree for so long I had forgotten that I'd removed it :-). Please let me know if this causes difficulty for your laptop.
|
129876 |
30-May-2004 |
phk |
Add some missing <sys/module.h> includes which are masked by the one on death-row in <sys/kernel.h>
|
128131 |
11-Apr-2004 |
imp |
Add note about why we're ignoring the below 1MB bit.
|
127135 |
17-Mar-2004 |
njl |
Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
|
121858 |
01-Nov-2003 |
dfr |
Make the cardbus driver a derived class of the pci driver. In theory, this should allow many of the pci methods to be re-staticised.
|
120870 |
07-Oct-2003 |
imp |
remove obsolete quirks for cardbus cis. none have proven to be needed.
|
120868 |
07-Oct-2003 |
imp |
o move the cis tuple definitions into a common file. o minor optimization of cardbus_cis processing. Remove a bunch of generic entries that are handled by generic. o no longer need the card_get_type stuff.
|
120867 |
07-Oct-2003 |
imp |
These aren't needed anymore
|
120865 |
06-Oct-2003 |
jhb |
Remove prototype for decode_tuple_copy() which was axed in the last revision to fix compile.
|
120857 |
06-Oct-2003 |
imp |
remove the cardbus cis reading code. nobody ever used it and it has locking issues down to the api level.
|
119690 |
02-Sep-2003 |
jhb |
Use PCIR_BAR(x) instead of PCIR_MAPS.
Glanced over by: imp, gibbs Tested by: i386 LINT
|
119418 |
24-Aug-2003 |
obrien |
Use __FBSDID(). Also some minor style cleanups.
|
117115 |
01-Jul-2003 |
tmm |
Add a new PCI interface method, assign_interrupt, to determine the interrupt to be used for a device. This is intended solely for internal use of PCI bus implementations, and exists so that PCI bus drivers implementing special interrupt assignment methods which require additional work at the bus level to work right can be easily derived from the generic driver (or any other one) without resorting to hacks.
It will be used in the sparc64 ofw_pcibus driver, which will be committed shortly.
Make use of this method in the generic implementation, and add it to the method table of bus drivers derived from the PCI one.
Reviewed by: imp, -hackers
|
115613 |
01-Jun-2003 |
phk |
Don't leak "barlist" allocation on failure.
Found by: FlexeLint
|
115297 |
24-May-2003 |
imp |
Ignore the 'must allocate below 1MB' flag for the TPL_BAR_REG. It is set on realtek cards, but they work without it (and don't work with it). The standard seems to imply that this is just a hint anyway, so this should be harmless. It doesn't appear to be set on any other cardbus cards that I have (or have seen).
This should make the rl based CardBus cards work again. I've been running it for about a month now.
Approved by: re@ (jhb)
|
113243 |
08-Apr-2003 |
imp |
MFp4: when you can't allocate a resource, print a message, don't panic.
|
111119 |
19-Feb-2003 |
imp |
Back out M_* changes, per decision of the TRB.
Approved by: trb
|
111096 |
18-Feb-2003 |
imp |
Move the resource handling down into the pci bus as well. Minor CIS resource allocation code cleanup Remove some fairly useless debug writes.
This finishes the work to move as much cardbus code as possible into pci. We wind up removing 800-odd lines from cardbus.c: we go from 1285 to 400 lines.
Reviewed by: mdodd
|
111060 |
17-Feb-2003 |
scottl |
Sanity check the BAR length reported by the CIS with the BAR length that is encoded in the PCI BAR. The latter is more reliable.
This allows the sio/modem function of the Xircom RealPort ethernet+modem card to work. Note that there still seem to be issues with sio_pci not releasing resources on detach.
|
111056 |
17-Feb-2003 |
imp |
Move the pnp and location info into the common pci bus. Make all known pci busses implement this.
Also minor comment smithing in cardbus. Fix copyright to this year with my name on it since I've been doing a lot to this file.
Reviewed by: jhb
|
111049 |
17-Feb-2003 |
imp |
Kill a now-bogus comment
|
111027 |
17-Feb-2003 |
imp |
Move call to pci_print_verbose until after all the variables that it depends on.
Pointy hat to: imp (anybody know if these things are accepted at Eco-Cycle?)
|
110975 |
16-Feb-2003 |
imp |
Checkpoint a work in progress: o Use the common pci_* routines in preference to the copied and hacked routines from an ancient pci.c.
This saves 509 lines in cardbus.c. More savings to follow when I convert the resource code over. In the past when I've done this the resource code conversion breaks cardbus in subtle ways so I'm doing a 1/2 way checkpoint this time. cardbus still works for me the same as it did before.
It also looks like cardbus devices now show up as pci bus devices to pciconf -l, but maybe that was happening before.
Inspired by a patch from Justin Gibbs many moons ago. When he finishes his kobj multiple inheritance work, we can transition the finished version of this work to that fairly easily.
|
110969 |
16-Feb-2003 |
scottl |
Clean up the CIS BAR parsing code by removing several pointless checks. Don't complain about the Option ROM BAR type since it's perfectly valid.
|
110751 |
12-Feb-2003 |
imp |
MF-p4: Kill the slightly bogus #define for DECODE_PROTOTYPE Be less verbose. Hide most (all I hope) of the CIS parsing behind cardbus_debug_cis (which is set with hw.cardbus.debug_cis=1).
This doesn't fix problems with parsing, but should make cardbus less chatty. There appears to be some issues still with the parsing of the CIS, but this won't fix them.
Prompted by: scottl
|
110750 |
12-Feb-2003 |
imp |
MFp4: Second part of the kldload patches for cardbus. This makes kldload of a driver for a device that's inserted now appears to work. To make it work, we only do a power cycle of the card if there's no children drivers attached.
This likely is papering over bogosities in the power system. The power sequence needs to be re-written, so I'll not worry about the papering over until the re-write.
|
110749 |
12-Feb-2003 |
imp |
MFp4: Don't reach inside of rman to r_dev. Use rman_get_device instead.
|
110748 |
12-Feb-2003 |
imp |
Whitespace nits.
|
110673 |
11-Feb-2003 |
imp |
Don't turn off the power of cards when new drivers are added unconditionally. kldloading a cardbus driver was shooting down other attached devices because most drivers assume that one cannot power-cycle cards w/o the driver knowning about it.
Submitted by: simokawa-san
|
109925 |
27-Jan-2003 |
imp |
MFp4: u_int*_t -> uint*_t to conform more closely with C99.
|
109623 |
21-Jan-2003 |
alfred |
Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
|
107321 |
27-Nov-2002 |
imp |
Need more parens here.
Approved by: re (blanket)
|
107301 |
27-Nov-2002 |
imp |
Implement PCI_IVAR_ETHADDR. Cardbus has the MAC addr in the CIS, sometimes, so return it when requested and it does. Also a little more infrastructure for a few other things.
Submitted by: sam Approved by: re (blanket for NEWCARD)
|
106895 |
14-Nov-2002 |
imp |
MFp4: o Add a diagnostic for an 'impossible' condition. o Collapse common code.
|
106894 |
14-Nov-2002 |
imp |
minor correction to comment
|
106881 |
13-Nov-2002 |
scottl |
When parsing the CIS, if a BAR tuple is encountered, enable the corresponding bit in the PCI command register for the device. Otherwise, device drivers that look at this register to see which types of BARs are usable will think that none of them are. This allows my Adaptec 1480A cardbus card to finally work.
Reviewed by: imp
|
106801 |
12-Nov-2002 |
scottl |
Fix two typos from the previous commit. This code is definitely infectious.
|
106800 |
12-Nov-2002 |
scottl |
Step one of cleaning and fixing cardbus: - Fix some especially bad style in the CIS BAR tuple parsing code. - activate Option ROMS correctly. - de-obfuscate the Option ROM image selection code. - Fix mis-interpretation of the PCI spec that prevented Option ROMs whose CIS section wasn't in the first image from working. - Fix mis-interpretation of the PCI spec that prevented CIS's mapped into MEMIO space from working at all. - Reject invalid CIS pointers.
Reviewed by: imp
|
106522 |
06-Nov-2002 |
jhb |
Use the explicit value 0xffffffff instead of assuming that is what ~0UL equals.
Approved by: imp
|
106362 |
02-Nov-2002 |
imp |
MFp4: o Always release the resources on device detach. o Attach resources the same with driver added as we do we do in the insert case (maybe this should be a routine). o signal the wakeup of the thread on resume instead of trying to force an interrupt. o Minor debug hacks. o use 0xffffffff instead of -1 for uint32_t items. o Don't complain when we're asked to detach no cards. This is normal. o Eliminate the now worthless second parameter to card_detach_card. o minor style(9)isms
Some of these patches may be from: iwasaki-san, jhb, iadowse
|
104639 |
07-Oct-2002 |
imp |
o Add routines to return the location and pnpinfo for this card. Note, we return the PCI pnp info, but in fact that's wrong to do since that data is not defined for CardBus cards. CardBus says that these registers are undefined and one should use the CIS to do device matching. To date, all CardBus cards have had these registered defined, no doubt because they are using common silicon to produce both the PCI cards and the CardBus cards. However, it isn't any worse than the rest of the system, so just note it in passing and move on. o Also sort prototypes while I'm here.
|
104638 |
07-Oct-2002 |
imp |
Don't abuse the fact that -a == ~a + 1. Signed vs unsigned checkers complain when a is a unsigned type. So instead use the latter here and be on our way.
Spotted by: flexlint by way of phk
|
104637 |
07-Oct-2002 |
imp |
Add extra set of parens around the barbit macro to make it clear what we're intending to shift.
Spotted by: flexlint by way of phk (should fix about 40 messages)
|
104146 |
29-Sep-2002 |
imp |
Don't leak the bar list for each thing we allocate.
# This code really needs a rewrite
Spotted by the eagle eyes of: phk
|
103191 |
10-Sep-2002 |
arr |
- Forgot to remove `cardattached` declaration in revision 1.22.
|
103172 |
10-Sep-2002 |
imp |
Remove more bogus reprobe code. I don't think it is needed here either.
|
101905 |
15-Aug-2002 |
imp |
pccbb -> cbb
|
97707 |
01-Jun-2002 |
alfred |
Silence warning.
When casting a "const void *" to a "struct foo **" you want to actually cast it to "struct foo * const *" not simply "const struct foo **".
|
97613 |
30-May-2002 |
takawata |
Make oldcard and newcard kernel module work.
|
92301 |
15-Mar-2002 |
imp |
Revert most of the recent PCI merge. This has proven to be too unstable for the coming DP1 release. Instead, I'll develop that on the IMP_CB_MERGE branch until it is more stable.
|
92207 |
13-Mar-2002 |
imp |
Cleanup the recent cardbus cleanups. This fixes some of the panics that I introduced with -v. However, other problems still remain (including the loss of interrupts).
|
91788 |
07-Mar-2002 |
imp |
Don't use __FBSDID yet. Looks like most (all?) of the rest of the kernel doesn't do that.
|
91787 |
07-Mar-2002 |
imp |
Implement hw.cardbus.debug and hw.cardbus.cis_debug to help debug some of the cardbus problems that people may start seeing.
|
91771 |
07-Mar-2002 |
imp |
Two style(9) fixes: - return(foo); (note parens) - use __FBSDID()
|
91770 |
07-Mar-2002 |
imp |
Check for NULL on resource allocation. For the moment, punt, but we should be smarter about a) cleanup and b) fallback.
|
91355 |
27-Feb-2002 |
imp |
Use the pci.c code wherever possible, rather than copying all the pci code into cardbus and s/pci/cardbus. This exposes a few pci_* functions that are now static.
This work is similar to work Justin posted to the mobile list about a year or two ago, which I have neglected since then.
This is a subset of his current work with the multiple inheritance newbus architecutre. When completed, that will eliminate the need for pci/pci_private.h.
Similar work is needed for the cardbus_cis and pccard_cis code as well.
|
90337 |
07-Feb-2002 |
imp |
Get rid of the bogus DETACH_NOWARN and don't warn when asked to detach a card that isn't there unless we're booting verbose. It serves no purpose.
|
87975 |
15-Dec-2001 |
imp |
Add support for suspending/resuming CardBus bridges.
We really should have and use power state information, but none exists today.
Submitted by: YAMAMOTO Shigeru-san <shigeru@iij.ad.jp>
|
82378 |
27-Aug-2001 |
jon |
Part two of this NEWCARD update:
Briefly, the significant changes include: * Way better resource management in pccbb, pccard and cardbus. * pccard hot-removal now appears to work. * support pre-fetchable memory in cardbus. * update cardbus to support new pci bus interface functions. * Fix CIS reading to no longer use rman_get_virtual().
What's not there, but in the works: * pccard needs to do interrupt properly and not read the ISR on single function cards. * real resource management for pccard * a complete implementation of CIS parsing * need to look into how to correctly use mutex in pccbb
|
82375 |
26-Aug-2001 |
jon |
Non-functional changes to NEWCARD stuff. This is the first part of a two-part update to NEWCARD. Changes in this commit are non-functional, and includes the following: * indentation and other changes to meet style(9). * other minor style consistancy changes * addition of comments * renaming of device_t variables to be consistant across all of NEWCARD.
(note that not all style violations are fixed in this commit -- those that aren't will be clobbered by the next commit.)
|
77795 |
05-Jun-2001 |
imp |
Use bus_space when reading CIS. This allows us to access it in 8 bit mode, which is what the standard mandates.
Submitted by: Takanori Watanabe-san Reviewed by: jhb
|
72185 |
08-Feb-2001 |
imp |
Fix memory leaks with dev_get_children().
Submitted by: Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>
|
72082 |
06-Feb-2001 |
asmodai |
Fix typo: wierd -> weird.
There is no such thing as wierd in the english language.
|
70763 |
07-Jan-2001 |
peter |
This cannot possibly be right: foo(int *nret) { for (i = 0; i < nret; i++) { free(array[i], .... Fix to do the logically correct thing.. (s/nret/*nret/)
|
70715 |
06-Jan-2001 |
jon |
* Better kld support in pccbb/cardbus - pccbb no longer needs to remember whether a card is inserted. - pccbb reissues insertion on load of cardbus/pccard modules. - got rid of unnecessary delays in power functions. - Cardbus children are no longer deleted if probe/attach fails. - non-attached child devices are reprobed at driver_added.
* CARD interface to read CIS - added card_cis_read/card_cis_free interface to read arbitrary CIS data. This currently is only implemented in cardbus.
* pccard begins to work - pccard can now use higher memory space (and uses it by default). - set_memory_offset interface changed. - fixed ccr access, which was broken at multiple locations. - implement an interrupt handler - pccard can now share interrupts. - resource alloc/release/activate/deactivate functions gutted: some resources are allocated by the bridge before the child device is probed or attached. Thus the resource "belongs" to the bridge, and the pccard_*_resource functions need to fudge the owner/rid. - changed some error conditions to panics to speed debugging.
* Mutex fix - Giant is entered at the beginning of thread
|
69956 |
13-Dec-2000 |
msmith |
Don't try to free the now-nonexistent hdrspec field. This one snuck by me in the previous round of patches. Oops.
|
69954 |
13-Dec-2000 |
msmith |
Updates to match changes elsewhere in the PCI subsystem:
- Remove redundant header-type-specific support in the cardbus pcibus clone. The bridges don't need this anymore. - Use pcib_get_bus instead of the deprecated pci_get_secondarybus. - Implement read/write ivar support for the pccbb, and teach it how to report its secondary bus number. Save the subsidiary bus number as well, although we don't use it yet.
|
69402 |
30-Nov-2000 |
gibbs |
Remove an unused variable.
Properly advance to the next image while searching for the ROM image that contains CIS data.
KNF an if statement.
|
69366 |
29-Nov-2000 |
jon |
This fixes several problems with CIS as suggested by Justin Gibbs: 4) The cardbus CIS code treats the CIS_PTR as a mapping register if it is mentioned in the CIS. I don't have a spec handy to understand why the CIS_PTR is mentioned in the CIS, but allocating a memory range for it is certainly bogus. My patch ignores bar #6 to prevent the mapping. [The pccard spec says that BAR 0 and 7 (-1 and 6 in thic case since we did a minus one) is "reserved". The off by 1 error has been fixed. also bar=5 is invalid for IO maps, so we check it.]
5) The CIS code allocated duplicate resources to those already found by cardbus_add_resources(). The fix is to pass in the bar computed from the CIS instead of the particular resource ID for that bar, so bus_generic_alloc_resource succeeds in finding the old resource. [fixed, also removed superfluous (and incorrect) writing back to the PCI config space.]
7) The CIS code seems to use the wrong bit to determine rather a particular register mapping is for I/O or memory space. From looking at the two cards I have, it seems TPL_BAR_REG_AS should be 0x10 instead of 0x08. Otherwise, all registers that should be I/O mapped gain a second mapping in memory space. [Oops, the spec does say 0x10..., fixed]
Submitted by: Justin Gibbs
|
69359 |
29-Nov-2000 |
jon |
Oops, broke CIS reading from ROM on my last commit. This should fix it.
|
69291 |
28-Nov-2000 |
jon |
1) When mucking with mapping registers, it is best to *not* have io or memory space access enabled. This patch defers the setting of these bits until after all of the mapping registers are probed. It might be even better to defer this until a particular mapping is activated and to disable that type of access when a new register is activated.
2) The PCI spec is very explicit about how mapping registers and the expansion ROM mapping register should be probed. This patch makes cardbus_add_map() follow the spec.
3) The PCI spec allows a device to use the same address decoder for expansion ROM access as is used for memory mapped register access. This patch carefully enables and disables ROM access along with resource (de)activiation.
This doesn't include the prefetching detection stuff (maybe later when code is written to actually turn on prefetching). It also does not use the PCI definitions (yet, I'll try to put this in all at once later)
Submitted by: Justin T. Gibbs
|
69289 |
28-Nov-2000 |
jon |
overhaul cis functions to read cis tuple by tuple (instead of all at once). Also fix incorrect parsing of BAR.
|
69288 |
28-Nov-2000 |
jon |
A bunch of newcard/cardbus changes that's been sitting in my tree for a while:
- Make pccbb/cardbus kld loadable and unloadable. - Make pccbb/cardbus use the power interface from pccard instead of inventing its own. - some other minor fixes
|
69287 |
27-Nov-2000 |
jon |
Patch to use M_ZERO
Submitted by: David Malone
|
67277 |
18-Oct-2000 |
jon |
Initial commit of NEWCARD cardbus side (that actually compiles and works)
Files: dev/cardbus/cardbus.c dev/cardbus/cardbusreg.h dev/cardbus/cardbusvar.h dev/cardbus/cardbus_cis.c dev/cardbus/cardbus_cis.h dev/pccbb/pccbb.c dev/pccbb/pccbbreg.h dev/pccbb/pccbbvar.h dev/pccbb/pccbb_if.m
This should support: - cardbus controllers: * TI 113X * TI 12XX * TI 14XX * Ricoh 47X * Ricoh 46X * ToPIC 95 * ToPIC 97 * ToPIC 100 * Cirrus Logic CLPD683x - cardbus cards * 3c575BT * 3c575CT * Xircom X3201 (includes IBM, Xircom and, Intel cards) [ 3com support already in kernel, Xircom will be committed real soon now]
This doesn't work with 16bit pccards under NEWCARD.
Enable in your config by having "device pccbb" and "device cardbus". (A "device pccard" will attach a pccard bus, but it means you system have a high chance of panicing when a 16bit card is inserted)
It should be fairly simple to make a driver attach to cardbus under NEWCARD -- simply add an entry for attaching to cardbus on a new DRIVER_MODULE and add new device IDs as necessary. You should also make sure the card can be detached nicely without the interrupt routine doing something weird, like going into an infinite loop. Usually that should entail adding an additional check when a pci register or the bus space is read to check if it equals 0xffffffff.
Any problems, please let me know.
Reviewed by: imp
|
67276 |
18-Oct-2000 |
jon |
Initial commit of NEWCARD cardbus side (that actually compiles and works)
Files: dev/cardbus/cardbus.c dev/cardbus/cardbusreg.h dev/cardbus/cardbusvar.h dev/cardbus/cardbus_cis.c dev/cardbus/cardbus_cis.h dev/pccbb/pccbb.c dev/pccbb/pccbbreg.h dev/pccbb/pccbbvar.h dev/pccbb/pccbb_if.m
This should support: - cardbus controllers: * TI 113X * TI 12XX * TI 14XX * Ricoh 47X * Ricoh 46X * ToPIC 95 * ToPIC 97 * ToPIC 100 * Cirrus Logic CLPD683x - cardbus cards * 3c575BT * 3c575CT * Xircom X3201 (includes IBM, Xircom and, Intel cards) [ 3com support already in kernel, Xircom will be committed real soon now]
This doesn't work with 16bit pccards under NEWCARD.
Enable in your config by having "device pccbb" and "device cardbus". (A "device pccard" will attach a pccard bus, but it means you system have a high chance of panicing when a 16bit card is inserted)
It should be fairly simple to make a driver attach to cardbus under NEWCARD -- simply add an entry for attaching to cardbus on a new DRIVER_MODULE and add new device IDs as necessary. You should also make sure the card can be detached nicely without the interrupt routine doing something weird, like going into an infinite loop. Usually that should entail adding an additional check when a pci register or the bus space is read to check if it equals 0xffffffff.
Any problems, please let me know.
Reviewed by: imp
|
53345 |
18-Nov-1999 |
imp |
Sync to latest cardbusdevs file
|
53343 |
18-Nov-1999 |
imp |
Raw import of newconfig cardbus code. This is effectively an import, so the code doesn't compile. I added $FreeBSD$ headers.
|