Commit Graph

255 Commits

Author SHA1 Message Date
joerg
e64612f440 Revert printf return value change. 2017-10-27 12:25:14 +00:00
utkarsh009
f11595bab5 [syzkaller] Cast all the printf's to (void *)
> as a result of new printf(9) declaration.
2017-10-27 09:59:16 +00:00
chs
fd34ea77eb 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.
2017-06-01 02:45:05 +00:00
riastradh
27568595fc #if DIAGNOSTIC panic ---> KASSERT; __diagused police 2017-03-20 01:24:06 +00:00
riastradh
fe6928ab88 Gather alldevs into a cacheline-aligned struct. 2017-03-20 01:13:07 +00:00
riastradh
8a00741dd2 Omit needless volatile qualifiers.
All these variables are used exclusively with alldevs_mtx held, not
atomics.  No need for volatile voodoo here.
2017-03-20 01:06:29 +00:00
riastradh
1d7e0698c7 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.
2017-03-20 01:05:03 +00:00
riastradh
f7e6ff90f6 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.)
2017-03-20 00:30:03 +00:00
msaitoh
207265e875 Print number of attach error regardless of AB_QUIET and AB_SILENT. 2016-07-19 07:44:03 +00:00
pgoyette
8665318c03 Also, don't hard-code the function name in the message; use __func__ 2016-07-15 01:17:47 +00:00
pgoyette
abd2da1923 As suggested by christos@, use KASSERTMSG() 2016-07-15 01:13:10 +00:00
pgoyette
097a241ddc 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@
2016-07-14 21:57:06 +00:00
msaitoh
6399f1a6ef KNF. No functional change. 2016-07-11 07:42:13 +00:00
bouyer
01a30830e3 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
2016-06-19 09:35:06 +00:00
skrll
8e0f1b1171 Simplify. No functional change. 2016-03-28 09:50:40 +00:00
mlelstv
2545a60c45 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.
2016-03-13 10:07:22 +00:00
christos
253490a42f Don't detach devices if we are dumping core. 2016-01-28 16:32:40 +00:00
pgoyette
2a9d726544 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.
2015-12-20 04:21:03 +00:00
pgoyette
42f5fa5fd3 Modularize drvctl(4) 2015-12-07 11:38:46 +00:00
joerg
8e87830d68 Add the parent device (if present) to the device properties, making it
easier to identify devices in the tree with drvctl(8).
2015-11-08 21:03:00 +00:00
riastradh
67d6ba47fb Convert remaining MI <sys/rnd.h> stragglers. Many MD ones left. 2015-04-13 16:46:33 +00:00
mrg
d64a5577d7 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
2015-03-06 09:28:15 +00:00
uebayasi
27fe31d88c Make config_stdsubmatch() human-readable. 2014-11-06 08:46:04 +00:00
matt
a35d1a8c7c Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.
2014-09-05 05:57:21 +00:00
tls
ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +00:00
pooka
4f6fb3bf35 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.
2014-02-25 18:30:08 +00:00
martin
f6552d7c17 Mark diagnostic-only variables 2013-10-25 16:08:18 +00:00
christos
11beb626a3 Pass the device name in, so we can debug what deferred drivers did not work. 2013-10-12 16:49:00 +00:00
christos
9a402121dd delete useless initialization
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 15:33:40 +00:00
christos
a67c3c8971 printflike maintenance. 2013-02-09 00:31:21 +00:00
mlelstv
20911e3ae3 Also report attachment of pseudo-devices to userland. 2013-01-10 10:15:59 +00:00
chs
cbab9cadce split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
2012-10-27 17:17:22 +00:00
matt
dfb595098c Give config thread more descriptive names. 2012-08-30 02:24:20 +00:00
matt
4b50cb788d Use proper ANSI prototypes for foo() -> foo(void)
Caught when compiling with -Wold-style-definition
2012-01-30 23:31:27 +00:00
pgoyette
0a2d38dd59 Include autoconfig info interface-attributes, locators) in device property
dictionaries.
2012-01-16 19:42:40 +00:00
plunky
7f3d4048d7 NULL does not need a cast 2011-08-31 18:31:02 +00:00
martin
c5ba0125cf Enhance a panic message slightly 2011-08-27 19:52:22 +00:00
dyoung
e04563cb82 Correct a comment on config_found_sm_loc(). 2011-08-09 21:07:14 +00:00
jmcneill
b993a69649 Re-add include of "drvctl.h", as its removal a year and a half ago broke
drvctl DRVGETEVENT.
2011-08-02 21:23:24 +00:00
christos
1f1986d685 provide a diagnostic for unsplit drivers. 2011-06-01 02:43:33 +00:00
rmind
bd5b92d68b - Replace few malloc(9) uses with kmem(9).
- Rename buf_malloc() to buf_alloc(), fix comments.
- Remove some unnecessary inclusions.
2011-04-24 18:46:22 +00:00
mbalmer
1571556be6 Fix misplaced parenthesis. From henning.petersen@t-online.de, thanks. 2011-04-02 08:11:31 +00:00
jmcneill
5efc85b67e - add support for using compressed images as splash images
- retire SPLASHSCREEN_PROGRESS and SPLASHSCREEN_IMAGE options
2011-02-06 23:25:16 +00:00
dyoung
dcda6c56b0 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.
2011-01-31 23:07:16 +00:00
dyoung
25fc6f07bf 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.
2011-01-31 23:00:34 +00:00
martin
72b336b07f Using "int" variables with sysctl's CTLTYPE_BOOL is a simple receipt to
loose on big endian machines. So make the variables "bool".
2011-01-14 10:18:21 +00:00
jruoho
795224299a From jmcneill@: call config_deferred(9) in rescan_with_cfdata(). 2010-08-16 17:29:52 +00:00
tsutsui
7b11ac5304 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
2010-06-26 06:43:13 +00:00
tsutsui
9aa0a261b5 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.
2010-06-25 15:10:42 +00:00
dyoung
b875f6ccc8 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.
2010-04-30 21:17:22 +00:00