[Cbe-oss-dev] [PATCH][RFC]libspe2: add SPE_CPU_TYPE query to spe_cpu_info_get

Kazunori Asayama asayama at sm.sony.co.jp
Fri Sep 19 23:10:54 EST 2008


D. Herrendoerfer wrote:
> This patch adds the SPE_CPU_TYPE query to the
> spe_cpu_info_get() function. The list of EDP
> capable CPUs is quite short, if anyone has 
> more information about PVR values please send them
> to me.

(snip)

> --- libspe2/spebase/info.c	(revision 133)
> +++ libspe2/spebase/info.c	(working copy)
> @@ -103,6 +103,24 @@ int _base_spe_count_physical_spes(int cp
>  	return ret;
>  }
>  
> +/* Since there are no mixed-type CPU systems at this time the cpu node
> + * is currently ignored, and a result is generated that returns the 
> + * feature set of the currently running CPU.
> + */
> +int _base_spe_read_cpu_type(int cpu_node)
> +{
> +	unsigned long pvr;
> +	int i=0;
> +	
> +	asm volatile ("mfpvr    %0" : "=r"(pvr));
> +	
> +	while (pvr_list_edp[i] != 0) {
> +		if (pvr_list_edp[i++] == pvr)
> +			return SPE_CPU_IS_CELLEDP;
> +	}
> +	
> +	return SPE_CPU_IS_CELLBE;
> +}
>  
>  int _base_spe_cpu_info_get(int info_requested, int cpu_node) {
>  	int ret = 0;
> @@ -118,6 +136,9 @@ int _base_spe_cpu_info_get(int info_requ
>  	case SPE_COUNT_USABLE_SPES:
>  		ret = _base_spe_count_usable_spes(cpu_node);
>  		break;
> +	case SPE_CPU_TYPE:
> +		ret = (_base_spe_read_cpu_type(cpu_node) == 0);
> +		break;

I think _base_spe_cpu_info_get() should just return
_base_spe_read_cpu_type()'s return value.

>  	default:
>  		errno = EINVAL;
>  		ret = -1;

-- 
(ASAYAMA Kazunori
  (asayama at sm.sony.co.jp))
t



More information about the cbe-oss-dev mailing list