Commit Graph

231 Commits

Author SHA1 Message Date
mlelstv 38ae6e1dbc If a specified root device does not exist when the kernel tries to
mount the root filesystem, retry for up to ROOT_WAITTIME (20) seconds.
This helps for root on hot-plug devices like USB disks.
2023-01-19 07:40:58 +00:00
hannken afc8fd54cd Fix locking after opendisk(), VOP_IOCTL() needs an unlocked vnode,
vn_rdwr() needs flag IO_NODELOCKED.
2022-03-19 13:51:35 +00:00
mlelstv abde51a7a8 Restore missing message for RB_ASKNAME.
Cleanups.
2020-11-21 08:10:27 +00:00
thorpej 599c240526 - Introduce a new global kernel variable "shutting_down" to indicate that
the system is shutting down or rebooting.
- Set this global in a new function called kern_reboot(), which is currently
  just a basic wrapper around cpu_reboot().
- Call kern_reboot() instead of cpu_reboot() almost everywhere; a few
  places remain where it's still called directly, but those are in early
  pre-main() machdep locations.

Eventually, all of the various cpu_reboot() functions should be re-factored
and common functionality moved to kern_reboot(), but that's for another day.
2020-01-01 22:57:16 +00:00
manu d45bbebabd Accept root device specification as NAME=label 2019-09-16 00:01:16 +00:00
manu a351ce9f52 Rollback change to accept NAME=label root device specification
As suggested by Michael van Elst, the operation should be done
int getwedgename()
2019-09-15 23:59:33 +00:00
manu 9749fdddc3 Accept root device specification as NAME=label 2019-09-13 01:33:20 +00:00
mlelstv 4e7617c5be Align parsing of boot devices. This allows to specify device names
as strings in the boot loader and the kernel configuration.
2019-08-18 06:28:42 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
mlelstv cb72cf618f Restore code to create md0, this fixes booting an INSTALL kernel. 2019-01-05 18:03:41 +00:00
mlelstv 4f0e04566d Refactor setroot, no functional change intended.
setroot
- prepare special cases
- loop until root is set

setroot_nfs
- special case for disk boot + NFS root

setroot_ask
- Prompt user

setroot_root
- set root device

setroot_dump
- set dump device
2019-01-05 09:39:56 +00:00
mlelstv 96652353da Set rootdev for wedges. 2018-10-07 11:24:16 +00:00
jmcneill f69ff2189c Include "flash" in list of block devices that don't use partitions. 2017-11-14 14:14:29 +00:00
christos f890274f96 add a "booted_method" string to aid in debugging double boot matches. 2017-11-09 01:02:55 +00:00
ozaki-r 040205ae93 Protect ifnet list with psz and psref
The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
2016-05-12 02:24:16 +00:00
mlelstv 68774bf92e Let MD code provide boot disk information as spec string that can be
parsed by MI code. The format is the same as provided by an embedded
'root on <rootspec>' string in the config file. An embedded string
(other than a wildcard) still takes precedence.
2014-11-22 11:04:57 +00:00
mlelstv 16fb494383 don't crash if rootspec is invalid 2014-11-22 10:24:02 +00:00
pooka 9737cfdd2b Group more syscall related routines together (kern_subr -> kern_syscall) 2013-12-09 16:49:43 +00:00
mlelstv 5741661f64 Make detection of root on wedges (dk(4)) machine independent. Remove
MD code for x86, xen, sparc64.
2012-06-10 17:05:18 +00:00
christos 1cc8b31503 ifdef unused variable with -UPTRACE 2011-09-19 23:54:29 +00:00
jmcneill 2db443b160 For PT_SYSCALLEMU, no need to stop again on syscall exit. 2011-08-31 23:42:46 +00:00
jmcneill 1904b2b8db PR# kern/45312: ptrace: PT_SETREGS can't alter system calls
Add a new PT_SYSCALLEMU request that cancels the current syscall, for
use with PT_SYSCALL.
2011-08-31 22:58:39 +00:00
uebayasi 2de1fdfe8b These don't need uvm/uvm_extern.h. 2011-07-27 14:35:33 +00:00
hannken c7919375e5 Change md(4) to:
- create md devices on first open and destroy on last close.
- add enough disk label support to make DIOCGDINFO and DIOCGPART work.
- add disk_busy()/disk_unbusy() instrumentation.

Ok: David Young <dyoung@netbsd.org>
2010-11-11 11:07:06 +00:00
pooka 7ea24651a7 Move routines related to syscall establishment from kern_subr.c and
kern_stub.c to kern_syscall.c.
2010-04-14 14:46:59 +00:00
pooka 04b824ef52 Place *hook implementations in kern_hook.c instead of them floating
around in the kern_subr.c gruel.  Arrrrr.
2010-01-31 01:38:48 +00:00
pooka 3b780690a4 Use proper static initializers for *hooklist (currently they happened
to work accidentally anyway since the initializer is 0).
2010-01-31 00:48:07 +00:00
pooka 92394bf5f3 Trade 200-something bytes for the death of an ifdef. 2010-01-30 23:19:55 +00:00
dyoung fbe2bb0ace Use deviter(9) instead of accessing alldevs directly. 2009-11-05 18:07:19 +00:00
pooka fcc20a4ba1 Split uiomove() and high-level copy routines out of the crowded
kern_subr and into their own cozy home in subr_copy.
2009-11-04 16:54:00 +00:00
pooka 68f37adaa6 Give humanize_number & format_bytes their own spots in the sun and move
from kern_subr to subr_humanize.
2009-10-02 15:48:41 +00:00
dyoung 7e8a3f8dc1 Replace 'struct device *' with 'device_t', throughout. No functional
change intended.
2009-09-25 19:21:09 +00:00
drochner eb4f9278bc In humanize_number(), avoid an integer overflow if the buffer
provided is "too large" (log10(2^64) = 19).
(It can still overflow if the input value is close to 2^64 but I don't
consider this a problem.)
fixes nonsense displayed as "total memory" on boot
2009-04-02 17:25:24 +00:00
christos 461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
pgoyette 9c68331911 Store config(1)'s root filesystem type as a text string rather than
embedding the address of its xxx_mountroot() in swapnetbsd.c.  This
permits booting of kernels with hard-wired filesystem type even if the
filesystem is in a loadable module (ie, not linked into the kernel
image).

Discussed on current-users.  Tested on amd64 and i386 with both hard-
wired and '?' filesystem times, and on both modular and monolithic
kernels.

Thanks to pooka@ for code review and suggestions.

Addresses my PR kern/40167
2008-12-19 17:11:57 +00:00
christos 78d77f514f better error messages, and more messages for DIAGNOSTIC. 2008-11-27 21:36:51 +00:00
ad 8fe49e035f PR kern/39913 exec, fork, exit hooks need locking
Acquire exec_lock where needed.
2008-11-14 13:01:18 +00:00
ad 119366618e Atomic insertion/removal of groups of system call vectors at runtime with
a basic facility for rollback.

Proposed on tech-kern@.
2008-11-12 14:29:31 +00:00
dyoung 94d985722a It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled.  So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks().  Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown().  No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown().  I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that.  Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.
2008-11-11 06:46:40 +00:00
pooka a44cdde52c M_IOV is used all over the place, so stuff it in with malloc_stdtypes 2008-10-14 14:17:49 +00:00
rmind ffb8ec88e1 Replace intptr_t with uintptr_t in few more places.
OK by <matt>.
2008-09-15 18:12:56 +00:00
drochner 520a61068b remove the hacks around fakemdrootdev[] which should be unnecessary now
that "md" devices show up in the "alldevs" list
2008-06-11 10:40:21 +00:00
dyoung 801c395b47 Run shutdown hooks whether or not the kernel has panicked. Restores
NetBSD's shutdown behavior of more than 6 years before rev 1.176.
Ok joerg@.

It is essential that we restore some hardware to initial conditions
before rebooting, in order to avoid interfering with the BIOS
bootstrap.  For example, if NetBSD gives control back to the Soekris
comBIOS while the kernel text is write-protected, the BIOS bootstrap
hangs during the power-on self-test, "POST: 0123456789bcefghip".
In principle, bus masters can also interfere with BIOS boot.
2008-05-28 15:40:58 +00:00
christos 2847938186 Coverity CID 5019: Check before deref. 2008-05-24 16:49:30 +00:00
ad 1253c2cad4 Allow md_root_setconf() to set in a miniroot as the root file system
even if MEMORY_DISK_IS_ROOT is not defined (a runtime override).
2008-05-02 13:02:31 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad 27168d9d58 - Rename crit_enter/crit_exit to kpreempt_disable/kpreempt_enable.
DragonflyBSD uses the crit names for something quite different.
- Add a kpreempt_disabled function for diagnostic assertions.
- Add inline versions of kpreempt_enable/kpreempt_disable for primitives.
- Make some more changes for preemption safety to the x86 pmap.
2008-04-27 11:37:48 +00:00
cegger 224670ae98 use device_xname() where appropriate
OK martin
2008-04-04 20:13:18 +00:00
yamt a67bae0b7b - simplify ASSERT_SLEEPABLE.
- move it from proc.h to systm.h.
- add some more checks.
- make it a little more lkm friendly.
2008-03-17 08:27:50 +00:00
drochner 0e748e633e 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
2008-02-28 14:25:12 +00:00