summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
Commit message (Collapse)AuthorAgeFilesLines
* Use ; not , as statement separator in PDEBUG() macro.phk2002-10-151-5/+4
| | | | | | | | | | | Ignoring a NULL dev in device_set_ivars() sounds wrong, KASSERT it to non-NULL instead. Do the same for device_get_ivars() for reasons of symmetry, though it probably would have yielded a panic anyway, this gives more precise diagnostics. Absentmindedly nodded OK to by: jhb
* Introducing /dev/devctl. This device reports events in theimp2002-10-071-2/+326
| | | | | | | configuration device hierarchy. Device arrival, departure and not matched are presently reported. This will be the basis for devd, which I still need to polish a little more before I commit it. If you don't use /dev/devctl, it will be a noop.
* Two minor bugfixes:imp2002-10-071-0/+3
| | | | | | o Allow the bus_debug variable to be set via the bus.debug tunable. o Return pnpinfo and location info via the devinfo interface to userland. devinfo(8) needs to be updated to print it.
* Add wrappers around the newly created bus_child_pnpinfo_str andimp2002-10-071-2/+28
| | | | bus_child_location_str.
* Minor string handling cleanup that I've had in my tree for a while:imp2002-10-071-21/+20
| | | | | | Don't use snprintf where strlcpy() will do the job. Also, a NUL is '\0' not 0 in our style (C doesn't care), so spell it like. Remove useless {} and () in the general area of this change.
* Don't need to NUL terminate after snprintfimp2002-10-071-1/+0
|
* Absorb <sys/bus_private.h> into kern/subr_bus.c to prevent misunderstandings.phk2002-10-021-1/+75
| | | | | Suggested by: bde Approved by: dfr
* Move includ of <sys/bus_priate.h> later to get semantic identity ofphk2002-09-281-1/+1
| | | | | | | | device_t the same throughout kernel. This is a very fine point of C which fortunatly does not make any difference in normal circumstances but which due to the pervasiveness of device_t in the kernel can make a lint barf a lot.
* Add additional information returned to userland by the device queryingimp2002-09-141-0/+5
| | | | | | | | | | | | | functions. We add pnpinfo, locationinfo, devflags (the newbus flags on the device), flags (the flags that device_get_flags returns) and state to the list of things we return. pnpinfo and locationinfo are place holders at the moment that will be filled in by the device's parent (optionally). Userland programs will likely use this information from time to time and take appropriate actions. Improvements to devinfo to follow.
* Fixed style bugs in resource_list_add_next().bde2002-09-121-5/+5
|
* Include <vm/uma.h> instead of depending on namespace pollution inbde2002-09-111-7/+10
| | | | | | | <sys/malloc.h>. Sorted includes as much as possible. Removed banal comment(s) attached to includes.
* Add bus_child_present and the child_present method to bus_if.mimp2002-07-211-0/+26
|
* Don't call malloc(9) to allocate zero bytes softc data for devices.phk2002-04-231-1/+1
|
* Add resource_list_add_next() which returns the RID for the resource added.mdodd2002-03-291-0/+13
|
* Don't (blindly) truncate the unit number to 4 digits when formatting thebde2002-03-061-1/+3
| | | | string returned by device_get_nameunit().
* Fixed 3 regressions in rev.1.99 (clobbering of the English fix in rev.1.98,bde2002-02-261-3/+4
| | | | and 2 unformattings).
* Hide "bla bla exists, skipping it" behind bootverbose.sos2002-02-261-4/+4
|
* Fixed an apparent typo ("-" before ":") and an English error (commabde2001-12-281-4/+4
| | | | | | | splice) in the "already exists" message. Fixed some minor style bugs (KNFization to "return (foo)" had rotted in 2 out of 177 cases).
* Add a generic __BUS_ACCESSOR macro to construct ivar accessor functions,tmm2001-12-211-2/+30
| | | | | | | and a generic resource_list_print_type() function to print all resouces of a certain type in a resource list. Use ulmin()/ulmax() instead of min()/max() in two places to handle u_longs correctly.
* Update to C99, s/__FUNCTION__/__func__/.obrien2001-12-101-1/+1
|
* o No need to set values to 0 when we utilize M_ZEROarr2001-11-051-2/+0
| | | | Approved by: peter
* Don't hide the failure to allocate device behind boot verbose. It isimp2001-11-021-3/+2
| | | | | | | still telling us of real problems so should remain until it stops doing that. Submitted by: OGAWA Takaya <t-ogawa@triaez.kaisei.org>
* Add new interface functionache2001-11-011-0/+10
| | | | | int devclass_find_free_unit(devclass_t dc, int unit); which return first free unit in given class starting from 'unit'.
* 1) In devclass_alloc_unit(), skip duplicated wired devices (i.e. with fixedache2001-10-281-8/+8
| | | | | | | | | | | | | | number) instead of allocating next free unit for them. If someone needs fixed place, he must specify it correctly. "Allocating next" is especially bad because leads to double device detection and to "repeat make_dev panic" as result. This can happens if the same devices present somewhere on PCI bus, hints and ACPI. Making them present in one place only not always possible, "sc" f.e. can't be removed from hints, it results to no console at all. 2) In make_device(), detect when devclass_add_device() fails, free dev and return. I.e. add missing error checking. This part needed to finish fix in 1), but must be done this way in anycase, with old variant too.
* Move the hints gunk to a seperate file. It isn't really part of thepeter2001-07-141-299/+0
| | | | newbus structure (no more than subr_rman.c is anyway).
* Go back to having either static OR dynamic hints, with fallbackpeter2001-07-141-17/+42
| | | | | | | | support. Trying to fix the merged set where dynamic overrode static was getting more and more complicated by the day. This should fix the duplicate atkbd, psm, fd* etc in GENERIC. (which paniced the alpha, but not the i386)
* Hints overhaul:peter2001-06-121-465/+274
| | | | | | | | | - Replace some very poorly thought out API hacks that should have been fixed a long while ago. - Provide some much more flexible search functions (resource_find_*()) - Use strings for storage instead of an outgrowth of the rather inconvenient temporary ioconf table from config(). We already had a fallback to using strings before malloc/vm was running anyway.
* Unset the devclass if the attach fails and the devclass was not set ton_hibma2001-01-081-0/+4
| | | | | | begin with. Reviewed by: dfr
* Make this file conform mostly to style(9):imp2001-01-051-947/+939
| | | | | | | | | | | | | | | | | | | o Use 8 space hard tabs o Eliminate trailing white space (while I'm here, just in a couple of places) o wrap mostly at 80 columns (printf literal strings being the notable exception) o use return (foo) consistantly o use 0 vs NULL more consistantly o use queue(3) xxx_FOREACH macros where appropriate (some places used it before, others didn't). o use BSD line continuation parameters Pendants will likely notice minor style(9) violations, but for the most part the file now looks much much closer to style(9) and is mostly self-consistant. Approved in principle by: dfr Reviewed by: md5 (no changes to the .o)
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-081-14/+7
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Staticize some malloc M_ instances.phk2000-12-081-1/+1
|
* Alter the return value and arguments of the GET_RESOURCE_LIST bus method.mdodd2000-11-281-23/+17
| | | | | | | Alter consumers of this method to conform to the new convention. Minor cosmetic adjustments to bus.h. This isn't of concern as this interface isn't in use yet.
* In preparation for deprecating CIRCLEQ macros in favor of TAILQmckusick2000-11-141-4/+2
| | | | | | | macros which provide the same functionality and are a bit more efficient, convert use of CIRCLEQ's in resource manager to TAILQ's. Approved by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
* Implement a trivial but effective interface for obtaining the kernel'smsmith2000-11-091-142/+213
| | | | | | | | device tree and resource manager contents. This is the kernel side of the upcoming libdevinfo, which will expose this information to userspace applications in a trivial fashion. Remove the now-obsolete DEVICE_SYSCTLS code.
* Add new bus method 'GET_RESOURCE_LIST' and appropriate genericmdodd2000-10-181-0/+92
| | | | | | | | | | implementation. Add bus_generic_rl_{get,set,delete,release,alloc}_resource() functions which provide generic operations for devices using resource list style resource management. This should simplify a number of bus drivers. Further commits to follow.
* Initialize 'hints_loaded' to 0.mdodd2000-09-171-1/+1
| | | | This allows static hints to work properly.
* When we are picking the next available unit number, specifically saypeter2000-09-051-3/+3
| | | | | what we picked. Otherwise it is anybody's guess as to where the device ended up.
* * Remove a bogus call to kobj_init() from make_device().dfr2000-08-281-3/+6
| | | | * Add a non-empty implementation of root_print_child().
* If the config program found a hints file and included it as a fallback,peter2000-08-251-10/+28
| | | | | | then treat it as such. This isn't perfect, but should do for things like GENERIC. When in fallback mode, they will be used if there are NO other hints.
* Fix a const related warning.peter2000-07-281-1/+1
|
* Patch up some bogons in the resource_find() vs resource_find_hard()peter2000-07-181-3/+9
| | | | | | | | | interfaces. The original resource_find() returned a pointer to an internal resource table entry. resource_find_hard() dereferences the actual passed in value (oops!) - effectively trashing random memory due to the pointer being passed in with a random initial value. Submitted by: bde
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.phk2000-07-041-2/+2
| | | | Pointed out by: bde
* Add device_set_softc() which does the obvious.phk2000-07-031-7/+21
| | | | Not objected to by: dfr
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:phk2000-07-031-2/+2
| | | | | | | | Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources: -sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
* Some changes and fixes from Bruce:peter2000-06-261-9/+9
| | | | | | | | Use strtoul(), not strtol() in the hints decoder so that 'flags 0xa0ffa0ff' is not truncated to 0x7fffffff. Use a stack buffer instead of a static 100 byte bss buffer. Use \0 for the NUL character. Remove some ``excessive'' parens.
* As a bit of a gross hack, allow earlier access to both the static andpeter2000-06-151-4/+58
| | | | | | dynamic hints. This allows the resource_XXX_value() calls to work before malloc() has started. This gets the serial console working as well as a few other things.
* Fix a stray debug output. change if (1 || bootverbose) to if (bootverbose)peter2000-06-151-3/+3
|
* Borrow phk's axe and apply the next stage of config(8)'s evolution.peter2000-06-131-62/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use Warner Losh's "hint" driver to decode ascii strings to fill the resource table at boot time. config(8) no longer generates an ioconf.c table - ie: the configuration no longer has to be compiled into the kernel. You can reconfigure your isa devices with the likes of this at loader(8) time: set hint.ed.0.port=0x320 userconfig will be rewritten to use this style interface one day and will move to /boot/userconfig.4th or something like that. It is still possible to statically compile in a set of hints into a kernel if you do not wish to use loader(8). See the "hints" directive in GENERIC as an example. All device wiring has been moved out of config(8). There is a set of helper scripts (see i386/conf/gethints.pl, and the same for alpha and pc98) that extract the 'at isa? port foo irq bar' from the old files and produces a hints file. If you install this file as /boot/device.hints (and update /boot/defaults/loader.conf - You can do a build/install in sys/boot) then loader will load it automatically for you. You can also compile in the hints directly with: hints "device.hints" as well. There are a few things that I'm not too happy with yet. Under this scheme, things like LINT would no longer be useful as "documentation" of settings. I have renamed this file to 'NOTES' and stored the example hints strings in it. However... this is not something that config(8) understands, so there is a script that extracts the build-specific data from the documentation file (NOTES) to produce a LINT that can be config'ed and built. A stack of man4 pages will need updating. :-/ Also, since there is no longer a difference between 'device' and 'pseudo-device' I collapsed the two together, and the resulting 'device' takes a 'number of units' for devices that still have it statically allocated. eg: 'device fe 4' will compile the fe driver with NFE set to 4. You can then set hints for 4 units (0 - 3). Also note that 'device fe0' will be interpreted as "zero units of 'fe'" which would be bad, so there is a config warning for this. This is only needed for old drivers that still have static limits on numbers of units. All the statically limited drivers that I could find were marked. Please exercise EXTREME CAUTION when transitioning! Moral support by: phk, msmith, dfr, asmodai, imp, and others
* Fixed allocation of unit numbers. Allocate the amount of space actuallybde2000-06-111-2/+1
| | | | | | | | | | | | | | required (rounded up a little) instead of twice the previous amount (or a fixed amount for the first allocation). The bug caused memory corruption when a new unit number for a devclass was more than about twice the previous maximum one (or more than 3 for the first one), so it corrupted memory (which happened to be the atkbdc port resource list) in the reporter's configuration with sio unit numbers { 0, 25, 1, 2, ... }. Reviewed by: dfr Reported by: Leonid Lukiyanets <stalwar78@hotmail.com>
* If devclass_alloc_unit() is called with a wired unit #, and this issos2000-05-261-12/+7
| | | | | | | | | buzy, only search upwards for a free slot to use.. This broke unit numbering on ATA systems where PCI attached controllers come before the mainboard ones... Reviewed by: dfr
OpenPOWER on IntegriCloud