⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hwxface.c

📁 Linux内核源代码 为压缩文件 是<<Linux内核>>一书中的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
		 *  we're done.		 */		if (throttle_state == 0) {			return (AE_OK);		}		/*		 *  Can't set this state		 */		return (AE_SUPPORT);	}	num_throttle_states = (u32) acpi_hw_local_pow (2,duty_width);	/*	 * Convert throttling state to duty cycle (invert).	 */	if (throttle_state > 0) {		duty_cycle = num_throttle_states - throttle_state;	}	/*	 *  Turn off throttling (don't muck with the h/w while throttling).	 */	acpi_hw_disable_throttling (cpu_obj->processor.address);	/*	 *  Program the throttling state.	 */	acpi_hw_program_duty_cycle (duty_offset, duty_cycle,			 cpu_obj->processor.address, num_throttle_states);	/*	 *  Only enable throttling for non-zero states (0 - 100%)	 */	if (throttle_state) {		acpi_hw_enable_throttling (cpu_obj->processor.address);	}	return(AE_OK);}/**************************************************************************** * * FUNCTION:    Acpi_get_processor_cx_info * * PARAMETERS:  Processor_handle    - handle for the cpu return info about *              User_buffer         - caller supplied buffer * * RETURN:      Status of function * * DESCRIPTION: Get Cx state latencies, this routine *              builds the data directly into the callers buffer * * ****************************************************************************/ACPI_STATUSacpi_get_processor_cx_info (	ACPI_HANDLE             processor_handle,	ACPI_BUFFER             *user_buffer){	ACPI_STATUS             status = AE_OK;	u32                     cx_state_latencies[4] = {0, 0, 0, 0};	NATIVE_UINT             buffer_space_needed = 0;	ACPI_CX_STATE           *state_ptr = NULL;	NATIVE_UINT             i = 0;	/*	 *  Have to at least have a buffer to return info in	 */	if (!user_buffer) {		return (AE_BAD_PARAMETER);	}	status = acpi_hw_get_cx_info (cx_state_latencies);	if (ACPI_FAILURE (status)) {		return (status);	}	buffer_space_needed = 4 * sizeof (ACPI_CX_STATE);	if ((user_buffer->length < buffer_space_needed) || !user_buffer->pointer) {		user_buffer->length = buffer_space_needed;		return (AE_BUFFER_OVERFLOW);	}	user_buffer->length = buffer_space_needed;	state_ptr = (ACPI_CX_STATE *) user_buffer->pointer;	for (i = 0; i < 4; i++) {		state_ptr[i].state_number = i;		state_ptr[i].latency = cx_state_latencies[i];	}	return (AE_OK);}/**************************************************************************** * * FUNCTION:    Acpi_set_processor_sleep_state * * PARAMETERS:  Processor_handle    - handle for the cpu return info about *              Cx_state            - the Cx sleeping state (C1-C3) to make *                                      'active' * * RETURN:      Status of function * * DESCRIPTION: Sets which Cx state will be used during calls to *              Acpi_processor_sleep () * ****************************************************************************/ACPI_STATUSacpi_set_processor_sleep_state (	ACPI_HANDLE             processor_handle,	u32                     cx_state){	ACPI_STATUS             status;	status = acpi_hw_set_cx (cx_state);	return (status);}/**************************************************************************** * * FUNCTION:    Acpi_processor_sleep * * PARAMETERS:  Processor_handle    - handle for the cpu to put to sleep (Cx) *              Time_sleeping       - time (in microseconds) elapsed while *                                      sleeping * * RETURN:      Status of function * * DESCRIPTION: Puts the processor into the currently active sleep state (Cx) * ****************************************************************************/ACPI_STATUSacpi_processor_sleep (	ACPI_HANDLE             processor_handle,	u32                     *pm_timer_ticks){	ACPI_NAMESPACE_NODE     *cpu_node = NULL;	ACPI_OPERAND_OBJECT     *cpu_obj = NULL;	ACPI_IO_ADDRESS         address = 0;	/*	 * Convert Processor_handle to Pblk_addres...	 */	/* Convert and validate the device handle */	cpu_node = acpi_ns_convert_handle_to_entry (processor_handle);	if (!cpu_node) {		return (AE_BAD_PARAMETER);	}   /* Check for an existing internal object */	cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node);	if (!cpu_obj) {		return (AE_NOT_FOUND);	}	/* Get the processor register block (P_BLK) address */	address = cpu_obj->processor.address;	if (!cpu_obj->processor.length) {		/* Ensure a NULL addresss (note that P_BLK isn't required for C1) */		address = 0;	}	/*	 * Enter the currently active Cx sleep state.	 */	return (acpi_hw_enter_cx (address, pm_timer_ticks));}/****************************************************************************** * * FUNCTION:    Acpi_get_timer * * PARAMETERS:  none * * RETURN:      Current value of the ACPI PMT (timer) * * DESCRIPTION: Obtains current value of ACPI PMT * ******************************************************************************/ACPI_STATUSacpi_get_timer (	u32                     *out_ticks){	if (!out_ticks) {		return (AE_BAD_PARAMETER);	}	*out_ticks = acpi_hw_pmt_ticks ();	return (AE_OK);}/****************************************************************************** * * FUNCTION:    Acpi_set_firmware_waking_vector * * PARAMETERS:  Physical_address    - Physical address of ACPI real mode *                                    entry point. * * RETURN:      AE_OK or AE_ERROR * * DESCRIPTION: Access function for d_firmware_waking_vector field in FACS * ******************************************************************************/ACPI_STATUSacpi_set_firmware_waking_vector (	ACPI_PHYSICAL_ADDRESS physical_address){	/* Make sure that we have an FACS */	if (!acpi_gbl_FACS) {		return (AE_NO_ACPI_TABLES);	}	/* Set the vector */	if (acpi_gbl_FACS->vector_width == 32) {		* (u32 *) acpi_gbl_FACS->firmware_waking_vector = (u32) physical_address;	}	else {		*acpi_gbl_FACS->firmware_waking_vector = physical_address;	}	return (AE_OK);}/****************************************************************************** * * FUNCTION:    Acpi_get_firmware_waking_vector * * PARAMETERS:  *Physical_address   - Output buffer where contents of *                                    the Firmware_waking_vector field of *                                    the FACS will be stored. * * RETURN:      Status * * DESCRIPTION: Access function for d_firmware_waking_vector field in FACS * ******************************************************************************/ACPI_STATUSacpi_get_firmware_waking_vector (	ACPI_PHYSICAL_ADDRESS *physical_address){	if (!physical_address) {		return (AE_BAD_PARAMETER);	}	/* Make sure that we have an FACS */	if (!acpi_gbl_FACS) {		return (AE_NO_ACPI_TABLES);	}	/* Get the vector */	if (acpi_gbl_FACS->vector_width == 32) {		*physical_address = * (u32 *) acpi_gbl_FACS->firmware_waking_vector;	}	else {		*physical_address = *acpi_gbl_FACS->firmware_waking_vector;	}	return (AE_OK);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -