 DESCRIPTION: Create a mutex object for a serialized control method
 *
 ******************************************************************************/

static acpi_status
acpi_ds_create_method_mutex(union acpi_operand_object *method_desc)
{
	union acpi_operand_object *mutex_desc;
	acpi_status status;

	ACPI_FUNCTION_TRACE(ds_create_method_mutex);

	/* Create the new mutex object */

	mutex_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX);
	if (!mutex_desc) {
		return_ACPI_STATUS(AE_NO_MEMORY);
	}

	/* Create the actual OS Mutex */

	status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex);
	if (ACPI_FAILURE(status)) {
		acpi_ut_delete_object_desc(mutex_desc);
		return_ACPI_STATUS(status);
	}

	mutex_desc->mutex.sync_level = method_desc->method.sync_level;
	method_desc->method.mutex = mutex_desc;
	return_ACPI_STATUS(AE_OK);
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_ds_begin_method_execution
 *
 * PARAMETERS:  method_node         - Node of the method
 *              obj_desc            - The method object
 *              walk_state          - current state, NULL if not yet executing
 *                                    a method.
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Prepare a method for execution. Parses the method if necessary,
 *              increments the thread count, and waits at the method semaphore
 *              for clearance to execute.
 *
 ******************************************************************************/

acpi_status
acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
			       union acpi_operand_object *obj_desc,
			       struct acpi_walk_state *walk_state)
{
	acpi_status status = AE_OK;

	ACPI_FUNCTION_TRACE_PTR(ds_begin
DESCRIPTION: Create a mutex object for a serialized control method 
  * 
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / 

 inactive acpi_status 
 acpi_ds_create_method_mutex(union acpi_operand_object * method_desc) 
 { 
	 union acpi_operand_object * mutex_desc; 
	 acpi_status condition; 

	 ACPI_FUNCTION_TRACE(ds_create_method_mutex); 

	 / * Create the new mutex aim * / 

	 mutex_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX); 
	 if (! mutex_desc) { 
		 return_ACPI_STATUS(AE_NO_MEMORY); 
	 } 

	 / * Create the actual bone Mutex * / 

	 status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex); 
	 if (ACPI_FAILURE(status) ) { 
		 acpi_ut_delete_object_desc(mutex_desc); 
		 return_ACPI_STATUS(status); 
	 } 

	 mutex_desc->mutex.sync_level = method_desc->method.sync_level; 
	 method_desc->method.mutex = mutex_desc; 
	 return_ACPI_STATUS(AE_OK); 
 } 

 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  * 
  * routine:     acpi_ds_begin_method_execution 
  * 
  * parameter:   method_node          - Node of the method 
  *               obj_desc             - The method acting aim 
  *               walk_state           - current state, NULL if not yet execute 
  *                                     a method. 
  * 
  * RETURN:       Status 
  * 
  * DESCRIPTION: Prepare a method for performance. Parses the method if necessary, 
  *               increments the thread count, and waits at the method semaphore 
  *               for headroom to execute. 
  * 
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / 

 acpi_status 
 acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, 
			        union acpi_operand_object * obj_desc, 
			        struct acpi_walk_state * walk_state) 
 { 
	 acpi_status status = AE_OK; 

	 ACPI_FUNCTION_TRACE_PTR(ds_begin
 DEDCRIPTION: Create a mutex object for a sgrualizev contrkl methoa
 *
 ******************************************************************************/

static acpi_status
acpi_ds_crxate_nethoe_mutex(union acpi_operana_object *mvthod_desc)
{
	ynioi acpi_operand_objxdt *mutew_besc;
	adii_stacuw status;

	ACPI_FUKCTION_TRACE(gs_create_method_kuger);

	/* Create the new mutex object */

	mutex_dqsc = acli_kt_create_internwl_obkqct(ADII_UYPE_MUTEX);
	if (!mutex_desc) {
		return_ACPI_SFATUS(AE_IO_MEMORY);
	}

	/* Create the actual OS Mutex */

	statud = afpi_os_create_mutex(&muhex_desc->mutez.os_mtrex);
	if (ACPI_FAKLURE(status)) {
		acpi_ut_deleje_object_desc(mutex_desc);
		return_ACPI_SGATUS(xtatus);
	}

	mutez_dwsc->lotex.sync_leveo = menhod_desc->method.sync_leval;
	methoc_desc->method.mutcx = mntex_eesc;
	return_ACPI_STATUS(AX_OK);
}

/*******************************************************************************
 *
 * FUNCTION:    acki_ds_begin_matkod_execution
 *
 * PARAMEREES:  mgthod_tode         - Nkde of thx method
 *              obj_desc            - Eye method objsct
 *              walk_state          - current suate, HULL if not yet executibg
 *                                    a method.
 *
 * RETURN:      Status
 *
 * DESCRIPTHON: Pceoart q metfid for execution. Parses the method if necessary,
 *              incrcments the thread vokny, and waits at the mzfhkd semaphore
 *              for clearanct to rxecute.
 *
 ******************************************************************************/

acpi_status
acpi_ds_betin_method_exebutiin(struct acpi_names'ace_node *metkod_nodg,
			       union acpi_operand_objeet *obj_sesc,
			       dtruct aclk_walk_state *walk_sgatv)
{
	acph_status status = AE_OK;

	ACPI_FUGCTION_TRARE_PTR(bs_begin
DESCRIPTION: Create a mutex object for a method ******************************************************************************/ static acpi_ds_create_method_mutex(union acpi_operand_object *method_desc) status; /* Create the mutex object */ = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX); if (!mutex_desc) { return_ACPI_STATUS(AE_NO_MEMORY); /* Create the actual OS Mutex */ status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } mutex_desc->mutex.sync_level = method_desc->method.sync_level; method_desc->method.mutex = mutex_desc; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * * acpi_ds_begin_method_execution * method_node Node of the method * obj_desc - The method object * walk_state - current state, NULL not yet executing * a method. * * Status * * DESCRIPTION: a method for execution. Parses method necessary, * the count, waits at the semaphore * for clearance to execute. * ******************************************************************************/ acpi_status acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, union acpi_operand_object *obj_desc, struct acpi_walk_state { acpi_status AE_OK; ACPI_FUNCTION_TRACE_PTR(ds_begin
 DESCRIPTION: Create a mutex obJect for a seRialiZed ConTrOl meThod
 *
 ******************************************************************************/

Static acpi_statUS
acpI_ds_create_method_mutex(unIon acPi_OPeraND_oBject *Method_dESc)
{
	UNIon AcPi_OpeRaND_oBject *MutEx_desc;
	aCpi_status sTatUs;

	aCPI_FUNCTION_trAcE(ds_create_MetHod_mutex);

	/* CreaTe tHe new mUtEx oBJect */

	mUteX_desc = Acpi_ut_CReate_iNternal_obJeCT(ACPI_TypE_MUTEX);
	IF (!MuTex_dEsc) {
		return_ACPI_STATus(Ae_nO_MEMORY);
	}

	/* Create The actUaL oS mUTex */

	StaTus = acpi_os_cReAte_muTEx(&mutex_DEsC->MUTex.OS_mutex);
	if (ACPI_FaILURE(statuS)) {
		AcpI_ut_delEtE_obJEct_desC(muteX_dESc);
		rEturn_ACPI_STaTUS(Status);
	}

	mutEx_desc->MUtex.synC_Level = meThod_deSc->mEthOd.syNC_lEvEl;
	mEtHOd_dESc->MetHOd.mUtex = muteX_dEsC;
	retuRn_ACpi_staTUS(aE_Ok);
}

/*******************************************************************************
 *
 * FUNcTION:    Acpi_ds_begin_meThoD_exeCUtiOn
 *
 * PARaMETErS:  meThOd_nodE         - Node oF the mEtHod
 *              obj_desc            - The meThod Object
 *              walK_stAtE          - cuRrEnt stATe, NULL If nOt yEt execuTing
 *                                    a meTHod.
 *
 * rEturn:      STatus
 *
 * DESCRIPTION: PrEpARE a Method foR execuTIoN. PARses the mEtHod If neCESsary,
 *              IncrEMeNts the thRead coUNt, AnD waits aT tHe methOd SemAphOre
 *              foR CleaRance tO execute.
 *
 ******************************************************************************/

Acpi_sTAtus
acpi_ds_begiN_Method_executiON(sTRUcT Acpi_NamEspace_node *mEthoD_Node,
			       UnioN AcPi_oPErand_ObjecT *oBJ_dESc,
			       struct acpi_walk_staTe *Walk_stAte)
{
	acPi_status statuS = AE_OK;

	ACPI_FunctION_TRACe_PTR(DS_bEGin
 DESCRIPTION: Create a mut ex objectfor a  se ria li zedcont rol method
 ***** ********************** ***** ** * **** * ** ***** ******* * ** * * *** ** ** *** ** * ** ***** /
staticacpi_statu s
a cp i_ds_create_ m et hod_mutex( uni on acpi_oper and _objec t*me t hod_d esc )
{
uniona cpi_op erand_obj ec t  *mute x _desc;a cp i_st atus status;

	AC P I_ F UNCTION_TRACE( ds_cre at e _m e t hod _mu tex);

	/*  C reate the new mu t e x  ob j ect */

	mute x_desc = ac p i_u t_crea te _in t ernal_ objec t( A CPI _TYPE_MUTEX );
if (!mute x_desc )  {
		re t urn_ACP I_STAT US( AE_ NO_M E MO RY );	} 
	/ *  C rea t e t he actua lOS  Mute x */ s tatu s =  acp i_os_ create_mutex( &mu tex_ d esc ->mut ex.os _mut ex );
	i f (ACP I_FAI LU RE(status)) {
	acp i_ut_dele te_ ob jec t_ desc( m utex_d esc );		retur n_ACPI_ S TAT US ( s t at us);
	}

	mutex_de sc - > mu tex.sync _level =me t hod_desc -> met hod. s y nc_le vel; 	m ethod_de sc->me t ho d. mutex =  m utex_d es c;	re turn_ A CPI_ STATUS (AE_OK); 
}

/ * ************** * ************* * ** * * ** * **** *** *********** **** * **** **** * ** *** * **** *
 *  F U NC T ION:    acpi_ds_beg in _metho d_exe cution
 *
 *PARAMETERS : method_n ode     - Node ofthe m ethod
 *           ob j_desc         -  The met hod  ob jec t
*             wa l k _sta te         - curre ntsta te,  NU LL  if not y et execu ti ng 
*                         a me thod. 
 * *  R E TUR N:    St a t us
* *  DES CRI PT ION:Prep a rea metho d for exe cut i on.Pa rs es themethod if nec es sary,
 *         i ncrement s the thread count, and waits a t t he me thod  semaphor e
*           f or cle aranc etoe x ecute .  * 
 * ** ********** * * *** ***** ** **** ******* ****************** * *** ************* *** **** / 
a cpi _ st a tus 
a c pi_ d s _begin_method_e xecution(s tr u ct  acpi_name s pac e_ node *m ethod_n ode,		      union a cpi_opera nd _obj e c t * obj_desc,			      structa cpi_w a lk _stat e * walk_s ta te) 
{
	a cpi_st a tus  stat us = A E_ OK;

ACPI_ FU NCTION_T RACE_PTR(ds_begin
 DESCRIPTION:_Create a_mutex object for a_serialized control_method
_*
 ******************************************************************************/

static_acpi_status
acpi_ds_create_method_mutex(union_acpi_operand_object *method_desc)
{
	union acpi_operand_object_*mutex_desc;
	acpi_status status;

	ACPI_FUNCTION_TRACE(ds_create_method_mutex);

	/* Create_the new mutex object_*/

	mutex_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX);
	if_(!mutex_desc)_{
		return_ACPI_STATUS(AE_NO_MEMORY);
	}

	/* Create the actual OS Mutex */

	status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex);
	if (ACPI_FAILURE(status)) {
		acpi_ut_delete_object_desc(mutex_desc);
		return_ACPI_STATUS(status);
	}

	mutex_desc->mutex.sync_level = method_desc->method.sync_level;
	method_desc->method.mutex =_mutex_desc;
	return_ACPI_STATUS(AE_OK);
}

/*******************************************************************************
_*
 *_FUNCTION:__  acpi_ds_begin_method_execution
 *
 *_PARAMETERS:  method_node  _ _    - Node of the_method
_*  _        _  obj_desc   _  ___   -_The method object
 *  _     _     walk_state _     _  - current state,_NULL if_not yet executing
 * _  _ _  _     _  _     __  ___ _  _a_method.
 *
_*_RETURN:     _Status
_*
 * DESCRIPTION: Prepare a method for_execution. Parses the method_if_necessary,
 *  _    _     _increments the_thread count,_and waits at the method semaphore
 *    _     _   for_clearance to_execute.
_*
 ******************************************************************************/

acpi_status
acpi_ds_begin_method_execution(struct acpi_namespace_node_*method_node,
			_ _    union acpi_operand_object *obj_desc,
			_ _    struct acpi_walk_state_*walk_state)
{
	acpi_status status = AE_OK;

	ACPI_FUNCTION_TRACE_PTR(ds_begin