11c11
< 	November 16, 2008
---
> 	Feb 21, 2009
27,43c27,36
<     4.2.1 CPU idle notification information data structure
< 	typedef struct cpu_idle_info {
< 		int	 ci_flags;
< 		int	 ci_intr_count;	   /* Interrupt count. */
< 		int	 ci_idle_state;	   /* Idle state to enter. */
< 		hrtime_t ci_idle_latency;  /* Idle round trip latency. */
< 		hrtime_t ci_max_idle_time; /* Predicted max idle time. */
< 		hrtime_t ci_last_idle_time;/* Last idle period. */
< 		hrtime_t ci_last_busy_time;/* Last busy period. */
< 	} cpu_idle_info_t;
< 	This structure is used to pass CPU idle information to callbacks.
< 	It could be extended to support architecture/platform specific
< 	information in future.
< 	Valid flags for cpu_idle_info_t:
< 	    CPU_IDLE_CI_FLAG_IDLE_STATE: field ci_idle_state is valid.
< 	    CPU_IDLE_CI_FLAG_IDLE_LATENCY: field ci_idle_latency is valid.
< 	    CPU_IDLE_CB_FLAG_MAX_IDLE_TIME: field ci_max_idle_time is valid.
---
>     4.2.1 CPU idle notification data structure
> 	typedef void *	cpu_idle_callback_handle_t;
> 	typedef void *	cpu_idle_callback_context_t;
> 	typedef void *	cpu_idle_prop_handle_t;
> 	typedef union cpu_idle_prop_value {
> 		intptr_t	cipv_intptr;
> 		uint32_t	cipv_uint32;
> 		uint64_t	cipv_uint64;
> 		hrtime_t	cipv_hrtime;
> 	} cpu_idle_prop_value_t;
47c40
< 	    cpu_idle_info_t *infop);
---
> 	    cpu_idle_callback_context_t *ctxp);
49,51c42,45
< 	which applies to idle thread becuase it will be called in idle 
< 	thread context.
< 	Argument arg is the parameter passed in when registering callback.
---
> 	which applies to idle thread because it will be called in idle 
> 	thread context. And it may be called with interrupt enabled/disabled.
> 	arg is the parameter passed in when registering callback.
> 	ctxp is an opaque parameter which will be used to retrieve property.
54c48,49
< 	typedef void (*cpu_idle_exit_cbfn)(void *arg, int flags);
---
> 	typedef void (*cpu_idle_exit_cbfn)(void *arg, 
> 	    cpu_idle_callback_context_t *ctxp, int flags);
59c54,55
< 	Valid flags for exiting idle state notification callback:
---
> 	ctxp is an opaque parameter which will be used to retrieve property.
> 	flags for exiting idle state notification callback:
69a66,67
> 	Field version will be used to match cpu_idle_callback_t structure and 
> 	CPU idle notification framework.
73c71,72
< 	    cpu_idle_callback_t *callbackp, void *arg, void **hdlpp);
---
> 	    cpu_idle_callback_t *callbackp, void *arg,
> 	    cpu_idle_callback_handle_t *hdlp);
77,81c76,85
< 	reverse order when CPU exits idle state.
< 	Argument priority is used to determine the calling order of
< 	registered callbacks.
< 	Argument arg will be passed back to registered callback and how to
< 	use it is determined by callback.
---
> 	reverse order when CPU exits idle state. If CPU is predicted to sleep
> 	for a short time or be under heavy load, framework may skip calling 
> 	registered callbacks when entering/exiting idle state to avoid 
> 	overhead and reduce performance penalty. This interface shouldn't be 
> 	called from callback handlers.
> 	priority is used to determine calling order of registered callbacks.
> 	arg will be passed back to registered callback and how to use it is
> 	determined by callback.
> 	hdlp is used to stored created handle on success.
> 	It returns zero on success and error number on failure.
84,86c88,91
< 	int cpu_idle_unregister_callback(uint_t priority,
< 	    cpu_idle_callback_t *callbackp, void *arg, void *hdlp);
< 	This interface deregisters a registered callback.
---
> 	int cpu_idle_unregister_callback(cpu_idle_callback_handle_t hdlp);
> 	This interface deregisters a registered callback. It shouldn't be 
> 	called from callback handler.
> 	It returns zero on success and error number on failure.
89,90c94,95
< 	void cpu_idle_enter(cpu_idle_info_t *infop);
< 	This interface notifies idle notification subsystem that a specific
---
> 	void cpu_idle_enter(int state);
> 	This interface notifies CPU idle notification subsystem that a specific
91a97
> 	state is idle state CPU is going to enter.
96a103,105
> 	flags for exiting idle state:
> 	    CPU_IDLE_CB_FLAG_INTR: called in interrupt context
> 	    CPU_IDLE_CB_FLAG_IDLE: called in idle thread context
97a107,157
>     4.2.9. Get idle callback context for calling CPU
> 	cpu_idle_callback_context_t cpu_idle_get_context(void);
> 
>     4.2.10. Create property handle
> 	int cpu_idle_prop_create_handle(const char *propname,
> 	    cpu_idle_prop_handle_t *prophdl);
> 	This function creates a handle for specific property if it's supported.
> 	It returns zero on success or error code on failure.
> 
>     4.2.11. Set property value
> 	void cpu_idle_property_set(cpu_idle_prop_handle_t prophdl,
> 	    cpu_idle_callback_context_t ctx, cpu_idle_prop_value_t val);
> 	This function is used by property provider to set value for property.
> 
>     4.2.12. Get property value
> 	int cpu_idle_property_get(cpu_idle_prop_handle_t prophdl,
> 	    cpu_idle_callback_context_t ctx, cpu_idle_prop_value_t *valp);
> 	The function tries to get value of a property, it may fail in case that
> 	the property doesn't support fast access.
> 	It return zero on success and error number on failure.
> 
> 	uint32_t cpu_idle_prop_get_uint32(cpu_idle_prop_handle_t prophdl,
> 	    cpu_idle_callback_context_t ctx);
> 	uint64_t cpu_idle_prop_get_uint64(cpu_idle_prop_handle_t prophdl,
> 	    cpu_idle_callback_context_t ctx);
> 	intptr_t cpu_idle_prop_get_intptr(cpu_idle_prop_handle_t prophdl,
> 	    cpu_idle_callback_context_t ctx);
> 	hrtime_t cpu_idle_prop_get_hrtime(cpu_idle_prop_handle_t prophdl,
> 	    cpu_idle_callback_context_t ctx);
> 	This suite of functions retrieve value of property which supports 
> 	fast access.
> 
>     4.2.13. Supported properties
> 	All properties without special notes are per logical CPU statistics.
> 
> 	The framework supports following properties by default.
> 	______________________________________________________________________
> 	| Property Name   | Data Type | Fast   | Decription                   |
> 	|_________________|___________|_Access_|______________________________|
> 	| idle-state	  | int	      | Yes    | CPU Idle state to enter      |
> 	| idle-enter-ts	  | hrtime_t  | Yes    | Timestamp for entering idle  |
> 	| idle-exit-ts	  | hrtime_t  | Yes    | Timestamp for exiting idle   |
> 	| last-idle-time  | hrtime_t  | Yes    | Last idle period             |
> 	| last-busy-time  | hrtime_t  | Yes    | Last busy period             |
> 	| interrupt-count | uint64_t  | Yes    | Interrupt count in last busy |
> 	|_________________|___________|________| period_______________________|
> 
> 	Other property providers may add new properties to framework in future.
> 	For example, CPU power management driver may support "idle-latency",
> 	"max-idle-time" etc.
> 
103c163
<     6.6. ARC Exposure: open
---
>     6.6. ARC Exposure: open
