freebsd-skq/sys/dev/ofw
marius 4b6458192f As it turns out, r186347 actually is insufficient to avoid the use of the
curthread-accessing part of mtx_{,un}lock(9) when using a r210623-style
curthread implementation on sparc64, crashing the kernel in its early
cycles as PCPU isn't set up, yet (and can't be set up as OFW is one of the
things we need for that, which leads to a chicken-and-egg problem). What
happens is that due to the fact that the idea of r210623 actually is to
allow the compiler to cache invocations of curthread, it factors out
obtaining curthread needed for both mtx_lock(9) and mtx_unlock(9) to
before the branch based on kobj_mutex_inited when compiling the kernel
without the debugging options. So change kobj_class_compile_static(9)
to just never acquire kobj_mtx, effectively restricting it to its
documented use, and add a kobj_init_static(9) for initializing objects
using a class compiled with the former and that also avoids using mutex(9)
(and malloc(9)). Also assert in both of these functions that they are
used in their intended way only.
While at it, inline kobj_register_method() and kobj_unregister_method()
as there wasn't much point for factoring them out in the first place
and so that a reader of the code has to figure out the locking for
fewer functions missing a KOBJ_ASSERT.
Tested on powerpc{,64} by andreast.

Reviewed by:	nwhitehorn (earlier version), jhb
MFC after:	3 days
2011-11-15 20:11:03 +00:00
..
ofw_bus_if.m
ofw_bus_subr.c Provide for multiple, cascaded PICs on PowerPC systems, and extend the 2010-06-18 14:06:27 +00:00
ofw_bus_subr.h Provide for multiple, cascaded PICs on PowerPC systems, and extend the 2010-06-18 14:06:27 +00:00
ofw_bus.h
ofw_console.c Follow up to r225203 refining break-to-debugger run-time configuration 2011-08-27 14:24:27 +00:00
ofw_disk.c Missed style fixes. 2009-06-14 00:15:26 +00:00
ofw_fdt.c FDT changes for 64 bit kernel 2011-10-17 13:44:33 +00:00
ofw_if.m Change OF_interpret() to also take an array of cell_t (missed in r209801). 2010-09-11 18:55:00 +00:00
ofw_iicbus.c bus_add_child: change type of order parameter to u_int 2010-09-10 11:19:03 +00:00
ofw_pci.h The NetBSD Foundation has granted permission to remove clause 3 and 4 from 2010-03-01 16:52:11 +00:00
ofw_standard.c Change OF_interpret() to also take an array of cell_t (missed in r209801). 2010-09-11 18:55:00 +00:00
ofwvar.h Fix style. 2009-06-14 00:05:38 +00:00
openfirm.c As it turns out, r186347 actually is insufficient to avoid the use of the 2011-11-15 20:11:03 +00:00
openfirm.h Missed a file in r209803: this header contains a definition of 2010-07-08 18:15:06 +00:00
openfirmio.c Fix style. 2009-06-14 00:05:38 +00:00
openfirmio.h
openpromio.c
openpromio.h