ia64/linux-2.6.18-xen.hg

changeset 681:cc6fc966c613

X86 and IA64: move px external logical to common place

this patch move the xen/acpi convert routine to common place,
since it can be used by both x86 and ia64 architecture.

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Sep 26 14:07:10 2008 +0100 (2008-09-26)
parents 583086d5cd26
children fba34c7b1c97
files arch/i386/kernel/acpi/processor_extcntl_xen.c include/acpi/processor.h
line diff
     1.1 --- a/arch/i386/kernel/acpi/processor_extcntl_xen.c	Thu Sep 25 16:40:13 2008 +0100
     1.2 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c	Fri Sep 26 14:07:10 2008 +0100
     1.3 @@ -101,44 +101,6 @@ static int xen_cx_notifier(struct acpi_p
     1.4  	return ret;
     1.5  }
     1.6  
     1.7 -static void convert_pct_reg(struct xen_pct_register *xpct,
     1.8 -	struct acpi_pct_register *apct)
     1.9 -{
    1.10 -	xpct->descriptor = apct->descriptor;
    1.11 -	xpct->length     = apct->length;
    1.12 -	xpct->space_id   = apct->space_id;
    1.13 -	xpct->bit_width  = apct->bit_width;
    1.14 -	xpct->bit_offset = apct->bit_offset;
    1.15 -	xpct->reserved   = apct->reserved;
    1.16 -	xpct->address    = apct->address;
    1.17 -}
    1.18 -
    1.19 -static void convert_pss_states(struct xen_processor_px *xpss, 
    1.20 -	struct acpi_processor_px *apss, int state_count)
    1.21 -{
    1.22 -	int i;
    1.23 -	for(i=0; i<state_count; i++) {
    1.24 -		xpss->core_frequency     = apss->core_frequency;
    1.25 -		xpss->power              = apss->power;
    1.26 -		xpss->transition_latency = apss->transition_latency;
    1.27 -		xpss->bus_master_latency = apss->bus_master_latency;
    1.28 -		xpss->control            = apss->control;
    1.29 -		xpss->status             = apss->status;
    1.30 -		xpss++;
    1.31 -		apss++;
    1.32 -	}
    1.33 -}
    1.34 -
    1.35 -static void convert_psd_pack(struct xen_psd_package *xpsd,
    1.36 -	struct acpi_psd_package *apsd)
    1.37 -{
    1.38 -	xpsd->num_entries    = apsd->num_entries;
    1.39 -	xpsd->revision       = apsd->revision;
    1.40 -	xpsd->domain         = apsd->domain;
    1.41 -	xpsd->coord_type     = apsd->coord_type;
    1.42 -	xpsd->num_processors = apsd->num_processors;
    1.43 -}
    1.44 -
    1.45  static int xen_px_notifier(struct acpi_processor *pr, int action)
    1.46  {
    1.47  	int ret = -EINVAL;
    1.48 @@ -179,20 +141,20 @@ static int xen_px_notifier(struct acpi_p
    1.49  		perf->platform_limit = pr->performance_platform_limit;
    1.50  
    1.51  		/* pct */
    1.52 -		convert_pct_reg(&perf->control_register, &px->control_register);
    1.53 -		convert_pct_reg(&perf->status_register, &px->status_register);
    1.54 +		xen_convert_pct_reg(&perf->control_register, &px->control_register);
    1.55 +		xen_convert_pct_reg(&perf->status_register, &px->status_register);
    1.56  
    1.57  		/* pss */
    1.58  		perf->state_count = px->state_count;
    1.59  		states = kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL);
    1.60  		if (!states)
    1.61  			return -ENOMEM;
    1.62 -		convert_pss_states(states, px->states, px->state_count);
    1.63 +		xen_convert_pss_states(states, px->states, px->state_count);
    1.64  		set_xen_guest_handle(perf->states, states);
    1.65  
    1.66  		/* psd */
    1.67  		pdomain = &px->domain_info;
    1.68 -		convert_psd_pack(&perf->domain_info, pdomain);
    1.69 +		xen_convert_psd_pack(&perf->domain_info, pdomain);
    1.70  		if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
    1.71  			perf->shared_type = CPUFREQ_SHARED_TYPE_ALL;
    1.72  		else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
     2.1 --- a/include/acpi/processor.h	Thu Sep 25 16:40:13 2008 +0100
     2.2 +++ b/include/acpi/processor.h	Fri Sep 26 14:07:10 2008 +0100
     2.3 @@ -422,4 +422,45 @@ static inline int processor_extcntl_prep
     2.4  }
     2.5  #endif /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */
     2.6  
     2.7 +#ifdef CONFIG_XEN
     2.8 +static inline void xen_convert_pct_reg(struct xen_pct_register *xpct,
     2.9 +	struct acpi_pct_register *apct)
    2.10 +{
    2.11 +	xpct->descriptor = apct->descriptor;
    2.12 +	xpct->length     = apct->length;
    2.13 +	xpct->space_id   = apct->space_id;
    2.14 +	xpct->bit_width  = apct->bit_width;
    2.15 +	xpct->bit_offset = apct->bit_offset;
    2.16 +	xpct->reserved   = apct->reserved;
    2.17 +	xpct->address    = apct->address;
    2.18 +}
    2.19 +
    2.20 +static inline void xen_convert_pss_states(struct xen_processor_px *xpss, 
    2.21 +	struct acpi_processor_px *apss, int state_count)
    2.22 +{
    2.23 +	int i;
    2.24 +	for(i=0; i<state_count; i++) {
    2.25 +		xpss->core_frequency     = apss->core_frequency;
    2.26 +		xpss->power              = apss->power;
    2.27 +		xpss->transition_latency = apss->transition_latency;
    2.28 +		xpss->bus_master_latency = apss->bus_master_latency;
    2.29 +		xpss->control            = apss->control;
    2.30 +		xpss->status             = apss->status;
    2.31 +		xpss++;
    2.32 +		apss++;
    2.33 +	}
    2.34 +}
    2.35 +
    2.36 +static inline void xen_convert_psd_pack(struct xen_psd_package *xpsd,
    2.37 +	struct acpi_psd_package *apsd)
    2.38 +{
    2.39 +	xpsd->num_entries    = apsd->num_entries;
    2.40 +	xpsd->revision       = apsd->revision;
    2.41 +	xpsd->domain         = apsd->domain;
    2.42 +	xpsd->coord_type     = apsd->coord_type;
    2.43 +	xpsd->num_processors = apsd->num_processors;
    2.44 +}
    2.45 +
    2.46 +#endif /* CONFIG_XEN */
    2.47 +
    2.48  #endif