diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-03-23 01:11:10 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-03-23 01:11:10 +0000 |
commit | 3a86d13e80538b80fe3c15581dde6988c3656138 (patch) | |
tree | 514cdc40a209ecedfb78cbdbf82876d060772a63 /sys/powerpc/aim | |
parent | c5da6703f515ef8f41371f20dd20099af86ab1d8 (diff) | |
download | FreeBSD-src-3a86d13e80538b80fe3c15581dde6988c3656138.zip FreeBSD-src-3a86d13e80538b80fe3c15581dde6988c3656138.tar.gz |
Open Firmware on powerpc is generally non-reetrant, so serialize all
OF calls with a mutex.
Diffstat (limited to 'sys/powerpc/aim')
-rw-r--r-- | sys/powerpc/aim/ofw_machdep.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/powerpc/aim/ofw_machdep.c b/sys/powerpc/aim/ofw_machdep.c index 6e27697..6e98f3e 100644 --- a/sys/powerpc/aim/ofw_machdep.c +++ b/sys/powerpc/aim/ofw_machdep.c @@ -63,6 +63,8 @@ __FBSDID("$FreeBSD$"); static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3]; static struct mem_region OFfree[OFMEM_REGIONS + 3]; +static struct mtx ofw_mutex; + struct mem_region64 { vm_offset_t mr_start_hi; vm_offset_t mr_start_lo; @@ -281,6 +283,8 @@ OF_bootstrap() { boolean_t status = FALSE; + mtx_init(&ofw_mutex, "open firmware", NULL, MTX_DEF); + if (ofwcall != NULL) { if (ofw_real_mode) status = OF_install(OFW_STD_REAL, 0); @@ -314,6 +318,8 @@ openfirmware(void *args) if (pmap_bootstrapped && ofw_real_mode) args = (void *)pmap_kextract((vm_offset_t)args); + mtx_lock(&ofw_mutex); + __asm __volatile( "\t" "sync\n\t" "mfmsr %0\n\t" @@ -366,6 +372,8 @@ openfirmware(void *args) : : "r" (oldmsr) ); + mtx_unlock(&ofw_mutex); + return (result); } |