summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Back out the previous change to the queue(3) interface.jake2000-05-261-1/+1
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-231-1/+1
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* If BUS_DEBUG is defined then create a sysctl, debug.bus_debug, thatpaul2000-05-031-1/+6
| | | | | | | | | | is used to control whether the debug messages are output at runtime. It defaults to on so that if you define BUS_DEBUG in your kernel then you get all the debugging info when you boot. It's very useful for disabling all the debugging info when you're developing a loadable device driver and you're doing lots of loads and unloads but don't always want to see all the debugging info.
* * Move the driver_t::refs field to kobj_t to replace kobj_t::instances.dfr2000-05-011-7/+4
| | | | | * Back out a couple of workarounds for the confusion between kobj_t::instances and driver_t::refs.
* The newer module dependency code exposes an apparent bug in thepeter2000-04-291-0/+1
| | | | | | | | | | | | | bus/driver/kobj system. I am not 100% sure that this is the correct fix, but it is harmless and does seem to solve the problem. At worst, it could cause a tiny memory leak at unload time - this is better than a free(NULL) and subsequent panic. I'm waiting for comments from Doug about this. This may yet be backed out and fixed differently. The change itself is to increment the reference count on drivers in one case where it appears to have been missed. When everything is unloaded, kobj_class_free() was being called twice in some cases, and panicing the second time.
* Make sure the driver's ops table has been initialised before callingdfr2000-04-221-0/+5
| | | | static methods.
* Fix LINT.dfr2000-04-171-18/+1
|
* Issue a detached message after detaching the device.imp2000-04-171-0/+1
| | | | Not Objected to by: new-bus@
* * Factor out the object system from new-bus so that it can be used bydfr2000-04-081-194/+26
| | | | | | | | | | non-device code. * Re-implement the method dispatch to improve efficiency. The new system takes about 40ns for a method dispatch on a 300Mhz PII which is only 10ns slower than a direct function call on the same hardware. This changes the new-bus ABI slightly so make sure you re-compile any driver modules which you use.
* device_set_unit() DO NOT USE THIS. This was approved before 4.0imp2000-04-011-0/+19
| | | | | | release for inclusion into the release, but bde talked me out of committing the module that needs this until after the release. It is after the release now. :-)
* Instead of using the next unit available, use the first unit available.n_hibma2000-03-161-13/+20
| | | | | | | | | | This avoids the unit number from going up indefinitely when diconnecting and connecting 2 devices alternately. Noticed by: nsayer (quite a while ago) And stop calling DEVICE_NOMATCH at probe repeatedly. This stops the message on the PCI VGA board from being printed when loading a PCI driver.
* If a driver probe fails, unset it from the device. This fixes a problemdfr2000-02-291-1/+3
| | | | | | with certain multiport cards. Approved by: jkh
* Hide the "devclass_alloc_unit: %s%d already exists, using next available..."sos2000-02-201-1/+2
| | | | | | behind bootverbose Approved by: jkh
* Hide the boring ``not probed (disabled)'' messages behind `bootverbose'.joerg2000-02-151-0/+2
| | | | | | | | | This unspams the boot messages, concentrating on the drivers that have actually been probed. This basically resurrects revision 1.106 from old /sys/i386/isa/isa.c. Reviewed by: jkh, dfr
* * Set the devclass of a device before calling the probe method. This allowsdfr1999-12-241-1/+12
| | | | | device_printf() etc. to print something intelligible. * Allow device_set_devclass(dev, 0) for clearing the devclass.
* correct incomplete last changemjacob1999-12-031-1/+1
|
* Remove the 'ivars' arguement to device_add_child() andmdodd1999-12-031-12/+20
| | | | | | | | | | | | | | | | device_add_child_ordered(). 'ivars' may now be set using the device_set_ivars() function. This makes it easier for us to change how arbitrary data structures are associated with a device_t. Eventually we won't be modifying device_t to add additional pointers for ivars, softc data etc. Despite my best efforts I've probably forgotten something so let me know if this breaks anything. I've been running with this change for months and its been quite involved actually isolating all the changes from the rest of the local changes in my tree. Reviewed by: peter, dfr
* Remove check for attached state.n_hibma1999-12-021-3/+0
| | | | | | | | | | | sc = devclass_get_softc(devclass, unit); doesn't return NULL during attach anymore, and produces the sc, identical to (for devclass_get_unit(devclass, unit) != NULL that is): sc = device_get_softc(devclass_get_unit(devclass, unit)); Reviewed-by: dfr
* Reduce code duplication.mdodd1999-11-301-6/+8
| | | | | | | | | | Hopefully this clears up some confusion about the nature of devclass_get_softc() vs. device_get_softc() as well. The check against DS_ATTACHED remains as this is not a change that modifies functionality. Reviewed by: Peter "in principle" Wemm
* 'const'ify a bunch of pointers in the resource_*() functions for accessingpeter1999-11-181-14/+17
| | | | the config hint tables. This fixes a few warnings elsewhere (eg: fd).
* * Add struct resource_list* argument to resource_list_alloc anddfr1999-10-121-17/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | resource_list_release. This removes the dependancy on the layout of ivars. * Move set_resource, get_resource and delete_resource from isa_if.m to bus_if.m. * Simplify driver code by providing wrappers to those methods: bus_set_resource(dev, type, rid, start, count); bus_get_resource(dev, type, rid, startp, countp); bus_get_resource_start(dev, type, rid); bus_get_resource_count(dev, type, rid); bus_delete_resource(dev, type, rid); * Delete isa_get_rsrc and use bus_get_resource_start instead. * Fix a stupid typo in isa_alloc_resource reported by Takahashi Yoshihiro <nyan@FreeBSD.org>. * Print a diagnostic message if we can't assign resources to a PnP device. * Change device_print_prettyname() so that it doesn't print "(no driver assigned)-1" for anonymous devices.
* Trim unused options (or #ifdef for undoc options).peter1999-10-111-2/+4
| | | | Submitted by: phk
* Call DEVICE_IDENIFY in bus_generic_driver_added to allow devices toimp1999-10-091-0/+1
| | | | | | | | | add nodes to the tree. Also, default to bus_generic_driver_added for the BUS_DRIVER_ADDED method. This allows newbus busses to be kldload'd. Reviewed by: dfr
* Create and use a dedicated malloc type for bus related stuff.phk1999-09-101-21/+23
| | | | Reviewed by: dfr
* Change isa_get/set_flags() to device_get/set_flags().dfr1999-09-071-0/+13
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Change calling of chained event handler from always aftern_hibma1999-08-161-3/+7
| | | | | | | | | | the attach/detach to 1) MOD_LOAD before attach 2) MOD_UNLOAD after detach The driver specific event handler can now be used to function as driver specific init/deinit function (compare to device specific init/deinit functions: attach & detach).
* add debugging message in unregister_methodn_hibma1999-08-141-1/+2
|
* Minor spelling glitchn_hibma1999-08-141-2/+2
|
* Grrrr. Fix a really lame bug that I tripped over while testing my miibuswpaul1999-08-141-2/+2
| | | | | | | | | | | | | | | | stuff: unregister_methods() is horribly broken. The idea, if I'm not mistaken, is that the refcount on a method is decremented, and only when it reaches zero is the method freed. However desc->method is set to NULL unconditionally regardless of the refcount, which means the method pointer is trashed the first time the method is deallocated. The obvious detrimental effect is that memory is leaked. The not so obvious effect is that when you call unregister_method() the second time on the same method, you get a NULL pointer dereference and a panic. Now I can successfully unload network device drivers and the miibus module without crashing the system. *sigh*
* Make subr_bus.c actually compile with -DBUS_DEBUGpeter1999-08-111-6/+6
|
* Zap some stray references to DRIVER_TYPE_foo in the BUS_DEBUG case, aspeter1999-08-111-12/+3
| | | | discovered by Bill Paul.
* Fix a typo.mdodd1999-07-291-2/+2
| | | | | | Back out a few lines that I haven't dealt with properly yet. Snickered at by: Mike Smith
* Alter the behavior of sys/kern/subr_bus.c:device_print_child()mdodd1999-07-291-11/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - device_print_child() either lets the BUS_PRINT_CHILD method produce the entire device announcement message or it prints "foo0: not found\n" Alter sys/kern/subr_bus.c:bus_generic_print_child() to take on the previous behavior of device_print_child() (printing the "foo0: <FooDevice 1.1>" bit of the announce message.) Provide bus_print_child_header() and bus_print_child_footer() to actually print the output for bus_generic_print_child(). These functions should be used whenever possible (unless you can just use bus_generic_print_child()) The BUS_PRINT_CHILD method now returns int instead of void. Modify everything else that defines or uses a BUS_PRINT_CHILD method to comply with the above changes. - Devices are 'on' a bus, not 'at' it. - If a custom BUS_PRINT_CHILD method does the same thing as bus_generic_print_child(), use bus_generic_print_child() - Use device_get_nameunit() instead of both device_get_name() and device_get_unit() - All BUS_PRINT_CHILD methods return the number of characters output. Reviewed by: dfr, peter
* This makes the in kernel printf routines conform to the documenteddfr1999-07-241-6/+8
| | | | | | behavior of their userland counterparts with respect to return values. Submitted by: Matthew N. Dodd <winter@jurai.net>
OpenPOWER on IntegriCloud