History log of /src/sys/kern/subr_autoconf.c |
Revision | | Date | Author | Comments |
1.314 |
| 18-Jul-2023 |
riastradh | autoconf(9): Print `waiting for devices' normally once a minute.
|
1.313 |
| 23-May-2023 |
riastradh | autoconf(9): Omit config_detach kernel lock assertion too for now.
like in config_attach_pseudo, this assertion almost certainly indicates real bugs, but let's try to get the tests back and running again before addressing those.
|
1.312 |
| 23-May-2023 |
riastradh | autoconf(9): Omit config_attach_pseudo kernel lock assertion for now.
Breaks too many things that I didn't test in the branch (cgd, fss, &c.); let's address all forty-odd cases before turning it on.
|
1.311 |
| 22-May-2023 |
riastradh | autoconf(9): New functions for referenced attach/detach.
New functions:
- config_found_acquire(dev, aux, print, cfargs) - config_attach_acquire(parent, cf, aux, print, cfargs) - config_attach_pseudo_acquire(cf, aux) - config_detach_release(dev, flags) - device_acquire(dev)
The config_*_acquire functions are like the non-acquire versions, but they return a referenced device_t, which is guaranteed to be safe to use until released. The device's detach function may run while it is referenced, but the device_t will not be freed and the parent's .ca_childdetached routine will not be called.
=> config_attach_pseudo_acquire additionally lets you pass an aux argument to the device's .ca_attach routine, unlike config_attach_pseudo which always passes NULL.
=> Eventually, config_found, config_attach, and config_attach_pseudo should be made to return void, because use of the device_t they return is unsafe without the kernel lock and difficult to use safely even with the kernel lock or in a UP system. For now, they require the caller to hold the kernel lock, while config_*_acquire do not.
config_detach_release is like device_release and then config_detach, but avoids the race inherent with that sequence.
=> Eventually, config_detach should be eliminated, because getting at the device_t it needs is unsafe without the kernel lock and difficult to use safely even with the kernel lock or in a UP system. For now, it requires the caller to hold the kernel lock, while config_detach_release does not.
device_acquire acquires a reference to a device. It never fails and can be used in thread context (but not interrupt context, hard or soft). Caller is responsible for ensuring that the device_t cannot be freed; in other words, the device_t must be made unavailable to any device_acquire callers before the .ca_detach function returns. Typically device_acquire will be used in a read section (mutex, rwlock, pserialize, &c.) in a data structure lookup, with corresponding logic in the .ca_detach function to remove the device from the data structure and wait for all read sections to complete.
Proposed on tech-kern: https://mail-index.netbsd.org/tech-kern/2023/05/10/msg028889.html
|
1.310 |
| 21-Apr-2023 |
riastradh | autoconf(9): Add a comment where we risk arithmetic overflow.
|
1.309 |
| 16-Apr-2023 |
riastradh | autoconf(9): Assert alldevs_lock held in config_unit_nextfree.
The one caller, config_unit_alloc, guarantees it through config_alldevs_enter/exit.
|
1.308 |
| 16-Apr-2023 |
riastradh | autoconf(9): Avoid potential ABA bug in config_makeroom.
When we unlock alldevs_lock to allocate a new cd_devs array nsp, other threads may have:
1. freed the old one (osp), 2. done some other memory allocation, 3. allocated a new _larger_ array whose address happens to concide with osp (e.g., in (2) the page was recycled for a different pool cache), and 4. updated cd_devs back to osp but increased cd_ndevs.
In that case, the memory may be corrupted: we try to copy the wrong number of device_t pointers into nsp and we free osp with the wrong (stale) length.
Avoid this by checking whether cd_ndevs has changed too -- if not, osp might have been recycled but at least the lengths we're about to copy and free are still correct so there's no harm in an ABA situation.
XXX pullup-8 XXX pullup-9 XXX pullup-10
|
1.307 |
| 22-Feb-2023 |
riastradh | autoconf(9): Clarify assertions about iattr in config_search.
|
1.306 |
| 13-Sep-2022 |
riastradh | branches: 1.306.4; autoconf(9): New diagnostic to detect double-detach.
- Rename dv_detached -> dv_detach_committed. - Add dv_detach_done, asserted false and then set in config_detach.
dv_detach_done may appear redundant with dv_del_gen, but dv_del_gen will be used to safely detect config_detach on two valid references to a device (e.g., a bus detaching its child concurrently with drvctl detaching the same child), while dv_detach_done is strictly a diagnostic to detect races in the config_detach API.
Currently the config_detach API itself is unsafe, but we can add a config_detach_release function that simultaneously releases and detaches a referenced device_t; this will continue to use dv_del_gen to safely avoid multiple detach, and dv_detach_done to check for races in usage.
|
1.305 |
| 13-Sep-2022 |
riastradh | autoconf(9): Improve diagnostics for config_detach_enter/commit/exit.
|
1.304 |
| 24-Aug-2022 |
riastradh | pmf(9): *_child_register never fails. Make it return void.
No kernel bump because this isn't documented or used in any modules, only in dev/pci/pci.c and dev/cardbus/cardbus.c which are as far as I know always statically linked into the kernel.
The next change, however, will require a revbump -- to make pmf_device_register return void so we can prune vast swaths of dead error branches.
|
1.303 |
| 24-Aug-2022 |
riastradh | kern: device_pmf_driver_register never fails, so make it return void.
No ABI bump despite change to device.h because this is used only inside autoconf.
|
1.302 |
| 12-Aug-2022 |
riastradh | autoconf(9): Provide diagnostics for config_detach_* misuse.
|
1.301 |
| 28-Mar-2022 |
riastradh | sys: Split struct device into a private device_impl.h.
Include this only inside autoconf itself, and a few files that abuse autoconf in ways I can't confidently make easy fixes for.
XXX kernel ABI change requires bump -- no more use of struct device internals allowed, previously done by some drivers
|
1.300 |
| 28-Mar-2022 |
riastradh | autoconf(9): Disentangle slightly circuitous config_detach logic.
No functional change intended.
|
1.299 |
| 28-Mar-2022 |
riastradh | autoconf(9): New function config_detach_commit.
When a driver's .ca_detach function has committed to detaching -- it definitely won't back out with EBUSY, for instance -- it can call this to wake all pending calls to device_lookup_acquire and make them fail immediately.
This is necessary to break a deadlock if the device_lookup_acquire calls happen inside I/O operations which the driver's .ca_detach function waits for the completion of -- without config_detach_commit, I/O operations would be stuck in device_lookup_acquire waiting for .ca_detach and .ca_detach would be stuck waiting for I/O operations to return.
Most drivers won't need to call this: for autoconf drivers used the traditional way by devsw for userland device nodes, the .ca_detach routine uses vdevgone, and we will arrange to make vdevgone call config_detach_commit automagically in such drivers anyway.
XXX kernel ABI change to struct device requires bump -- later change will make struct device opaque to ABI, but we're not there yet
|
1.298 |
| 28-Mar-2022 |
riastradh | autoconf(9): New localcount-based device instance references.
device_lookup_acquire looks up an autoconf device instance, if found, and acquires a reference the caller must release with device_release. If attach or detach is still in progress, device_lookup_acquire waits until it completes. While references are held, the device's softc will not be freed or reused until the last reference is released.
The reference is meant to be held while opening a device in the short term, and then to be passed off to a longer-term reference that can be broken explicitly by detach -- usually a device special vnode, which is broken by vdevgone in the driver's *_detach function.
Sleeping while holding a reference is allowed, e.g. waiting to open a tty. A driver must arrange that its *_detach function will interrupt any threads sleeping while holding references and cause them to back out so that detach can complete promptly.
Subsequent changes to subr_devsw.c will make bdev_open and cdev_open automatically take a reference to an autoconf instance for drivers that opt into this, so there will be no logic changes needed in most drivers other than to connect the autoconf cfdriver to the bdevsw/cdevsw I/O operation tables. The effect will be that *_detach may run while d_open is in progress, but no new d_open can begin until *_detach has backed out from or committed to detaching.
XXX kernel ABI change to struct device requires bump -- later change will make struct device opaque to ABI, but we're not there yet
|
1.297 |
| 21-Mar-2022 |
riastradh | autoconf(9): Enter more timing samples into entropy pool.
Previously, we sampled the time of each _failed_ config_search. I'm not sure why -- there was no explanation in the comment or the commit message introducing this in rev. 1.230.2.1 on tls-earlyentropy.
With this change, we sample the time of _every_ search including the successful ones -- and also measure the time to attach which often includes things like probing device registers, triggering device reset and waiting for it to post, &c.
|
1.296 |
| 12-Mar-2022 |
riastradh | autoconf(9): Refuse to consider negative unit numbers in cfdata.
Reported-by: syzbot+a63ae6c58df86f40b6f3@syzkaller.appspotmail.com
|
1.295 |
| 06-Feb-2022 |
tnn | move attribute before function declarator
|
1.294 |
| 06-Feb-2022 |
martin | Revert previous, mark cfdriver_iattr_count as __diagused instead.
|
1.293 |
| 05-Feb-2022 |
martin | cfdriver_iattr_count() is only used in a KASSERT, so #ifdef DIAGNOSTIC it.
|
1.292 |
| 29-Jan-2022 |
riastradh | pmf(9): Conditionalize pmflock_debug output on PMFLOCK_DEBUG.
This is really only helpful for debugging the software logic to handle the trees of devices for suspend/resume, not for debugging the drivers, which is most of what we need to do. If anyone still finds this useful they can make a sysctl knob for it or something, but for now this substantially reduces the amount of debug output that's getting in my way.
|
1.291 |
| 31-Dec-2021 |
riastradh | libkern: Make KASSERT verify expression is valid if !DIAGNOSTIC.
This way it is no longer necessary to mark variables __diagused if they are used in KASSERT conditions.
Fix fallout from this by removing now-unnecessary and `#ifdef DIAGNOSTIC'.
Don't do the same for KDASSERT if !DEBUG -- unlike KASSERT and DIAGNOSTIC, variables needed by KDASSERT and DEBUG are likely to be expensive to compute (and potentially difficult for a compiler to prove flushable), so we don't want to require them under !DEBUG.
|
1.290 |
| 11-Oct-2021 |
jmcneill | Squash "holding up boot" messages into a single line, and only print the device list if no progress has been made in 1 second.
|
1.289 |
| 07-Aug-2021 |
thorpej | Merge thorpej-cfargs2.
|
1.288 |
| 14-Jun-2021 |
skrll | branches: 1.288.2; Fix UP build
|
1.287 |
| 13-Jun-2021 |
riastradh | autoconf(9): Take kernel lock in config_detach.
config_detach is used in too many places to audit for now -- so although I'm quite sure it is racy (e.g., with cloning devices and drvctl: drvctl -d a newly opened fss0 before sc_state has transitioned from FSS_IDLE), this will mitigate the immediate fallout until we can properly fix autoconf's notions of device pointers.
|
1.286 |
| 13-Jun-2021 |
riastradh | autoconf(9): Sprinkle KASSERT(dev->dv_pending == 0) in dealloc paths.
This would have made uhub's config_pending_incr leak more obvious by crashing in KASSERT(dev->dv_pending == 0) early on, rather than crashing in a tailq panic later on when the config_pending list gets corrupted with use-after-free because nothing took the device off dv_pending_list when attached.
(This is slightly academic now because config_detach blocks until dev->dv_pending == 0, but it doesn't hurt and makes the intent clearer.)
|
1.285 |
| 13-Jun-2021 |
riastradh | autoconf(9): Take kernel lock in a few entry points.
The arguments to config_attach_pseudo, config_init/fini_component, and config_cfdata_attach/detach are generally statically allocated objects in a module or the main kernel and as such are stable, and there are no data structure invariants they assume the kernel lock will covers from call to call. So there should be no need for the caller to hold the kernel lock.
Should fix panic on modload of, e.g., nvmm.
|
1.284 |
| 12-Jun-2021 |
riastradh | autoconf(9): Must hold alldevs_lock to iterate dv_list on alldevs.
|
1.283 |
| 12-Jun-2021 |
riastradh | autoconf(9): Prevent concurrent attach/detach and detach/detach.
- Use config_pending_incr/decr around attach. No need for separate flag indicating device is still attaching. (dv_flags locking is also incoherent.)
- Any config_pending now blocks config_detach.
- New dv_detaching exclusive lock for config_detach.
|
1.282 |
| 12-Jun-2021 |
riastradh | autoconf(9), drvctl(4): Sprinkle kernel lock assertions.
|
1.281 |
| 12-Jun-2021 |
riastradh | autoconf(9): Take kernel lock on various entries into autoconf.
Most of autoconf still tacitly assumes the kernel lock is held.
|
1.280 |
| 28-Apr-2021 |
thorpej | Validate the return value of cfprint functions before using it to index the msgs[] array. Use designated initializers to initialize msgs[].
|
1.279 |
| 27-Apr-2021 |
thorpej | The Amiga and Atari ports abuse some autoconfiguration internals as part of their early console bring-up, so we need to expose some of the new internals to them and adapt the call sites.
|
1.278 |
| 24-Apr-2021 |
thorpej | branches: 1.278.2; Merge thorpej-cfargs branch:
Simplify and make extensible the config_search() / config_found() / config_attach() interfaces: rather than having different variants for which arguments you want pass along, just have a single call that takes a variadic list of tag-value arguments.
Adjust all call sites: - Simplify wherever possible; don't pass along arguments that aren't actually needed. - Don't be explicit about what interface attribute is attaching if the device only has one. (More simplification.) - Add a config_probe() function to be used in indirect configuiration situations, making is visibly easier to see when indirect config is in play, and allowing for future change in semantics. (As of now, this is just a wrapper around config_match(), but that is an implementation detail.)
Remove unnecessary or redundant interface attributes where they're not needed.
There are currently 5 "cfargs" defined: - CFARG_SUBMATCH (submatch function for direct config) - CFARG_SEARCH (search function for indirect config) - CFARG_IATTR (interface attribte) - CFARG_LOCATORS (locators array) - CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)
...and a sentinel value CFARG_EOL.
Add some extra sanity checking to ensure that interface attributes aren't ambiguous.
Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark ports to associate those device handles with device_t instance. This will trickle trough to more places over time (need back-end for pre-OFW Sun OBP; any others?).
|
1.277 |
| 27-Jan-2021 |
thorpej | branches: 1.277.2; Add device_compatible_match_id() and device_compatible_lookup_id(), which are like device_compatible_match() and device_compatible_lookup(), but take a single scalar value as an ID.
Add a "uintptr_t id" field to device_compatible_entry, in an anonymous union with the existing "const char *compat" field.
|
1.276 |
| 24-Jan-2021 |
thorpej | Refactor and simplify device_compatible_match(), and also provide device_compatible_p{match,lookup}() which treats the strings in the driver compatible data as pmatch(9) patterns.
Add device_compatible_{,p}{match,lookup}_strlist(), which are the same, but take an OpenFirmware-style string list rather than an array of strings for the device data.
|
1.275 |
| 18-Jan-2021 |
thorpej | Change the device_compatible_match() function to only perform the match. Introduce a device_compatible_lookup() function to return an entry based on the same matching criteria (a'la of_search_compatible()).
Update iic_compatible_match() to reflect the above change, and introduce iic_compatible_lookup(). This pattern is less awkward to use.
|
1.274 |
| 03-Oct-2020 |
riastradh | branches: 1.274.2; autoconf: Blame devices holding up boot with config_pending.
Blame message requires `boot -x' (AB_DEBUG).
Fix ata so it doesn't mismatch config_pending_incr/decr devices.
|
1.273 |
| 01-Aug-2020 |
jdolecek | avoid VLA for the sizeof() calculations
|
1.272 |
| 27-Jun-2020 |
jmcneill | prop_dictionary_[sg]et_cstring{,_nocopy} -> prop_dictionary_[sg]et_string{,_nocopy}
|
1.271 |
| 25-May-2020 |
thorpej | Remove support for the !DVF_PRIV_ALLOC case; device_t and driver private storage separation are now mandatory.
|
1.270 |
| 30-Apr-2020 |
riastradh | Rewrite entropy subsystem.
Primary goals:
1. Use cryptography primitives designed and vetted by cryptographers. 2. Be honest about entropy estimation. 3. Propagate full entropy as soon as possible. 4. Simplify the APIs. 5. Reduce overhead of rnd_add_data and cprng_strong. 6. Reduce side channels of HWRNG data and human input sources. 7. Improve visibility of operation with sysctl and event counters.
Caveat: rngtest is no longer used generically for RND_TYPE_RNG rndsources. Hardware RNG devices should have hardware-specific health tests. For example, checking for two repeated 256-bit outputs works to detect AMD's 2019 RDRAND bug. Not all hardware RNGs are necessarily designed to produce exactly uniform output.
ENTROPY POOL
- A Keccak sponge, with test vectors, replaces the old LFSR/SHA-1 kludge as the cryptographic primitive.
- `Entropy depletion' is available for testing purposes with a sysctl knob kern.entropy.depletion; otherwise it is disabled, and once the system reaches full entropy it is assumed to stay there as far as modern cryptography is concerned.
- No `entropy estimation' based on sample values. Such `entropy estimation' is a contradiction in terms, dishonest to users, and a potential source of side channels. It is the responsibility of the driver author to study the entropy of the process that generates the samples.
- Per-CPU gathering pools avoid contention on a global queue.
- Entropy is occasionally consolidated into global pool -- as soon as it's ready, if we've never reached full entropy, and with a rate limit afterward. Operators can force consolidation now by running sysctl -w kern.entropy.consolidate=1.
- rndsink(9) API has been replaced by an epoch counter which changes whenever entropy is consolidated into the global pool. . Usage: Cache entropy_epoch() when you seed. If entropy_epoch() has changed when you're about to use whatever you seeded, reseed. . Epoch is never zero, so initialize cache to 0 if you want to reseed on first use. . Epoch is -1 iff we have never reached full entropy -- in other words, the old rnd_initial_entropy is (entropy_epoch() != -1) -- but it is better if you check for changes rather than for -1, so that if the system estimated its own entropy incorrectly, entropy consolidation has the opportunity to prevent future compromise.
- Sysctls and event counters provide operator visibility into what's happening: . kern.entropy.needed - bits of entropy short of full entropy . kern.entropy.pending - bits known to be pending in per-CPU pools, can be consolidated with sysctl -w kern.entropy.consolidate=1 . kern.entropy.epoch - number of times consolidation has happened, never 0, and -1 iff we have never reached full entropy
CPRNG_STRONG
- A cprng_strong instance is now a collection of per-CPU NIST Hash_DRBGs. There are only two in the system: user_cprng for /dev/urandom and sysctl kern.?random, and kern_cprng for kernel users which may need to operate in interrupt context up to IPL_VM.
(Calling cprng_strong in interrupt context does not strike me as a particularly good idea, so I added an event counter to see whether anything actually does.)
- Event counters provide operator visibility into when reseeding happens.
INTEL RDRAND/RDSEED, VIA C3 RNG (CPU_RNG)
- Unwired for now; will be rewired in a subsequent commit.
|
1.269 |
| 27-Feb-2020 |
macallan | when reporting events to devmon, pass location info along if we find it
|
1.268 |
| 25-Feb-2020 |
jdolecek | Previous commit resolves: netbsd boot error: panic: ASan: Unauthorized Access In ADDR: Addr ADDR [8 bytes, read, PoolUseAfterFree]
Reported-by: syzbot+43111d810160fb4b978b@syzkaller.appspotmail.com
|
1.267 |
| 25-Feb-2020 |
jdolecek | fix use-after-free in config_interrupts_thread() found by KASAN, introduced with addition of the locking; problem pointed out by kamil@
|
1.266 |
| 20-Feb-2020 |
jdolecek | protect deferred lists' manipulation by config_misc_lock, same as config_pending semaphore itself; right now this also covers DVF_ATTACH_INPROGRESS flag
|
1.265 |
| 01-Dec-2018 |
msaitoh | branches: 1.265.4; 1.265.6; Fix compile error.
|
1.264 |
| 01-Dec-2018 |
msaitoh | Add new dv_flags value DVF_ATTACH_INPROGRESS. Currenty, this flags is used only for checking the registration of pmf.
This flag should be set when an attach function(ca_attach) doesn't complete the whole attach work when the function returned. config_interrupts() set it. It's also required for device drivers who do a part of the attach work in their own kthread to set it.
|
1.263 |
| 18-Sep-2018 |
mrg | - move export for devmon_insert_vec into sys/device.h. - export root_is_mounted for future USB RB_ASKNAME hack. - make some things in subr_autoconf.c static - move device_printf() prototype out from the middle of two sets of aprint_*() prototypes.
|
1.262 |
| 26-Jun-2018 |
thorpej | branches: 1.262.2; In my quest to make device_compatible_entry (and associated goo) super-general, it turns out I also made it a little to cumbersome to use (if my tired fingers are any indication). So, this is a course-correction -- one string per entry (like of_compat_data, which it will soon replace), and remove the over-verbose macros.
|
1.261 |
| 26-Jun-2018 |
thorpej | Change device_compatible_match() and iic_compatible_match() to return the weighted match value and take an optional compatible-entry pointer, rather than the other way around.
|
1.260 |
| 19-Jun-2018 |
thorpej | Sigh, fix another stupid mistake in previous that squeaked by because, again, I booted the wrong test kernel.
|
1.259 |
| 18-Jun-2018 |
thorpej | Fix a silly mistake in device_compatible_entry_matches() that I made while re-factoring this from a prior version.
(I booted the wrong kernel when testing, oops.)
|
1.258 |
| 18-Jun-2018 |
thorpej | Add device_compatible_match(), a generalized routine for weighted matching of device_compatible_entry data to a device's "compatible" strings.
|
1.257 |
| 04-Mar-2018 |
mlelstv | branches: 1.257.2; expose struct devicelist alldevs again.
|
1.256 |
| 26-Jan-2018 |
pgoyette | Ensure that dev is not NULL - CID/1428649
|
1.255 |
| 27-Oct-2017 |
joerg | Revert printf return value change.
|
1.254 |
| 27-Oct-2017 |
utkarsh009 | [syzkaller] Cast all the printf's to (void *) > as a result of new printf(9) declaration.
|
1.253 |
| 01-Jun-2017 |
chs | branches: 1.253.2; remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP kmem_zalloc() with KM_SLEEP percpu_alloc() pserialize_create() psref_class_create()
all of these paths include an assertion that the allocation has not failed, so callers should not assert that again.
|
1.252 |
| 20-Mar-2017 |
riastradh | branches: 1.252.4; #if DIAGNOSTIC panic ---> KASSERT; __diagused police
|
1.251 |
| 20-Mar-2017 |
riastradh | Gather alldevs into a cacheline-aligned struct.
|
1.250 |
| 20-Mar-2017 |
riastradh | Omit needless volatile qualifiers.
All these variables are used exclusively with alldevs_mtx held, not atomics. No need for volatile voodoo here.
|
1.249 |
| 20-Mar-2017 |
riastradh | Assert ownership of alldevs_mtx, as required for config_makeroom.
The one caller in config_unit_alloc guarantees ownership, via config_alldevs_enter and preserved by config_makeroom.
|
1.248 |
| 20-Mar-2017 |
riastradh | Make sure we hold alldevs_mtx for access to alldevs in deviter.
- Extend alldevs_mtx section in deviter_init. - Assert ownership of alldevs_mtx in private functions: . deviter_reinit . deviter_next1 . deviter_next2 - Acquire alldevs_mtx in deviter_next.
(alldevs_mtx is not relevant to the struct deviter object, which is private to the caller who must guarantee exclusive access to it.)
|
1.247 |
| 19-Jul-2016 |
msaitoh | branches: 1.247.2; Print number of attach error regardless of AB_QUIET and AB_SILENT.
|
1.246 |
| 15-Jul-2016 |
pgoyette | branches: 1.246.2; Also, don't hard-code the function name in the message; use __func__
|
1.245 |
| 15-Jul-2016 |
pgoyette | As suggested by christos@, use KASSERTMSG()
|
1.244 |
| 14-Jul-2016 |
pgoyette | Remove a call to panic() which duplicates the subsequent KASSERT()!
XXX Since everything has (or should have) been switched to dev_t, we XXX could probably remove the check for XXX XXX ca->ca_devsize >= sizeof(struct device) XXX XXX But someone ought to check on that first!
Reviewed by riastradh@
|
1.243 |
| 11-Jul-2016 |
msaitoh | KNF. No functional change.
|
1.242 |
| 19-Jun-2016 |
bouyer | Add a new config_detach() flag, DETACH_POWEROFF, which is set when detaching devices at shutdown time with RB_POWERDOWN. When detaching wd(4), put the drive in standby before detach for DETACH_POWEROFF. Fix PR kern/51252
|
1.241 |
| 28-Mar-2016 |
skrll | Simplify. No functional change.
|
1.240 |
| 13-Mar-2016 |
mlelstv | gcc silently optimizes away a != NULL check if a pointer has been used before.
- assert that old size == 0 or old pointer valid - check for size instead - rewrite array splice operation with simple loops instead of memcpy/memset.
|
1.239 |
| 28-Jan-2016 |
christos | Don't detach devices if we are dumping core.
|
1.238 |
| 20-Dec-2015 |
pgoyette | If we process the callback immediately, don't bother adding it to the list of future callbacks. We've already processed the list (and removed all the entries), and there's nothing in the future that will process the list again.
This avoids the possibility of leaving an entry in the list that points to an unloaded module's former address space.
|
1.237 |
| 07-Dec-2015 |
pgoyette | Modularize drvctl(4)
|
1.236 |
| 08-Nov-2015 |
joerg | Add the parent device (if present) to the device properties, making it easier to identify devices in the tree with drvctl(8).
|
1.235 |
| 13-Apr-2015 |
riastradh | Convert remaining MI <sys/rnd.h> stragglers. Many MD ones left.
|
1.234 |
| 06-Mar-2015 |
mrg | wait for config_mountroot threads to complete before we tell init it can start up. this solves the problem where a console device needs mountroot to complete attaching, and must create wsdisplay0 before init tries to open /dev/console. fixes PR#49709.
XXX: pullup-7
|
1.233 |
| 06-Nov-2014 |
uebayasi | branches: 1.233.2; Make config_stdsubmatch() human-readable.
|
1.232 |
| 05-Sep-2014 |
matt | Don't next structure and enum definitions. Don't use C++ keywords new, try, class, private, etc.
|
1.231 |
| 10-Aug-2014 |
tls | branches: 1.231.2; Merge tls-earlyentropy branch into HEAD.
|
1.230 |
| 25-Feb-2014 |
pooka | branches: 1.230.2; Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before the sysctl link sets are processed, and remove redundancy.
Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate lines of code.
|
1.229 |
| 25-Oct-2013 |
martin | Mark diagnostic-only variables
|
1.228 |
| 12-Oct-2013 |
christos | Pass the device name in, so we can debug what deferred drivers did not work.
|
1.227 |
| 28-Jun-2013 |
christos | branches: 1.227.2; delete useless initialization http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
|
1.226 |
| 09-Feb-2013 |
christos | printflike maintenance.
|
1.225 |
| 10-Jan-2013 |
mlelstv | Also report attachment of pseudo-devices to userland.
|
1.224 |
| 27-Oct-2012 |
chs | split device_t/softc for all remaining drivers. replace "struct device *" with "device_t". use device_xname(), device_unit(), etc.
|
1.223 |
| 30-Aug-2012 |
matt | branches: 1.223.2; Give config thread more descriptive names.
|
1.222 |
| 30-Jan-2012 |
matt | Use proper ANSI prototypes for foo() -> foo(void) Caught when compiling with -Wold-style-definition
|
1.221 |
| 16-Jan-2012 |
pgoyette | Include autoconfig info interface-attributes, locators) in device property dictionaries.
|
1.220 |
| 31-Aug-2011 |
plunky | branches: 1.220.2; 1.220.6; NULL does not need a cast
|
1.219 |
| 27-Aug-2011 |
martin | Enhance a panic message slightly
|
1.218 |
| 09-Aug-2011 |
dyoung | Correct a comment on config_found_sm_loc().
|
1.217 |
| 02-Aug-2011 |
jmcneill | Re-add include of "drvctl.h", as its removal a year and a half ago broke drvctl DRVGETEVENT.
|
1.216 |
| 01-Jun-2011 |
christos | provide a diagnostic for unsplit drivers.
|
1.215 |
| 24-Apr-2011 |
rmind | - Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
1.214 |
| 02-Apr-2011 |
mbalmer | Fix misplaced parenthesis. From henning.petersen@t-online.de, thanks.
|
1.213 |
| 06-Feb-2011 |
jmcneill | - add support for using compressed images as splash images - retire SPLASHSCREEN_PROGRESS and SPLASHSCREEN_IMAGE options
|
1.212 |
| 31-Jan-2011 |
dyoung | Let the linker instead of the C preprocessor configure the kernel: make weak aliases device_register(9) and device_register_post_config(9) for the stub routine voidop(). Get rid of __HAVE_DEVICE_REGISTER and __HAVE_DEVICE_REGISTER_POST_CONFIG.
|
1.211 |
| 31-Jan-2011 |
dyoung | If there are readers or writers in the alldevs list, don't remove a device_t out from under them, but tag it for deletion, later.
|
1.210 |
| 14-Jan-2011 |
martin | branches: 1.210.2; 1.210.4; Using "int" variables with sysctl's CTLTYPE_BOOL is a simple receipt to loose on big endian machines. So make the variables "bool".
|
1.209 |
| 16-Aug-2010 |
jruoho | From jmcneill@: call config_deferred(9) in rescan_with_cfdata().
|
1.208 |
| 26-Jun-2010 |
tsutsui | Rather than referring a global variable rootvnode in autoconf(9), prepare and use an internal "root_is_mounted" flag for config_mountroot(9).
Should fix annoying dependency problem in librump reported by Paul Goyette on current-users@: http://mail-index.NetBSD.org/current-users/2010/06/25/msg013771.html
|
1.207 |
| 25-Jun-2010 |
tsutsui | Add config_mountroot(9), which defers device configuration after mountroot(), like config_interrupt(9) that defers configuration after interrupts are enabled. This will be used for devices that require firmware loaded from the root file system by firmload(9) to complete device initialization (getting MAC address etc).
No objection on tech-kern@: http://mail-index.NetBSD.org/tech-kern/2010/06/18/msg008370.html and will also fix PR kern/43125.
|
1.206 |
| 30-Apr-2010 |
dyoung | IPL_VM is the highest interrupt priority where alldevs is read/written, and acquiring alldevs_mtx already blocks those interrupts, so delete the splhigh()/splx() in config_alldevs_lock()/_unlock().
Release alldevs_mtx while freeing memory with kmem_free(9); according to new documentation, kmem_free(9) can sleep! :-) Thanks to rmind@ for the tip.
Next step: use finer-grained locking, probably by adding a mutex to cfdriver_t.
And after that: make sure that all threads of execution are out of the device_t and/or softc before releasing their memory.
|
1.205 |
| 19-Apr-2010 |
jruoho | Use CTLTYPE_BOOL.
|
1.204 |
| 25-Mar-2010 |
pooka | Add init/fini for components (modules etc.). These eat the standard driver/attach/data typically present and once some locking is grown in here, these routines can be made to fail or succeed a component attachment/detachment atomically.
|
1.203 |
| 24-Feb-2010 |
dyoung | branches: 1.203.2; A pointer typedef entails trading too much flexibility to declare const and non-const types, and the kernel uses both const and non-const PMF qualifiers and device suspensors, so change the pmf_qual_t and device_suspensor_t typedefs from "pointers to const" to non-pointer, non-const types.
|
1.202 |
| 19-Feb-2010 |
dyoung | Avoid a potential crash: get more struct device initialization out of the way before trying to get a unit number. If we cannot get a unit number, we call config_devfree(), which expects for fields such as dv_flags, dv_cfattach, and dv_private to be initialized.
|
1.201 |
| 15-Feb-2010 |
dyoung | Extract a subroutine, const char *cfdata_ifattr(cfdata_t cf), that returns the name of the interface attribute that associates cf with its parent. Use cfdata_ifattr() at several sites in the autoconf code.
|
1.200 |
| 31-Jan-2010 |
pooka | branches: 1.200.2; Device accessors are only marginally related to autoconf, so put them into subr_device.c instead of having them in subr_autoconf.c.
Since none of the copyrights in subr_autoconf.c really match the history of device accessors, I took the liberty of slapping (c) 2006 TNF onto subr_device.c.
|
1.199 |
| 19-Jan-2010 |
dyoung | A new survey of the code indicates that the very highest interrupt priority level where the kernel accesses alldevs is IPL_VM, where some hardware interrupt handlers call config_deactivate(9). Lower the IPL of alldevs_mtx from IPL_HIGH to IPL_VM, accordingly.
|
1.198 |
| 19-Jan-2010 |
dyoung | Refactor: as suggested by rmind@, extract duplicate code into subroutines config_alldevs_enter() and config_alldevs_exit(). This change amounts to textual substitution. No functional change intended.
We do not collect garbage in device_lookup(), so there is no use dumping it: get rid of the garbage list. Do not call config_dump_garbage().
In device_lookup_private(), call device_lookup() instead of duplicating the code from device_lookup().
|
1.197 |
| 12-Jan-2010 |
rmind | Revert 1.194 rev.
|
1.196 |
| 10-Jan-2010 |
martin | Add a new optional function device_register_post_config(), symmetric to device register, called after config is done with a device. Only used if an arch defines __HAVE_DEVICE_REGISTER_POSTCONFIG.
|
1.195 |
| 08-Jan-2010 |
dyoung | Expand PMF_FN_* macros.
|
1.194 |
| 08-Jan-2010 |
rmind | Simplify device G/C: use global list and config_alldevs_unlock_gc().
|
1.193 |
| 08-Jan-2010 |
dyoung | Move all copies of ifattr_match() to sys/kern/subr_autoconf.c.
|
1.192 |
| 07-Jan-2010 |
dyoung | Add a do-nothing child-detachment hook, null_childdetached(device_t, device_t).
|
1.191 |
| 05-Jan-2010 |
dyoung | Call device_lookup() from device_lookup_private() instead of duplicating code.
Per suggestions by rmind@:
Simplify some code that used "empty statements," ";".
Don't collect garbage in device_lookup{,_private}(), since they are called in interrupt context from certain drivers.
Make config_collect_garbage() KASSERT() that it does not run in interrupt or software-interrupt context.
|
1.190 |
| 15-Dec-2009 |
dyoung | Per rmind@'s suggestion, avoid an acquire/release-mutex dance by collecting garbage in two phases: in the first stage, with alldevs_mtx held, gather all of the objects to be freed onto a list. Drop alldevs_mtx, and in the second stage, free all the collected objects.
Also per rmind@'s suggestion, remove KASSERT(!mutex_owned(&alldevs_mtx)) throughout, it is not useful.
Find a free unit number and allocate it for a new device_t atomically. Before, two threads would sometimes find the same free unit number and race to allocate it. The loser panicked. Now there is no race.
In support of the changes above, extract some new subroutines that are private to this module: config_unit_nextfree(), config_unit_alloc(), config_devfree(), config_dump_garbage().
Delete all of the #ifdef __BROKEN_CONFIG_UNIT_USAGE code. Only the sun3 port still depends on __BROKEN_CONFIG_UNIT_USAGE, it's not hard for the port to do without, and port-sun3@ had fair warning that it was going away (>1 week, or a few years' warning, depending how far back you look!).
|
1.189 |
| 29-Nov-2009 |
pooka | Fix kernel build on platforms which define __BROKEN_CONFIG_UNIT_USAGE and therefore don't take config_alldevs_lock() in config_devalloc().
|
1.188 |
| 12-Nov-2009 |
dyoung | Use TAILQ_FOREACH() instead of open-coding it.
I applied this patch with Coccinelle's semantic patch tool, spatch(1). I installed Coccinelle from pkgsrc: devel/coccinelle/. I wrote tailq.spatch and kdefs.h (see below) and ran this command,
spatch -debug -macro_file_builtins ./kdefs.h -outplace \ -sp_file sys/kern/tailq.spatch sys/kern/subr_autoconf.c
which wrote the transformed source file to /tmp/subr_autoconf.c. Then I used indent(1) to fix the indentation.
:::::::::::::::::::: ::: tailq.spatch ::: ::::::::::::::::::::
@@ identifier I, N; expression H; statement S; iterator name TAILQ_FOREACH; @@
- for (I = TAILQ_FIRST(H); I != NULL; I = TAILQ_NEXT(I, N)) S + TAILQ_FOREACH(I, H, N) S
::::::::::::::: ::: kdefs.h ::: :::::::::::::::
#define MAXUSERS 64 #define _KERNEL #define _KERNEL_OPT #define i386
/* * Tail queue definitions. */ #define _TAILQ_HEAD(name, type, qual) \ struct name { \ qual type *tqh_first; /* first element */ \ qual type *qual *tqh_last; /* addr of last next element */ \ } #define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
#define TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first }
#define _TAILQ_ENTRY(type, qual) \ struct { \ qual type *tqe_next; /* next element */ \ qual type *qual *tqe_prev; /* address of previous next element */\ } #define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
#define PMF_FN_PROTO1 pmf_qual_t #define PMF_FN_ARGS1 pmf_qual_t qual #define PMF_FN_CALL1 qual
#define PMF_FN_PROTO , pmf_qual_t #define PMF_FN_ARGS , pmf_qual_t qual #define PMF_FN_CALL , qual
#define __KERNEL_RCSID(a, b)
|
1.187 |
| 12-Nov-2009 |
dyoung | Move a device-deactivation pattern that is replicated throughout the system into config_deactivate(dev): deactivate dev and all of its descendants. Block all interrupts while calling each device's activation hook, ca_activate. Now it is possible to simplify or to delete several device-activation hooks throughout the system.
Do not deactivate a driver while detaching it! If the driver was already deactivated (because of accidental/emergency removal), let the driver cope with the knowledge that DVF_ACTIVE has been cleared. Otherwise, let the driver access the underlying hardware (so that it can flush caches, restore original register settings, et cetera) until it exits its device-detachment hook.
Let multiple readers and writers simultaneously access the system's device_t list, alldevs, from either interrupt or thread context: postpone changing alldevs linkages and freeing autoconf device structures until a garbage-collection phase that runs after all readers & writers have left the list.
Give device iterators (deviter(9)) a consistent view of alldevs no matter whether device_t's are added and deleted during iteration: keep a global alldevs generation number. When an iterator enters alldevs, record the current generation number in the iterator and increase the global number. When a device_t is created, label it with the current global generation number. When a device_t is deleted, add a second label, the current global generation number. During iteration, compare a device_t's added- and deleted-generation with the iterator's generation and skip a device_t that was deleted before the iterator entered the list or added after the iterator entered the list.
The alldevs generation number is never 0. The garbage collector reaps device_t's whose delete-generation number is non-zero.
Make alldevs private to sys/kern/subr_autoconf.c. Use deviter(9) to access it.
|
1.186 |
| 12-Oct-2009 |
yamt | remove no longer necessary include of drvctl.h
|
1.185 |
| 21-Sep-2009 |
pooka | Split config_init() into config_init() and config_init_mi() to help platforms which want to call config_init() very early in the boot.
|
1.184 |
| 16-Sep-2009 |
dyoung | Nothing calls config_activate(9) any longer, so delete it.
|
1.183 |
| 16-Sep-2009 |
dyoung | In pmf(9), improve the implementation of device self-suspension and make suspension by self, by drvctl(8), and by ACPI system sleep play nice together. Start solidifying some temporary API changes.
1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and #include it from <sys/pmf.h> instead of <sys/device.h> to break the circular dependency between <sys/device.h> and <sys/pmf.h>.
2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF suspend/resume call. Start to replace instances of PMF_FN_PROTO, PMF_FN_ARGS, et cetera, with a pmf_qual_t.
3. Introduce the notion of a "suspensor," an entity that holds a device in suspension. More than one suspensor may hold a device at once. A device stays suspended as long as at least one suspensor holds it. A device resumes when the last suspensor releases it.
Currently, the kernel defines three suspensors,
3a the system-suspensor: for system suspension, initiated by 'sysctl -w machdep.sleep_state=3', by lid closure, by power-button press, et cetera,
3b the drvctl-suspensor: for device suspension by /dev/drvctl ioctl, e.g., drvctl -S sip0.
3c the system self-suspensor: for device drivers that suspend themselves and their children. Several drivers for network interfaces put the network device to sleep while it is not administratively up, that is, after the kernel calls if_stop(, 1). The self-suspensor should not be used directly. See the description of suspensor delegates, below.
A suspensor can have one or more "delegates". A suspensor can release devices that its delegates hold suspended. Right now, only the system self-suspensor has delegates. For each device that a self-suspending driver attaches, it creates the device's self-suspensor, a delegate of the system self-suspensor.
Suspensors stop a system-wide suspend/resume cycle from waking devices that the operator put to sleep with drvctl before the cycle. They also help self-suspension to work more simply, safely, and in accord with expectations.
4. Add the notion of device activation level, devact_level_t, and a routine for checking the current activation level, device_activation(). Current activation levels are DEVACT_LEVEL_BUS, DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively indicate that the device's bus is active, that the bus and device are active, and that the bus, device, and the functions of the device's class (network, audio) are active.
Suspend/resume calls can be qualified with a devact_level_t. The power-management framework treats a devact_level_t that qualifies a device suspension as the device's current activation level; it only runs hooks to reduce the activation level from the presumed current level to the fully suspended state. The framework treats a devact_level_t qualifying device resumption as the target activation level; it only runs hooks to raise the activation level to the target.
5. Use pmf_qual_t, devact_level_t, and self-suspensors in several drivers.
6. Temporarily add an unused power-management workqueue that I will remove or replace, soon.
|
1.182 |
| 16-Sep-2009 |
pooka | Replace a large number of link set based sysctl node creations with calls from subsystem constructors. Benefits both future kernel modules and rump.
no change to sysctl nodes on i386/MONOLITHIC & build tested i386/ALL
|
1.181 |
| 06-Sep-2009 |
pooka | Remove autoconf dependency on vfs and dk: opendisk() -> kern/subr_disk_open.c config_handle_wedges -> dev/dkwedge/dk.c
|
1.180 |
| 03-Sep-2009 |
pooka | Move configure() and configure2() from subr_autoconf.c to init_main.c, since they are only peripherially related to the autoconf subsystem and more related to boot initialization. Also, apply _KERNEL_OPT to autoconf where necessary.
|
1.179 |
| 14-Jul-2009 |
tsutsui | Add a workaround for some traditional ports (amiga and atari): - Defer callout_setfunc() call after config_init() call in configure().
Fixes silent hang before consinit() at least on atari.
These traditional ports use config(9) structures and autoconf(9) functions to detect console devices, and config_init() is called at very early stage at boot where mutex(9) is not ready.
Actually config_init() has been split out from configure() for these ports: http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/kern/subr_autoconf.c#rev1.74 while x68k has been fixed properly: http://mail-index.NetBSD.org/source-changes/2009/01/17/msg215673.html
See also: http://mail-index.NetBSD.org/port-x68k/2008/12/31/msg000006.html http://mail-index.NetBSD.org/port-atari/2009/07/03/msg000419.html
|
1.178 |
| 26-Jun-2009 |
dyoung | Switch to kmem(9).
(void *)pew is one way to get a struct work *, but let's write&pew->pew_work, instead. It is more defensive and persuasive.
Make miscellaneous changes in support of tearing down arbitrary stacks of filesystems and devices during shutdown:
1 Move struct shutdown_state, shutdown_first(), and shutdown_next(), from kern_pmf.c to subr_autoconf.c. Rename detach_all() to config_detach_all(), and move it from kern_pmf.c to subr_autoconf.c. Export all of those routines.
2 In pmf_system_shutdown(), do not suspend user process scheduling, and do not detach all devices: I am going to do that in cpu_reboot(), instead. (Soon I will do it in an MI cpu_reboot() routine.) Do still call PMF shutdown hooks.
3 In config_detach(), add a DIAGNOSTIC assertion: if we're exiting config_detach() at the bottom, alldevs_nwrite had better not be 0, because config_detach() is a writer of the device list.
4 In deviter_release(), check to see if we're iterating the device list for reading, *first*, and if so, decrease the number of readers. Used to be that if we happened to be reading during shutdown, we ran the shutdown branch. Thus the number of writers reached 0, the number of readers remained > 0, and no writer could iterate again. Under certain circumstances that would cause a hang during shutdown.
|
1.177 |
| 29-May-2009 |
dyoung | In config_detach(9), if device deactivation fails with EOPNOTSUPP, don't treat it as an error. This should stop the kernel from panicking in config_detach(9) when sd(4)/wd(4) detach.
|
1.176 |
| 24-May-2009 |
ad | Bus scans can make it appear as if the system has paused, so twiddle constantly while config_interrupts() jobs are running.
|
1.175 |
| 01-May-2009 |
cegger | remove useless parenthesis
|
1.174 |
| 02-Apr-2009 |
dyoung | During shutdown, detach devices in an orderly fashion.
Call the detach routine for every device in the device tree, starting with the leaves and moving toward the root, expecting that each (pseudo-)device driver will use the opportunity to gracefully commit outstandings transactions to the underlying (pseudo-)device and to relinquish control of the hardware to the system BIOS.
Detaching devices is not suitable for every shutdown: in an emergency, or if the system state is inconsistent, we should resort to a fast, simple shutdown that uses only the pmf(9) shutdown hooks and the (deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in boothowto, opt for the fast, simple shutdown.
Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence that it is safe to detach a device during shutdown. Introduce macros CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf attachments with default device flags. Add DVF_DETACH_SHUTDOWN to configuration attachments for atabus(4), atw(4) at cardbus(4), cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4), elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4), pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).
Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the autoconf code and a device driver that the reason for detachment is system shutdown.
Add a sysctl, kern.detachall, that tells the system to try to detach every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.
This is a work in progress. In future work, I aim to treat pseudo-devices more thoroughly, and to gracefully tear down a stack of (pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and raid(4) instances at shutdown.
Also commit some changes that are not easily untangled from the rest:
(1) begin to simplify device_t locking: rename struct pmf_private to device_lock, and incorporate device_lock into struct device.
(2) #include <sys/device.h> in sys/pmf.h in order to get some definitions that it needs. Stop unnecessarily #including <sys/device.h> in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases building.
|
1.173 |
| 28-Mar-2009 |
christos | revert previous; ctags has been fixed.
|
1.172 |
| 25-Mar-2009 |
dyoung | ctags(1) gets confused by 'typedef struct X { } X_t', so break 'typedef struct pmf_private { ... } pmf_private_t' into a struct definition and a typedef definition.
|
1.171 |
| 25-Mar-2009 |
dyoung | DVF_ACTIVE is unconditionally set when we attach a device, so unconditionally clear it after we give a device's deactivate() routine a chance.
|
1.170 |
| 25-Mar-2009 |
dyoung | When we attach a pseudo-device, set its cfdata_t's cf_fstate to FSTATE_FOUND, as we do in config_attach_loc(), in order to avoid a DIAGNOSTIC panic in config_detach() if we detach the device.
|
1.169 |
| 14-Mar-2009 |
ad | 'boot -z' bogons
|
1.168 |
| 12-Feb-2009 |
christos | Unbreak ssp kernels. The issue here that when the ssp_init() call was deferred, it caused the return from the enclosing function to break, as well as the ssp return on i386. To fix both issues, split configure in two pieces the one before calling ssp_init and the one after, and move the ssp_init() call back in main. Put ssp_init() in its own file, and compile this new file with -fno-stack-protector. Tested on amd64. XXX: If we want to have ssp kernels working on 5.0, this change needs to be pulled up.
|
1.167 |
| 29-Dec-2008 |
ad | branches: 1.167.2; Don't need to hold kernel_lock for most of this (and not into the swapper!).
|
1.166 |
| 29-Dec-2008 |
ad | Don't do KM_NOSLEEP allocations.
|
1.165 |
| 18-Nov-2008 |
macallan | don't leak kmem on LP64
|
1.164 |
| 12-Nov-2008 |
ad | Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
|
1.163 |
| 07-Sep-2008 |
cube | branches: 1.163.2; 1.163.4; Remove what seems to be a debug printf committed by accident.
|
1.162 |
| 01-Sep-2008 |
drochner | fix the logics of device memory deallocation (non-split devices paniced a diagnostic kernel)
|
1.161 |
| 27-Aug-2008 |
christos | better debugging messages.
|
1.160 |
| 15-Aug-2008 |
matt | Don't call null handlers
|
1.159 |
| 15-Aug-2008 |
matt | Change subr_autoconf.c to use kmem_{*alloc,free}. in pmf_deregister, don't constantly realloc. just shift everything closer to the front. and then if empty, free. When adding, add space for 4 more entries. Instead of n * sizeof(type) use C99 sizeof(type [n]).
|
1.158 |
| 14-Aug-2008 |
matt | Only deallocate dv_private if we had allocated it.
|
1.157 |
| 28-Jul-2008 |
drochner | Avoid NULL pointer dereference on power handler deregistration if it was not registered before. I assume that a lot of drivers do not proper bookkeeping in the case the attach() exits early due to errors. This is hard to fix and to test, so just be generous here.
|
1.156 |
| 11-Jun-2008 |
drochner | branches: 1.156.2; tighten type checking: use device_t instead of void* at some places
|
1.155 |
| 11-Jun-2008 |
dyoung | In device_pmf_driver_deregister, postpone deleting a device_t's reference to the PMF private data until the private data has no more waiters. This protects against a NULL dereference.
In device_pmf_lock1(), test a device_t for PMF registration before dereferencing its PMF private data.
|
1.154 |
| 06-Jun-2008 |
drochner | branches: 1.154.2; add a KASSERT to catch missing locators
|
1.153 |
| 05-Jun-2008 |
cegger | make this build
|
1.152 |
| 04-Jun-2008 |
ad | - vm_page: put listq, pageq into a union alongside a LIST_ENTRY, so we can use both types of list.
- Make page coloring and idle zero state per-CPU.
- Maintain per-CPU page freelists. When freeing, put pages onto the local CPU's lists and the global lists. When allocating, prefer to take pages from the local CPU. If none are available take from the global list as done now. Proposed on tech-kern@.
|
1.151 |
| 27-May-2008 |
ad | Replace a couple of tsleep calls with cv_wait.
|
1.150 |
| 25-May-2008 |
jmcneill | Export device-driver and device-unit properties via drvctl
|
1.149 |
| 25-May-2008 |
jmcneill | Add DRVGETEVENT support for /dev/drvctl, based on devmon support by Jachym Holecek for Google Summer of Code. DRVGETEVENT plist is currently limited to event type, device name, and device parent name.
|
1.148 |
| 19-May-2008 |
ad | Reduce ifdefs due to MULTIPROCESSOR slightly.
|
1.147 |
| 29-Apr-2008 |
rmind | branches: 1.147.2; Split the runqueue management code into the separate file. OK by <ad>.
|
1.146 |
| 24-Apr-2008 |
ad | branches: 1.146.2; xc_broadcast: don't try to run cross calls on CPUs that are not yet running.
|
1.145 |
| 22-Apr-2008 |
ad | Implement MP callouts as discussed on tech-kern. The CPU binding code is disabled for the moment until we figure out what we want to do with CPUs being offlined.
|
1.144 |
| 14-Apr-2008 |
ad | branches: 1.144.2; SSP: block interrupts when enabling, and move the init to just before starting secondary processors.
|
1.143 |
| 04-Apr-2008 |
cegger | use device_xname() where appropriate OK martin
|
1.142 |
| 01-Apr-2008 |
ad | Use multiple kthreads to process config_interrupts tasks. Proposed on tech-kern.
|
1.141 |
| 12-Mar-2008 |
dyoung | Use device_t and its accessors throughout. Use aprint_*_dev().
Improve PMF-ability.
Add a 'flags' argument to suspend/resume handlers and callers such as pmf_system_suspend().
Define a flag, PMF_F_SELF, which indicates to PMF that a device is suspending/resuming itself. Add helper routines, pmf_device_suspend_self(dev) and pmf_device_resume_self(dev), that call pmf_device_suspend(dev, PMF_F_SELF) and pmf_device_resume(dev, PMF_F_SELF), respectively. Use PMF_F_SELF to suspend/resume self in ath(4), audio(4), rtw(4), and sip(4).
In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable callbacks, provided by the bus front-end, with self-suspension/resumption. Also, clean up the bus front-ends. Make sure that the interrupt handler is disestablished during suspension. Get rid of driver-private flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use device_is_active()/device_has_power() calls, instead.
In the network-class suspend handler, call if_stop(, 0) instead of if_stop(, 1), because the latter is superfluous (bus- and driver-suspension hooks will 'disable' the NIC), and it may cause recursion.
In the network-class resume handler, prevent infinite recursion through if_init() by getting out early if we are self-suspending (PMF_F_SELF).
rtw(4) improvements:
Destroy rtw(4) callouts when we detach it. Make rtw at pci detachable. Print some more information with the "rx frame too long" warning.
Remove activate() methods:
Get rid of rtw_activate() and ath_activate(). The device activate() methods are not good for much these days.
Make ath at cardbus resume with crypto functions intact:
Introduce a boolean device property, "pmf-powerdown". If pmf-powerdown is present and false, it indicates that a bus back-end should not remove power from a device.
Honor this property in cardbus_child_suspend().
Set this property to 'false' in ath_attach(), since removing power from an ath at cardbus seems to lobotomize the WPA crypto engine. XXX Should the pmf-powerdown property propagate toward the root of the device tree?
Miscellaneous ath(4) changes:
Warn if ath(4) tries to write crypto keys to suspended hardware.
Reduce differences between FreeBSD and NetBSD in ath(4) multicast filter setup.
Make ath_printrxbuf() print an rx descriptor's status & key index, to help debug crypto errors.
Shorten a staircase in ath_ioctl(). Don't check for ieee80211_ioctl() return code ERESTART, it never happens.
|
1.140 |
| 11-Mar-2008 |
matt | Add device_lookup_private() which is just device_private(device_lookup(&cd, i)) Most callers don't want the device_t, they want their softc and that's what device_lookup_private returns.
|
1.139 |
| 07-Mar-2008 |
dyoung | PMF: synchronize device suspension and resumption.
|
1.138 |
| 07-Mar-2008 |
dyoung | Stop the kernel from panicking when it detaches sysbeep0: do not try to free the device driver-private storage if dv_private is NULL.
|
1.137 |
| 05-Mar-2008 |
dyoung | Remove a couple of bogus KASSERTs.
|
1.136 |
| 05-Mar-2008 |
dyoung | Synchronize readers and writers of the device tree.
Add a device iterator object, deviter_t, and methods deviter_init(), deviter_first(), and deviter_next() for visiting each device in the device tree.
Take care not to re-shutdown a device in the event that the machine panics during reboot and the operator types 'reboot' at the kernel debugger prompt.
While I'm here, sprinkle PMF_FN_ARGS, PMF_FN_PROTO, et cetera.
|
1.135 |
| 05-Mar-2008 |
dyoung | Introduce PMF_FN_{ARGS,PROTO}1, and use PMF_FN_{ARGS,PROTO} more widely, further helping me to introduce PMF API changes piecemeal.
|
1.134 |
| 04-Mar-2008 |
cube | Report a change from the cube-autoconf branch to allow device_private(NULL). That will ease the conversion of drivers to splitted softc/device_t which is mandatory for cube-autoconf and will be done in HEAD.
|
1.133 |
| 28-Feb-2008 |
drochner | Extend the pmf suspend/resume hooks by a shutdown method, so drivers can register a shutdown handler explicitely. Install a pci bus shutdown handler which disables bus master accesses for all childs, so the drivers don't need to care. This will hopefully be sufficient to replace the shutdownhooks (together with the powerhooks). (It has been suggested to use some general event notification framework for shutdown handlers, but there might be cases where shutdown handlers must be run in an order following the device hierarchy, which wouldn't be easy with event handlers not tied to drivers.) approved by David Young
|
1.132 |
| 27-Feb-2008 |
matt | Allow PRIV_ALLOC devices to have no private data.
|
1.131 |
| 12-Feb-2008 |
joerg | branches: 1.131.2; 1.131.6; Introduce device_find_by_xname and device_find_by_driver_unit to replace alldevs iterations all over src.
Patch discussed with and improved on suggestioned from cube@.
|
1.130 |
| 06-Feb-2008 |
drochner | The tricks done in device_foreach_child() still don't make it safe to use by config_detach_children(), because the latter can work recursively and remove any number of devices, so rewrite config_detach_children() to restart list traversal after each call of config_detach(), and since only one user of device_foreach_child() is left (in kern_drvctl.c), and it is simpler to open-code the loop than to deal with callbacks, just remove it.
|
1.129 |
| 14-Jan-2008 |
yamt | add a per-cpu storage allocator.
|
1.128 |
| 08-Jan-2008 |
dyoung | In device_foreach_child(), use a safe idiom for walking a list whose elements we might be deleting. This stops us from crashing in config_detach_children().
|
1.127 |
| 04-Jan-2008 |
ad | Start detangling lock.h from intr.h. This is likely to cause short term breakage, but the mess of dependencies has been regularly breaking the build recently anyhow.
|
1.126 |
| 16-Dec-2007 |
dyoung | Add config_deferred() for forcing the deferred configuration to run, which we need to do from drvctl(4) sometimes.
Add device_foreach_child() for calling a function on each child of a device_t.
Add config_detach_children() for detaching all of the children of a device (uses device_foreach_child()).
|
1.125 |
| 09-Dec-2007 |
jmcneill | branches: 1.125.2; 1.125.4; Use aprint_debug to notify the user that a device does not implement the power management framework rather than aprint_error.
|
1.124 |
| 09-Dec-2007 |
jmcneill | Merge jmcneill-pm branch.
|
1.123 |
| 26-Nov-2007 |
pooka | branches: 1.123.2; 1.123.4; Remove the "struct lwp *" argument from all VFS and VOP interfaces. The general trend is to remove it from all kernel interfaces and this is a start. In case the calling lwp is desired, curlwp should be used.
quick consensus on tech-kern
|
1.122 |
| 14-Nov-2007 |
ad | Boot the secondary processors just before the interrupt-enabled section of autoconfig. This is needed if APs are able to take interrupts.
|
1.121 |
| 11-Nov-2007 |
matt | Change some initialization of static queues to compile time. (xxx_INIT to xxx_HEAD_INITIALIZER). Drop code which inits non-auto (global or static) variables to 0 since that's already implied by being non-auto. Init some static/global cpu_simple_locks at compile time.
|
1.120 |
| 24-Sep-2007 |
joerg | branches: 1.120.2; 1.120.4; Introduce CFATTACH_DECL_NEW and CFATTACH_DECL2_NEW for drivers that don't expect struct device as first field of softc. device_private uses a new field of struct device to give the softc address and that field is either set the struct device for old-style devices or a separate allocation by config_devalloc. Both macros are intended as temporary bandaid until all drivers are converted and will be removed later.
|
1.119 |
| 20-Jul-2007 |
tsutsui | branches: 1.119.4; 1.119.6; 1.119.8; 1.119.10; Defer callout_startup2() (which calls softintr_establish(9)) call after cpu_configure(9) for now because softintr(9) is initialized in cpu_configure(9) on some ports.
Ok'ed by ad@ on current-users, and fixes hangs on m68k ports during scsi probe.
|
1.118 |
| 24-Jun-2007 |
dyoung | branches: 1.118.2; Extract common code from i386, xen, and sparc64, creating config_handle_wedges() and read_disk_sectors(). On x86, handle_wedges() is a thin wrapper for config_handle_wedges(). Share opendisk() across architectures.
Add kernel code in support of specifying a root partition by wedge name. E.g., root specifications "wedge:wd0a", "wedge:David's Root Volume" are possible. (Patches for config(1) coming soon.)
In support of moving disks between architectures (esp. i386 <-> evbmips), I've written a routine convertdisklabel() that ensures that the raw partition is at RAW_DISK by following these steps:
0 If we have read a disklabel that has a RAW_PART with p_offset == 0 and p_size != 0, then use that raw partition.
1 If we have read a disklabel that has both partitions 'c' and 'd', and RAW_PART has p_offset != 0 or p_size == 0, but the other partition is suitable for a raw partition (p_offset == 0, p_size != 0), then swap the two partitions and use the new raw partition.
2 If the architecture's raw partition is 'd', and if there is no partition 'd', but there is a partition 'c' that is suitable for a raw partition, then copy partition 'c' to partition 'd'.
3 Determine the drive's last sector, using either the d_secperunit the drive reported, or by guessing (0x1fffffff). If we cannot read the drive's last sector, then fail.
4 If we have read a disklabel that has no partition slot RAW_PART, then create a partition RAW_PART. Make it span the whole drive.
5 If there are fewer than MAXPARTITIONS partitions, then "slide" the unsuitable raw partition RAW_PART, and subsequent partitions, into partition slots RAW_PART+1 and subsequent slots. Create a raw partition at RAW_PART. Make it span the whole drive.
The convertdisklabel() procedure can probably stand to be simplified, but it ought to deal with all but an extraordinarily broken disklabel, now.
i386: compiled and tested, sparc64: compiled, evbmips: compiled.
|
1.117 |
| 05-Mar-2007 |
drochner | branches: 1.117.2; 1.117.4; Make the attach functions for real and pseudo devices share as much code as possible. For that, split out a function which does the allocation of a softc (without linking it into global structures) and a function which inserts the device into the global alldevs lists and the per-driver cd_devs. There is a little semantic change involved: the pseudo-device code didn't interpret FSTATE_STAR as such, for no good reason. This looks harmless; I'll modify driver frontends as I find ways to test. Get config_makeroom() out of the public namespace - that's clearly an internal of autoconf which drivers can't be allowed to deal with.
|
1.116 |
| 21-Feb-2007 |
thorpej | Replace the Mach-derived boolean_t type with the C99 bool type. A future commit will replace use of TRUE and FALSE with true and false.
|
1.115 |
| 02-Oct-2006 |
chs | branches: 1.115.4; remove details of the kernel malloc() implementation from header files: - change MALLOC() and FREE() to just call their function equivalents. - remove references to other malloc()-related constants.
|
1.114 |
| 14-May-2006 |
christos | branches: 1.114.8; 1.114.10; Initialize an uninitialized variable gcc 4 found
|
1.113 |
| 08-May-2006 |
thorpej | Initialize dv_properties in config_attach_pseudo(). PR kern/33438
|
1.112 |
| 05-May-2006 |
thorpej | Remove the devprop API and switch everthing over to the new proplib. Add a new device_properties() accessor for device_t that returns the device's property dictionary.
|
1.111 |
| 29-Mar-2006 |
thorpej | Fix typo.
|
1.110 |
| 29-Mar-2006 |
thorpej | Add a device_private() to return the driver's private data (softc). For now, this just returns the passed device_t (as a void *) because device softcs currently contain a "struct device" as the first member.
|
1.109 |
| 29-Mar-2006 |
thorpej | Replace device_locators() with device_locator(), and use it.
|
1.108 |
| 23-Feb-2006 |
thorpej | branches: 1.108.2; 1.108.4; 1.108.6; Add device_is_a(), which returns true if the device is an instance of the driver specified by name.
|
1.107 |
| 19-Feb-2006 |
thorpej | Add accessor functions for the device_t type. Make device_lookup() a real function, rather than a macro.
|
1.106 |
| 18-Feb-2006 |
martin | #if __i386__ the include of opt_splash.h for now - it is only defined on i386. XXX - Jared, this needs to be done differently!
|
1.105 |
| 18-Feb-2006 |
jmcneill | If options SPLASHSCREEN and SPLASHSCREEN_PROGRESS are enabled, update the animation periodically during autoconf.
|
1.104 |
| 18-Feb-2006 |
thorpej | - Don't expose dev_propdb directly -- provide devprop_*() wrappers instead. - Rework the ARMADILLO / epe device properties interaction so that it actually associates the MAC address property with the epe device instance.
|
1.103 |
| 24-Dec-2005 |
perry | branches: 1.103.2; 1.103.4; 1.103.6; Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
|
1.102 |
| 20-Dec-2005 |
thorpej | Use new typedefs.
|
1.101 |
| 11-Dec-2005 |
christos | merge ktrace-lwp.
|
1.100 |
| 29-Aug-2005 |
drochner | in mapply(), call config_match() instead duplicating its code
|
1.99 |
| 26-Aug-2005 |
drochner | nuke locdesc_t from orbit
|
1.98 |
| 25-Aug-2005 |
drochner | now that we have information about default locator values we can implement an universal submatch() function covering all the standard cases: if (<configured> != <wildcard> && <configured> != <real>) then fail else ask device match function
|
1.97 |
| 25-Aug-2005 |
drochner | replace the "locdesc_t" structure carrying the number of locators explicitely by a plain integer array the length in now known to all relevant parties, so this avoids duplication of information, and we can allocate that thing in drivers without hacks
|
1.96 |
| 25-Aug-2005 |
drochner | Replace the "locnames", attached to cfdata, which was solely good for userconf, by more complete information (including default values) about interface attributes, attached to the drivers which provide them.
|
1.95 |
| 28-Jun-2005 |
drochner | branches: 1.95.2; clean up duplication which was to support the old (not locator passing) API for bus "submatch" functions
|
1.94 |
| 29-May-2005 |
christos | - add const. - remove unnecessary casts. - add __UNCONST casts and mark them with XXXUNCONST as necessary.
|
1.93 |
| 26-Feb-2005 |
perry | nuke trailing whitespace
|
1.92 |
| 15-Oct-2004 |
thorpej | branches: 1.92.4; 1.92.6; Change config_attach_pseudo() to take a cfdata * that contains the necessary information to create the pseudo-device instance. Pseudo-device device's will reference this cfdata, just as normal devices reference their corresponding cfdata.
Welcome to 2.99.10.
|
1.91 |
| 30-Aug-2004 |
drochner | split out the check whether a driver supports a given interface attribure, and add a diagnostic assertion to config_search_loc() which ensures that a supplied attribute name is correct
|
1.90 |
| 17-Aug-2004 |
drochner | Add some extensions to the autoconf framework to better support loadable drivers and user controlled attach/detach of devices. An outline was given in http://mail-index.NetBSD.org/tech-kern/2004/08/11/0000.html To cite the relevant parts: -Add a "child detached" and a "rescan" method (both optional) to the device driver. (This is added to the "cfattach" for now because this is under the driver writer's control. Logically it belongs more to the "cfdriver", but this is automatically generated now.) The "child detached" is called by the autoconf framework during config_detach(), after the child's ca_detach() function was called but before the device data structure is freed. The "rescan" is called explicitely, either after a driver LKM was loaded, or on user request (see the "control device" below). -Add a field to the device instance where the "locators" (in terms of the autoconf framework), which describe the actual location of the device relatively to the parent bus, can be stored. This can be used by the "child detached" function for easier bookkeeping (no need to lookup by device instance pointer). (An idea for the future is to use this for generation of optimized kernel config files - like DEC's "doconfig".) -Pass the locators tuple describing a device's location to various autoconf functions to support the previous. And since locators do only make sense in relation to an "interface attribute", pass this as well. -Add helper functions to add/remove supplemental "cfdata" arrays. Needed for driver LKMs.
There is some code duplication which will hopefully resolved when all "submatch"-style functions are changed to accept the locator argument. Some more cleanup can take place when config(8) issues more information about locators, in particular the length and default values. To be done later.
|
1.89 |
| 17-Feb-2004 |
rtr | split off the evcnt code (which is unrelated to autoconfiguration) into a separate file
approved by simonb@
|
1.88 |
| 17-Nov-2003 |
keihan | www.netbsd.org -> www.NetBSD.org
|
1.87 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
|
1.86 |
| 04-Jul-2003 |
thorpej | Add a dev_propdb to hold device properties. Properties are already being used in an ad hoc way by a couple of eval board ports, so might as well tidy it up a little and add some formality. (And, yes, I need to use it in another eval board port.)
|
1.85 |
| 29-Apr-2003 |
thorpej | branches: 1.85.2; Fix a logic botch that would cause some unwanted messages in the AB_SILENT case.
|
1.84 |
| 16-Mar-2003 |
matt | Make cfroots const.
|
1.83 |
| 09-Feb-2003 |
jdolecek | const msgs[] some more
|
1.82 |
| 02-Jan-2003 |
mrg | move #include <sys/reboot.h> with the rest of the <sys/...> headers.
|
1.81 |
| 01-Jan-2003 |
augustss | Make it compile without USERCONF.
|
1.80 |
| 31-Dec-2002 |
thorpej | Add support for quiet and silent boots to the autoconfiguration message machinery.
Quiet boots look like this (inspired by BSD/OS): . . Found tlp0 at pci0 . . Found wd0 at wdc0 . .
Silent boots look like this: . . Detecting hardware...<twiddle>done. . .
NOTE: This requires cooperation on the part of all device drivers, changes to which have not yet been checked in.
|
1.79 |
| 24-Nov-2002 |
thorpej | Add an EVCNT_ATTACH_STATIC() macro which gathers static evcnts into a link set, which are added to the list of event counters at boot time.
|
1.78 |
| 20-Oct-2002 |
isaki | x68k needs config_cfdriver_lookup() to initialize its console. XXX ad-hoc way?
|
1.77 |
| 09-Oct-2002 |
thorpej | Implement config_attach_pseudo(), which creates an instance of a pseudo-device which behaves like a normal device in the device tree, including the capability to have children.
|
1.76 |
| 04-Oct-2002 |
thorpej | Overhaul the way cfattach structures are looked up. The cfdata entry now carries the name of the attachment (e.g. "tlp_pci" or "audio"), and cfattach structures are registered at boot time on a per-driver basis. The cfdriver and cfattach pointers are cached in the device structure when attached.
|
1.75 |
| 01-Oct-2002 |
thorpej | Add a generic config finalization hook, to be called once all real devices have been discovered. All finalizer routines are iteratively invoked until all of them report that they have done no work.
Use this hook to fix a latent bug in RAIDframe autoconfiguration of RAID sets exposed by the rework of SCSI device discovery.
|
1.74 |
| 30-Sep-2002 |
thorpej | Add a config_init() function to initialize the config data structures. Normally this is called by configure(), but some ports (amiga, atari, x68k) need to do this early because of how they find the console.
|
1.73 |
| 27-Sep-2002 |
thorpej | Declare all cfattach structures const.
|
1.72 |
| 27-Sep-2002 |
provos | remove trailing \n in panic(). approved perry.
|
1.71 |
| 27-Sep-2002 |
thorpej | Oops, missed one place to use the STREQ() macro.
|
1.70 |
| 27-Sep-2002 |
thorpej | Skip pspec-less entries (root nodes) in cfparent_match(). This fixes the "kernel crashes" component of PR #18433.
|
1.69 |
| 27-Sep-2002 |
thorpej | Some ports (like Amiga) want to use the config machinery VERY early (to initialize the console). Support this when doing cfdriver lookup.
|
1.68 |
| 27-Sep-2002 |
thorpej | Introduce a new routine, config_match(), which invokes the cfattach->ca_match function in behalf of the caller. Use it rather than invoking cfattach->ca_match directly.
|
1.67 |
| 27-Sep-2002 |
thorpej | Rather than referencing the cfdriver directly in the cfdata entries, instead use a string naming the driver. The cfdriver is then looked up in a list which is built at run-time.
|
1.66 |
| 26-Sep-2002 |
thorpej | Overhaul the way parent attachments are specified; instead of using a vector of indices into the cfdata table to specify potential parents, record the interface attributes that devices have and add a new "parent spec" structure which lists the iattr, as well as optionally listing specific parent device instances.
See:
http://mail-index.netbsd.org/tech-kern/2002/09/25/0014.html
...for a detailed description.
While here, const poison some things, as suggested by Matt Thomas.
|
1.65 |
| 23-Sep-2002 |
thorpej | Add support for multiple cfdata tables to the internals of the autoconfiguration machinery, derived from PR #2112.
More work is left to do, including revamping how matches against a candidate parent are done.
|
1.64 |
| 10-Jul-2002 |
drochner | fix off-by-one error in string len check
|
1.63 |
| 15-Apr-2002 |
gmcgarry | branches: 1.63.2; When searching for devices also skip those deleted by userconf. Problem reported by uwe.
|
1.62 |
| 15-Feb-2002 |
simonb | branches: 1.62.6; Add a "show event" ddb command to show the event counters.
|
1.61 |
| 10-Dec-2001 |
thorpej | Don't compare an int against NULL.
|
1.60 |
| 05-Dec-2001 |
augustss | Use NULL instead of 0 in a few places.
|
1.59 |
| 02-Dec-2001 |
augustss | Move the code that expands the cd_devs array into a subroutine.
|
1.58 |
| 12-Nov-2001 |
lukem | clean up whitespace
|
1.57 |
| 01-Jul-2001 |
gmcgarry | branches: 1.57.2; 1.57.6; In-kernel device configuration manager - allows modification of device locators at run-time.
Written by Mats O Jansson <moj@stacken.kth.se>. Reworked by Jun-ichiro itojun Hagino <itojun@netbsd.org>.
|
1.56 |
| 28-May-2001 |
thorpej | Statically-initialize `allevents' so that events can be registered very early (before main() is called).
|
1.55 |
| 08-Jul-2000 |
sommerfeld | branches: 1.55.2; Format paranoia
|
1.54 |
| 13-Jun-2000 |
cgd | Replace my personal attribution string ("This product includes software developed by Christopher G. Demetriou for the NetBSD Project.") with a generic NetBSD one ("This product includes software developed for the NetBSD Project. See http://www.netbsd.org/ for information about NetBSD.") so that this same set of terms can be used by others if they so desire. (Eventually i'll be converting more/all of my code.)
|
1.53 |
| 04-Jun-2000 |
cgd | Implement the more flexiable `evcnt' interface as discussed (briefly) on tech-kern and now documented in evcnt(9).
|
1.52 |
| 02-Jun-2000 |
cgd | another mod of opportunity: const poison. (cfprint_t should take const char * as second arg, too, but that's Hard.) also, convert use of "(char *)0" to NULL.
|
1.51 |
| 02-Jun-2000 |
cgd | __P and K&R declarations -> ANSI protos + declarations. tweak NetBSD IDs, and __KERNEL_RCSID to subr_autoconf.c.
|
1.50 |
| 28-Mar-2000 |
augustss | branches: 1.50.2; Get rid of a lot of register declarations. (Why isn't this done everywhere in the kernel already?)
|
1.49 |
| 01-Feb-2000 |
danw | #define __HAVE_DEVICE_REGISTER on ports that have it, and check for that, rather than a list of architecture defines, in config_attach
|
1.48 |
| 25-Jan-2000 |
enami | In the diagnostic check in config_detach, inform the name of parent and its child who shouldn't be exist.
|
1.47 |
| 24-Jan-2000 |
thorpej | Add a `config_pending' semaphore to block mounting of the root file system until all device driver discovery threads have had a chance to do their work. This in turn blocks initproc's exec of init(8) until root is mounted and process start times and CWD info has been fixed up.
Addresses kern/9247.
|
1.46 |
| 18-Jan-2000 |
cgd | use the old cloning-device cf_unit increment behaviour, if __BROKEN_CONFIG_UNIT_USAGE is defined.
|
1.45 |
| 30-Dec-1999 |
cgd | avoid 'marching unit numbers' for cloning devices. (e.g., previously, if you com* at pcmcia?, and com3 and com4 as pcmcia cards, and removed and reinserted the card that was com3, it would become com5. if you then removed and reinserted com4, it would become com6. etc.) Now, instead of incrementing FSTATE_STAR configuration entries for a driver when a cloning instance is attached, leave it alone, and scan the device softc array (starting at the first cloning unit number) for units which are available for use. This wastes a tiny bit of time (can require a linear scan of the softc table for the device), but device attachment should be relatively infrequent and the number of units of each type of device is never particularly large anyway.
|
1.44 |
| 23-Sep-1999 |
minoura | branches: 1.44.2; First step toward network boot. By Takeshi Nakayama <tn@catvmics.ne.jp>.
|
1.43 |
| 17-Sep-1999 |
thorpej | - Centralize the declaration and clearing of `cold'. - Call configure() after setting up proc0. - Call initclocks() from configure(), after cpu_configure(). Once the clocks are running, clear `cold'. Then run interrupt-driven autoconfiguration.
|
1.42 |
| 15-Sep-1999 |
thorpej | Add a mechanism to defer configuration of children until interrupts are enabled.
|
1.41 |
| 15-Sep-1999 |
thorpej | Rename the machine-dependent autoconfiguration entry point `cpu_configure()', and rename config_init() to configure() and call cpu_configure() from there.
|
1.40 |
| 20-Jun-1999 |
ragge | Add vax to user of device_register.
|
1.39 |
| 21-Apr-1999 |
mrg | revert previous. oops.
|
1.38 |
| 21-Apr-1999 |
mrg | properly test the msgsz as "msgsz - len". from PR#7386
|
1.37 |
| 03-Dec-1998 |
pk | branches: 1.37.6; Enable `device_register()' for the sparc.
|
1.36 |
| 18-Nov-1998 |
thorpej | Oops, fix uninitialzed variable in last.
|
1.35 |
| 18-Nov-1998 |
thorpej | Be a bit more precise about how we allow no deactivation support in config_detach().
|
1.34 |
| 18-Nov-1998 |
thorpej | If the ca_activate entry point fails, make sure to restore the old dv_flags.
|
1.33 |
| 17-Nov-1998 |
thorpej | Implement config_detach(), mostly from Chris Demetriou, modified slightly by Ken Hornstein and myself.
Add flags to struct device, and define one as "active". Devices are initially active from config_attach(). Their active state may be changed via config_activate() and config_deactivate().
These new functions assume that the device being manipulated will recursively perform the action on its children.
Together, config_deactivate() and config_detach() may be used to implement interrupt-driven device detachment. config_deactivate() will take care of things that need to be performed at interrupt time, and config_detach() (which must run in a valid thread context) finishes the job, which may block.
|
1.32 |
| 31-Aug-1998 |
cgd | kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port used it, and it's non-working and apparently slated for replacement.)
|
1.31 |
| 04-Aug-1998 |
perry | Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one. bcopy(x, y, z) -> memcpy(y, x, z) ovbcopy(x, y, z) -> memmove(y, x, z) bcmp(x, y, z) -> memcmp(x, y, z) bzero(x, y) -> memset(x, 0, y)
|
1.30 |
| 31-Jul-1998 |
perry | fix sizeofs so they comply with the KNF style guide. yes, it is pedantic.
|
1.29 |
| 09-Jun-1998 |
thorpej | branches: 1.29.2; Implement config_defer(), a generic mechanism to defer the configuration of a device until all of its parent's children have been attached.
|
1.28 |
| 01-Mar-1998 |
fvdl | Merge with Lite2 + local changes
|
1.27 |
| 20-Sep-1997 |
drochner | Call device_register() on i386 too.
|
1.26 |
| 17-Dec-1996 |
thorpej | branches: 1.26.10; Call device_register() if __alpha__ || hp300
|
1.25 |
| 05-Dec-1996 |
cgd | Check for a new definition, __BROKEN_INDIRECT_CONFIG, and if it is _not_ defined: define match functions to take a struct cfdata * as their second argument, config_search() to take a struct cfdata * as its second argument, and config_{root,}search() to return struct cfdata *.
remove 'cd_indirect' cfdriver element.
remove config_scan().
remove config_make_softc() as a seperate function, reintegrating its functionality into config_attach().
Ports will define __BROKEN_INDIRECT_CONFIG until their drivers prototypes are updated to work with the new definitions, and until it is sure that their indirect-config drivers do not assume that they have a softc in their match routine.
|
1.24 |
| 13-Oct-1996 |
christos | backout previous kprintf change
|
1.23 |
| 10-Oct-1996 |
christos | printf -> kprintf, sprintf -> ksprintf
|
1.22 |
| 13-Jun-1996 |
cgd | #ifdef __alpha__, call a machine-dependent function with new device structure and 'aux', right before ca_attach is called for the newly-attached device. This allows the alpha port to do root device autodetection without modifying every bus and device driver which could be in the 'boot path.' In the long run, it may make sense to make this machine-independent.
|
1.21 |
| 04-Apr-1996 |
cgd | branches: 1.21.4; Make config_found_sm() (and therefore config_found()) and config_rootfound() return a struct device * of attached device, or NULL if device attach failed, rather than 1/0 for success/failure, so that code that bus code which needs to know what the child device is doesn't have to open-code a hacked variant of config_found(). Make config_attach() return struct device *, rather than void, to facilitate that.
|
1.20 |
| 04-Apr-1996 |
cgd | change 'struct device' and 'struct evcnt' lists (alldevs and allevents) to be TAILQ's. TAILQ_HEAD's of those structs are now 'struct devicelist' and 'struct evcntlist', respectively.
|
1.19 |
| 17-Mar-1996 |
thorpej | New device attachment scheme:
- split softc size and match/attach out from cfdriver into a new struct cfattach.
- new "attach" directive for files.*. May specify the name of the cfattach structure, so that devices may be easily attached to parents with different autoconfiguration semantics.
|
1.18 |
| 27-Feb-1996 |
cgd | Replace config_found() with config_found_sm(), which adds a cfmatch_t to the argument list. This allows easy 'submatching', which will eliminate a fair bit of slightly tricky duplicated code from various busses. config_found() is now a #define in sys/device.h, which invokes config_found_sm().
|
1.17 |
| 04-Feb-1996 |
christos | First pass at prototyping
|
1.16 |
| 04-Nov-1994 |
mycroft | Add a new function config_scan(), which just calls a particular function with each plausibly cfdata, ignoring the priority mechanism completely.
|
1.15 |
| 04-Nov-1994 |
mycroft | Export struct matchinfo and mapply().
|
1.14 |
| 04-Nov-1994 |
mycroft | Calculate indirectness earlier, and stor it in the struct matchinfo.
|
1.13 |
| 04-Nov-1994 |
mycroft | config_make_softc() needs pointer to parent; and fix a couple of other bogons.
|
1.12 |
| 03-Nov-1994 |
mycroft | If cd_indirect is set in the parent, create a softc early and pass it to the probe routine.
|
1.11 |
| 30-Oct-1994 |
cgd | be more careful with types, also pull in headers where necessary.
|
1.10 |
| 07-Oct-1994 |
mycroft | Simplify the code to expand the dev array slightly, and make sure the size is a power of 2.
|
1.9 |
| 29-Jun-1994 |
cgd | New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
|
1.8 |
| 20-May-1994 |
cgd | reorg derivations, slightly.
|
1.7 |
| 20-May-1994 |
glass | update to 4.4-lite + local changes
|
1.6 |
| 12-May-1994 |
glass | slightly more optimal fix from torek himself
|
1.5 |
| 12-May-1994 |
glass | fix chopps, et al discovered bug in allocating cd_devs array
|
1.4 |
| 18-Dec-1993 |
mycroft | Canonicalize all #includes.
|
1.3 |
| 15-Aug-1993 |
glass | branches: 1.3.2; runs up to and including configure(). todo: exceptions, interrupt support, make isrs affect vector table kernel/user stacks
|
1.2 |
| 13-Aug-1993 |
glass | baseline revision
|
1.1 |
| 13-Aug-1993 |
glass | branches: 1.1.1; snapshot of intergration of torek's config
|
1.1.1.2 |
| 01-Mar-1998 |
fvdl | Import 4.4BSD-Lite2
|
1.1.1.1 |
| 01-Mar-1998 |
fvdl | Import 4.4BSD-Lite for reference
|
1.3.2.3 |
| 29-Nov-1993 |
mycroft | Implement dk_establish().
|
1.3.2.2 |
| 14-Nov-1993 |
mycroft | Canonicalize all #includes.
|
1.3.2.1 |
| 14-Sep-1993 |
mycroft | init_main.c: clock changes from 4.4; initclocks() is called after vfsinit(). No startrtclock() or enablertclock(). Some pseudo-device cruft, but this needs to be updated. kern_clock.c: from 4.4: gatherstats() --> statclock(). statclock(), hardclock(), and softclock() take a `struct clockframe *'. New initclocks(), harclock(), statclock(), startprofclock(), and stopprofclock(). kern_synch.c: from 4.4: machine-independent swtch(), which is now where process time is integrated. Calls cpu_swtch() with the current process as an arg. subr_autoconf.c: Fix typo. subr_prf.c: msgbufp and msgbufmapped are define in machdep.c tty.c: Make TIOCHPCL #ifdef COMPAT_43. Incorporate changes from main branch.
|
1.21.4.1 |
| 13-Jun-1996 |
cgd | pull up from trunk: >#ifdef __alpha__, call a machine-dependent function with new device >structure and 'aux', right before ca_attach is called for the >newly-attached device. This allows the alpha port to do root device >autodetection without modifying every bus and device driver which could >be in the 'boot path.' In the long run, it may make sense to make >this machine-independent.
|
1.26.10.1 |
| 22-Sep-1997 |
thorpej | Update marc-pcmcia branch from trunk.
|
1.29.2.1 |
| 08-Aug-1998 |
eeh | Revert cdevsw mmap routines to return int.
|
1.37.6.1 |
| 21-Jun-1999 |
thorpej | Sync w/ -current.
|
1.44.2.1 |
| 20-Nov-2000 |
bouyer | Update thorpej_scsipi to -current as of a month ago
|
1.50.2.1 |
| 22-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.55.2.11 |
| 03-Jan-2003 |
thorpej | Sync with HEAD.
|
1.55.2.10 |
| 11-Dec-2002 |
thorpej | Sync with HEAD.
|
1.55.2.9 |
| 11-Nov-2002 |
nathanw | Catch up to -current
|
1.55.2.8 |
| 18-Oct-2002 |
nathanw | Catch up to -current.
|
1.55.2.7 |
| 01-Aug-2002 |
nathanw | Catch up to -current.
|
1.55.2.6 |
| 17-Apr-2002 |
nathanw | Catch up to -current.
|
1.55.2.5 |
| 28-Feb-2002 |
nathanw | Catch up to -current.
|
1.55.2.4 |
| 08-Jan-2002 |
nathanw | Catch up to -current.
|
1.55.2.3 |
| 14-Nov-2001 |
nathanw | Catch up to -current.
|
1.55.2.2 |
| 24-Aug-2001 |
nathanw | Catch up with -current.
|
1.55.2.1 |
| 21-Jun-2001 |
nathanw | Catch up to -current.
|
1.57.6.1 |
| 12-Nov-2001 |
thorpej | Sync the thorpej-mips-cache branch with -current.
|
1.57.2.5 |
| 10-Oct-2002 |
jdolecek | sync kqueue with -current; this includes merge of gehenna-devsw branch, merge of i386 MP branch, and part of autoconf rototil work
|
1.57.2.4 |
| 06-Sep-2002 |
jdolecek | sync kqueue branch with HEAD
|
1.57.2.3 |
| 23-Jun-2002 |
jdolecek | catch up with -current on kqueue branch
|
1.57.2.2 |
| 16-Mar-2002 |
jdolecek | Catch up with -current.
|
1.57.2.1 |
| 10-Jan-2002 |
thorpej | Sync kqueue branch with -current.
|
1.62.6.3 |
| 06-Apr-2002 |
eeh | Add dev_dumprops() for debug and make dev_mdgetprop() conditional.
|
1.62.6.2 |
| 26-Mar-2002 |
eeh | Add locator properites in config_attach(), add a "cd-name" property to the rest of the locators, and always allocate a combined device+softc.
|
1.62.6.1 |
| 22-Mar-2002 |
eeh | Add devprops implementation.
|
1.63.2.1 |
| 15-Jul-2002 |
gehenna | catch up with -current.
|
1.85.2.8 |
| 10-Nov-2005 |
skrll | Sync with HEAD. Here we go again...
|
1.85.2.7 |
| 04-Mar-2005 |
skrll | Sync with HEAD.
Hi Perry!
|
1.85.2.6 |
| 19-Oct-2004 |
skrll | Sync with HEAD
|
1.85.2.5 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.85.2.4 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.85.2.3 |
| 03-Sep-2004 |
skrll | Sync with HEAD
|
1.85.2.2 |
| 25-Aug-2004 |
skrll | Sync with HEAD.
|
1.85.2.1 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.92.6.1 |
| 19-Mar-2005 |
yamt | sync with head. xen and whitespace. xen part is not finished.
|
1.92.4.1 |
| 29-Apr-2005 |
kent | sync with -current
|
1.95.2.11 |
| 17-Mar-2008 |
yamt | sync with head.
|
1.95.2.10 |
| 27-Feb-2008 |
yamt | sync with head.
|
1.95.2.9 |
| 11-Feb-2008 |
yamt | sync with head.
|
1.95.2.8 |
| 21-Jan-2008 |
yamt | sync with head
|
1.95.2.7 |
| 07-Dec-2007 |
yamt | sync with head
|
1.95.2.6 |
| 15-Nov-2007 |
yamt | sync with head.
|
1.95.2.5 |
| 27-Oct-2007 |
yamt | sync with head.
|
1.95.2.4 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.95.2.3 |
| 26-Feb-2007 |
yamt | sync with head.
|
1.95.2.2 |
| 30-Dec-2006 |
yamt | sync with head.
|
1.95.2.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.103.6.2 |
| 01-Jun-2006 |
kardel | Sync with head.
|
1.103.6.1 |
| 22-Apr-2006 |
simonb | Sync with head.
|
1.103.4.1 |
| 09-Sep-2006 |
rpaulo | sync with head
|
1.103.2.2 |
| 01-Mar-2006 |
yamt | sync with head.
|
1.103.2.1 |
| 18-Feb-2006 |
yamt | sync with head.
|
1.108.6.2 |
| 24-May-2006 |
tron | Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
|
1.108.6.1 |
| 31-Mar-2006 |
tron | Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
|
1.108.4.2 |
| 11-May-2006 |
elad | sync with head
|
1.108.4.1 |
| 19-Apr-2006 |
elad | sync with head.
|
1.108.2.2 |
| 24-May-2006 |
yamt | sync with head.
|
1.108.2.1 |
| 01-Apr-2006 |
yamt | sync with head.
|
1.114.10.1 |
| 22-Oct-2006 |
yamt | sync with head
|
1.114.8.1 |
| 18-Nov-2006 |
ad | Sync with head.
|
1.115.4.2 |
| 12-Mar-2007 |
rmind | Sync with HEAD.
|
1.115.4.1 |
| 27-Feb-2007 |
yamt | - sync with head. - move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
|
1.117.4.1 |
| 11-Jul-2007 |
mjf | Sync with head.
|
1.117.2.3 |
| 09-Oct-2007 |
ad | Sync with head.
|
1.117.2.2 |
| 20-Aug-2007 |
ad | Sync with HEAD.
|
1.117.2.1 |
| 15-Jul-2007 |
ad | Sync with head.
|
1.118.2.1 |
| 15-Aug-2007 |
skrll | Sync with HEAD.
|
1.119.10.2 |
| 20-Jul-2007 |
tsutsui | Defer callout_startup2() (which calls softintr_establish(9)) call after cpu_configure(9) for now because softintr(9) is initialized in cpu_configure(9) on some ports.
Ok'ed by ad@ on current-users, and fixes hangs on m68k ports during scsi probe.
|
1.119.10.1 |
| 20-Jul-2007 |
tsutsui | file subr_autoconf.c was added on branch matt-mips64 on 2007-07-20 22:15:48 +0000
|
1.119.8.1 |
| 06-Oct-2007 |
yamt | sync with head.
|
1.119.6.3 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.119.6.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.119.6.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.119.4.9 |
| 08-Dec-2007 |
jmcneill | Rename pnp(9) -> pmf(9), as requested by many.
|
1.119.4.8 |
| 27-Nov-2007 |
joerg | Sync with HEAD. amd64 Xen support needs testing.
|
1.119.4.7 |
| 21-Nov-2007 |
joerg | Sync with HEAD.
|
1.119.4.6 |
| 14-Nov-2007 |
joerg | Sync with HEAD.
|
1.119.4.5 |
| 07-Nov-2007 |
joerg | Introduce device_has_power to fix a race between resuming a device and the device enabling interrupts as seen by jmcneill@ with uhci. Change ehci, ohci, uhci and azalia to use this function to protect the interrupt handler.
|
1.119.4.4 |
| 06-Nov-2007 |
joerg | Refactor PNP API: - Make suspend/resume directly a device functionality. It consists of three layers (class logic, device logic, bus logic), all of them being optional. This replaces D0/D3 transitions. - device_is_active returns true if the device was not disabled and was not suspended (even partially), device_is_enabled returns true if the device was enabled. - Change pnp_global_transition into pnp_system_suspend and pnp_system_resume. Before running any suspend/resume handlers, check that all currently attached devices support power management and bail out otherwise. The latter is not done for the shutdown/panic case. - Make the former bus-specific generic network handlers a class handler. - Make PNP message like volume up/down/toogle PNP events. Each device can register what events they are interested in and whether the handler should be global or not. - Introduce device_active API for devices to mark themselve in use from either the system or the device. Use this to implement the idle handling for audio and input devices. This is intended to replace most ad-hoc watchdogs as well. - Fix somes situations in which audio resume would lose mixer settings. - Make USB host controllers better deal with suspend in the light of shared interrupts. - Flush filesystem cache on suspend. - Flush disk caches on suspend. Put ATA disks into standby on suspend as well. - Adopt drivers to use the new PNP API. - Fix a critical bug in the generic cardbus layer that made D0->D3 break. - Fix ral(4) to set if_stop. - Convert cbb(4) to the new PNP API. - Apply the PCI Express SCI fix on resume again.
|
1.119.4.3 |
| 02-Oct-2007 |
joerg | Sync with HEAD.
|
1.119.4.2 |
| 01-Oct-2007 |
joerg | Extend device API by device_power_private and device_power_set_private. The latter is a temporary mean until the pnp_register API itself is overhault. This functions allow a generic power handler to store its state independent of the driver.
Use this and revamp the PCI power handling. Pretty much all PCI devices had power handlers that did the same thing, generalize this in pci_generic_power_register/deregister and the handler. This interface offers callbacks for the drivers to save and restore state on transistions. After a long discussion with jmcneill@ it was considered to be powerful enough until evidence is shown that devices can handle D1/D2 with less code and higher speed than without the full save/restore. The generic code is carefully written to handle device without PCI-PM support and ensure that the correct registers are written to when D3 loses all state.
Reimplement the generic PCI network device handling on top of PCI generic power handling.
Introduce pci_disable_retry as used and implemented locally at least by ath(4) and iwi(4). Use it in this drivers to restore behaviour from before the introduction of generic PCI network handling.
Convert all PCI drivers that were using pnp_register to the new framework. The only exception is vga(4) as it is commonly used as console device. Add a note therein that this should be fixed later.
|
1.119.4.1 |
| 03-Aug-2007 |
jmcneill | Pull in power management changes from private branch.
|
1.120.4.4 |
| 18-Feb-2008 |
mjf | Sync with HEAD.
|
1.120.4.3 |
| 27-Dec-2007 |
mjf | Sync with HEAD.
|
1.120.4.2 |
| 08-Dec-2007 |
mjf | Sync with HEAD.
|
1.120.4.1 |
| 19-Nov-2007 |
mjf | Sync with HEAD.
|
1.120.2.2 |
| 18-Nov-2007 |
bouyer | Sync with HEAD
|
1.120.2.1 |
| 13-Nov-2007 |
bouyer | Sync with HEAD
|
1.123.4.1 |
| 11-Dec-2007 |
yamt | sync with head.
|
1.123.2.1 |
| 26-Dec-2007 |
ad | Sync with head.
|
1.125.4.1 |
| 16-Dec-2007 |
cube | Split off device-specific stuff out of subr_autconf.c, and split off autoconf-specific stuff out of device.h.
The only functional change is the removal of the unused evcnt.h include in device.h which (*sigh*) has side-effects in x86's intr.h, and probably some other in the rest of the tree but I'm only compiling i386's QEMU for the time being.
|
1.125.2.3 |
| 19-Jan-2008 |
bouyer | Sync with HEAD
|
1.125.2.2 |
| 08-Jan-2008 |
bouyer | Sync with HEAD
|
1.125.2.1 |
| 02-Jan-2008 |
bouyer | Sync with HEAD
|
1.131.6.6 |
| 17-Jan-2009 |
mjf | Sync with HEAD.
|
1.131.6.5 |
| 28-Sep-2008 |
mjf | Sync with HEAD.
|
1.131.6.4 |
| 29-Jun-2008 |
mjf | Sync with HEAD.
|
1.131.6.3 |
| 05-Jun-2008 |
mjf | Sync with HEAD.
Also fix build.
|
1.131.6.2 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.131.6.1 |
| 03-Apr-2008 |
mjf | Sync with HEAD.
|
1.131.2.1 |
| 24-Mar-2008 |
keiichi | sync with head.
|
1.144.2.3 |
| 17-Jun-2008 |
yamt | sync with head.
|
1.144.2.2 |
| 04-Jun-2008 |
yamt | sync with head
|
1.144.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.146.2.8 |
| 09-Oct-2010 |
yamt | sync with head
|
1.146.2.7 |
| 11-Aug-2010 |
yamt | sync with head.
|
1.146.2.6 |
| 11-Mar-2010 |
yamt | sync with head
|
1.146.2.5 |
| 16-Sep-2009 |
yamt | sync with head
|
1.146.2.4 |
| 18-Jul-2009 |
yamt | sync with head.
|
1.146.2.3 |
| 20-Jun-2009 |
yamt | sync with head
|
1.146.2.2 |
| 04-May-2009 |
yamt | sync with head.
|
1.146.2.1 |
| 16-May-2008 |
yamt | sync with head.
|
1.147.2.3 |
| 24-Sep-2008 |
wrstuden | Merge in changes between wrstuden-revivesa-base-2 and wrstuden-revivesa-base-3.
|
1.147.2.2 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.147.2.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.154.2.2 |
| 31-Jul-2008 |
simonb | Sync with head.
|
1.154.2.1 |
| 18-Jun-2008 |
simonb | Sync with head.
|
1.156.2.2 |
| 13-Dec-2008 |
haad | Update haad-dm branch to haad-dm-base2.
|
1.156.2.1 |
| 19-Oct-2008 |
haad | Sync with HEAD.
|
1.163.4.3 |
| 20-Nov-2010 |
riz | Pull up following revision(s) (requested by hubertf in ticket #1386): sys/dev/raidframe/rf_netbsdkintf.c: revision 1.258 sys/dev/pad/pad.c: revision 1.11 sys/dev/scsipi/cd.c: revision 1.288 sys/dev/isa/pcppi.c: revision 1.33 sys/kern/subr_autoconf.c: revision 1.169 'boot -z' bogons
|
1.163.4.2 |
| 15-Mar-2009 |
snj | branches: 1.163.4.2.4; Pull up following revision(s) (requested by christos in ticket #458): sys/conf/Makefile.kern.inc: revision 1.121 sys/conf/files: revision 1.940 sys/kern/init_main.c: revision 1.381 sys/kern/kern_ssp.c: revision 1.1 sys/kern/subr_autoconf.c: revision 1.168 sys/sys/device.h: revision 1.116 sys/sys/systm.h: revision 1.233 Unbreak ssp kernels. The issue here that when the ssp_init() call was deferred, it caused the return from the enclosing function to break, as well as the ssp return on i386. To fix both issues, split configure in two pieces the one before calling ssp_init and the one after, and move the ssp_init() call back in main. Put ssp_init() in its own file, and compile this new file with -fno-stack-protector. Tested on amd64. XXX: If we want to have ssp kernels working on 5.0, this change needs to be pulled up.
|
1.163.4.1 |
| 02-Feb-2009 |
snj | Pull up following revision(s) (requested by ad in ticket #339): sys/kern/subr_autoconf.c: revision 1.167 Don't need to hold kernel_lock for most of this (and not into the swapper!).
|
1.163.4.2.4.3 |
| 08-Feb-2011 |
cliff | use mutex_obj_alloc() to allocate config_queues_lock and dc_funcs_lock instead of declaring them statically.
|
1.163.4.2.4.2 |
| 08-Feb-2011 |
cliff | - add config_queues_lock to serialize access to deferred_config_queue and interrupt_config_queue for adds, deletes and (those DIAGNOSTIC) searches - add dc_funcs_lock to serialize dispatch of deferred config functions many (all?) of which may not be MP safe.
|
1.163.4.2.4.1 |
| 05-Feb-2011 |
cliff | - include opt_multiprocessor.h for explicit MULTIPROCESSOR dependency
|
1.163.2.3 |
| 28-Apr-2009 |
skrll | Sync with HEAD.
|
1.163.2.2 |
| 03-Mar-2009 |
skrll | Sync with HEAD.
|
1.163.2.1 |
| 19-Jan-2009 |
skrll | Sync with HEAD.
|
1.167.2.2 |
| 23-Jul-2009 |
jym | Sync with HEAD.
|
1.167.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Commit is split, to avoid a "too many arguments" protocol error.
|
1.200.2.3 |
| 22-Oct-2010 |
uebayasi | Sync with HEAD (-D20101022).
|
1.200.2.2 |
| 17-Aug-2010 |
uebayasi | Sync with HEAD.
|
1.200.2.1 |
| 30-Apr-2010 |
uebayasi | Sync with HEAD.
|
1.203.2.6 |
| 12-Jun-2011 |
rmind | sync with head
|
1.203.2.5 |
| 31-May-2011 |
rmind | sync with head
|
1.203.2.4 |
| 21-Apr-2011 |
rmind | sync with head
|
1.203.2.3 |
| 05-Mar-2011 |
rmind | sync with head
|
1.203.2.2 |
| 03-Jul-2010 |
rmind | sync with head
|
1.203.2.1 |
| 30-May-2010 |
rmind | sync with head
|
1.210.4.1 |
| 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.210.2.1 |
| 06-Jun-2011 |
jruoho | Sync with HEAD.
|
1.220.6.1 |
| 18-Feb-2012 |
mrg | merge to -current.
|
1.220.2.4 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.220.2.3 |
| 23-Jan-2013 |
yamt | sync with head
|
1.220.2.2 |
| 30-Oct-2012 |
yamt | sync with head
|
1.220.2.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.223.2.5 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.223.2.4 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.223.2.3 |
| 25-Feb-2013 |
tls | resync with head
|
1.223.2.2 |
| 20-Nov-2012 |
tls | Resync to 2012-11-19 00:00:00 UTC
|
1.223.2.1 |
| 12-Sep-2012 |
tls | Initial snapshot of work to eliminate 64K MAXPHYS. Basically works for physio (I/O to raw devices); needs more doing to get it going with the filesystems, but it shouldn't damage data.
All work's been done on amd64 so far. Not hard to add support to other ports. If others want to pitch in, one very helpful thing would be to sort out when and how IDE disks can do 128K or larger transfers, and adjust the various PCI IDE (or at least ahcisata) drivers and wd.c accordingly -- it would make testing much easier. Another very helpful thing would be to implement a smart minphys() for RAIDframe along the lines detailed in the MAXPHYS-NOTES file.
|
1.227.2.1 |
| 18-May-2014 |
rmind | sync with head
|
1.230.2.1 |
| 07-Apr-2014 |
tls | Get more entropy into the system early:
1) Add device attach timings from autoconf. 2) Accumulate the output of kernel printf (as well as the times when it's called) and add this periodically. To avoid issues with recursion through diagnostic printfs, we use SHA512 to accumulate the printf output, then mix in its output. 3) Add all sysctl settings -- mixes in the hostname and likely a bit more.
|
1.231.2.3 |
| 05-Jul-2016 |
snj | Pull up following revision(s) (requested by bouyer in ticket #1186): sys/dev/ata/wd.c: revision 1.421 sys/kern/subr_autoconf.c: revision 1.242 via patch sys/sys/device.h: revision 1.149 Add a new config_detach() flag, DETACH_POWEROFF, which is set when detaching devices at shutdown time with RB_POWERDOWN. When detaching wd(4), put the drive in standby before detach for DETACH_POWEROFF. Fix PR kern/51252
|
1.231.2.2 |
| 16-Nov-2015 |
msaitoh | Pull up following revision(s) (requested by joerg in ticket #1030): sys/kern/subr_autoconf.c: revision 1.236 Add the parent device (if present) to the device properties, making it easier to identify devices in the tree with drvctl(8).
|
1.231.2.1 |
| 09-Mar-2015 |
snj | Pull up following revision(s) (requested by mrg in ticket #576): sys/kern/init_main.c: revision 1.462 sys/kern/subr_autoconf.c: revision 1.234 sys/sys/device.h: revision 1.147 wait for config_mountroot threads to complete before we tell init it can start up. this solves the problem where a console device needs mountroot to complete attaching, and must create wsdisplay0 before init tries to open /dev/console. fixes PR#49709. XXX: pullup-7
|
1.233.2.8 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
1.233.2.7 |
| 05-Oct-2016 |
skrll | Sync with HEAD
|
1.233.2.6 |
| 09-Jul-2016 |
skrll | Sync with HEAD
|
1.233.2.5 |
| 22-Apr-2016 |
skrll | Sync with HEAD
|
1.233.2.4 |
| 19-Mar-2016 |
skrll | Sync with HEAD
|
1.233.2.3 |
| 27-Dec-2015 |
skrll | Sync with HEAD (as of 26th Dec)
|
1.233.2.2 |
| 06-Jun-2015 |
skrll | Sync with HEAD
|
1.233.2.1 |
| 06-Apr-2015 |
skrll | Sync with HEAD
|
1.246.2.9 |
| 25-Apr-2017 |
pgoyette | Use KASSERTMSG() to ensure that the device has a localcount.
|
1.246.2.8 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.246.2.7 |
| 26-Jul-2016 |
pgoyette | Sync with HEAD
|
1.246.2.6 |
| 24-Jul-2016 |
pgoyette | Add a device_acquire() for when we need to grab a reference and we already have a pointer to the device.
|
1.246.2.5 |
| 22-Jul-2016 |
pgoyette | Fix logic to avoid dereferencing NULL pointer
|
1.246.2.4 |
| 22-Jul-2016 |
pgoyette | Remove stray debugging info
|
1.246.2.3 |
| 22-Jul-2016 |
pgoyette | In config_devfree(), free the 'struct localcount'
In device_lookup_private_acquire() we need to ensure that the caller has access to the device_t so the reference that we're acquiring can later be device_release()d. So we must require that the device has non-NULL private data where the pointer back to the device_t can be stored (ie, in xxx->sc_dev).
|
1.246.2.2 |
| 16-Jul-2016 |
pgoyette | Add new xxx_acquire variants for device_lookup_private() and device_find_by_driver_unit_acquire rather than blindly making the old variants call localcount_acquire().
Also fix a couple of locking sequences.
Thanks to Taylor for the review!
|
1.246.2.1 |
| 16-Jul-2016 |
pgoyette | Initial set of changes for subr_autoconf usage of localcount mechanism.
Nothing actually uses this yet - all callers of device_lookup() need conversion to device_lookup_acquire()/device_release(). This also means that callers of device_lookup_private() need to be modified to call device_release() when finished accessing the softc.
XXX Perhaps device_lookup_private() should be removed, and all callers XXX modified to use device_lookup_acquire()/.../device_release()?
|
1.247.2.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.252.4.4 |
| 17-May-2017 |
pgoyette | At suggestion of chuq@, modify config_attach_pseudo() to return with a reference held on the device.
Adapt callers to expect the reference to exist, and to ensure that the reference is released.
|
1.252.4.3 |
| 30-Apr-2017 |
pgoyette | Release the interlock mutex before calling device_release().
Ensure that device_release() gets called even if the (ca->ca_detach)() call fails.
|
1.252.4.2 |
| 28-Apr-2017 |
pgoyette | Introduce config_detach_release() which does all the work from the former config_detach(). Now, config_detach() simply acquires a reference to the device, which config_detach_release() can release!
This is needed because some drivers call config_detach() with a reference, while other drivers have not been updated to use the localcount reference mechanism. So we provide a shim to make everyone equal.
|
1.252.4.1 |
| 27-Apr-2017 |
pgoyette | Restore all work from the former pgoyette-localcount branch (which is now abandoned doe to cvs merge botch).
The branch now builds, and installs via anita. There are still some problems (cgd is non-functional and all atf tests time-out) but they will get resolved soon.
|
1.253.2.1 |
| 23-Sep-2018 |
martin | Pull up following revision(s) (requested by mrg in ticket #1025):
sys/kern/subr_autoconf.c: revision 1.263 sys/kern/kern_drvctl.c: revision 1.44 sys/sys/device.h: revision 1.156 sys/sys/systm.h: revision 1.278
- move export for devmon_insert_vec into sys/device.h. - export root_is_mounted for future USB RB_ASKNAME hack. - make some things in subr_autoconf.c static - move device_printf() prototype out from the middle of two sets of aprint_*() prototypes.
|
1.257.2.4 |
| 26-Dec-2018 |
pgoyette | Sync with HEAD, resolve a few conflicts
|
1.257.2.3 |
| 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.257.2.2 |
| 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.257.2.1 |
| 25-Jun-2018 |
pgoyette | Sync with HEAD
|
1.262.2.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.262.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.265.6.1 |
| 29-Feb-2020 |
ad | Sync with head.
|
1.265.4.1 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1688):
sys/kern/subr_autoconf.c: revision 1.308
autoconf(9): Avoid potential ABA bug in config_makeroom.
When we unlock alldevs_lock to allocate a new cd_devs array nsp, other threads may have: 1. freed the old one (osp), 2. done some other memory allocation, 3. allocated a new _larger_ array whose address happens to concide with osp (e.g., in (2) the page was recycled for a different pool cache), and 4. updated cd_devs back to osp but increased cd_ndevs.
In that case, the memory may be corrupted: we try to copy the wrong number of device_t pointers into nsp and we free osp with the wrong (stale) length.
Avoid this by checking whether cd_ndevs has changed too -- if not, osp might have been recycled but at least the lengths we're about to copy and free are still correct so there's no harm in an ABA situation.
|
1.274.2.1 |
| 03-Apr-2021 |
thorpej | Sync with HEAD.
|
1.277.2.13 |
| 05-Apr-2021 |
thorpej | Document that config_probe() really should just return a bool, but explain why it cannot, currently.
|
1.277.2.12 |
| 04-Apr-2021 |
thorpej | Add a config_probe() function. This is currently a synonym for config_match(), but exists so as to make a distinction between probing (as is done in indirect configuration) and matching (which is done in direct configuration).
The intention is for direct config "submatch" routines to use config_match() and for indirect config "search" routines to use config_probe().
|
1.277.2.11 |
| 04-Apr-2021 |
thorpej | Add a CFARG_SEARCH tag, which specifies an indirect config search function (which has the same signature as a direct config submatch function). This is a synonym for CFARG_SUBMATCH internally, but this is an implementation detail; the two things should be distinct to callers, because submatch and search functions have different behaviors. Only one SEARCH or SUBMATCH argument is allowed.
Also, change config_get_cfargs() to panic if an unknown tag is passed (we don't know what kind of argument to consume after an unknown tag, so this is fatal).
|
1.277.2.10 |
| 03-Apr-2021 |
thorpej | Add CFARG_DEVHANDLE, allowing direct configuration using e.g. ACPI or OpenFirmware / FDT to associate the handle with the device_t.
|
1.277.2.9 |
| 03-Apr-2021 |
thorpej | - Give config_devalloc() the tagged variadic argument treatment. - Only extract the values from the variadic argument list if we're going to use them locally. If not, just pass them along (using va_copy() if necessary). This serves to future-proof the intermediaries as new cfarg_t tag values are added in the future.
|
1.277.2.8 |
| 03-Apr-2021 |
thorpej | config_attach_loc() -> config_attach() with CFARG_LOCATORS argument.
|
1.277.2.7 |
| 03-Apr-2021 |
thorpej | Give config_attach() the tagged variadic argument treatment and mechanically convert all call sites.
|
1.277.2.6 |
| 02-Apr-2021 |
thorpej | config_found_ia() -> config_found() w/ CFARG_IATTR.
|
1.277.2.5 |
| 22-Mar-2021 |
thorpej | Temporarily continue to provide config_found_ia().
|
1.277.2.4 |
| 22-Mar-2021 |
thorpej | Mechanical conversion of config_found_sm_loc() -> config_found(). CFARG_IATTR usage needs to be audited.
|
1.277.2.3 |
| 21-Mar-2021 |
thorpej | Give config_found() the same variadic arguments treatment as config_search(). This commit only adds the CFARG_EOL sentinel to the existing config_found() calls. Conversion of config_found_sm_loc() and config_found_ia() call sites will be in subsequent commits.
|
1.277.2.2 |
| 21-Mar-2021 |
thorpej | In config_search(), we already asserted that either an interface attribute is not specified, or the specified attribute is carried by the parent.
Add an additional assertion: That an interface attribute is specified or that the parent has fewer than 2 interface attributes (i.e. lack of interface attribute specification would be ambiguous).
Yes, "fewer than 2". Zero interface attributes doesn't really make sense, because a device cannot then be a parent of another device by definition. But cfparent_match() would already catch this situation gracefully, and there is obviously no ambiguity when a device has no interface attributes.
|
1.277.2.1 |
| 20-Mar-2021 |
thorpej | The proliferation if config_search_*() and config_found_*() combinations is a little absurd, so begin to tidy this up:
- Introduce a new cfarg_t enumerated type, that defines the types of tag-value variadic arguments that can be passed to the various config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS, for now, plus a CFARG_EOL sentinel). - Collapse config_search_*() into config_search() that takes these variadic arguments. - Convert all call sites of config_search_*() to the new signature. Noticed several incorrect usages along the way, which will be audited in a future commit.
|
1.278.2.2 |
| 17-Jun-2021 |
thorpej | Sync w/ HEAD.
|
1.278.2.1 |
| 13-May-2021 |
thorpej | Sync with HEAD.
|
1.288.2.1 |
| 03-Aug-2021 |
thorpej | Address concerns about limited compile-time type checking with the tag-value mechanism of specifying arguments to config_search(), config_found(), and config_attach() by replacing the tag-value scheme with a "struct cfargs", a pointer to which is passed to the aforementioned functions instead.
The structure has a version field to allow for future ABI versioning flexibility. The external structure is canononicalized internally before use.
To ease the initialization of this structure, use a variadic preprocessor macro, CFARGS(), to construct an anonymous "struct cfargs" inline, the address of which is passed to the target function. A CFARGS_NONE macro provides a symbolic stand-in for when the caller doesn't want to pass arguments (currently expands to NULL and is handled during canonicalization).
|
1.306.4.2 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #285):
sys/kern/subr_autoconf.c: revision 1.308
autoconf(9): Avoid potential ABA bug in config_makeroom.
When we unlock alldevs_lock to allocate a new cd_devs array nsp, other threads may have: 1. freed the old one (osp), 2. done some other memory allocation, 3. allocated a new _larger_ array whose address happens to concide with osp (e.g., in (2) the page was recycled for a different pool cache), and 4. updated cd_devs back to osp but increased cd_ndevs.
In that case, the memory may be corrupted: we try to copy the wrong number of device_t pointers into nsp and we free osp with the wrong (stale) length.
Avoid this by checking whether cd_ndevs has changed too -- if not, osp might have been recycled but at least the lengths we're about to copy and free are still correct so there's no harm in an ABA situation.
|
1.306.4.1 |
| 30-Jul-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #260):
sys/kern/subr_autoconf.c: revision 1.314
autoconf(9): Print `waiting for devices' normally once a minute.
|