summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Whoops, revert accidental commit.jhb2006-06-211-19/+7
|
* Fix two comments and a style fix.jhb2006-06-211-7/+19
|
* const'ify resource_spec to note that we won't be changing anything whilejmg2006-04-201-2/+4
| | | | releasing resources... also, NULL out the resources as we free them...
* Add a devd(8) event that is sent after the system resumes. This can benjl2006-01-221-1/+13
| | | | | | | | | | | | | used by utilities to reset moused(8), for example. The syntax is: !system=kern subsystem=power type=resume Note that it would be nice to have notification of suspend, but it's more difficult since there would have to be a method of doing request/ack to userland and automatically timing out if no response. apm(4) has a similar mechanism. MFC after: 2 weeks
* When loading a driver that is a subclass of another driver don't set thejhb2006-01-201-1/+11
| | | | | | | | | | | | | devclass's parent pointer if the two drivers share the same devclass. This can happen if the drivers use the same new-bus name. For example, we currently have 3 drivers that use the name "pci": the generic PCI bus driver, the ACPI PCI bus driver, and the OpenFirmware PCI bus driver. If the ACPI PCI bus driver was defined as a subclass of the generic PCI bus driver, then without this check the "pci" devclass would point to itself as its parent and device_probe_child() would spin forever when it encountered the first PCI device that did have a matching driver. Reviewed by: dfr, imp, new-bus@
* Correct STAILQ usage in purge of resourcelist.phk2006-01-141-1/+1
| | | | Found with: Coverity Prevent(tm)
* When data passed into devctl_notify is NULL, don't print (null). Insteadimp2005-10-041-2/+6
| | | | | | | don't print anything at all. # this fixes a problem that I noticed with devd.pipe not terminating lines # with \n correctly sometimes.
* Add two convenience functions for device drivers: bus_alloc_resources()phk2005-09-241-0/+31
| | | | | | | | | | | | and bus_free_resources(). These functions take a list of resources and handle them all in one go. A flag makes it possible to mark a resource as optional. A typical device driver can save 10-30 lines of code by using these. Usage examples will follow RSN. MFC: A good idea, eventually.
* MFp4: Expose device_probe_child()imp2005-09-181-1/+1
|
* Simplify the code a bit after the bzero().imp2005-06-091-12/+3
|
* Document that the returned pointer should be freed even if the numbernjl2005-05-201-1/+1
| | | | of items returned is 0.
* If we are going tocperciva2005-05-061-0/+1
| | | | | | | | | | 1. Copy a NULL-terminated string into a fixed-length buffer, and 2. copyout that buffer to userland, we really ought to 0. Zero the entire buffer first. Security: FreeBSD-SA-05:08.kmem
* resource_list_purge: release the resources in this list, and purge theimp2005-04-121-0/+21
| | | | | | elements of this list (eg, reset it). Man page to follow
* Return the resource created/found in resource_list_add to avoid an extraimp2005-04-121-2/+3
| | | | | | | resouce_list_find in some places. Suggested by: sam Found by: Coventry Analysis tool.
* Document that devclass_get_maxunit(9) returns one greater than the currentnjl2005-04-041-0/+3
| | | | | | | highest unit. Reviewed by: dfr MFC after: 2 weeks
* Add devclass_get_drivers(9) which provides an array of pointers to drivernjl2005-04-041-0/+41
| | | | | | | | instances in a given devclass. This is useful for systems that want to call code in driver static methods, similar to device_identify(). Reviewed by: dfr MFC after: 2 weeks
* maxunit is actually one higher than the greatest currently-allocated unitnjl2005-04-031-1/+1
| | | | | | | | | in a devclass. All the other uses of maxunit are correct and this one was safe since it checks the return value of devclass_get_device(), which would always say that the highest unit device doesn't exist. Reviewed by: dfr MFC after: 3 days
* - Denote a few places where kobj class references are manipulated withoutjhb2005-03-311-1/+2
| | | | | | holding the appropriate lock. - Add a comment explaining why we bump a driver's kobj class reference when loading a module.
* Move implementation of hw.bus.rman sysctl to subr_rman.c so thatphk2005-03-241-87/+0
| | | | | | subr_bus.c doesn't need to peek inside struct resource. OK from: imp
* Use STAILQ in preference to SLIST for the resources. Insert new resourcesimp2005-03-181-7/+7
| | | | | | | | | 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.
* Use dynamic major number allocation.phk2005-02-271-2/+0
|
* kill dead codesam2005-02-231-7/+1
| | | | Noticed by: Coverity Prevent analysis tool
* Maxunit is inclusive so fix off-by-one in previous commit.njl2005-02-081-1/+1
|
* Update device_find_child(9) to return the first matching child if unitnjl2005-02-081-5/+15
| | | | | | is set to -1. Reviewed by: dfr, imp
* Correct a minr whitespace inconsistency introduced in revision 1.159:rwatson2005-01-291-1/+1
| | | | add a tab between #define and DF_REBID instead of a space.
* Introduce bus_free_resource. It is a convenience function which wrapsimp2005-01-191-0/+8
| | | | bus_release_resource by grabbing the rid from the resource.
* Implement device_quiesce. This method means 'you are about to beimp2004-12-311-0/+101
| | | | | | | | unloaded, cleanup, or return ebusy of that's inconvenient.' The default module hanlder for newbus will now call this when we get a MOD_QUIESCE event, but in the future may call this at other times. This shouldn't change any actual behavior until drivers start to use it.
* Add the devclass_get_count(9) function and man page. It gets a count ofnjl2004-12-081-7/+19
| | | | | | | the number of devices in a devclass and is a subset of devclass_get_devices(9). Reviewed by: imp, dfr
* When panicing in device_unbusy(), actually tell what device has the issue.obrien2004-12-051-1/+2
|
* Start to add GIANT_REQUIRED; macros in places where giant is requiredimp2004-12-051-0/+6
| | | | | | | | | and that I've verified things seem to basically work. I was able to boot and hot plug usb devices. Please let me know if this causes problems for anybody. The push down of giant has proceeded to the point that this will start to matter more and more.
* Don't print the singularly unhelpful message:phk2004-11-031-1/+1
| | | | | | unknown: not probled (disabled) During verbose boot.
* Update flags patch for the !ISA case.njl2004-10-141-5/+14
| | | | | | | | | | | | * Get flags first, in case there is no devclass. * Reset flags after each probe in case the next driver has no hints so it doesn't inherit the old ones. * Set them again before the winning probe. Tested ok both with and without ACPI for ISA device flags. Reviewed by: imp MFC after: 1 day
* Set flags for devices before probing them. In the non-ISA case, flags setnjl2004-10-131-1/+5
| | | | | | | via hints were not getting passed to the child. PR: kern/72489 MFC after: 1 day
* Fix BUS_DEBUG caseimp2004-08-301-1/+1
|
* Initial support (disabled) for rebidding devices. I've been runningimp2004-08-291-4/+36
| | | | | | | | | | this in my tree for a while and in its disabled state there are no issues. It isn't enabled yet because some drivers (in acpi) have side effects in their probe routines that need to be resolved in some manner before this can be turned on. The consensus at the last developer's summit was to provide a static method for each driver class that will return characteristics of the driver, one of which is if can be reprobed idempotently.
* MFp4: Merge in the patches, submitted long ago by someone whose emailimp2004-08-291-12/+26
| | | | | | | | | address I've lost, that move the location information to the atttach routine as well. While one could use devinfo to get this data, that is difficult and error prone and subject to races for short lived devices. Would make a good MT5 candidate.
* Set the description to NULL in the right detach routine. This shouldimp2004-08-241-1/+1
| | | | | keep dangling pointers to strings in loaded modules from hanging around after the drivers are unloaded.
* Add doxygen doc comments for most of newbus and the BUS interface.dfr2004-07-181-46/+919
|
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPphk2004-07-151-0/+5
| | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything".
* Hide struct resource and struct rman. You must defineimp2004-06-301-0/+1
| | | | | | __RMAN_RESOURCE_VISIBLE to see inside these now. Reviewed by: dfr, njl (not njr)
* Include more information about the device in the devadded andimp2004-06-301-2/+38
| | | | | | | | devremoved events. This reduces the races around these events. We now include the pnp info in both. This lets one do more interesting thigns with devd on device insertion. Submitted by: Bernd Walter
* Turns out that jhb didn't really like this. And nate pointed out thatimp2004-06-281-2/+2
| | | | | | it wasn't a good idea to have the test for NULL on only a limited subset. Go back because I'm not sure adding NULL to all the others is a good idea.
* Allow dev to be NULL and assume that a device is not alive or notimp2004-06-281-2/+2
| | | | | | attached. Reviewed by: njl(?) and jhb
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-6/+6
| | | | Bump __FreeBSD_version accordingly.
* When we don't have any meaningful value to print for the device sysctlmux2004-06-051-8/+4
| | | | | | | | | tree, output an empty string instead of "?". This is already what happened with DEVICE_SYSCTL_LOCATION and DEVICE_SYSCTL_PNPINFO. This makes the output of "sysctl dev" much nicer (it won't display those empty sysctls). Reviewed by: des
* Add a devclass level to the dev sysctl tree, in order to support per-des2004-06-041-10/+64
| | | | | | class variables in addition to per-device variables. In plain English, this means that dev.foo0.bar is now called dev.foo.0.bar, and it is possible to to have dev.foo.bar as well.
* As discussed on arch@, flatten the device sysctl tree to make itmux2004-06-021-13/+12
| | | | | more convenient to deal with. The notion of hierarchy is however preserved by adding a new %parent node.
* Sysctl hw.bus.devctl_disable shouldn't be writtable from inside a jail.pjd2004-05-261-3/+2
| | | | Approved by: imp
* As previously threatened, give each device its own sysctl context anddes2004-05-251-29/+153
| | | | | subtree (under the new dev top-level node). This should greatly simplify drivers which need per-device sysctl variables (such as ndis).
* Don't print out 'GIANT-LOCKED' for INTR_FAST drivers.scottl2004-04-011-1/+1
|
OpenPOWER on IntegriCloud