17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*2df1fe9cSrandyf * Common Development and Distribution License (the "License"). 6*2df1fe9cSrandyf * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21*2df1fe9cSrandyf 227c478bd9Sstevel@tonic-gate /* 23*2df1fe9cSrandyf * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #include <sys/promif.h> 307c478bd9Sstevel@tonic-gate #include <sys/promimpl.h> 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate /* 337c478bd9Sstevel@tonic-gate * This function is installed for both pre and post output during cpr to keep 347c478bd9Sstevel@tonic-gate * the early stages of the resuming kernel from accessing outside the nucleus 357c478bd9Sstevel@tonic-gate * mapping; we assert that the console is all powered up before it is installed 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate static void null_outfunc(void)387c478bd9Sstevel@tonic-gatenull_outfunc(void) 397c478bd9Sstevel@tonic-gate { 407c478bd9Sstevel@tonic-gate } 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate static promif_owrap_t nullwrapper = 437c478bd9Sstevel@tonic-gate { 447c478bd9Sstevel@tonic-gate null_outfunc, 457c478bd9Sstevel@tonic-gate null_outfunc 467c478bd9Sstevel@tonic-gate }; 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate static promif_owrap_t *wrapper = &nullwrapper; 497c478bd9Sstevel@tonic-gate static promif_owrap_t pmwrapper; 50*2df1fe9cSrandyf static promif_owrap_t *saved_wrapper; 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate promif_owrap_t promif_preout(void)537c478bd9Sstevel@tonic-gate*promif_preout(void) 547c478bd9Sstevel@tonic-gate { 557c478bd9Sstevel@tonic-gate promif_owrap_t *ow = wrapper; 567c478bd9Sstevel@tonic-gate (ow->preout)(); 577c478bd9Sstevel@tonic-gate return (ow); 587c478bd9Sstevel@tonic-gate } 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate void promif_postout(promif_owrap_t * ow)617c478bd9Sstevel@tonic-gatepromif_postout(promif_owrap_t *ow) 627c478bd9Sstevel@tonic-gate { 637c478bd9Sstevel@tonic-gate (ow->postout)(); 647c478bd9Sstevel@tonic-gate } 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate void prom_set_outfuncs(void (* pref)(void),void (* postf)(void))677c478bd9Sstevel@tonic-gateprom_set_outfuncs(void (*pref)(void), void (*postf)(void)) 687c478bd9Sstevel@tonic-gate { 697c478bd9Sstevel@tonic-gate pmwrapper.preout = pref; 707c478bd9Sstevel@tonic-gate pmwrapper.postout = postf; 717c478bd9Sstevel@tonic-gate wrapper = &pmwrapper; 727c478bd9Sstevel@tonic-gate } 73*2df1fe9cSrandyf 74*2df1fe9cSrandyf void prom_suspend_prepost(void)75*2df1fe9cSrandyfprom_suspend_prepost(void) 76*2df1fe9cSrandyf { 77*2df1fe9cSrandyf saved_wrapper = wrapper; 78*2df1fe9cSrandyf wrapper = &nullwrapper; 79*2df1fe9cSrandyf } 80*2df1fe9cSrandyf 81*2df1fe9cSrandyf void prom_resume_prepost(void)82*2df1fe9cSrandyfprom_resume_prepost(void) 83*2df1fe9cSrandyf { 84*2df1fe9cSrandyf wrapper = saved_wrapper; 85*2df1fe9cSrandyf saved_wrapper = NULL; 86*2df1fe9cSrandyf } 87