ACPI & driver patches for 2.6.30-rc0
Subsystems (11)
Len Brown
reviewerThe following patches are staged for 2.6.30, please speak up if you see issues with any of them.
thanks,
-Len Brown, Intel Open Source Technology Center
Len Brown
reviewerPATCH 1/98 thermal: use integers rather than strings for thermal values
From: Matthew Garrett <[email protected]>
The thermal API currently uses strings to pass values to userspace. This makes it difficult to use from within the kernel. Change the interface to use integers and fix up the consumers.
--- drivers/acpi/fan.c | 20 +++++--- drivers/acpi/processor_thermal.c | 20 ++++---- drivers/acpi/thermal.c | 80 +++++++++++++++++++----------- drivers/acpi/video.c | 22 +++++---- drivers/platform/x86/intel_menlow.c | 29 ++++------- drivers/thermal/thermal_sys.c | 91 ++++++++++++++++++++++++++++++----- include/linux/thermal.h | 32 +++++++++--- 7 files changed, 198 insertions(+), 96 deletions(-)
drivers/acpi/fan.c +12 -8
@@ -68,31 +68,35 @@ static struct acpi_driver acpi_fan_driver = { };/* thermal cooling device callbacks */ -static int fan_get_max_state (struct thermal_cooling_device *cdev,char *buf) +static int fan_get_max_state (struct thermal_cooling_device *cdev,unsigned long + *state) {/* ACPI fan device only support two states: ON/OFF */ -return sprintf (buf,"1\n" ); + *state =1 ; +return 0 ; } -static int fan_get_cur_state (struct thermal_cooling_device *cdev,char *buf) +static int fan_get_cur_state (struct thermal_cooling_device *cdev,unsigned long + *state) {struct acpi_device *device = cdev->devdata; -int state;int result; +int acpi_state;if (!device)return -EINVAL ; - result =acpi_bus_get_power (device->handle, &state); + result =acpi_bus_get_power (device->handle, &acpi_state);if (result)return result; -return sprintf (buf,"%s\n" , state ==ACPI_STATE_D3 ?"0" : - (state ==ACPI_STATE_D0 ?"1" :"unknown" )); + *state = (acpi_state ==ACPI_STATE_D3 ?0 : + (acpi_state ==ACPI_STATE_D0 ?1 :-1 )); +return 0 ; }static int -fan_set_cur_state (struct thermal_cooling_device *cdev,unsigned int state) +fan_set_cur_state (struct thermal_cooling_device *cdev,unsigned long state) {struct acpi_device *device = cdev->devdata;int result;
drivers/acpi/processor_thermal.c +11 -9
@@ -373,7 +373,8 @@ static int acpi_processor_max_state(struct acpi_processor *pr)return max_state; }static int -processor_get_max_state (struct thermal_cooling_device *cdev,char *buf) +processor_get_max_state (struct thermal_cooling_device *cdev, +unsigned long *state) {struct acpi_device *device = cdev->devdata;struct acpi_processor *pr =acpi_driver_data (device);
@@ -381,28 +382,29 @@ processor_get_max_state(struct thermal_cooling_device *cdev, char *buf)if (!device || !pr)return -EINVAL ; -return sprintf (buf,"%d\n" ,acpi_processor_max_state (pr)); + *state =acpi_processor_max_state (pr); +return 0 ; }static int -processor_get_cur_state (struct thermal_cooling_device *cdev,char *buf) +processor_get_cur_state (struct thermal_cooling_device *cdev, +unsigned long *cur_state) {struct acpi_device *device = cdev->devdata;struct acpi_processor *pr =acpi_driver_data (device); -int cur_state;if (!device || !pr)return -EINVAL ; - cur_state =cpufreq_get_cur_state (pr->id); + *cur_state =cpufreq_get_cur_state (pr->id);if (pr->flags.throttling) - cur_state += pr->throttling.state; - -return sprintf (buf,"%d\n" , cur_state); + *cur_state += pr->throttling.state; +return 0 ; }static int -processor_set_cur_state (struct thermal_cooling_device *cdev,unsigned int state) +processor_set_cur_state (struct thermal_cooling_device *cdev, +unsigned long state) {struct acpi_device *device = cdev->devdata;struct acpi_processor *pr =acpi_driver_data (device);
drivers/acpi/thermal.c +50 -30
163 lines not on this page · raw message
drivers/acpi/video.c +13 -9
@@ -358,32 +358,36 @@ static struct output_properties acpi_output_properties = {/* thermal cooling device callbacks */ -static int video_get_max_state (struct thermal_cooling_device *cdev,char *buf) +static int video_get_max_state (struct thermal_cooling_device *cdev,unsigned +long *state) {struct acpi_device *device = cdev->devdata;struct acpi_video_device *video =acpi_driver_data (device); -return sprintf (buf,"%d\n" , video->brightness->count -3 ); + *state = video->brightness->count -3 ; +return 0 ; } -static int video_get_cur_state (struct thermal_cooling_device *cdev,char *buf) +static int video_get_cur_state (struct thermal_cooling_device *cdev,unsigned +long *state) {struct acpi_device *device = cdev->devdata;struct acpi_video_device *video =acpi_driver_data (device);unsigned long long level; -int state; +int offset;acpi_video_device_lcd_get_level_current (video, &level); -for (state =2 ; state < video->brightness->count; state++) -if (level == video->brightness->levels[state]) -return sprintf (buf,"%d\n" , - video->brightness->count - state -1 ); +for (offset =2 ; offset < video->brightness->count; offset++) +if (level == video->brightness->levels[offset]) { + *state = video->brightness->count - offset -1 ; +return 0 ; + }return -EINVAL ; }static int -video_set_cur_state (struct thermal_cooling_device *cdev,unsigned int state) +video_set_cur_state (struct thermal_cooling_device *cdev,unsigned long state) {struct acpi_device *device = cdev->devdata;struct acpi_video_device *video =acpi_driver_data (device);
drivers/platform/x86/intel_menlow.c +10 -19
@@ -57,8 +57,8 @@ MODULE_LICENSE("GPL");* In that case max_cstate would be n-1 * GTHS returning '0' would mean that no bandwidth control states are supported */ -static int memory_get_int_max_bandwidth (struct thermal_cooling_device *cdev, -unsigned long *max_state) +static int memory_get_max_bandwidth (struct thermal_cooling_device *cdev, +unsigned long *max_state) {struct acpi_device *device = cdev->devdata;acpi_handle handle = device->handle;
@@ -83,22 +83,12 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev,return 0 ; } -static int memory_get_max_bandwidth (struct thermal_cooling_device *cdev, -char *buf) -{ -unsigned long value; -if (memory_get_int_max_bandwidth (cdev, &value)) -return -EINVAL ; - -return sprintf (buf,"%ld\n" , value); -} -static int memory_get_cur_bandwidth (struct thermal_cooling_device *cdev, -char *buf) +unsigned long *value) {struct acpi_device *device = cdev->devdata;acpi_handle handle = device->handle; -unsigned long long value; +unsigned long long result;struct acpi_object_list arg_list;union acpi_object arg;acpi_status status =AE_OK ;
@@ -108,15 +98,16 @@ static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev, arg.type =ACPI_TYPE_INTEGER ; arg.integer.value =MEMORY_ARG_CUR_BANDWIDTH ; status =acpi_evaluate_integer (handle,MEMORY_GET_BANDWIDTH , - &arg_list, &value); + &arg_list, &result);if (ACPI_FAILURE (status))return -EFAULT ; -return sprintf (buf,"%llu\n" , value); + *value = result; +return 0 ; }static int memory_set_cur_bandwidth (struct thermal_cooling_device *cdev, -unsigned int state) +unsigned long state) {struct acpi_device *device = cdev->devdata;acpi_handle handle = device->handle;
@@ -126,7 +117,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,unsigned long long temp;unsigned long max_state; -if (memory_get_int_max_bandwidth (cdev, &max_state)) +if (memory_get_max_bandwidth (cdev, &max_state))return -EFAULT ;if (state > max_state)
@@ -142,7 +133,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev, &temp);printk (KERN_INFO -"Bandwidth value was %d: status is %d\n" , state, status); +"Bandwidth value was %ld: status is %d\n" , state, status);if (ACPI_FAILURE (status))return -EFAULT ;
drivers/thermal/thermal_sys.c +78 -13
182 lines not on this page · raw message
include/linux/thermal.h +24 -8
@@ -31,23 +31,39 @@struct thermal_zone_device ;struct thermal_cooling_device ; +enum thermal_device_mode { +THERMAL_DEVICE_DISABLED =0 , +THERMAL_DEVICE_ENABLED , +}; + +enum thermal_trip_type { +THERMAL_TRIP_ACTIVE =0 , +THERMAL_TRIP_PASSIVE , +THERMAL_TRIP_HOT , +THERMAL_TRIP_CRITICAL , +}; +struct thermal_zone_device_ops {int (*bind) (struct thermal_zone_device *,struct thermal_cooling_device *);int (*unbind) (struct thermal_zone_device *,struct thermal_cooling_device *); -int (*get_temp) (struct thermal_zone_device *,char *); -int (*get_mode) (struct thermal_zone_device *,char *); -int (*set_mode) (struct thermal_zone_device *,const char *); -int (*get_trip_type) (struct thermal_zone_device *,int ,char *); -int (*get_trip_temp) (struct thermal_zone_device *,int ,char *); +int (*get_temp) (struct thermal_zone_device *,unsigned long *); +int (*get_mode) (struct thermal_zone_device *, +enum thermal_device_mode *); +int (*set_mode) (struct thermal_zone_device *, +enum thermal_device_mode ); +int (*get_trip_type) (struct thermal_zone_device *,int , +enum thermal_trip_type *); +int (*get_trip_temp) (struct thermal_zone_device *,int , +unsigned long *);int (*get_crit_temp) (struct thermal_zone_device *,unsigned long *); };struct thermal_cooling_device_ops { -int (*get_max_state) (struct thermal_cooling_device *,char *); -int (*get_cur_state) (struct thermal_cooling_device *,char *); -int (*set_cur_state) (struct thermal_cooling_device *,unsigned int ); +int (*get_max_state) (struct thermal_cooling_device *,unsigned long *); +int (*get_cur_state) (struct thermal_cooling_device *,unsigned long *); +int (*set_cur_state) (struct thermal_cooling_device *,unsigned long ); };#define THERMAL_TRIPS_NONE -1
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 2/98 ACPI: move thermal trip handling to generic thermal layer
In reply to Len BrownFrom: Matthew Garrett <[email protected]>
The ACPI code currently carries its own thermal trip handling, meaning that any other thermal implementation will need to reimplement it. Move the code to the generic thermal layer.
--- drivers/acpi/thermal.c | 458 +++++------------------------------------ drivers/thermal/thermal_sys.c | 188 +++++++++++++++++- include/linux/thermal.h | 15 ++- 3 files changed, 248 insertions(+), 413 deletions(-)
drivers/acpi/thermal.c +48 -410
@@ -37,7 +37,6 @@#include <linux/init.h> #include <linux/types.h> #include <linux/proc_fs.h> -#include <linux/timer.h> #include <linux/jiffies.h> #include <linux/kmod.h> #include <linux/seq_file.h>
@@ -190,7 +189,6 @@ struct acpi_thermal {struct acpi_thermal_state state;struct acpi_thermal_trips trips;struct acpi_handle_list devices; -struct timer_list timer;struct thermal_zone_device *thermal_zone;int tz_enabled;struct mutex lock;
@@ -290,6 +288,11 @@ static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) tz->polling_frequency = seconds *10 ;/* Convert value to deci-seconds */ + tz->thermal_zone->polling_delay = seconds *1000 ; + +if (tz->tz_enabled) +thermal_zone_device_update (tz->thermal_zone); +ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Polling frequency set to %lu seconds\n" , tz->polling_frequency/10 ));
@@ -569,386 +572,11 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)return acpi_thermal_trips_update (tz,ACPI_TRIPS_INIT ); } -static int acpi_thermal_critical (struct acpi_thermal *tz) -{ -if (!tz || !tz->trips.critical.flags.valid) -return -EINVAL ; - -if (tz->temperature >= tz->trips.critical.temperature) { - printk(KERN_WARNING PREFIX "Critical trip point\n"); - tz->trips.critical.flags.enabled =1 ; - }else if (tz->trips.critical.flags.enabled) - tz->trips.critical.flags.enabled =0 ; - -acpi_bus_generate_proc_event (tz->device,ACPI_THERMAL_NOTIFY_CRITICAL , - tz->trips.critical.flags.enabled); -acpi_bus_generate_netlink_event (tz->device->pnp.device_class, -dev_name (&tz->device->dev), -ACPI_THERMAL_NOTIFY_CRITICAL , - tz->trips.critical.flags.enabled); - -/* take no action if nocrt is set */ -if (!nocrt) { -printk (KERN_EMERG -"Critical temperature reached (%ld C), shutting down.\n" , -KELVIN_TO_CELSIUS (tz->temperature)); -orderly_poweroff (true); - } - -return 0 ; -} - -static int acpi_thermal_hot (struct acpi_thermal *tz) -{ -if (!tz || !tz->trips.hot.flags.valid) -return -EINVAL ; - -if (tz->temperature >= tz->trips.hot.temperature) { - printk(KERN_WARNING PREFIX "Hot trip point\n"); - tz->trips.hot.flags.enabled =1 ; - }else if (tz->trips.hot.flags.enabled) - tz->trips.hot.flags.enabled =0 ; - -acpi_bus_generate_proc_event (tz->device,ACPI_THERMAL_NOTIFY_HOT , - tz->trips.hot.flags.enabled); -acpi_bus_generate_netlink_event (tz->device->pnp.device_class, -dev_name (&tz->device->dev), -ACPI_THERMAL_NOTIFY_HOT , - tz->trips.hot.flags.enabled); - -/* TBD: Call user-mode "sleep(S4)" function if nocrt is cleared */ - -return 0 ; -} - -static void acpi_thermal_passive (struct acpi_thermal *tz) -{ -int result =1 ; -struct acpi_thermal_passive *passive =NULL ; -int trend =0 ; -int i =0 ; - - -if (!tz || !tz->trips.passive.flags.valid) -return ; - - passive = &(tz->trips.passive); - -/* -* Above Trip? -* ----------- -* Calculate the thermal trend (using the passive cooling equation) -* and modify the performance limit for all passive cooling devices -* accordingly. Note that we assume symmetry. -*/ -if (tz->temperature >= passive->temperature) { - trend = - (passive->tc1 * (tz->temperature - tz->last_temperature)) + - (passive->tc2 * (tz->temperature - passive->temperature)); -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n" , - trend, passive->tc1, tz->temperature, - tz->last_temperature, passive->tc2, - tz->temperature, passive->temperature)); - passive->flags.enabled =1 ; -/* Heating up? */ -if (trend >0 ) -for (i =0 ; i < passive->devices.count; i++) -acpi_processor_set_thermal_limit (passive-> - devices. - handles[i], -ACPI_PROCESSOR_LIMIT_INCREMENT ); -/* Cooling off? */ -else if (trend <0 ) { -for (i =0 ; i < passive->devices.count; i++) -/* -* assume that we are on highest -* freq/lowest thrott and can leave -* passive mode, even in error case -*/ -if (!acpi_processor_set_thermal_limit - (passive->devices.handles[i], -ACPI_PROCESSOR_LIMIT_DECREMENT )) - result =0 ; -/* -* Leave cooling mode, even if the temp might -* higher than trip point This is because some -* machines might have long thermal polling -* frequencies (tsp) defined. We will fall back -* into passive mode in next cycle (probably quicker) -*/ -if (result) { - passive->flags.enabled =0 ; -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Disabling passive cooling, still above threshold," -" but we are cooling down\n" )); - } - } -return ; - } - -/* -* Below Trip? -* ----------- -* Implement passive cooling hysteresis to slowly increase performance -* and avoid thrashing around the passive trip point. Note that we -* assume symmetry. -*/ -if (!passive->flags.enabled) -return ; -for (i =0 ; i < passive->devices.count; i++) -if (!acpi_processor_set_thermal_limit - (passive->devices.handles[i], -ACPI_PROCESSOR_LIMIT_DECREMENT )) - result =0 ; -if (result) { - passive->flags.enabled =0 ; -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Disabling passive cooling (zone is cool)\n" )); - } -} - -static void acpi_thermal_active (struct acpi_thermal *tz) -{ -int result =0 ; -struct acpi_thermal_active *active =NULL ; -int i =0 ; -int j =0 ; -unsigned long maxtemp =0 ; - - -if (!tz) -return ; - -for (i =0 ; i <ACPI_THERMAL_MAX_ACTIVE ; i++) { - active = &(tz->trips.active[i]); -if (!active || !active->flags.valid) -break ; -if (tz->temperature >= active->temperature) { -/* -* Above Threshold? -* ---------------- -* If not already enabled, turn ON all cooling devices -* associated with this active threshold. -*/ -if (active->temperature > maxtemp) - tz->state.active_index = i; - maxtemp = active->temperature; -if (active->flags.enabled) -continue ; -for (j =0 ; j < active->devices.count; j++) { - result = -acpi_bus_set_power (active->devices. - handles[j], -ACPI_STATE_D0 ); -if (result) { - printk(KERN_WARNING PREFIX -"Unable to turn cooling device [%p] 'on'\n" , - active->devices. - handles[j]); -continue ; - } - active->flags.enabled =1 ; -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Cooling device [%p] now 'on'\n" , - active->devices.handles[j])); - } -continue ; - } -if (!active->flags.enabled) -continue ; -/* -* Below Threshold? -* ---------------- -* Turn OFF all cooling devices associated with this -* threshold. -*/ -for (j =0 ; j < active->devices.count; j++) { - result =acpi_bus_set_power (active->devices.handles[j], -ACPI_STATE_D3 ); -if (result) { - printk(KERN_WARNING PREFIX -"Unable to turn cooling device [%p] 'off'\n" , - active->devices.handles[j]); -continue ; - } - active->flags.enabled =0 ; -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Cooling device [%p] now 'off'\n" , - active->devices.handles[j])); - } - } -} - -static void acpi_thermal_check (void *context); - -static void acpi_thermal_run (unsigned long data) -{ -struct acpi_thermal *tz = (struct acpi_thermal *)data; -if (!tz->zombie) -acpi_os_execute (OSL_GPE_HANDLER , acpi_thermal_check, (void *)data); -} - -static void acpi_thermal_active_off (void *data) -{ -int result =0 ; -struct acpi_thermal *tz = data; -int i =0 ; -int j =0 ; -struct acpi_thermal_active *active =NULL ; - -if (!tz) { - printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); -return ; - } - - result =acpi_thermal_get_temperature (tz); -if (result) -return ; - -for (i =0 ; i <ACPI_THERMAL_MAX_ACTIVE ; i++) { - active = &(tz->trips.active[i]); -if (!active || !active->flags.valid) -break ; -if (tz->temperature >= active->temperature) { -/* -* If the thermal temperature is greater than the -* active threshod, unnecessary to turn off the -* the active cooling device. -*/ -continue ; - } -/* -* Below Threshold? -* ---------------- -* Turn OFF all cooling devices associated with this -* threshold. -*/ -for (j =0 ; j < active->devices.count; j++) - result =acpi_bus_set_power (active->devices.handles[j], -ACPI_STATE_D3 ); - } -} -static void acpi_thermal_check (void *data) { -int result =0 ;struct acpi_thermal *tz = data; -unsigned long sleep_time =0 ; -unsigned long timeout_jiffies =0 ; -int i =0 ; -struct acpi_thermal_state state; - - -if (!tz) { - printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); -return ; - } - -/* Check if someone else is already running */ -if (!mutex_trylock (&tz->lock)) -return ; - - state = tz->state; - - result =acpi_thermal_get_temperature (tz); -if (result) - goto unlock; - -if (!tz->tz_enabled) - goto unlock; - -memset (&tz->state,0 ,sizeof (tz->state)); - -/* -* Check Trip Points -* ----------------- -* Compare the current temperature to the trip point values to see -* if we've entered one of the thermal policy states. Note that -* this function determines when a state is entered, but the -* individual policy decides when it is exited (e.g. hysteresis). -*/ -if (tz->trips.critical.flags.valid) - state.critical |= - (tz->temperature >= tz->trips.critical.temperature); -if (tz->trips.hot.flags.valid) - state.hot |= (tz->temperature >= tz->trips.hot.temperature); -if (tz->trips.passive.flags.valid) - state.passive |= - (tz->temperature >= tz->trips.passive.temperature); -for (i =0 ; i <ACPI_THERMAL_MAX_ACTIVE ; i++) -if (tz->trips.active[i].flags.valid) - state.active |= - (tz->temperature >= - tz->trips.active[i].temperature); - -/* -* Invoke Policy -* ------------- -* Separated from the above check to allow individual policy to -* determine when to exit a given state. -*/ -if (state.critical) -acpi_thermal_critical (tz); -if (state.hot) -acpi_thermal_hot (tz); -if (state.passive) -acpi_thermal_passive (tz); -if (state.active) -acpi_thermal_active (tz); - -/* -* Calculate State -* --------------- -* Again, separated from the above two to allow independent policy -* decisions. -*/ - tz->state.critical = tz->trips.critical.flags.enabled; - tz->state.hot = tz->trips.hot.flags.enabled; - tz->state.passive = tz->trips.passive.flags.enabled; - tz->state.active =0 ; -for (i =0 ; i <ACPI_THERMAL_MAX_ACTIVE ; i++) - tz->state.active |= tz->trips.active[i].flags.enabled; - -/* -* Calculate Sleep Time -* -------------------- -* If we're in the passive state, use _TSP's value. Otherwise -* use the default polling frequency (e.g. _TZP). If no polling -* frequency is specified then we'll wait forever (at least until -* a thermal event occurs). Note that _TSP and _TZD values are -* given in 1/10th seconds (we must covert to milliseconds). -*/ -if (tz->state.passive) { - sleep_time = tz->trips.passive.tsp *100 ; - timeout_jiffies = jiffies + (HZ * sleep_time) /1000 ; - }else if (tz->polling_frequency >0 ) { - sleep_time = tz->polling_frequency *100 ; - timeout_jiffies =round_jiffies (jiffies + (HZ * sleep_time) /1000 ); - } - -ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"%s: temperature[%lu] sleep[%lu]\n" , - tz->name, tz->temperature, sleep_time)); -/* -* Schedule Next Poll -* ------------------ -*/ -if (!sleep_time) { -if (timer_pending (&(tz->timer))) -del_timer (&(tz->timer)); - }else { -if (timer_pending (&(tz->timer))) -mod_timer (&(tz->timer), timeout_jiffies); -else { - tz->timer.data = (unsigned long )tz; - tz->timer.function = acpi_thermal_run; - tz->timer.expires = timeout_jiffies; -add_timer (&(tz->timer)); - } - } - unlock: -mutex_unlock (&tz->lock); +thermal_zone_device_update (tz->thermal_zone); }/* sys I/F for generic thermal sysfs support */
@@ -1122,6 +750,29 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,return -EINVAL ; } +static int thermal_notify (struct thermal_zone_device *thermal,int trip, +enum thermal_trip_type trip_type) +{ +u8 type =0 ; +struct acpi_thermal *tz = thermal->devdata; + +if (trip_type ==THERMAL_TRIP_CRITICAL ) + type =ACPI_THERMAL_NOTIFY_CRITICAL ; +else if (trip_type ==THERMAL_TRIP_HOT ) + type =ACPI_THERMAL_NOTIFY_HOT ; +else +return 0 ; + +acpi_bus_generate_proc_event (tz->device, type,1 ); +acpi_bus_generate_netlink_event (tz->device->pnp.device_class, + tz->device->dev.bus_id, type,1 ); + +if (trip_type ==THERMAL_TRIP_CRITICAL && nocrt) +return 1 ; + +return 0 ; +} +typedef int (*cb )(struct thermal_zone_device *,int ,struct thermal_cooling_device *); static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
@@ -1214,6 +865,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { .get_trip_type = thermal_get_trip_type, .get_trip_temp = thermal_get_trip_temp, .get_crit_temp = thermal_get_crit_temp, + .notify = thermal_notify, };static int acpi_thermal_register_thermal_zone (struct acpi_thermal *tz)
@@ -1234,8 +886,21 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)for (i =0 ; i <ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].flags.valid; i++, trips++); - tz->thermal_zone =thermal_zone_device_register ("acpitz" , - trips, tz, &acpi_thermal_zone_ops); + +if (tz->trips.passive.flags.valid) + tz->thermal_zone = +thermal_zone_device_register ("acpitz" , trips, tz, + &acpi_thermal_zone_ops, + tz->trips.passive.tc1, + tz->trips.passive.tc2, + tz->trips.passive.tsp*100 , + tz->polling_frequency*100 ); +else + tz->thermal_zone = +thermal_zone_device_register ("acpitz" , trips, tz, + &acpi_thermal_zone_ops, +0 ,0 ,0 , + tz->polling_frequency);if (IS_ERR (tz->thermal_zone))return -ENODEV ;
@@ -1467,13 +1132,13 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)if (!tz) goto end; -if (!tz->polling_frequency) { +if (!tz->thermal_zone->polling_delay) {seq_puts (seq,"<polling disabled>\n" ); goto end; } -seq_printf (seq,"polling frequency: %lu seconds\n" , - (tz->polling_frequency /10 )); +seq_printf (seq,"polling frequency: %d seconds\n" , + (tz->thermal_zone->polling_delay /1000 )); end:return 0 ;
@@ -1703,12 +1368,6 @@ static int acpi_thermal_add(struct acpi_device *device)if (result) goto unregister_thermal_zone; -init_timer (&tz->timer); - -acpi_thermal_active_off (tz); - -acpi_thermal_check (tz); - status =acpi_install_notify_handler (device->handle,ACPI_DEVICE_NOTIFY , acpi_thermal_notify, tz);
@@ -1737,36 +1396,15 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)acpi_status status =AE_OK ;struct acpi_thermal *tz =NULL ; -if (!device || !acpi_driver_data (device))return -EINVAL ; tz =acpi_driver_data (device); -/* avoid timer adding new defer task */ - tz->zombie =1 ; -/* wait for running timer (on other CPUs) finish */ -del_timer_sync (&(tz->timer)); -/* synchronize deferred task */ -acpi_os_wait_events_complete (NULL ); -/* deferred task may reinsert timer */ -del_timer_sync (&(tz->timer)); - status =acpi_remove_notify_handler (device->handle,ACPI_DEVICE_NOTIFY , acpi_thermal_notify); -/* Terminate policy */ -if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { - tz->trips.passive.flags.enabled =0 ; -acpi_thermal_passive (tz); - } -if (tz->trips.active[0 ].flags.valid - && tz->trips.active[0 ].flags.enabled) { - tz->trips.active[0 ].flags.enabled =0 ; -acpi_thermal_active (tz); - } -acpi_thermal_remove_fs (device);acpi_thermal_unregister_thermal_zone (tz);mutex_destroy (&tz->lock);
drivers/thermal/thermal_sys.c +186 -2
236 lines not on this page · raw message
include/linux/thermal.h +14 -1
@@ -27,6 +27,7 @@#include <linux/idr.h> #include <linux/device.h> +#include <linux/workqueue.h> struct thermal_zone_device ;struct thermal_cooling_device ;
@@ -58,6 +59,8 @@ struct thermal_zone_device_ops {int (*get_trip_temp) (struct thermal_zone_device *,int ,unsigned long *);int (*get_crit_temp) (struct thermal_zone_device *,unsigned long *); +int (*notify) (struct thermal_zone_device *,int , +enum thermal_trip_type ); };struct thermal_cooling_device_ops {
@@ -104,11 +107,18 @@ struct thermal_zone_device {struct device device;void *devdata;int trips; +int tc1; +int tc2; +int passive_delay; +int polling_delay; +int last_temperature; +bool passive;struct thermal_zone_device_ops *ops;struct list_head cooling_devices;struct idr idr;struct mutex lock;/* protect cooling devices list */ struct list_head node; +struct delayed_work poll_queue;#if defined(CONFIG_THERMAL_HWMON )struct list_head hwmon_node;struct thermal_hwmon_device *hwmon;
@@ -120,13 +130,16 @@ struct thermal_zone_device {struct thermal_zone_device *thermal_zone_device_register (char *,int ,void *,struct thermal_zone_device_ops - *); + *,int tc1,int tc2, +int passive_freq, +int polling_freq);void thermal_zone_device_unregister (struct thermal_zone_device *);int thermal_zone_bind_cooling_device (struct thermal_zone_device *,int ,struct thermal_cooling_device *);int thermal_zone_unbind_cooling_device (struct thermal_zone_device *,int ,struct thermal_cooling_device *); +void thermal_zone_device_update (struct thermal_zone_device *);struct thermal_cooling_device *thermal_cooling_device_register (char *,void *,struct thermal_cooling_device_ops
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 3/98 ACPI: introduce sysfs I/F for dynamic tables
In reply to Len BrownFrom: Zhang Rui <[email protected]>
SSDT tables may be loaded at runtime.
create sysfs I/F for these dynamic tables in/sys/firmware/acpi/tables/dynamic/.
--- drivers/acpi/system.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 48 insertions(+), 3 deletions(-)
drivers/acpi/system.c +48 -3
@@ -62,6 +62,7 @@ module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444);-------------------------------------------------------------------------- */ static LIST_HEAD (acpi_table_attr_list);static struct kobject *tables_kobj; +static struct kobject *dynamic_tables_kobj;struct acpi_table_attr {struct bin_attribute attr;
@@ -128,6 +129,40 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,return ; } +static acpi_status +acpi_sysfs_table_handler (u32 event,void *table,void *context) +{ +struct acpi_table_attr *table_attr; + +switch (event) { +case ACPI_TABLE_EVENT_LOAD : + table_attr = +kzalloc (sizeof (struct acpi_table_attr ),GFP_KERNEL ); +if (!table_attr) +return AE_NO_MEMORY ; + +acpi_table_attr_init (table_attr, table); +if (sysfs_create_bin_file (dynamic_tables_kobj, + &table_attr->attr)) { +kfree (table_attr); +return AE_ERROR ; + }else +list_add_tail (&table_attr->node, + &acpi_table_attr_list); +break ; +case ACPI_TABLE_EVENT_UNLOAD : +/* +* we do not need to do anything right now +* because the table is not deleted from the +* global table list when unloading it. +*/ +break ; +default : +return AE_BAD_PARAMETER ; + } +return AE_OK ; +} +static int acpi_system_sysfs_init (void ) {struct acpi_table_attr *table_attr;
@@ -137,7 +172,11 @@ static int acpi_system_sysfs_init(void) tables_kobj =kobject_create_and_add ("tables" , acpi_kobj);if (!tables_kobj) -return -ENOMEM ; + goto err; + + dynamic_tables_kobj =kobject_create_and_add ("dynamic" , tables_kobj); +if (!dynamic_tables_kobj) + goto err_dynamic_tables; do { result = acpi_get_table_by_index(table_index, &table_header);
@@ -162,8 +201,14 @@ static int acpi_system_sysfs_init(void) } }while (!result);kobject_uevent (tables_kobj,KOBJ_ADD ); - -return 0 ; +kobject_uevent (dynamic_tables_kobj,KOBJ_ADD ); + result =acpi_install_table_handler (acpi_sysfs_table_handler,NULL ); + +return result ==AE_OK ?0 : -EINVAL ; +err_dynamic_tables: +kobject_put (tables_kobj); +err: +return -ENOMEM ; }/*
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 4/98 ACPI: Add the dmi check to make acpi_enforce_resources strict
In reply to Len BrownFrom: Zhao Yakui <[email protected]>
On some boxes the SMBus PCI controller is not hidden. The SMbus I/O port will be accessed in AML code. If the i2c driver is still loaded for the SMbus PCI device, there is no synchronization between OS and BIOS. And the conflict will happen.
So the dmi check is added so that the acpi_enforce_resources is strict when
the box falls into the dmi check table. In such case the i2c driver won't be loaded for the SMbus pci device.
Now the following are added in the dmi check table:
a. Asus EEEPC 702/900/901
b. Asus P6T Delux
c. Dell 1537http://bugzilla.kernel.org/show_bug.cgi?id=12376
http://bugzilla.kernel.org/show_bug.cgi?id=12541
--- drivers/acpi/osl.c | 92 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 70 insertions(+), 22 deletions(-)
drivers/acpi/osl.c +70 -22
@@ -134,6 +134,68 @@ static struct osi_linux { unsigned int cmdline:1; unsigned int known:1; } osi_linux = { 0, 0, 0, 0}; +/* Check of resource interference between native drivers and ACPI +* OperationRegions (SystemIO and System Memory only). +* IO ports and memory declared in ACPI might be used by the ACPI subsystem +* in arbitrary AML code and can interfere with legacy drivers. +* acpi_enforce_resources= can be set to: +* +* - strict (2) +* -> further driver trying to access the resources will not load +* - lax (default) (1) +* -> further driver trying to access the resources will load, but you +* get a system message that something might go wrong... +* +* - no (0) +* -> ACPI Operation Region resources will not be registered +* +*/ + +#define ENFORCE_RESOURCES_STRICT 2 +#define ENFORCE_RESOURCES_LAX 1 +#define ENFORCE_RESOURCES_NO 0 + +static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; +static struct dmi_system_id __initdata acpi_resources_dmi_table[] = { + { + .ident ="Asus EEEPC-901" , + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK Computer INC." ), +DMI_MATCH (DMI_BOARD_NAME ,"901" ), + }, + }, + { + .ident ="Asus P6T DELUXE" , + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK Computer INC." ), +DMI_MATCH (DMI_BOARD_NAME ,"P6T DELUXE" ), + }, + }, + { + .ident ="Asus EEEPC-702" , + .matches = { +DMI_MATCH (DMI_PRODUCT_NAME ,"Eee PC" ), +DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK Computer INC." ), +DMI_MATCH (DMI_BOARD_NAME ,"702" ), + }, + }, + { + .ident ="Dell 1537" , + .matches = { +DMI_MATCH (DMI_PRODUCT_NAME ,"Studio 1537" ), +DMI_MATCH (DMI_BOARD_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_BOARD_NAME ,"0P132H" ), + }, + }, + { + .ident ="Asus EEEPC-900" , + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK Computer INC." ), +DMI_MATCH (DMI_BOARD_NAME ,"900" ), + }, + }, + {}, +};static void __init acpi_request_region (struct acpi_generic_address *addr,unsigned int length,char *desc)
@@ -179,6 +241,14 @@ static int __init acpi_reserve_resources(void)acpi_request_region (&acpi_gbl_FADT.xgpe1_block, acpi_gbl_FADT.gpe1_block_length,"ACPI GPE1_BLK" ); +/* +* Only when the ACPI is enabled, the dmi table will be checked. If +* the system falls into the dmi check table, the strict resource +* check will be used. +*/ +if (!acpi_disabled &&dmi_check_system (acpi_resources_dmi_table)) + acpi_enforce_resources =ENFORCE_RESOURCES_STRICT ; +return 0 ; }device_initcall (acpi_reserve_resources);
@@ -1057,28 +1127,6 @@ static int __init acpi_wake_gpes_always_on_setup(char *str)__setup ("acpi_wake_gpes_always_on" , acpi_wake_gpes_always_on_setup); -/* Check of resource interference between native drivers and ACPI -* OperationRegions (SystemIO and System Memory only). -* IO ports and memory declared in ACPI might be used by the ACPI subsystem -* in arbitrary AML code and can interfere with legacy drivers. -* acpi_enforce_resources= can be set to: -* -* - strict (2) -* -> further driver trying to access the resources will not load -* - lax (default) (1) -* -> further driver trying to access the resources will load, but you -* get a system message that something might go wrong... -* -* - no (0) -* -> ACPI Operation Region resources will not be registered -* -*/ -#define ENFORCE_RESOURCES_STRICT 2 -#define ENFORCE_RESOURCES_LAX 1 -#define ENFORCE_RESOURCES_NO 0 - -static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; -static int __init acpi_enforce_resources_setup (char *str) {if (str ==NULL || *str =='\0' )
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 5/98 hp-wmi: notify of a potential docking state change on resume
In reply to Len BrownFrom: Frans Pop <[email protected]>
It is possible that the system gets docked or undocked while it's suspended. Generate an input event on resume to notify user space if there was a state change.
As it is a switch, we can generate the event unconditionally; the input layer will only pass it on if there is an actual change.
--- drivers/platform/x86/hp-wmi.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
drivers/platform/x86/hp-wmi.c +25 -0
@@ -53,6 +53,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");static int __init hp_wmi_bios_setup (struct platform_device *device); static int __exit hp_wmi_bios_remove(struct platform_device *device); +static int hp_wmi_resume_handler (struct platform_device *device);struct bios_args {u32 signature;
@@ -101,6 +102,7 @@ static struct platform_driver hp_wmi_driver = { }, .probe = hp_wmi_bios_setup, .remove = hp_wmi_bios_remove, + .resume = hp_wmi_resume_handler, };static int hp_wmi_perform_query (int query,int write,int value)
@@ -487,6 +489,29 @@ static int __exit hp_wmi_bios_remove(struct platform_device *device)return 0 ; } +static int hp_wmi_resume_handler (struct platform_device *device) +{ +struct key_entry *key; + +/* +* Docking state may have changed while suspended, so trigger +* an input event for the current state. As this is a switch, +* the input layer will only actually pass it on if the state +* changed. +*/ +for (key = hp_wmi_keymap; key->type !=KE_END ; key++) { +switch (key->type) { +case KE_SW : +input_report_switch (hp_wmi_input_dev, key->keycode, +hp_wmi_dock_state ()); +input_sync (hp_wmi_input_dev); +break ; + } + } + +return 0 ; +} +static int __init hp_wmi_init (void ) {int err;
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 6/98 acpi: fix of pmtimer overflow that make Cx states time incorrect
In reply to Len BrownFrom: alex.shi <[email protected]>
We found Cx states time abnormal in our some of machines which have 16 LCPUs, the C0 take too many time while system is really idle when kernel enabled tickless and highres. powertop output is below:
PowerTOP version 1.9 (C) 2007 Intel Corporation
Cn Avg residency P-states (frequencies)
C0 (cpu running) (40.5%) 2.53 Ghz 0.0%
C1 0.0ms ( 0.0%) 2.53 Ghz 0.0%
C2 128.8ms (59.5%) 2.40 Ghz 0.0%
1.60 Ghz 100.0%Wakeups-from-idle per second : 4.7 interval: 20.0s
no ACPI power usage estimate available
Top causes for wakeups:
41.4% ( 24.9) <interrupt> : extra timer interrupt
20.2% ( 12.2) <kernel core> : usb_hcd_poll_rh_status
(rh_timer_func)
After tacking detailed for this issue, Yakui and I find it is due to 24 bit PM timer overflows when some of cpu sleep more than 4 seconds. With tickless kernel, the CPU want to sleep as much as possible when system idle. But the Cx sleep time are recorded by pmtimer which length is determined by BIOS. The current Cx time was gotten in the following function from driver/acpi/processor_idle.c:
static inline u32 ticks_elapsed(u32 t1, u32 t2)
{
if (t2 >= t1)
return (t2 - t1);
else if (!(acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER))
return (((0x00FFFFFF - t1) + t2) & 0x00FFFFFF);
else
return ((0xFFFFFFFF - t1) + t2);
}If pmtimer is 24 bits and it take 5 seconds from t1 to t2, in above function, just about 1 seconds ticks was recorded. So the Cx time will be reduced about 4 seconds. and this is why we see above powertop output.
To resolve this problem, Yakui and I use ktime_get() to record the Cx states time instead of PM timer as the following patch. the patch was tested with i386/x86_64 modes on several platforms.
--- drivers/acpi/processor_idle.c | 63 +++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 36 deletions(-)
drivers/acpi/processor_idle.c +27 -36
@@ -64,7 +64,6 @@#define _COMPONENT ACPI_PROCESSOR_COMPONENTACPI_MODULE_NAME ("processor_idle" );#define ACPI_PROCESSOR_FILE_POWER "power" -#define US_TO_PM_TIMER_TICKS (t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)#define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY)#define C2_OVERHEAD 1/* 1us */ #define C3_OVERHEAD 1/* 1us */
@@ -78,6 +77,10 @@ module_param(nocst, uint, 0000);static unsigned int latency_factor__read_mostly =2 ;module_param (latency_factor, uint,0644 ); +static s64 us_to_pm_timer_ticks (s64 t) +{ +return div64_u64 (t *PM_TIMER_FREQUENCY ,1000000 ); +}/* * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. * For now disable this. Probably a bug somewhere else.
@@ -159,25 +162,6 @@ static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { {}, }; -static inline u32 ticks_elapsed (u32 t1,u32 t2) -{ -if (t2 >= t1) -return (t2 - t1); -else if (!(acpi_gbl_FADT.flags &ACPI_FADT_32BIT_TIMER )) -return (((0x00FFFFFF - t1) + t2) &0x00FFFFFF ); -else -return ((0xFFFFFFFF - t1) + t2); -} - -static inline u32 ticks_elapsed_in_us (u32 t1,u32 t2) -{ -if (t2 >= t1) -return PM_TIMER_TICKS_TO_US (t2 - t1); -else if (!(acpi_gbl_FADT.flags &ACPI_FADT_32BIT_TIMER )) -return PM_TIMER_TICKS_TO_US (((0x00FFFFFF - t1) + t2) &0x00FFFFFF ); -else -return PM_TIMER_TICKS_TO_US ((0xFFFFFFFF - t1) + t2); -}/* * Callers should disable interrupts before the call and enable
@@ -853,7 +837,8 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)static int acpi_idle_enter_c1 (struct cpuidle_device *dev,struct cpuidle_state *state) { -u32 t1, t2; +ktime_t kt1, kt2; +s64 idle_time;struct acpi_processor *pr;struct acpi_processor_cx *cx =cpuidle_get_statedata (state);
@@ -871,14 +856,15 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,return 0 ; } - t1 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt1 =ktime_get_real ();acpi_idle_do_entry (cx); - t2 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt2 =ktime_get_real (); + idle_time =ktime_to_us (ktime_sub (kt2, kt1));local_irq_enable (); cx->usage++; -return ticks_elapsed_in_us (t1, t2); +return idle_time; }/**
@@ -891,8 +877,9 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, {struct acpi_processor *pr;struct acpi_processor_cx *cx =cpuidle_get_statedata (state); -u32 t1, t2; -int sleep_ticks =0 ; +ktime_t kt1, kt2; +s64 idle_time; +s64 sleep_ticks =0 ; pr =__get_cpu_var (processors);
@@ -925,18 +912,19 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,if (cx->type ==ACPI_STATE_C3 )ACPI_FLUSH_CPU_CACHE (); - t1 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt1 =ktime_get_real ();/* Tell the scheduler that we are going deep-idle: */ sched_clock_idle_sleep_event ();acpi_idle_do_entry (cx); - t2 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt2 =ktime_get_real (); + idle_time =ktime_to_us (ktime_sub (kt2, kt1));#if defined (CONFIG_GENERIC_TIME ) && defined (CONFIG_X86 )/* TSC could halt in idle, so notify users */ if (tsc_halts_in_c (cx->type))mark_tsc_unstable ("TSC halts in idle" );;#endif - sleep_ticks =ticks_elapsed (t1, t2); + sleep_ticks =us_to_pm_timer_ticks (idle_time);/* Tell the scheduler how much we idled: */ sched_clock_idle_wakeup_event (sleep_ticks*PM_TIMER_TICK_NS );
@@ -948,7 +936,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,acpi_state_timer_broadcast (pr, cx,0 ); cx->time += sleep_ticks; -return ticks_elapsed_in_us (t1, t2); +return idle_time; }static int c3_cpu_count;
@@ -966,8 +954,10 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, {struct acpi_processor *pr;struct acpi_processor_cx *cx =cpuidle_get_statedata (state); -u32 t1, t2; -int sleep_ticks =0 ; +ktime_t kt1, kt2; +s64 idle_time; +s64 sleep_ticks =0 ; + pr =__get_cpu_var (processors);
@@ -1034,9 +1024,10 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,ACPI_FLUSH_CPU_CACHE (); } - t1 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt1 =ktime_get_real ();acpi_idle_do_entry (cx); - t2 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt2 =ktime_get_real (); + idle_time =ktime_to_us (ktime_sub (kt2, kt1));/* Re-enable bus master arbitration */ if (pr->flags.bm_check && pr->flags.bm_control) {
@@ -1051,7 +1042,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,if (tsc_halts_in_c (ACPI_STATE_C3 ))mark_tsc_unstable ("TSC halts in idle" );#endif - sleep_ticks =ticks_elapsed (t1, t2); + sleep_ticks =us_to_pm_timer_ticks (idle_time);/* Tell the scheduler how much we idled: */ sched_clock_idle_wakeup_event (sleep_ticks*PM_TIMER_TICK_NS );
@@ -1062,7 +1053,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,acpi_state_timer_broadcast (pr, cx,0 ); cx->time += sleep_ticks; -return ticks_elapsed_in_us (t1, t2); +return idle_time; }struct cpuidle_driver acpi_idle_driver = {
Signature · 1 line
1.6.0.6
Re: [PATCH 06/98] acpi: fix of pmtimer overflow that make Cx states time incorrect
Quoted 39 lines · On Saturday 28 March 2009 05:30:41 Len Brown wrote:
From: alex.shi <[email protected]>
We found Cx states time abnormal in our some of machines which have 16 LCPUs, the C0 take too many time while system is really idle when kernel enabled tickless and highres. powertop output is below:
PowerTOP version 1.9 (C) 2007 Intel Corporation
Cn Avg residency P-states (frequencies)
C0 (cpu running) (40.5%) 2.53 Ghz 0.0% C1 0.0ms ( 0.0%) 2.53 Ghz 0.0% C2 128.8ms (59.5%) 2.40 Ghz 0.0% 1.60 Ghz 100.0%Wakeups-from-idle per second : 4.7 interval: 20.0s
no ACPI power usage estimate availableTop causes for wakeups:
41.4% ( 24.9) <interrupt> : extra timer interrupt
20.2% ( 12.2) <kernel core> :usb_hcd_poll_rh_status
(rh_timer_func)After tacking detailed for this issue, Yakui and I find it is due to 24 bit PM timer overflows when some of cpu sleep more than 4 seconds. With tickless kernel, the CPU want to sleep as much as possible when system idle. But the Cx sleep time are recorded by pmtimer which length is determined by BIOS. The current Cx time was gotten in the following function from
driver/acpi/processor_idle.c:static inline u32
ticks_elapsed(u32 t1, u32 t2){ if (t2 >= t1) return (t2 - t1); else if (!(acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER)) return (((0x00FFFFFF - t1) + t2) & 0x00FFFFFF); else return ((0xFFFFFFFF - t1) + t2); }
Quoted 7 lines
If pmtimer is 24 bits and it take 5 seconds from t1 to t2, in above function, just about 1 seconds ticks was recorded. So the Cx time will be reduced about 4 seconds. and this is why we see above powertop output.
To resolve this problem, Yakui and I use
ktime_get()to record the Cx states time instead of PM timer as the following patch. the patch was tested with i386/x86_64 modes on several platforms.
Is this worth adding:
CC: [email protected]
but wait until 2.6.30 is finished and no regressions have been reported? Then backport things to .29/.28 and eventually others?
Thomas
Quoted 177 lines
Tested-by Alex Shi <[email protected]>Signed-off-by Alex Shi <[email protected]>Signed-off-by Yakui.zhao <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Len Brown <[email protected]>--- drivers/acpi/processor_idle.c | 63 +++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 36 deletions(-)drivers/acpi/processor_idle.c +27
-36@@ -64,7 +64,6 @@#define _COMPONENT ACPI_PROCESSOR_COMPONENTACPI_MODULE_NAME ("processor_idle" );#define ACPI_PROCESSOR_FILE_POWER "power" -#define US_TO_PM_TIMER_TICKS (t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)#define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY)#define C2_OVERHEAD 1/* 1us */ #define C3_OVERHEAD 1/* 1us */ @@ -78,6 +77,10 @@ module_param(nocst, uint, 0000);static unsigned int latency_factor__read_mostly =2 ;module_param (latency_factor, uint,0644 ); +static s64 us_to_pm_timer_ticks (s64 t) +{ +return div64_u64 (t *PM_TIMER_FREQUENCY ,1000000 ); +}/* * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. * For now disable this. Probably a bug somewhere else. @@ -159,25 +162,6 @@ static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { {}, }; -static inline u32 ticks_elapsed (u32 t1,u32 t2) -{ -if (t2 >= t1) -return (t2 - t1); -else if (!(acpi_gbl_FADT.flags &ACPI_FADT_32BIT_TIMER )) -return (((0x00FFFFFF - t1) + t2) &0x00FFFFFF ); -else -return ((0xFFFFFFFF - t1) + t2); -} - -static inline u32 ticks_elapsed_in_us (u32 t1,u32 t2) -{ -if (t2 >= t1) -return PM_TIMER_TICKS_TO_US (t2 - t1); -else if (!(acpi_gbl_FADT.flags &ACPI_FADT_32BIT_TIMER )) -return PM_TIMER_TICKS_TO_US (((0x00FFFFFF - t1) + t2) &0x00FFFFFF ); -else -return PM_TIMER_TICKS_TO_US ((0xFFFFFFFF - t1) + t2); -}/* * Callers should disable interrupts before the call and enable @@ -853,7 +837,8 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)static int acpi_idle_enter_c1 (struct cpuidle_device *dev,struct cpuidle_state *state) { -u32 t1, t2; +ktime_t kt1, kt2; +s64 idle_time;struct acpi_processor *pr;struct acpi_processor_cx *cx =cpuidle_get_statedata (state);@@ -871,14 +856,15 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,return 0 ; } - t1 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt1 =ktime_get_real ();acpi_idle_do_entry (cx); - t2 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt2 =ktime_get_real (); + idle_time =ktime_to_us (ktime_sub (kt2, kt1));local_irq_enable (); cx->usage++; -return ticks_elapsed_in_us (t1, t2); +return idle_time; }/** @@ -891,8 +877,9 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, {struct acpi_processor *pr;struct acpi_processor_cx *cx =cpuidle_get_statedata (state); -u32 t1, t2; -int sleep_ticks =0 ; +ktime_t kt1, kt2; +s64 idle_time; +s64 sleep_ticks =0 ; pr =__get_cpu_var (processors);@@ -925,18 +912,19 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,if (cx->type ==ACPI_STATE_C3 )ACPI_FLUSH_CPU_CACHE (); - t1 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt1 =ktime_get_real ();/* Tell the scheduler that we are going deep-idle: */ sched_clock_idle_sleep_event ();acpi_idle_do_entry (cx); - t2 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt2 =ktime_get_real (); + idle_time =ktime_to_us (ktime_sub (kt2, kt1));#if defined (CONFIG_GENERIC_TIME ) && defined (CONFIG_X86 )/* TSC could halt in idle, so notify users */ if (tsc_halts_in_c (cx->type))mark_tsc_unstable ("TSC halts in idle" );;#endif - sleep_ticks =ticks_elapsed (t1, t2); + sleep_ticks =us_to_pm_timer_ticks (idle_time);/* Tell the scheduler how much we idled: */ sched_clock_idle_wakeup_event (sleep_ticks*PM_TIMER_TICK_NS );@@ -948,7 +936,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,acpi_state_timer_broadcast (pr, cx,0 ); cx->time += sleep_ticks; -return ticks_elapsed_in_us (t1, t2); +return idle_time; }static int c3_cpu_count;@@ -966,8 +954,10 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, {struct acpi_processor *pr;struct acpi_processor_cx *cx =cpuidle_get_statedata (state); -u32 t1, t2; -int sleep_ticks =0 ; +ktime_t kt1, kt2; +s64 idle_time; +s64 sleep_ticks =0 ; + pr =__get_cpu_var (processors);@@ -1034,9 +1024,10 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,ACPI_FLUSH_CPU_CACHE (); } - t1 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt1 =ktime_get_real ();acpi_idle_do_entry (cx); - t2 =inl (acpi_gbl_FADT.xpm_timer_block.address); + kt2 =ktime_get_real (); + idle_time =ktime_to_us (ktime_sub (kt2, kt1));/* Re-enable bus master arbitration */ if (pr->flags.bm_check && pr->flags.bm_control) {@@ -1051,7 +1042,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,if (tsc_halts_in_c (ACPI_STATE_C3 ))mark_tsc_unstable ("TSC halts in idle" );#endif - sleep_ticks =ticks_elapsed (t1, t2); + sleep_ticks =us_to_pm_timer_ticks (idle_time);/* Tell the scheduler how much we idled: */ sched_clock_idle_wakeup_event (sleep_ticks*PM_TIMER_TICK_NS );@@ -1062,7 +1053,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,acpi_state_timer_broadcast (pr, cx,0 ); cx->time += sleep_ticks; -return ticks_elapsed_in_us (t1, t2); +return idle_time; }struct cpuidle_driver acpi_idle_driver = {
Len Brown
reviewerRe: [PATCH 06/98] acpi: fix of pmtimer overflow that make Cx states time incorrect
Quoted 5 lines
Is this worth adding:
CC: [email protected]
but wait until 2.6.30 is finished and no regressions have been reported? Then backport things to .29/.28 and eventually others?
possibly -- lets re-visit, say at rc3.
What happens when this is not applied is that the accounting gets screwed up, powertop looks wrong, and in rare cases -- non-optimal c-state selection decisions could be made.
So the actual symptom is mostly cosmetic -- but the possibility of puzzled or even alarmed users may be justification to backport.
But as this will not happen on most machines, and the failure is not severe, I don't hink a crusade to backport to every possible old release would make sense.
thanks,
-Len Brown, Intel Open Source Technology Center
Len Brown
reviewerPATCH 7/98 ACPI: pci_link: clean up whitespace
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes whitespace and indentation more consistent.
--- drivers/acpi/pci_link.c | 73 +++++++++++++++++----------------------------- 1 files changed, 27 insertions(+), 46 deletions(-)
drivers/acpi/pci_link.c +27 -46
@@ -43,13 +43,14 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> -#define _COMPONENT ACPI_PCI_COMPONENT +#define _COMPONENT ACPI_PCI_COMPONENTACPI_MODULE_NAME ("pci_link" );#define ACPI_PCI_LINK_CLASS "pci_irq_routing"#define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link"#define ACPI_PCI_LINK_FILE_INFO "info"#define ACPI_PCI_LINK_FILE_STATUS "state" -#define ACPI_PCI_LINK_MAX_POSSIBLE 16 +#define ACPI_PCI_LINK_MAX_POSSIBLE 16 +static int acpi_pci_link_add (struct acpi_device *device);static int acpi_pci_link_remove (struct acpi_device *device,int type);
@@ -66,7 +67,7 @@ static struct acpi_driver acpi_pci_link_driver = { .ops = { .add = acpi_pci_link_add, .remove = acpi_pci_link_remove, - }, + }, };/*
@@ -76,7 +77,7 @@ static struct acpi_driver acpi_pci_link_driver = {struct acpi_pci_link_irq {u8 active;/* Current IRQ */ u8 triggering;/* All IRQs */ -u8 polarity;/* All IRQs */ +u8 polarity;/* All IRQs */ u8 resource_type;u8 possible_count;u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE ];
@@ -85,15 +86,15 @@ struct acpi_pci_link_irq { };struct acpi_pci_link { -struct list_head node; -struct acpi_device *device; -struct acpi_pci_link_irq irq; -int refcnt; +struct list_head node; +struct acpi_device *device; +struct acpi_pci_link_irq irq; +int refcnt; };static struct { -int count; -struct list_head entries; +int count; +struct list_head entries; } acpi_link;static DEFINE_MUTEX (acpi_link_lock);
@@ -104,13 +105,12 @@ static DEFINE_MUTEX(acpi_link_lock);/* * set context (link) possible list from resource list */ -static acpi_status -acpi_pci_link_check_possible (struct acpi_resource *resource,void *context) +static acpi_status acpi_pci_link_check_possible (struct acpi_resource *resource, +void *context) {struct acpi_pci_link *link = context;u32 i =0 ; -switch (resource->type) {case ACPI_RESOURCE_TYPE_START_DEPENDENT :case ACPI_RESOURCE_TYPE_END_TAG :
@@ -179,7 +179,6 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) {acpi_status status; -if (!link)return -EINVAL ;
@@ -197,12 +196,11 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link)return 0 ; } -static acpi_status -acpi_pci_link_check_current (struct acpi_resource *resource,void *context) +static acpi_status acpi_pci_link_check_current (struct acpi_resource *resource, +void *context) {int *irq = (int *)context; -switch (resource->type) {case ACPI_RESOURCE_TYPE_START_DEPENDENT :case ACPI_RESOURCE_TYPE_END_TAG :
@@ -316,7 +314,6 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) } *resource;struct acpi_buffer buffer = {0 ,NULL }; -if (!link || !irq)return -EINVAL ;
@@ -479,10 +476,10 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {PIRQ_PENALTY_PCI_AVAILABLE ,/* IRQ9 PCI, often acpi */ PIRQ_PENALTY_PCI_AVAILABLE ,/* IRQ10 PCI */ PIRQ_PENALTY_PCI_AVAILABLE ,/* IRQ11 PCI */ -PIRQ_PENALTY_ISA_USED ,/* IRQ12 mouse */ -PIRQ_PENALTY_ISA_USED ,/* IRQ13 fpe, sometimes */ -PIRQ_PENALTY_ISA_USED ,/* IRQ14 ide0 */ - PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ +PIRQ_PENALTY_ISA_USED ,/* IRQ12 mouse */ +PIRQ_PENALTY_ISA_USED ,/* IRQ13 fpe, sometimes */ +PIRQ_PENALTY_ISA_USED ,/* IRQ14 ide0 */ + PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ /* >IRQ15 */ };
@@ -492,12 +489,10 @@ int __init acpi_irq_penalty_init(void)struct acpi_pci_link *link =NULL ;int i =0 ; -/* * Update penalties to facilitate IRQ balancing. */ list_for_each (node, &acpi_link.entries) { - link = list_entry(node, struct acpi_pci_link, node);if (!link) { printk(KERN_ERR PREFIX "Invalid link context\n");
@@ -527,7 +522,6 @@ int __init acpi_irq_penalty_init(void) }/* Add a penalty for the SCI */ acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] +=PIRQ_PENALTY_PCI_USING ; -return 0 ; }
@@ -538,7 +532,6 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)int irq;int i; -if (link->irq.initialized) {if (link->refcnt ==0 )/* This means the link is disabled but initialized */
@@ -566,11 +559,10 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)/* * if active found, use it; else pick entry from end of possible list. */ -if (link->irq.active) { +if (link->irq.active) irq = link->irq.active; - }else { +else irq = link->irq.possible[link->irq.possible_count -1 ]; - }if (acpi_irq_balance || !link->irq.active) {/*
@@ -599,7 +591,6 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) } link->irq.initialized =1 ; -return 0 ; }
@@ -608,17 +599,13 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)* success: return IRQ >= 0 * failure: return -1 */ - -int -acpi_pci_link_allocate_irq (acpi_handle handle, -int index, -int *triggering,int *polarity,char **name) +int acpi_pci_link_allocate_irq (acpi_handle handle,int index,int *triggering, +int *polarity,char **name) {int result =0 ;struct acpi_device *device =NULL ;struct acpi_pci_link *link =NULL ; - result =acpi_bus_get_device (handle, &device);if (result) { printk(KERN_ERR PREFIX "Invalid link device\n");
@@ -673,7 +660,6 @@ int acpi_pci_link_free_irq(acpi_handle handle)struct acpi_pci_link *link =NULL ;acpi_status result; - result =acpi_bus_get_device (handle, &device);if (result) { printk(KERN_ERR PREFIX "Invalid link device\n");
@@ -708,9 +694,9 @@ int acpi_pci_link_free_irq(acpi_handle handle)"Link %s is dereferenced\n" , acpi_device_bid(link->device))); -if (link->refcnt ==0 ) { +if (link->refcnt ==0 )acpi_evaluate_object (link->device->handle,"_DIS" ,NULL ,NULL ); - } +mutex_unlock (&acpi_link_lock);return (link->irq.active); }
@@ -726,7 +712,6 @@ static int acpi_pci_link_add(struct acpi_device *device)int i =0 ;int found =0 ; -if (!device)return -EINVAL ;
@@ -784,11 +769,10 @@ static int acpi_pci_link_add(struct acpi_device *device)static int acpi_pci_link_resume (struct acpi_pci_link *link) { -if (link->refcnt && link->irq.active && link->irq.initialized)return (acpi_pci_link_set (link, link->irq.active)); -else -return 0 ; + +return 0 ; }static int irqrouter_resume (struct sys_device *dev)
@@ -811,7 +795,6 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) {struct acpi_pci_link *link =NULL ; -if (!device || !acpi_driver_data (device))return -EINVAL ;
@@ -822,7 +805,6 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type)mutex_unlock (&acpi_link_lock);kfree (link); -return 0 ; }
@@ -931,7 +913,6 @@ static int __init irqrouter_init_sysfs(void) {int error; -if (acpi_disabled || acpi_noirq)return 0 ;
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 8/98 ACPI: pci_link: remove unnecessary casts and initializations
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
Remove unnecessary casts and initializations.
--- drivers/acpi/pci_link.c | 38 +++++++++++++++++++------------------- 1 files changed, 19 insertions(+), 19 deletions(-)
drivers/acpi/pci_link.c +19 -19
@@ -109,7 +109,7 @@ static acpi_status acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) {struct acpi_pci_link *link = context; -u32 i =0 ; +u32 i;switch (resource->type) {case ACPI_RESOURCE_TYPE_START_DEPENDENT :
@@ -199,7 +199,7 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link)static acpi_status acpi_pci_link_check_current (struct acpi_resource *resource,void *context) { -int *irq = (int *)context; +int *irq = context;switch (resource->type) {case ACPI_RESOURCE_TYPE_START_DEPENDENT :
@@ -256,7 +256,7 @@ static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource,static int acpi_pci_link_get_current (struct acpi_pci_link *link) {int result =0 ; -acpi_status status =AE_OK ; +acpi_status status;int irq =0 ;if (!link)
@@ -306,8 +306,8 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)static int acpi_pci_link_set (struct acpi_pci_link *link,int irq) { -int result =0 ; -acpi_status status =AE_OK ; +int result; +acpi_status status;struct {struct acpi_resource res;struct acpi_resource end;
@@ -485,9 +485,9 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {int __init acpi_irq_penalty_init (void ) { -struct list_head *node =NULL ; -struct acpi_pci_link *link =NULL ; -int i =0 ; +struct list_head *node; +struct acpi_pci_link *link; +int i;/* * Update penalties to facilitate IRQ balancing.
@@ -602,9 +602,9 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)int acpi_pci_link_allocate_irq (acpi_handle handle,int index,int *triggering,int *polarity,char **name) { -int result =0 ; -struct acpi_device *device =NULL ; -struct acpi_pci_link *link =NULL ; +int result; +struct acpi_device *device; +struct acpi_pci_link *link; result =acpi_bus_get_device (handle, &device);if (result) {
@@ -656,8 +656,8 @@ int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering,*/ int acpi_pci_link_free_irq (acpi_handle handle) { -struct acpi_device *device =NULL ; -struct acpi_pci_link *link =NULL ; +struct acpi_device *device; +struct acpi_pci_link *link;acpi_status result; result =acpi_bus_get_device (handle, &device);
@@ -707,9 +707,9 @@ int acpi_pci_link_free_irq(acpi_handle handle)static int acpi_pci_link_add (struct acpi_device *device) { -int result =0 ; -struct acpi_pci_link *link =NULL ; -int i =0 ; +int result; +struct acpi_pci_link *link; +int i;int found =0 ;if (!device)
@@ -777,8 +777,8 @@ static int acpi_pci_link_resume(struct acpi_pci_link *link)static int irqrouter_resume (struct sys_device *dev) { -struct list_head *node =NULL ; -struct acpi_pci_link *link =NULL ; +struct list_head *node; +struct acpi_pci_link *link;list_for_each (node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node);
@@ -793,7 +793,7 @@ static int irqrouter_resume(struct sys_device *dev)static int acpi_pci_link_remove (struct acpi_device *device,int type) { -struct acpi_pci_link *link =NULL ; +struct acpi_pci_link *link;if (!device || !acpi_driver_data (device))return -EINVAL ;
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 9/98 ACPI: pci_link: remove unnecessary null pointer checks
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
Better to oops and learn about a bug than to silently cover it up.
--- drivers/acpi/pci_link.c | 14 +------------- 1 files changed, 1 insertions(+), 13 deletions(-)
drivers/acpi/pci_link.c +1 -13
@@ -179,9 +179,6 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) {acpi_status status; -if (!link) -return -EINVAL ; - status =acpi_walk_resources (link->device->handle,METHOD_NAME__PRS , acpi_pci_link_check_possible, link);if (ACPI_FAILURE (status)) {
@@ -259,9 +256,6 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)acpi_status status;int irq =0 ; -if (!link) -return -EINVAL ; - link->irq.active =0 ;/* in practice, status disabled is meaningless, ignore it */
@@ -314,7 +308,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) } *resource;struct acpi_buffer buffer = {0 ,NULL }; -if (!link || !irq) +if (!irq)return -EINVAL ; resource =kzalloc (sizeof (*resource) +1 ,irqs_disabled () ?GFP_ATOMIC :GFP_KERNEL );
@@ -712,9 +706,6 @@ static int acpi_pci_link_add(struct acpi_device *device)int i;int found =0 ; -if (!device) -return -EINVAL ; - link =kzalloc (sizeof (struct acpi_pci_link ),GFP_KERNEL );if (!link)return -ENOMEM ;
@@ -795,9 +786,6 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) {struct acpi_pci_link *link; -if (!device || !acpi_driver_data (device)) -return -EINVAL ; - link =acpi_driver_data (device);mutex_lock (&acpi_link_lock);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 10/98 ACPI: pci_link: simplify list of link devices
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
We don't need a struct containing a count and a list_head; a simple list_head is sufficient. The list iterators handle empty lists fine.
Furthermore, we don't need to check for null list entries because we only add non-null entries.
--- drivers/acpi/pci_link.c | 32 ++++++-------------------------- 1 files changed, 6 insertions(+), 26 deletions(-)
drivers/acpi/pci_link.c +6 -26
@@ -86,16 +86,13 @@ struct acpi_pci_link_irq { };struct acpi_pci_link { -struct list_head node; +struct list_head list;struct acpi_device *device;struct acpi_pci_link_irq irq;int refcnt; }; -static struct { -int count; -struct list_head entries; -} acpi_link; +static LIST_HEAD (acpi_link_list);static DEFINE_MUTEX (acpi_link_lock);/* --------------------------------------------------------------------------
@@ -479,19 +476,13 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {int __init acpi_irq_penalty_init (void ) { -struct list_head *node;struct acpi_pci_link *link;int i;/* * Update penalties to facilitate IRQ balancing. */ -list_for_each (node, &acpi_link.entries) { - link = list_entry(node, struct acpi_pci_link, node); -if (!link) { - printk(KERN_ERR PREFIX "Invalid link context\n"); -continue ; - } +list_for_each_entry (link, &acpi_link_list, list) {/* * reflect the possible and active irqs in the penalty table --
@@ -743,9 +734,7 @@ static int acpi_pci_link_add(struct acpi_device *device)printk ("\n" ); -/* TBD: Acquire/release lock */ -list_add_tail (&link->node, &acpi_link.entries); - acpi_link.count++; +list_add_tail (&link->list, &acpi_link_list); end:/* disable all links -- to be activated on use */
@@ -768,15 +757,9 @@ static int acpi_pci_link_resume(struct acpi_pci_link *link)static int irqrouter_resume (struct sys_device *dev) { -struct list_head *node;struct acpi_pci_link *link; -list_for_each (node, &acpi_link.entries) { - link = list_entry(node, struct acpi_pci_link, node); -if (!link) { - printk(KERN_ERR PREFIX "Invalid link context\n"); -continue ; - } +list_for_each_entry (link, &acpi_link_list, list) {acpi_pci_link_resume (link); }return 0 ;
@@ -789,7 +772,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) link =acpi_driver_data (device);mutex_lock (&acpi_link_lock); -list_del (&link->node); +list_del (&link->list);mutex_unlock (&acpi_link_lock);kfree (link);
@@ -926,9 +909,6 @@ static int __init acpi_pci_link_init(void) acpi_irq_balance =0 ; } - acpi_link.count =0 ; -INIT_LIST_HEAD (&acpi_link.entries); -if (acpi_bus_register_driver (&acpi_pci_link_driver) <0 )return -ENODEV ;
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 11/98 ACPI: PCI: use generic pci_swizzle_interrupt_pin()
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
Use the generic pci_swizzle_interrupt_pin() instead of ACPI-specific code.
--- drivers/acpi/pci_irq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/pci_irq.c +1 -1
@@ -319,7 +319,7 @@ static struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin)*/ bridge = dev->bus->self;while (bridge) { - pin = (((pin -1 ) +PCI_SLOT (dev->devfn)) %4 ) +1 ; + pin =pci_swizzle_interrupt_pin (dev, pin);if ((bridge->class >>8 ) ==PCI_CLASS_BRIDGE_CARDBUS ) {/* PC card has the same IRQ as its cardbridge */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 12/98 ACPI: update Kconfig help texts (no functional changes)
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
Use "help" (not "---help---") consistently throughout.
ACPI can't be a module, so if both ACPI & APM are configured, we use ACPI.
Update pointers to ACPI CA and Linux ACPI projects.
Replace "Compaq" with "Hewlett-Packard" in the spec developer list.
Fix typo in /sys/module path.
The user-space daemon is "acpid", not "acpi".
Add standard "To compile this driver as a module ..." help text.
--- drivers/acpi/Kconfig | 150 ++++++++++++++++++++++++++++--------------------- 1 files changed, 86 insertions(+), 64 deletions(-)
drivers/acpi/Kconfig +86 -64
@@ -11,9 +11,9 @@ menuconfig ACPI select PNP select CPU_IDLE default y - ---help--- + help Advanced Configuration and Power Interface (ACPI) support for - Linux requires an ACPI compliant platform (hardware/firmware), + Linux requires an ACPI-compliant platform (hardware/firmware), and assumes the presence of OS-directed configuration and power management (OSPM) software. This option will enlarge your kernel by about 70K.
@@ -23,20 +23,19 @@ menuconfig ACPI the Plug-and-Play BIOS specification (PnP BIOS), the MultiProcessor Specification (MPS), and the Advanced Power Management (APM) specification. If both ACPI and APM support - are configured, whichever is loaded first shall be used. + are configured, ACPI is used. - The ACPI SourceForge project contains the latest source code, - documentation, tools, mailing list subscription, and other - information. This project is available at: - <http://sourceforge.net/projects/acpi> + The project home page for the Linux ACPI subsystem is here: + <http://www.lesswatts.org/projects/acpi/> Linux support for ACPI is based on Intel Corporation's ACPI - Component Architecture (ACPI CA). For more information see: - <http://developer.intel.com/technology/iapc/acpi> + Component Architecture (ACPI CA). For more information on the + ACPI CA, see: + <http://acpica.org/> - ACPI is an open industry specification co-developed by Compaq, - Intel, Microsoft, Phoenix, and Toshiba. The specification is - available at: + ACPI is an open industry specification co-developed by + Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba. + The specification is available at: <http://www.acpi.info> if ACPI
@@ -49,14 +48,14 @@ config ACPI_SLEEP config ACPI_PROCFS bool "Deprecated /proc/acpi files" depends on PROC_FS - ---help--- + help For backwards compatibility, this option allows deprecated /proc/acpi/ files to exist, even when they have been replaced by functions in /sys. The deprecated files (and their replacements) include: /proc/acpi/sleep (/sys/power/state) - /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) + /proc/acpi/info (/sys/module/acpi/parameters/acpica_version) /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
@@ -66,11 +65,12 @@ config ACPI_PROCFS and functions which do not yet exist in /sys. Say N to delete /proc/acpi/ files that have moved to /sys/ + config ACPI_PROCFS_POWER bool "Deprecated power /proc/acpi directories" depends on PROC_FS default y - ---help--- + help For backwards compatibility, this option allows deprecated power /proc/acpi/ directories to exist, even when they have been replaced by functions in /sys.
@@ -86,19 +86,19 @@ config ACPI_SYSFS_POWER bool "Future power /sys interface" select POWER_SUPPLY default y - ---help--- + help Say N to disable power /sys interface config ACPI_PROC_EVENT bool "Deprecated /proc/acpi/event support" depends on PROC_FS default y - ---help--- - A user-space daemon, acpi, typically read /proc/acpi/event - and handled all ACPI sub-system generated events. + help + A user-space daemon, acpid, typically reads /proc/acpi/event + and handles all ACPI-generated events. - These events are now delivered to user-space via - either the input layer, or as netlink events. + These events are now delivered to user-space either + via the input layer or as netlink events. This build option enables the old code for legacy user-space implementation. After some time, this will
@@ -112,10 +112,13 @@ config ACPI_AC depends on X86 default y help - This driver adds support for the AC Adapter object, which indicates - whether a system is on AC, or not. If you have a system that can + This driver supports the AC Adapter object, which indicates + whether a system is on AC or not. If you have a system that can switch between A/C and battery, say Y. + To compile this driver as a module, choose M here: + the module will be called ac. + config ACPI_BATTERY tristate "Battery" depends on X86
@@ -125,15 +128,21 @@ config ACPI_BATTERY /proc/acpi/battery. If you have a mobile system with a battery, say Y. + To compile this driver as a module, choose M here: + the module will be called battery. + config ACPI_BUTTON tristate "Button" depends on INPUT default y help - This driver handles events on the power, sleep and lid buttons. + This driver handles events on the power, sleep, and lid buttons. A daemon reads /proc/acpi/event and perform user-defined actions such as shutting down the system. This is necessary for - software controlled poweroff. + software-controlled poweroff. + + To compile this driver as a module, choose M here: + the module will be called button. config ACPI_VIDEO tristate "Video"
@@ -141,38 +150,45 @@ config ACPI_VIDEO depends on INPUT select THERMAL help - This driver implement the ACPI Extensions For Display Adapters + This driver implements the ACPI Extensions For Display Adapters for integrated graphics devices on motherboard, as specified in - ACPI 2.0 Specification, Appendix B, allowing to perform some basic - control like defining the video POST device, retrieving EDID information - or to setup a video output, etc. - Note that this is an ref. implementation only. It may or may not work - for your integrated video device. + ACPI 2.0 Specification, Appendix B. This supports basic operations + such as defining the video POST device, retrieving EDID information, + and setting up a video output. + + To compile this driver as a module, choose M here: + the module will be called video. config ACPI_FAN tristate "Fan" select THERMAL default y help - This driver adds support for ACPI fan devices, allowing user-mode + This driver supports ACPI fan devices, allowing user-mode applications to perform basic fan control (on, off, status). + To compile this driver as a module, choose M here: + the module will be called fan. + config ACPI_DOCK bool "Dock" depends on EXPERIMENTAL help - This driver adds support for ACPI controlled docking stations and removable - drive bays such as the IBM ultrabay or the Dell Module Bay. + This driver supports ACPI-controlled docking stations and removable + drive bays such as the IBM Ultrabay and the Dell Module Bay. config ACPI_PROCESSOR tristate "Processor" select THERMAL default y help - This driver installs ACPI as the idle handler for Linux, and uses - ACPI C2 and C3 processor states to save power, on systems that + This driver installs ACPI as the idle handler for Linux and uses + ACPI C2 and C3 processor states to save power on systems that support it. It is required by several flavors of cpufreq - Performance-state drivers. + performance-state drivers. + + To compile this driver as a module, choose M here: + the module will be called processor. config ACPI_HOTPLUG_CPU bool
@@ -186,11 +202,14 @@ config ACPI_THERMAL select THERMAL default y help - This driver adds support for ACPI thermal zones. Most mobile and + This driver supports ACPI thermal zones. Most mobile and some desktop systems support ACPI thermal zones. It is HIGHLY recommended that this option be enabled, as your processor(s) may be damaged without it. + To compile this driver as a module, choose M here: + the module will be called thermal. + config ACPI_NUMA bool "NUMA support" depends on NUMA
@@ -218,7 +237,7 @@ config ACPI_BLACKLIST_YEAR int "Disable ACPI for systems before Jan 1st this year" if X86_32 default 0 help - enter a 4-digit year, eg. 2001 to disable ACPI by default + Enter a 4-digit year, e.g., 2001, to disable ACPI by default on platforms with DMI BIOS date before January 1st that year. "acpi=force" can be used to override this mechanism.
@@ -249,10 +268,13 @@ config ACPI_PCI_SLOT tristate "PCI slot detection driver" default n help - This driver will attempt to discover all PCI slots in your system, - and creates entries in /sys/bus/pci/slots/. This feature can - help you correlate PCI bus addresses with the physical geography - of your slots. If you are unsure, say N. + This driver creates entries in /sys/bus/pci/slots/ for all PCI + slots in the system. This can help correlate PCI bus addresses, + i.e., segment/bus/device/function tuples, with physical slots in + the system. If you are unsure, say N. + + To compile this driver as a module, choose M here: + the module will be called pci_slot. config X86_PM_TIMER bool "Power Management Timer Support" if EMBEDDED
@@ -271,43 +293,43 @@ config X86_PM_TIMER systems require this timer. config ACPI_CONTAINER - tristate "ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)" + tristate "Container and Module Devices (EXPERIMENTAL)" depends on EXPERIMENTAL default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) - ---help--- - This allows _physical_ insertion and removal of CPUs and memory. - This can be useful, for example, on NUMA machines that support - ACPI based physical hotplug of nodes, or non-NUMA machines that - support physical cpu/memory hot-plug. + help + This driver supports ACPI Container and Module devices (IDs + ACPI0004, PNP0A05, and PNP0A06). - If one selects "m", this driver can be loaded with - "modprobe container". + This helps support hotplug of nodes, CPUs, and memory. + + To compile this driver as a module, choose M here: + the module will be called container. config ACPI_HOTPLUG_MEMORY tristate "Memory Hotplug" depends on MEMORY_HOTPLUG default n help - This driver adds supports for ACPI Memory Hotplug. This driver - provides support for fielding notifications on ACPI memory - devices (PNP0C80) which represent memory ranges that may be - onlined or offlined during runtime. + This driver supports ACPI memory hotplug. The driver + fields notifications on ACPI memory devices (PNP0C80), + which represent memory ranges that may be onlined or + offlined during runtime. - Enabling this driver assumes that your platform hardware - and firmware have support for hot-plugging physical memory. If - your system does not support physically adding or ripping out - memory DIMMs at some platform defined granularity (individually - or as a bank) at runtime, then you need not enable this driver. + If your hardware and firmware do not support adding or + removing memory devices at runtime, you need not enable + this driver. - If one selects "m," this driver can be loaded using the following - command: - $>modprobe acpi_memhotplug + To compile this driver as a module, choose M here: + the module will be called acpi_memhotplug. config ACPI_SBS tristate "Smart Battery System" depends on X86 help - This driver adds support for the Smart Battery System, another + This driver supports the Smart Battery System, another type of access to battery information, found on some laptops. + To compile this driver as a module, choose M here: + the modules will be called sbs and sbshc. + endif # ACPI
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 13/98 ACPI: move private declarations to internal.h
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
A number of things that shouldn't be exposed outside the ACPI core were declared in include/acpi/acpi_drivers.h, where anybody can see them. This patch moves those declarations to a new "internal.h" inside drivers/acpi.
--- drivers/acpi/bus.c | 2 ++ drivers/acpi/internal.h | 24 ++++++++++++++++++++++++ drivers/acpi/scan.c | 2 ++ drivers/acpi/sleep.c | 2 ++ drivers/acpi/wakeup.c | 2 ++ include/acpi/acpi_drivers.h | 23 ----------------------- 6 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 drivers/acpi/internal.h
drivers/acpi/bus.c +2 -0
@@ -39,6 +39,8 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> +#include "internal.h" +#define _COMPONENT ACPI_BUS_COMPONENTACPI_MODULE_NAME ("bus" );
drivers/acpi/internal.h new file +24 -0
@@ -0,0 +1,24 @@ +/* For use by Linux/ACPI infrastructure, not drivers */ + +/* -------------------------------------------------------------------------- +Power Resource +-------------------------------------------------------------------------- */ + +int acpi_device_sleep_wake (struct acpi_device *dev, +int enable,int sleep_state,int dev_state); +int acpi_enable_wakeup_device_power (struct acpi_device *dev,int sleep_state); +int acpi_disable_wakeup_device_power (struct acpi_device *dev); +int acpi_power_get_inferred_state (struct acpi_device *device); +int acpi_power_transition (struct acpi_device *device,int state); +extern int acpi_power_nocheck; + +/* -------------------------------------------------------------------------- +Embedded Controller +-------------------------------------------------------------------------- */ +int acpi_ec_ecdt_probe (void ); +int acpi_boot_ec_enable (void ); + +/*-------------------------------------------------------------------------- +Suspend/Resume +-------------------------------------------------------------------------- */ +extern int acpi_sleep_init (void );
drivers/acpi/scan.c +2 -0
@@ -11,6 +11,8 @@#include <acpi/acpi_drivers.h> +#include "internal.h" +#define _COMPONENT ACPI_BUS_COMPONENTACPI_MODULE_NAME ("scan" );#define STRUCT_TO_INT (s) (*((int*)&s))
drivers/acpi/sleep.c +2 -0
@@ -21,6 +21,8 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> + +#include "internal.h" #include "sleep.h" u8 sleep_states[ACPI_S_STATE_COUNT ];
drivers/acpi/wakeup.c +2 -0
@@ -8,6 +8,8 @@#include <acpi/acpi_drivers.h> #include <linux/kernel.h> #include <linux/types.h> + +#include "internal.h" #include "sleep.h" #define _COMPONENT ACPI_SYSTEM_COMPONENT
include/acpi/acpi_drivers.h +0 -23
@@ -99,24 +99,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, int bus);/* -------------------------------------------------------------------------- -Power Resource --------------------------------------------------------------------------- */ - -int acpi_device_sleep_wake (struct acpi_device *dev, -int enable,int sleep_state,int dev_state); -int acpi_enable_wakeup_device_power (struct acpi_device *dev,int sleep_state); -int acpi_disable_wakeup_device_power (struct acpi_device *dev); -int acpi_power_get_inferred_state (struct acpi_device *device); -int acpi_power_transition (struct acpi_device *device,int state); -extern int acpi_power_nocheck; - -/* -------------------------------------------------------------------------- -Embedded Controller --------------------------------------------------------------------------- */ -int acpi_ec_ecdt_probe (void ); -int acpi_boot_ec_enable (void ); - -/* -------------------------------------------------------------------------- Processor -------------------------------------------------------------------------- */
@@ -165,9 +147,4 @@ static inline void unregister_hotplug_dock_device(acpi_handle handle) }#endif -/*-------------------------------------------------------------------------- -Suspend/Resume --------------------------------------------------------------------------- */ -extern int acpi_sleep_init (void ); -#endif /*__ACPI_DRIVERS_H__*/
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 14/98 ACPICA: Add error check to debug object dump routine
In reply to Len BrownFrom: Bob Moore <[email protected]>
Add check for invalid handle in acpi_ns_dump_one_object.
--- drivers/acpi/acpica/nsdump.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/acpi/acpica/nsdump.c +6 -0
@@ -181,6 +181,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, } this_node =acpi_ns_map_handle_to_node (obj_handle); +if (!this_node) { +ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Invalid object handle %p\n" , + obj_handle)); +return (AE_OK ); + } + type = this_node->type;/* Check if the owner matches */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 15/98 ACPICA: Allow OS override of all ACPI tables
In reply to Len BrownFrom: Bob Moore <[email protected]>
Previously, the table override mechanism was implemented for the DSDT only. Now, any table in the RSDT/XSDT can be replaced by the host OS. (including the DSDT).
--- drivers/acpi/acpica/acglobal.h | 1 - drivers/acpi/acpica/tbutils.c | 59 +++++++++++++++++++++++++++++++--------- drivers/acpi/acpica/tbxface.c | 31 +-------------------- include/acpi/actbl.h | 5 ++- 4 files changed, 50 insertions(+), 46 deletions(-)
drivers/acpi/acpica/acglobal.h +0 -1
@@ -371,7 +371,6 @@ ACPI_EXTERN char *acpi_gbl_db_buffer; ACPI_EXTERN char *acpi_gbl_db_filename; ACPI_EXTERN u32 acpi_gbl_db_debug_level; ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; -ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr; ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node;/*
drivers/acpi/acpica/tbutils.c +46 -13
101 lines not on this page · raw message
drivers/acpi/acpica/tbxface.c +1 -30
@@ -491,7 +491,6 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_by_index)static acpi_status acpi_tb_load_namespace (void ) {acpi_status status; -struct acpi_table_header *table;u32 i;ACPI_FUNCTION_TRACE (tb_load_namespace);
@@ -515,41 +514,13 @@ static acpi_status acpi_tb_load_namespace(void) goto unlock_and_exit; } -/* -* Find DSDT table -*/ - status = -acpi_os_table_override (acpi_gbl_root_table_list. - tables[ACPI_TABLE_INDEX_DSDT ].pointer, - &table); -if (ACPI_SUCCESS (status) && table) { -/* -* DSDT table has been found -*/ -acpi_tb_delete_table (&acpi_gbl_root_table_list. - tables[ACPI_TABLE_INDEX_DSDT ]); - acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT ].pointer = - table; - acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT ].length = - table->length; - acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT ].flags = -ACPI_TABLE_ORIGIN_UNKNOWN ; - -ACPI_INFO ((AE_INFO ,"Table DSDT replaced by host OS" )); -acpi_tb_print_table_header (0 , table); - -if (no_auto_ssdt ==0 ) { -printk (KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\"\n" ); - } - } +/* A valid DSDT is required */ status =acpi_tb_verify_table (&acpi_gbl_root_table_list. tables[ACPI_TABLE_INDEX_DSDT ]);if (ACPI_FAILURE (status)) { -/* A valid DSDT is required */ - status =AE_NO_ACPI_TABLES ; goto unlock_and_exit; }
include/acpi/actbl.h +3 -2
@@ -310,8 +310,9 @@ struct acpi_table_desc {#define ACPI_TABLE_ORIGIN_UNKNOWN (0)#define ACPI_TABLE_ORIGIN_MAPPED (1)#define ACPI_TABLE_ORIGIN_ALLOCATED (2) -#define ACPI_TABLE_ORIGIN_MASK (3) -#define ACPI_TABLE_IS_LOADED (4) +#define ACPI_TABLE_ORIGIN_OVERRIDE (4) +#define ACPI_TABLE_ORIGIN_MASK (7) +#define ACPI_TABLE_IS_LOADED (8)/* * Get the remaining ACPI tables
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 16/98 ACPICA: Remove extraneous parameter in table manager
In reply to Len BrownFrom: Bob Moore <[email protected]>
Removed the Flags parameter from several internal functions since it was not being used.
--- drivers/acpi/acpica/actables.h | 7 +++---- drivers/acpi/acpica/tbfadt.c | 7 +++---- drivers/acpi/acpica/tbutils.c | 14 +++++++------- drivers/acpi/acpica/tbxface.c | 3 +-- 4 files changed, 14 insertions(+), 17 deletions(-)
drivers/acpi/acpica/actables.h +3 -4
@@ -49,7 +49,7 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count);/* * tbfadt - FADT parse/convert/validate */ -void acpi_tb_parse_fadt (u32 table_index,u8 flags); +void acpi_tb_parse_fadt (u32 table_index);void acpi_tb_create_local_fadt (struct acpi_table_header *table,u32 length);
@@ -109,9 +109,8 @@ acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length);void acpi_tb_install_table (acpi_physical_address address, -u8 flags,char *signature,u32 table_index); +char *signature,u32 table_index); -acpi_status -acpi_tb_parse_root_table (acpi_physical_address rsdp_address,u8 flags); +acpi_status acpi_tb_parse_root_table (acpi_physical_address rsdp_address);#endif /* __ACTABLES_H__ */
drivers/acpi/acpica/tbfadt.c +3 -4
@@ -172,7 +172,6 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,* FUNCTION: acpi_tb_parse_fadt * * PARAMETERS: table_index - Index for the FADT -* Flags - Flags * * RETURN: None *
@@ -181,7 +180,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,* ******************************************************************************/ -void acpi_tb_parse_fadt (u32 table_index,u8 flags) +void acpi_tb_parse_fadt (u32 table_index) {u32 length;struct acpi_table_header *table;
@@ -219,10 +218,10 @@ void acpi_tb_parse_fadt(u32 table_index, u8 flags)/* Obtain the DSDT and FACS tables via their addresses within the FADT */ acpi_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xdsdt, - flags,ACPI_SIG_DSDT ,ACPI_TABLE_INDEX_DSDT ); +ACPI_SIG_DSDT ,ACPI_TABLE_INDEX_DSDT );acpi_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xfacs, - flags,ACPI_SIG_FACS ,ACPI_TABLE_INDEX_FACS ); +ACPI_SIG_FACS ,ACPI_TABLE_INDEX_FACS ); }/*******************************************************************************
drivers/acpi/acpica/tbutils.c +7 -7
@@ -280,7 +280,6 @@ u8 acpi_tb_checksum(u8 *buffer, u32 length)* FUNCTION: acpi_tb_install_table * * PARAMETERS: Address - Physical address of DSDT or FACS -* Flags - Flags * Signature - Table signature, NULL if no need to * match * table_index - Index into root table array
@@ -296,8 +295,9 @@ u8 acpi_tb_checksum(u8 *buffer, u32 length)void acpi_tb_install_table (acpi_physical_address address, -u8 flags,char *signature,u32 table_index) +char *signature,u32 table_index) { +u8 flags;acpi_status status;struct acpi_table_header *table_to_install;struct acpi_table_header *mapped_table;
@@ -344,12 +344,13 @@ acpi_tb_install_table(acpi_physical_address address, acpi_gbl_root_table_list.tables[table_index].pointer = override_table; - flags =ACPI_TABLE_ORIGIN_OVERRIDE ; address =ACPI_PTR_TO_PHYSADDR (override_table); table_to_install = override_table; + flags =ACPI_TABLE_ORIGIN_OVERRIDE ; }else { table_to_install = mapped_table; + flags =ACPI_TABLE_ORIGIN_MAPPED ; }/* Initialize the table entry */
@@ -435,7 +436,6 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size)* FUNCTION: acpi_tb_parse_root_table * * PARAMETERS: Rsdp - Pointer to the RSDP -* Flags - Flags * * RETURN: Status *
@@ -449,7 +449,7 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size)******************************************************************************/ acpi_status __init -acpi_tb_parse_root_table (acpi_physical_address rsdp_address,u8 flags) +acpi_tb_parse_root_table (acpi_physical_address rsdp_address) {struct acpi_table_rsdp *rsdp;u32 table_entry_size;
@@ -600,14 +600,14 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)*/ for (i =2 ; i < acpi_gbl_root_table_list.count; i++) {acpi_tb_install_table (acpi_gbl_root_table_list.tables[i]. - address, flags,NULL , i); + address,NULL , i);/* Special case for FADT - get the DSDT and FACS */ if (ACPI_COMPARE_NAME (&acpi_gbl_root_table_list.tables[i].signature,ACPI_SIG_FADT )) { -acpi_tb_parse_fadt (i, flags); +acpi_tb_parse_fadt (i); } }
drivers/acpi/acpica/tbxface.c +1 -2
@@ -150,8 +150,7 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,* Root Table Array. This array contains the information of the RSDT/XSDT * in a common, more useable format. */ - status = -acpi_tb_parse_root_table (rsdp_address,ACPI_TABLE_ORIGIN_MAPPED ); + status =acpi_tb_parse_root_table (rsdp_address);return_ACPI_STATUS (status); }
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 17/98 ACPICA: Add override for dynamic tables
In reply to Len BrownFrom: Bob Moore <[email protected]>
Add a call to acpi_os_table_override during the installation of a dynamic table (loaded via the Load or LoadTable AML operators).
--- drivers/acpi/acpica/tbinstal.c | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-)
drivers/acpi/acpica/tbinstal.c +27 -1
@@ -103,7 +103,9 @@ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc)* * RETURN: Status * -* DESCRIPTION: This function is called to add the ACPI table +* DESCRIPTION: This function is called to add an ACPI table. It is used to +* dynamically load tables via the Load and load_table AML +* operators. * ******************************************************************************/
@@ -112,6 +114,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) {u32 i;acpi_status status =AE_OK ; +struct acpi_table_header *override_table =NULL ;ACPI_FUNCTION_TRACE (tb_add_table);
@@ -201,6 +204,29 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) } } +/* +* ACPI Table Override: +* Allow the host to override dynamically loaded tables. +*/ + status =acpi_os_table_override (table_desc->pointer, &override_table); +if (ACPI_SUCCESS (status) && override_table) { +ACPI_INFO ((AE_INFO , +"%4.4s @ 0x%p Table override, replaced with:" , + table_desc->pointer->signature, +ACPI_CAST_PTR (void, table_desc->address))); + +/* We can delete the table that was passed as a parameter */ + +acpi_tb_delete_table (table_desc); + +/* Setup descriptor for the new table */ + + table_desc->address =ACPI_PTR_TO_PHYSADDR (override_table); + table_desc->pointer = override_table; + table_desc->length = override_table->length; + table_desc->flags =ACPI_TABLE_ORIGIN_OVERRIDE ; + } +/* Add the table to the global root table list */ status = acpi_tb_store_table(table_desc->address, table_desc->pointer,
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 18/98 ACPICA: Update FADT flag definitions
In reply to Len BrownFrom: Bob Moore <[email protected]>
Add new flags in the Boot Architecture flags field. Update comments for all FADT flags. Add FADT version when each flag was defined.
--- drivers/pci/pci-acpi.c | 4 +- include/acpi/actbl.h | 69 +++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 37 deletions(-)
drivers/pci/pci-acpi.c +2 -2
@@ -386,12 +386,12 @@ static int __init acpi_pci_init(void) {int ret; -if (acpi_gbl_FADT.boot_flags &BAF_MSI_NOT_SUPPORTED ) { +if (acpi_gbl_FADT.boot_flags &ACPI_FADT_NO_MSI ) {printk (KERN_INFO "ACPI FADT declares the system doesn't support MSI, so disable it\n" );pci_no_msi (); } -if (acpi_gbl_FADT.boot_flags &BAF_PCIE_ASPM_CONTROL ) { +if (acpi_gbl_FADT.boot_flags &ACPI_FADT_NO_ASPM ) {printk (KERN_INFO "ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n" );pcie_no_aspm (); }
include/acpi/actbl.h +34 -35
93 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 19/98 ACPICA: Update version to 20090123
In reply to Len BrownFrom: Bob Moore <[email protected]>
Update version to 20090123.
--- include/acpi/acpixf.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acpixf.h +1 -1
@@ -47,7 +47,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20081204 +#define ACPI_CA_VERSION 0x20090123#include "actypes.h" #include "actbl.h"
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 20/98 ACPICA: Split out PM1 status registers from the FADT
In reply to Len BrownFrom: Bob Moore <[email protected]>
Add new globals for the PM1 status registers (A/B), similar to the way the PM1 enable registers are handled. Instead of overloading the FADT Event Register blocks. This makes the code clearer and less prone to error.
--- drivers/acpi/acpica/acglobal.h | 5 +- drivers/acpi/acpica/hwregs.c | 18 ++-- drivers/acpi/acpica/tbfadt.c | 246 ++++++++++++++++++++++------------------ 3 files changed, 147 insertions(+), 122 deletions(-)
drivers/acpi/acpica/acglobal.h +4 -1
@@ -148,9 +148,12 @@ ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list; ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT; ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS; -/* These addresses are calculated from FADT address values */ +/* These addresses are calculated from the FADT Event Block addresses */ +ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_status; ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; + +ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_status; ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;/*
drivers/acpi/acpica/hwregs.c +10 -8
@@ -72,21 +72,23 @@ acpi_status acpi_hw_clear_acpi_status(void)ACPI_DEBUG_PRINT ((ACPI_DB_IO ,"About to write %04X to %04X\n" ,ACPI_BITMASK_ALL_FIXED_STATUS , - (u16 ) acpi_gbl_FADT.xpm1a_event_block.address)); + (u16 ) acpi_gbl_xpm1a_status.address)); lock_flags =acpi_os_acquire_lock (acpi_gbl_hardware_lock); +/* Clear the fixed events */ + status =acpi_hw_register_write (ACPI_REGISTER_PM1_STATUS ,ACPI_BITMASK_ALL_FIXED_STATUS );if (ACPI_FAILURE (status)) { goto unlock_and_exit; } -/* Clear the fixed events */ +/* Write PM1B register if present */ -if (acpi_gbl_FADT.xpm1b_event_block.address) { +if (acpi_gbl_xpm1b_status.address) { status =acpi_write (ACPI_BITMASK_ALL_FIXED_STATUS , - &acpi_gbl_FADT.xpm1b_event_block); + &acpi_gbl_xpm1b_status);if (ACPI_FAILURE (status)) { goto unlock_and_exit; }
@@ -150,14 +152,14 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)switch (register_id) {case ACPI_REGISTER_PM1_STATUS :/* 16-bit access */ - status =acpi_read (&value1, &acpi_gbl_FADT.xpm1a_event_block); + status =acpi_read (&value1, &acpi_gbl_xpm1a_status);if (ACPI_FAILURE (status)) { goto exit; }/* PM1B is optional */ - status =acpi_read (&value2, &acpi_gbl_FADT.xpm1b_event_block); + status =acpi_read (&value2, &acpi_gbl_xpm1b_status); value1 |= value2;break ;
@@ -267,14 +269,14 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)/* Now we can write the data */ - status =acpi_write (value, &acpi_gbl_FADT.xpm1a_event_block); + status =acpi_write (value, &acpi_gbl_xpm1a_status);if (ACPI_FAILURE (status)) { goto exit; }/* PM1B is optional */ - status =acpi_write (value, &acpi_gbl_FADT.xpm1b_event_block); + status =acpi_write (value, &acpi_gbl_xpm1b_status);break ;case ACPI_REGISTER_PM1_ENABLE :/* 16-bit access */
drivers/acpi/acpica/tbfadt.c +133 -113
286 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 21/98 ACPICA: Check for non-zero address before being converted to GAS
In reply to Len BrownFrom: Lin Ming <[email protected]>
--- drivers/acpi/acpica/tbfadt.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
drivers/acpi/acpica/tbfadt.c +9 -7
@@ -618,12 +618,14 @@ static void acpi_tb_setup_fadt_registers(void) ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, fadt_pm_info_table[i].source); -acpi_tb_init_generic_address (fadt_pm_info_table[i].target, - source64->space_id, - pm1_register_byte_width, - source64->address + - (fadt_pm_info_table[i]. - register_num * - pm1_register_byte_width)); +if (source64->address) { +acpi_tb_init_generic_address (fadt_pm_info_table[i]. + target, source64->space_id, + pm1_register_byte_width, + source64->address + + (fadt_pm_info_table[i]. + register_num * + pm1_register_byte_width)); + } } }
Signature · 1 line
1.6.0.6
Re: [PATCH 21/98] ACPICA: Check for non-zero address before being converted to GAS
Quoted 5 lines · On Saturday 28 March 2009 05:30:56 Len Brown wrote:
From: Lin Ming <[email protected]>
Reported-by FreeBSD communitySigned-off-by Lin Ming <[email protected]>Signed-off-by Len Brown <[email protected]>
Does this fix something for real?
If yes, please add:
CC: [email protected]
not sure if not.
Review
Quoted 5 lines
--- drivers/acpi/acpica/tbfadt.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)(quoted diff) +0
-0
b/drivers/acpi/acpica/tbfadt.c
Quoted 26 lines
index a8191ef..43fe886 100644
drivers/acpi/acpica/tbfadt.c +9
-7@@ -618,12 +618,14 @@ static void acpi_tb_setup_fadt_registers(void) ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, fadt_pm_info_table[i].source); -acpi_tb_init_generic_address (fadt_pm_info_table[i].target, - source64->space_id, - pm1_register_byte_width, - source64->address + - (fadt_pm_info_table[i]. - register_num * - pm1_register_byte_width)); +if (source64->address) { +acpi_tb_init_generic_address (fadt_pm_info_table[i]. + target, source64->space_id, + pm1_register_byte_width, + source64->address + + (fadt_pm_info_table[i]. + register_num * + pm1_register_byte_width)); + } } }
Re: [PATCH 21/98] ACPICA: Check for non-zero address before being converted to GAS
Quoted 7 lines · Thomas Renninger
Quoted 5 lines · On Saturday 28 March 2009 05:30:56 Len Brown wrote:
From: Lin Ming <[email protected]>
Reported-by FreeBSD communitySigned-off-by Lin Ming <[email protected]>Signed-off-by Len Brown <[email protected]>Does this fix something for real?
It's a regression fix.
see "linux-next acpi changes make vmware server unusable"
http://marc.info/?l=linux-acpi&m=123620365021296&w=2
Lin Ming
Quoted 40 lines
If yes, please add:
CC: [email protected]
not sure if not.Review
Quoted 5 lines
--- drivers/acpi/acpica/tbfadt.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)(quoted diff) +0
-0
b/drivers/acpi/acpica/tbfadt.cQuoted 16 lines
index a8191ef..43fe886 100644
drivers/acpi/acpica/tbfadt.c +1
-7@@ -618,12 +618,14 @@ static void acpi_tb_setup_fadt_registers(void) ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, fadt_pm_info_table[i].source); -acpi_tb_init_generic_address (fadt_pm_info_table[i].target, - source64->space_id, - pm1_register_byte_width, - source64->address + - (fadt_pm_info_table[i]. - register_num * - pm1_register_byte_width)); +if (source64->address) {drivers/acpi/acpica/tbfadt.c static void acpi_tb_setup_fadt_registers(void) · line 631
Quoted 10 lines
drivers/acpi/acpica/tbfadt.c +8
-0+acpi_tb_init_generic_address (fadt_pm_info_table[i]. + target, source64->space_id, + pm1_register_byte_width, + source64->address + + (fadt_pm_info_table[i]. + register_num * + pm1_register_byte_width)); + } } }--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Len Brown
reviewerRe: [PATCH 21/98] ACPICA: Check for non-zero address before being converted to GAS
Quoted 4 lines · Lin Ming
Quoted 3 lines · Thomas Renninger
Quoted 2 lines · On Saturday 28 March 2009 05:30:56 Len Brown wrote:
From: Lin Ming <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Reported-by FreeBSD communitySigned-off-by Lin Ming <[email protected]>Signed-off-by Len Brown <[email protected]>Does this fix something for real?
It's a regression fix.
see "linux-next acpi changes make vmware server unusable"
http://marc.info/?l=linux-acpi&m=123620365021296&w=2
To clarify...
this fix is in response to a regression caused by the previous patch in this series. That is why it doesn't need to go to .stable.
thanks,
-Len Brown, Intel Open Source Technology Center
Len Brown
reviewerPATCH 22/98 ACPICA: Update comments in module header
In reply to Len BrownFrom: Bob Moore <[email protected]>
Enhance the explanations of the various package return types for clarity.
--- drivers/acpi/acpica/acpredef.h | 41 +++++++++++++++++++++------------------ 1 files changed, 22 insertions(+), 19 deletions(-)
drivers/acpi/acpica/acpredef.h +22 -19
@@ -52,41 +52,44 @@* 1) PTYPE1 packages do not contain sub-packages. * * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types: -* object type -* count -* object type -* count +* object type +* count +* object type +* count * * ACPI_PTYPE1_VAR: Variable length: -* object type (Int/Buf/Ref) +* object type (Int/Buf/Ref) * -* ACPI_PTYPE1_OPTION: Package has some required and some optional elements: -* Used for _PRW +* ACPI_PTYPE1_OPTION: Package has some required and some optional elements +* (Used for _PRW) * * * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the * different types describe the contents of each of the sub-packages. * * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: -* object type -* count -* object type -* count +* object type +* count +* object type +* count +* (Used for _ALR,_MLS,_PSS,_TRT,_TSS) * * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element: -* object type +* object type +* (Used for _CSD,_PSD,_TSD) * * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types: -* object type -* count -* object type -* count +* object type +* count +* object type +* count +* (Used for _CST) * -* ACPI_PTYPE2_FIXED: Each subpackage is of fixed length: -* Used for _PRT +* ACPI_PTYPE2_FIXED: Each subpackage is of fixed length +* (Used for _PRT) * * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length -* Used for _HPX +* (Used for _HPX) * *****************************************************************************/
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 23/98 ACPICA: Fix writes to optional PM1B registers
In reply to Len BrownFrom: Bob Moore <[email protected]>
On read, shift B register bits above the A bits. On write, shift B bits down to zero before writing the B register. New:acpi_hw_read_multiple, acpi_hw_write_multiple. These two functions now transparently handle the (possible) split registers for PM1 Status, Enable, and Control.
--- drivers/acpi/acpica/hwregs.c | 205 ++++++++++++++++++++++++++++------------- 1 files changed, 140 insertions(+), 65 deletions(-)
drivers/acpi/acpica/hwregs.c +140 -65
@@ -51,6 +51,17 @@#define _COMPONENT ACPI_HARDWAREACPI_MODULE_NAME ("hwregs" ) +/* Local Prototypes */ +static acpi_status +acpi_hw_read_multiple (u32 *value, +struct acpi_generic_address *register_a, +struct acpi_generic_address *register_b); + +static acpi_status +acpi_hw_write_multiple (u32 value, +struct acpi_generic_address *register_a, +struct acpi_generic_address *register_b); +/******************************************************************************* * * FUNCTION: acpi_hw_clear_acpi_status
@@ -63,6 +74,7 @@ ACPI_MODULE_NAME("hwregs")* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ +acpi_status acpi_hw_clear_acpi_status (void ) {acpi_status status;
@@ -143,64 +155,49 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)acpi_status acpi_hw_register_read (u32 register_id,u32 * return_value) { -u32 value1 =0 ; -u32 value2 =0 ; +u32 value =0 ;acpi_status status;ACPI_FUNCTION_TRACE (hw_register_read);switch (register_id) { -case ACPI_REGISTER_PM1_STATUS :/* 16-bit access */ +case ACPI_REGISTER_PM1_STATUS :/* PM1 A/B: 16-bit access each */ - status =acpi_read (&value1, &acpi_gbl_xpm1a_status); -if (ACPI_FAILURE (status)) { - goto exit; - } - -/* PM1B is optional */ - - status =acpi_read (&value2, &acpi_gbl_xpm1b_status); - value1 |= value2; + status =acpi_hw_read_multiple (&value, + &acpi_gbl_xpm1a_status, + &acpi_gbl_xpm1b_status);break ; -case ACPI_REGISTER_PM1_ENABLE :/* 16-bit access */ +case ACPI_REGISTER_PM1_ENABLE :/* PM1 A/B: 16-bit access each */ - status =acpi_read (&value1, &acpi_gbl_xpm1a_enable); -if (ACPI_FAILURE (status)) { - goto exit; - } - -/* PM1B is optional */ - - status =acpi_read (&value2, &acpi_gbl_xpm1b_enable); - value1 |= value2; + status =acpi_hw_read_multiple (&value, + &acpi_gbl_xpm1a_enable, + &acpi_gbl_xpm1b_enable);break ; -case ACPI_REGISTER_PM1_CONTROL :/* 16-bit access */ - - status =acpi_read (&value1, &acpi_gbl_FADT.xpm1a_control_block); -if (ACPI_FAILURE (status)) { - goto exit; - } +case ACPI_REGISTER_PM1_CONTROL :/* PM1 A/B: 16-bit access each */ - status =acpi_read (&value2, &acpi_gbl_FADT.xpm1b_control_block); - value1 |= value2; + status =acpi_hw_read_multiple (&value, + &acpi_gbl_FADT. + xpm1a_control_block, + &acpi_gbl_FADT. + xpm1b_control_block);break ;case ACPI_REGISTER_PM2_CONTROL :/* 8-bit access */ - status =acpi_read (&value1, &acpi_gbl_FADT.xpm2_control_block); + status =acpi_read (&value, &acpi_gbl_FADT.xpm2_control_block);break ;case ACPI_REGISTER_PM_TIMER :/* 32-bit access */ - status =acpi_read (&value1, &acpi_gbl_FADT.xpm_timer_block); + status =acpi_read (&value, &acpi_gbl_FADT.xpm_timer_block);break ;case ACPI_REGISTER_SMI_COMMAND_BLOCK :/* 8-bit access */ status = -acpi_os_read_port (acpi_gbl_FADT.smi_command, &value1,8 ); +acpi_os_read_port (acpi_gbl_FADT.smi_command, &value,8 );break ;default :
@@ -209,10 +206,8 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)break ; } - exit: -if (ACPI_SUCCESS (status)) { - *return_value = value1; + *return_value = value; }return_ACPI_STATUS (status);
@@ -252,12 +247,13 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)ACPI_FUNCTION_TRACE (hw_register_write);switch (register_id) { -case ACPI_REGISTER_PM1_STATUS :/* 16-bit access */ +case ACPI_REGISTER_PM1_STATUS :/* PM1 A/B: 16-bit access each */ /* Perform a read first to preserve certain bits (per ACPI spec) */ - status =acpi_hw_register_read (ACPI_REGISTER_PM1_STATUS , - &read_value); + status =acpi_hw_read_multiple (&read_value, + &acpi_gbl_xpm1a_status, + &acpi_gbl_xpm1b_status);if (ACPI_FAILURE (status)) { goto exit; }
@@ -269,35 +265,29 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)/* Now we can write the data */ - status =acpi_write (value, &acpi_gbl_xpm1a_status); -if (ACPI_FAILURE (status)) { - goto exit; - } - -/* PM1B is optional */ - - status =acpi_write (value, &acpi_gbl_xpm1b_status); + status =acpi_hw_write_multiple (value, + &acpi_gbl_xpm1a_status, + &acpi_gbl_xpm1b_status);break ; -case ACPI_REGISTER_PM1_ENABLE :/* 16-bit access */ +case ACPI_REGISTER_PM1_ENABLE :/* PM1 A/B: 16-bit access */ - status =acpi_write (value, &acpi_gbl_xpm1a_enable); -if (ACPI_FAILURE (status)) { - goto exit; - } - -/* PM1B is optional */ - - status =acpi_write (value, &acpi_gbl_xpm1b_enable); + status =acpi_hw_write_multiple (value, + &acpi_gbl_xpm1a_enable, + &acpi_gbl_xpm1b_enable);break ; -case ACPI_REGISTER_PM1_CONTROL :/* 16-bit access */ +case ACPI_REGISTER_PM1_CONTROL :/* PM1 A/B: 16-bit access each */ /* * Perform a read first to preserve certain bits (per ACPI spec) +* Note: This includes SCI_EN, we never want to change this bit */ - status =acpi_hw_register_read (ACPI_REGISTER_PM1_CONTROL , - &read_value); + status =acpi_hw_read_multiple (&read_value, + &acpi_gbl_FADT. + xpm1a_control_block, + &acpi_gbl_FADT. + xpm1b_control_block);if (ACPI_FAILURE (status)) { goto exit; }
@@ -309,12 +299,11 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)/* Now we can write the data */ - status =acpi_write (value, &acpi_gbl_FADT.xpm1a_control_block); -if (ACPI_FAILURE (status)) { - goto exit; - } - - status =acpi_write (value, &acpi_gbl_FADT.xpm1b_control_block); + status =acpi_hw_write_multiple (value, + &acpi_gbl_FADT. + xpm1a_control_block, + &acpi_gbl_FADT. + xpm1b_control_block);break ;case ACPI_REGISTER_PM1A_CONTROL :/* 16-bit access */
@@ -346,6 +335,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)break ;default : +ACPI_ERROR ((AE_INFO ,"Unknown Register ID: %X" , register_id)); status =AE_BAD_PARAMETER ;break ; }
@@ -353,3 +343,88 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) exit:return_ACPI_STATUS (status); } + +/****************************************************************************** +* +* FUNCTION: acpi_hw_read_multiple +* +* PARAMETERS: Value - Where the register value is returned +* register_a - First ACPI register (required) +* register_b - Second ACPI register (optional) +* +* RETURN: Status +* +* DESCRIPTION: Read from the specified two-part ACPI register (such as PM1 A/B) +* +******************************************************************************/ + +static acpi_status +acpi_hw_read_multiple (u32 *value, +struct acpi_generic_address *register_a, +struct acpi_generic_address *register_b) +{ +u32 value_a =0 ; +u32 value_b =0 ; +acpi_status status; + +/* The first register is always required */ + + status =acpi_read (&value_a, register_a); +if (ACPI_FAILURE (status)) { +return (status); + } + +/* Second register is optional */ + +if (register_b->address) { + status =acpi_read (&value_b, register_b); +if (ACPI_FAILURE (status)) { +return (status); + } + } + +/* Shift the B bits above the A bits */ + + *value = value_a | (value_b << register_a->bit_width); +return (AE_OK ); +} + +/****************************************************************************** +* +* FUNCTION: acpi_hw_write_multiple +* +* PARAMETERS: Value - The value to write +* register_a - First ACPI register (required) +* register_b - Second ACPI register (optional) +* +* RETURN: Status +* +* DESCRIPTION: Write to the specified two-part ACPI register (such as PM1 A/B) +* +******************************************************************************/ + +static acpi_status +acpi_hw_write_multiple (u32 value, +struct acpi_generic_address *register_a, +struct acpi_generic_address *register_b) +{ +acpi_status status; + +/* The first register is always required */ + + status =acpi_write (value, register_a); +if (ACPI_FAILURE (status)) { +return (status); + } + +/* Second register is optional */ + +if (register_b->address) { + +/* Normalize the B bits before write */ + + status =acpi_write (value >> register_a->bit_width, register_b); + } + +return (status); +}
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 24/98 ACPICA: Remove extra write for acpi_hw_clear_acpi_status
In reply to Len BrownFrom: Bob Moore <[email protected]>
This function was writing an optional PM1B status register twice. The existing call to the low-level acpi_hw_register_write automatically handles a possibly split PM1 A/B register. ACPICA BZ 751.
http://www.acpica.org/bugzilla/show_bug.cgi?id=751
--- drivers/acpi/acpica/hwregs.c | 17 +++-------------- 1 files changed, 3 insertions(+), 14 deletions(-)
drivers/acpi/acpica/hwregs.c +3 -14
@@ -71,7 +71,6 @@ acpi_hw_write_multiple(u32 value,* RETURN: Status * * DESCRIPTION: Clears all fixed and general purpose status bits -* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/
@@ -82,13 +81,13 @@ acpi_status acpi_hw_clear_acpi_status(void)ACPI_FUNCTION_TRACE (hw_clear_acpi_status); -ACPI_DEBUG_PRINT ((ACPI_DB_IO ,"About to write %04X to %04X\n" , +ACPI_DEBUG_PRINT ((ACPI_DB_IO ,"About to write %04X to %0llX\n" ,ACPI_BITMASK_ALL_FIXED_STATUS , - (u16 ) acpi_gbl_xpm1a_status.address)); + acpi_gbl_xpm1a_status.address)); lock_flags =acpi_os_acquire_lock (acpi_gbl_hardware_lock); -/* Clear the fixed events */ +/* Clear the fixed events in PM1 A/B */ status =acpi_hw_register_write (ACPI_REGISTER_PM1_STATUS ,ACPI_BITMASK_ALL_FIXED_STATUS );
@@ -96,16 +95,6 @@ acpi_status acpi_hw_clear_acpi_status(void) goto unlock_and_exit; } -/* Write PM1B register if present */ - -if (acpi_gbl_xpm1b_status.address) { - status =acpi_write (ACPI_BITMASK_ALL_FIXED_STATUS , - &acpi_gbl_xpm1b_status); -if (ACPI_FAILURE (status)) { - goto unlock_and_exit; - } - } -/* Clear the GPE Bits in all GPE registers in all GPE blocks */ status =acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block,NULL );
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 25/98 ACPICA: For PM1B registers, do not shift value read or written
In reply to Len BrownFrom: Bob Moore <[email protected]>
The PM1B registers are mirrors of the PM1A registers with different bits actually implemented. From the ACPI specification:
"Although the bits can be split between the two register blocks (each register block has a unique pointer within the FADT), the bit positions are maintained. The register block with unimplemented bits (that is, those implemented in the other register block) always returns zeros, and writes have no side effects"
--- drivers/acpi/acpica/hwregs.c | 33 ++++++++++++++++++++++++--------- 1 files changed, 24 insertions(+), 9 deletions(-)
drivers/acpi/acpica/hwregs.c +24 -9
@@ -372,9 +372,17 @@ acpi_hw_read_multiple(u32 *value, } } -/* Shift the B bits above the A bits */ - - *value = value_a | (value_b << register_a->bit_width); +/* +* OR the two return values together. No shifting or masking is necessary, +* because of how the PM1 registers are defined in the ACPI specification: +* +* "Although the bits can be split between the two register blocks (each +* register block has a unique pointer within the FADT), the bit positions +* are maintained. The register block with unimplemented bits (that is, +* those implemented in the other register block) always returns zeros, +* and writes have no side effects" +*/ + *value = (value_a | value_b);return (AE_OK ); }
@@ -406,13 +414,20 @@ acpi_hw_write_multiple(u32 value,return (status); } -/* Second register is optional */ - +/* +* Second register is optional +* +* No bit shifting or clearing is necessary, because of how the PM1 +* registers are defined in the ACPI specification: +* +* "Although the bits can be split between the two register blocks (each +* register block has a unique pointer within the FADT), the bit positions +* are maintained. The register block with unimplemented bits (that is, +* those implemented in the other register block) always returns zeros, +* and writes have no side effects" +*/ if (register_b->address) { - -/* Normalize the B bits before write */ - - status =acpi_write (value >> register_a->bit_width, register_b); + status =acpi_write (value, register_b); }return (status);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 26/98 ACPICA: Fix parameter validation for acpi_read/write
In reply to Len BrownFrom: Bob Moore <[email protected]>
Now return AE_BAD_PARAMETER if the input register pointer is null, and AE_BAD_ADDRESS if the register has an address of zero. Previously, these cases simply returned AE_OK. For optional registers such as PM1B status/enable/control, the caller should check for a valid register address before calling. ACPICA BZ 748.
http://www.acpica.org/bugzilla/show_bug.cgi?id=748
--- drivers/acpi/acpica/hwxface.c | 18 ++++++++---------- include/acpi/acexcep.h | 6 ++++-- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/acpi/acpica/hwxface.c +8 -10
@@ -107,19 +107,18 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)ACPI_FUNCTION_NAME (acpi_read);/* -* Must have a valid pointer to a GAS structure, and -* a non-zero address within. However, don't return an error -* because the PM1A/B code must not fail if B isn't present. +* Must have a valid pointer to a GAS structure, and a non-zero address +* within. */ if (!reg) { -return (AE_OK ); +return (AE_BAD_PARAMETER ); }/* Get a local copy of the address. Handles possible alignment issues */ ACPI_MOVE_64_TO_64 (&address, ®->address);if (!address) { -return (AE_OK ); +return (AE_BAD_ADDRESS ); }/* Supported widths are 8/16/32 */
@@ -187,19 +186,18 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)ACPI_FUNCTION_NAME (acpi_write);/* -* Must have a valid pointer to a GAS structure, and -* a non-zero address within. However, don't return an error -* because the PM1A/B code must not fail if B isn't present. +* Must have a valid pointer to a GAS structure, and a non-zero address +* within. */ if (!reg) { -return (AE_OK ); +return (AE_BAD_PARAMETER ); }/* Get a local copy of the address. Handles possible alignment issues */ ACPI_MOVE_64_TO_64 (&address, ®->address);if (!address) { -return (AE_OK ); +return (AE_BAD_ADDRESS ); }/* Supported widths are 8/16/32 */
include/acpi/acexcep.h +4 -2
@@ -103,8 +103,9 @@#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)#define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) +#define AE_BAD_ADDRESS (acpi_status) (0x0009 | AE_CODE_PROGRAMMER) -#define AE_CODE_PGM_MAX 0x0008 +#define AE_CODE_PGM_MAX 0x0009/* * Acpi table exceptions
@@ -224,7 +225,8 @@ char const *acpi_gbl_exception_names_pgm[] = {"AE_BAD_HEX_CONSTANT" ,"AE_BAD_OCTAL_CONSTANT" ,"AE_BAD_DECIMAL_CONSTANT" , -"AE_MISSING_ARGUMENTS" +"AE_MISSING_ARGUMENTS" , +"AE_BAD_ADDRESS" }; char const *acpi_gbl_exception_names_tbl[] = {
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 27/98 ACPICA: Remove redundant ACPI_BITREG_SLEEP_TYPE_B
In reply to Len BrownFrom: Bob Moore <[email protected]>
This type is the same as TYPE_A. Removed this and all related instances. Renamed SLEEP_TYPE_A to simply SLEEP_TYPE. ACPICA BZ 754.
http://www.acpica.org/bugzilla/show_bug.cgi?id=754
--- drivers/acpi/acpica/aclocal.h | 4 ++-- drivers/acpi/acpica/hwsleep.c | 4 ++-- drivers/acpi/acpica/utglobal.c | 9 +++------ include/acpi/actypes.h | 9 ++++----- 4 files changed, 11 insertions(+), 15 deletions(-)
drivers/acpi/acpica/aclocal.h +2 -2
@@ -818,7 +818,7 @@ struct acpi_bit_register_info {#define ACPI_BITMASK_SCI_ENABLE 0x0001#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 -#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00 +#define ACPI_BITMASK_SLEEP_TYPE 0x1C00#define ACPI_BITMASK_SLEEP_ENABLE 0x2000#define ACPI_BITMASK_ARB_DISABLE 0x0001
@@ -844,7 +844,7 @@ struct acpi_bit_register_info {#define ACPI_BITPOSITION_SCI_ENABLE 0x00#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 -#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A +#define ACPI_BITPOSITION_SLEEP_TYPE 0x0A#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D#define ACPI_BITPOSITION_ARB_DISABLE 0x00
drivers/acpi/acpica/hwsleep.c +2 -2
@@ -242,7 +242,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) } sleep_type_reg_info = -acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A ); +acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE ); sleep_enable_reg_info =acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE );
@@ -486,7 +486,7 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) &acpi_gbl_sleep_type_b);if (ACPI_SUCCESS (status)) { sleep_type_reg_info = -acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A ); +acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE ); sleep_enable_reg_info =acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE );
drivers/acpi/acpica/utglobal.c +3 -6
@@ -294,12 +294,9 @@ struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {/* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL ,ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE , ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, - /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, -ACPI_BITPOSITION_SLEEP_TYPE_X , - ACPI_BITMASK_SLEEP_TYPE_X}, - /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, -ACPI_BITPOSITION_SLEEP_TYPE_X , - ACPI_BITMASK_SLEEP_TYPE_X}, + /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL, +ACPI_BITPOSITION_SLEEP_TYPE , + ACPI_BITMASK_SLEEP_TYPE}, /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,ACPI_BITPOSITION_SLEEP_ENABLE , ACPI_BITMASK_SLEEP_ENABLE},
include/acpi/actypes.h +4 -5
@@ -777,15 +777,14 @@ typedef u8 acpi_adr_space_type;#define ACPI_BITREG_SCI_ENABLE 0x0E#define ACPI_BITREG_BUS_MASTER_RLD 0x0F#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 -#define ACPI_BITREG_SLEEP_TYPE_A 0x11 -#define ACPI_BITREG_SLEEP_TYPE_B 0x12 -#define ACPI_BITREG_SLEEP_ENABLE 0x13 +#define ACPI_BITREG_SLEEP_TYPE 0x11 +#define ACPI_BITREG_SLEEP_ENABLE 0x12/* PM2 Control register */ -#define ACPI_BITREG_ARB_DISABLE 0x14 +#define ACPI_BITREG_ARB_DISABLE 0x13 -#define ACPI_BITREG_MAX 0x14 +#define ACPI_BITREG_MAX 0x13#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1/*
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 28/98 ACPICA: Add function to handle PM1 control registers
In reply to Len BrownFrom: Bob Moore <[email protected]>
Added acpi_hw_write_pm1_control. This function writes both of the PM1 control registers (A/B). These registers are different than than the PM1 A/B status and enable registers in that different values can be written to the A/B registers. Most notably, the SLP_TYP bits can be different, as per the values returned from the _Sx predefined methods.
--- drivers/acpi/acpica/achware.h | 5 +- drivers/acpi/acpica/aclocal.h | 10 ++--- drivers/acpi/acpica/hwregs.c | 46 +++++++++++++++++----- drivers/acpi/acpica/hwsleep.c | 84 +++++++++++++++++------------------------ 4 files changed, 78 insertions(+), 67 deletions(-)
drivers/acpi/acpica/achware.h +3 -2
@@ -64,8 +64,9 @@ u32 acpi_hw_get_mode(void);*/ struct acpi_bit_register_info *acpi_hw_get_bit_register_info (u32 register_id); -acpi_status -acpi_hw_register_read (u32 register_id,u32 * return_value); +acpi_status acpi_hw_write_pm1_control (u32 pm1a_control,u32 pm1b_control); + +acpi_status acpi_hw_register_read (u32 register_id,u32 *return_value);acpi_status acpi_hw_register_write (u32 register_id,u32 value);
drivers/acpi/acpica/aclocal.h +4 -6
@@ -781,12 +781,10 @@ struct acpi_bit_register_info {#define ACPI_REGISTER_PM1_STATUS 0x01#define ACPI_REGISTER_PM1_ENABLE 0x02#define ACPI_REGISTER_PM1_CONTROL 0x03 -#define ACPI_REGISTER_PM1A_CONTROL 0x04 -#define ACPI_REGISTER_PM1B_CONTROL 0x05 -#define ACPI_REGISTER_PM2_CONTROL 0x06 -#define ACPI_REGISTER_PM_TIMER 0x07 -#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 -#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 +#define ACPI_REGISTER_PM2_CONTROL 0x04 +#define ACPI_REGISTER_PM_TIMER 0x05 +#define ACPI_REGISTER_PROCESSOR_BLOCK 0x06 +#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07/* Masks used to access the bit_registers */
drivers/acpi/acpica/hwregs.c +36 -10
58 lines not on this page · raw message
drivers/acpi/acpica/hwsleep.c +35 -49
152 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 29/98 ACPICA: Remove ACPI_GET_OBJECT_TYPE macro
In reply to Len BrownFrom: Bob Moore <[email protected]>
Remove all instances of this obsolete macro, since it is now a simple reference to ->common.type. There were about 150 invocations of the macro across 41 files. ACPICA BZ 755.
http://www.acpica.org/bugzilla/show_bug.cgi?id=755
--- drivers/acpi/acpica/acmacros.h | 4 ---- drivers/acpi/acpica/dsmthdat.c | 2 +- drivers/acpi/acpica/dsobject.c | 6 +++--- drivers/acpi/acpica/dsopcode.c | 8 +++----- drivers/acpi/acpica/dsutils.c | 2 +- drivers/acpi/acpica/dswexec.c | 5 ++--- drivers/acpi/acpica/evgpeblk.c | 8 ++++---- drivers/acpi/acpica/evregion.c | 2 +- drivers/acpi/acpica/exconfig.c | 4 ++-- drivers/acpi/acpica/exconvrt.c | 11 +++++------ drivers/acpi/acpica/exdump.c | 19 ++++++++----------- drivers/acpi/acpica/exfield.c | 29 +++++++++++++---------------- drivers/acpi/acpica/exfldio.c | 8 ++++---- drivers/acpi/acpica/exmisc.c | 14 +++++++------- drivers/acpi/acpica/exoparg1.c | 13 +++++-------- drivers/acpi/acpica/exoparg2.c | 2 +- drivers/acpi/acpica/exoparg3.c | 7 +++---- drivers/acpi/acpica/exprep.c | 2 +- drivers/acpi/acpica/exresnte.c | 8 ++++---- drivers/acpi/acpica/exresolv.c | 9 ++++----- drivers/acpi/acpica/exresop.c | 23 +++++++++++------------ drivers/acpi/acpica/exstore.c | 18 ++++++++---------- drivers/acpi/acpica/exstoren.c | 29 ++++++++++++----------------- drivers/acpi/acpica/exutils.c | 2 +- drivers/acpi/acpica/hwxface.c | 6 +++--- drivers/acpi/acpica/nsaccess.c | 3 +-- drivers/acpi/acpica/nsdump.c | 2 +- drivers/acpi/acpica/nsobject.c | 18 ++++++++---------- drivers/acpi/acpica/nspredef.c | 8 ++++---- drivers/acpi/acpica/nsxfeval.c | 3 +-- drivers/acpi/acpica/rscalc.c | 7 +++---- drivers/acpi/acpica/rscreate.c | 15 +++++++-------- drivers/acpi/acpica/utcopy.c | 25 ++++++++++++------------- drivers/acpi/acpica/utdelete.c | 6 +++--- drivers/acpi/acpica/uteval.c | 12 ++++++------ drivers/acpi/acpica/utglobal.c | 2 +- drivers/acpi/acpica/utmisc.c | 3 +-- drivers/acpi/acpica/utobject.c | 7 +++---- 38 files changed, 158 insertions(+), 194 deletions(-)
drivers/acpi/acpica/acmacros.h +0 -4
@@ -292,10 +292,6 @@#define ACPI_GET_DESCRIPTOR_TYPE (d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)#define ACPI_SET_DESCRIPTOR_TYPE (d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) -/* Macro to test the object type */ - -#define ACPI_GET_OBJECT_TYPE (d) (((union acpi_operand_object *)(void *)(d))->common.type) -/* * Macros for the master AML opcode table */
drivers/acpi/acpica/dsmthdat.c +1 -1
@@ -713,6 +713,6 @@ acpi_ds_method_data_get_type(u16 opcode,/* Get the object type */ - return_VALUE(ACPI_GET_OBJECT_TYPE(object)); + return_VALUE(object->type); }#endif
drivers/acpi/acpica/dsobject.c +3 -3
@@ -565,7 +565,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,/* Re-type the object according to its argument */ - node->type =ACPI_GET_OBJECT_TYPE (obj_desc); + node->type = obj_desc->common.type;/* Attach obj to node */
@@ -619,7 +619,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,/* Perform per-object initialization */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_BUFFER :/*
@@ -803,7 +803,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,default :ACPI_ERROR ((AE_INFO ,"Unimplemented data type: %X" , -ACPI_GET_OBJECT_TYPE (obj_desc))); + obj_desc->common.type)); status =AE_AML_OPERAND_TYPE ;break ;
drivers/acpi/acpica/dsopcode.c +3 -5
@@ -484,7 +484,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode,/* Host object must be a Buffer */ -if (ACPI_GET_OBJECT_TYPE (buffer_desc) !=ACPI_TYPE_BUFFER ) { +if (buffer_desc->common.type !=ACPI_TYPE_BUFFER ) {ACPI_ERROR ((AE_INFO ,"Target of Create Field is not a Buffer object - %s" ,acpi_ut_get_object_type_name (buffer_desc)));
@@ -1365,10 +1365,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0 ]) ==ACPI_DESC_TYPE_OPERAND ) - && - (ACPI_GET_OBJECT_TYPE - (walk_state->results->results.obj_desc[0 ]) == -ACPI_TYPE_LOCAL_REFERENCE ) + && ((walk_state->results->results.obj_desc[0 ])-> + common.type ==ACPI_TYPE_LOCAL_REFERENCE ) && ((walk_state->results->results.obj_desc[0 ])-> reference.class !=ACPI_REFCLASS_INDEX )) { status =
drivers/acpi/acpica/dsutils.c +1 -1
@@ -816,7 +816,7 @@ acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state) goto push_result; } - type =ACPI_GET_OBJECT_TYPE (*operand); + type = (*operand)->common.type; status =acpi_ex_resolve_to_value (operand, walk_state);if (ACPI_FAILURE (status)) {
drivers/acpi/acpica/dswexec.c +2 -3
@@ -138,11 +138,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, goto cleanup; } -if (ACPI_GET_OBJECT_TYPE (local_obj_desc) !=ACPI_TYPE_INTEGER ) { +if (local_obj_desc->common.type !=ACPI_TYPE_INTEGER ) {ACPI_ERROR ((AE_INFO ,"Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X" , - obj_desc, walk_state, -ACPI_GET_OBJECT_TYPE (obj_desc))); + obj_desc, walk_state, obj_desc->common.type)); status =AE_AML_OPERAND_TYPE ; goto cleanup;
drivers/acpi/acpica/evgpeblk.c +4 -4
@@ -408,7 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,*/ obj_desc = pkg_desc->package.elements[0 ]; -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_INTEGER ) { +if (obj_desc->common.type ==ACPI_TYPE_INTEGER ) {/* Use FADT-defined GPE device (from definition of _PRW) */
@@ -417,14 +417,14 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,/* Integer is the GPE number in the FADT described GPE blocks */ gpe_number = (u32 ) obj_desc->integer.value; - }else if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_PACKAGE ) { + }else if (obj_desc->common.type ==ACPI_TYPE_PACKAGE ) {/* Package contains a GPE reference and GPE number within a GPE block */ if ((obj_desc->package.count <2 ) || - (ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[0 ]) != + ((obj_desc->package.elements[0 ])->common.type !=ACPI_TYPE_LOCAL_REFERENCE ) - || (ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[1 ]) != + || ((obj_desc->package.elements[1 ])->common.type !=ACPI_TYPE_INTEGER )) { goto cleanup; }
drivers/acpi/acpica/evregion.c +1 -1
@@ -691,7 +691,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,/* Devices are handled different than regions */ -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_DEVICE ) { +if (obj_desc->common.type ==ACPI_TYPE_DEVICE ) {/* Check if this Device already has a handler for this address space */
drivers/acpi/acpica/exconfig.c +2 -2
@@ -291,7 +291,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,/* Source Object can be either an op_region or a Buffer/Field */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_REGION : ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -501,7 +501,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)*/ if ((!ddb_handle) || (ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) !=ACPI_DESC_TYPE_OPERAND ) || - (ACPI_GET_OBJECT_TYPE (ddb_handle) !=ACPI_TYPE_LOCAL_REFERENCE )) { + (ddb_handle->common.type !=ACPI_TYPE_LOCAL_REFERENCE )) {return_ACPI_STATUS (AE_BAD_PARAMETER ); }
drivers/acpi/acpica/exconvrt.c +5 -6
@@ -82,7 +82,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,ACPI_FUNCTION_TRACE_PTR (ex_convert_to_integer, obj_desc); -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_INTEGER :/* No conversion necessary */
@@ -116,7 +116,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,/* String conversion is different than Buffer conversion */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_STRING :/*
@@ -206,7 +206,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,ACPI_FUNCTION_TRACE_PTR (ex_convert_to_buffer, obj_desc); -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_BUFFER :/* No conversion necessary */
@@ -409,7 +409,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,ACPI_FUNCTION_TRACE_PTR (ex_convert_to_string, obj_desc); -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_STRING :/* No conversion necessary */
@@ -605,8 +605,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,default :/* No conversion allowed for these types */ -if (destination_type != -ACPI_GET_OBJECT_TYPE (source_desc)) { +if (destination_type != source_desc->common.type) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Explicit operator, will store (%s) over existing type (%s)\n", acpi_ut_get_object_type_name
drivers/acpi/acpica/exdump.c +8 -11
@@ -492,7 +492,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)/* Decode object type */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_LOCAL_REFERENCE : acpi_os_printf("Reference: [%s] ",
@@ -531,7 +531,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)acpi_os_printf ("%X" , obj_desc->reference.value); -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_INTEGER ) { +if (obj_desc->common.type ==ACPI_TYPE_INTEGER ) {/* Value is an Integer */
@@ -548,7 +548,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)acpi_os_printf ("%X" , obj_desc->reference.value); -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_INTEGER ) { +if (obj_desc->common.type ==ACPI_TYPE_INTEGER ) {/* Value is an Integer */
@@ -686,9 +686,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)if (!obj_desc->buffer_field.buffer_obj) {ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"*NULL*\n" )); - }else -if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) - !=ACPI_TYPE_BUFFER ) { + }else if ((obj_desc->buffer_field.buffer_obj)->common.type != +ACPI_TYPE_BUFFER ) {acpi_os_printf ("*not a Buffer*\n" ); }else { acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
@@ -737,8 +736,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)default :/* Unknown Type */ -acpi_os_printf ("Unknown Type %X\n" , -ACPI_GET_OBJECT_TYPE (obj_desc)); +acpi_os_printf ("Unknown Type %X\n" , obj_desc->common.type);break ; }
@@ -939,7 +937,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,/* Packages may only contain a few object types */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_INTEGER : acpi_os_printf("[Integer] = %8.8X%8.8X\n",
@@ -990,8 +988,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,default : -acpi_os_printf ("[Unknown Type] %X\n" , -ACPI_GET_OBJECT_TYPE (obj_desc)); +acpi_os_printf ("[Unknown Type] %X\n" , obj_desc->common.type);break ; } }
drivers/acpi/acpica/exfield.c +13 -16
@@ -84,7 +84,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,return_ACPI_STATUS (AE_BAD_PARAMETER ); } -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_BUFFER_FIELD ) { +if (obj_desc->common.type ==ACPI_TYPE_BUFFER_FIELD ) {/* * If the buffer_field arguments have not been previously evaluated, * evaluate them now and save the results.
@@ -95,9 +95,8 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,return_ACPI_STATUS (status); } } - }else -if ((ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_LOCAL_REGION_FIELD ) - && (obj_desc->field.region_obj->region.space_id == + }else if ((obj_desc->common.type ==ACPI_TYPE_LOCAL_REGION_FIELD ) && + (obj_desc->field.region_obj->region.space_id ==ACPI_ADR_SPACE_SMBUS )) {/* * This is an SMBus read. We must create a buffer to hold the data
@@ -163,7 +162,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD ,"FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n" , - obj_desc,ACPI_GET_OBJECT_TYPE (obj_desc), buffer, + obj_desc, obj_desc->common.type, buffer, (u32 ) length)); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n",
@@ -222,7 +221,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,return_ACPI_STATUS (AE_AML_NO_OPERAND ); } -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_BUFFER_FIELD ) { +if (obj_desc->common.type ==ACPI_TYPE_BUFFER_FIELD ) {/* * If the buffer_field arguments have not been previously evaluated, * evaluate them now and save the results.
@@ -233,9 +232,8 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,return_ACPI_STATUS (status); } } - }else -if ((ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_LOCAL_REGION_FIELD ) - && (obj_desc->field.region_obj->region.space_id == + }else if ((obj_desc->common.type ==ACPI_TYPE_LOCAL_REGION_FIELD ) && + (obj_desc->field.region_obj->region.space_id ==ACPI_ADR_SPACE_SMBUS )) {/* * This is an SMBus write. We will bypass the entire field mechanism
@@ -243,7 +241,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,* * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). */ -if (ACPI_GET_OBJECT_TYPE (source_desc) !=ACPI_TYPE_BUFFER ) { +if (source_desc->common.type !=ACPI_TYPE_BUFFER ) {ACPI_ERROR ((AE_INFO ,"SMBus write requires Buffer, found type %s" ,acpi_ut_get_object_type_name (source_desc)));
@@ -291,7 +289,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,/* Get a pointer to the data to be written */ -switch (ACPI_GET_OBJECT_TYPE (source_desc)) { +switch (source_desc->common.type) {case ACPI_TYPE_INTEGER : buffer = &source_desc->integer.value; length =sizeof (source_desc->integer.value);
@@ -314,15 +312,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD ,"FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n" , source_desc, -acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE - (source_desc)), -ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); +acpi_ut_get_type_name (source_desc->common.type), + source_desc->common.type, buffer, length));ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD ,"FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n" , obj_desc, -acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), -ACPI_GET_OBJECT_TYPE (obj_desc), +acpi_ut_get_type_name (obj_desc->common.type), + obj_desc->common.type, obj_desc->common_field.bit_length, obj_desc->common_field.start_field_bit_offset, obj_desc->common_field.base_byte_offset));
drivers/acpi/acpica/exfldio.c +4 -4
@@ -94,9 +94,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,/* We must have a valid region */ -if (ACPI_GET_OBJECT_TYPE (rgn_desc) !=ACPI_TYPE_REGION ) { +if (rgn_desc->common.type !=ACPI_TYPE_REGION ) {ACPI_ERROR ((AE_INFO ,"Needed Region, found type %X (%s)" , -ACPI_GET_OBJECT_TYPE (rgn_desc), + rgn_desc->common.type,acpi_ut_get_object_type_name (rgn_desc)));return_ACPI_STATUS (AE_AML_OPERAND_TYPE );
@@ -390,7 +390,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,* index_field - Write to an Index Register, then read/write from/to a * Data Register */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_BUFFER_FIELD :/* * If the buffer_field arguments have not been previously evaluated,
@@ -527,7 +527,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,default :ACPI_ERROR ((AE_INFO ,"Wrong object type in field I/O %X" , -ACPI_GET_OBJECT_TYPE (obj_desc))); + obj_desc->common.type)); status =AE_AML_INTERNAL ;break ; }
drivers/acpi/acpica/exmisc.c +7 -7
@@ -80,7 +80,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {case ACPI_DESC_TYPE_OPERAND : -if (ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_LOCAL_REFERENCE ) { +if (obj_desc->common.type !=ACPI_TYPE_LOCAL_REFERENCE ) {return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); }
@@ -260,7 +260,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,* guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism. */ -switch (ACPI_GET_OBJECT_TYPE (operand0)) { +switch (operand0->common.type) {case ACPI_TYPE_INTEGER : status =acpi_ex_convert_to_integer (operand1, &local_operand1,16 );
@@ -277,7 +277,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,default :ACPI_ERROR ((AE_INFO ,"Invalid object type: %X" , -ACPI_GET_OBJECT_TYPE (operand0))); + operand0->common.type)); status =AE_AML_INTERNAL ; }
@@ -298,7 +298,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,* 2) Two Strings concatenated to produce a new String * 3) Two Buffers concatenated to produce a new Buffer */ -switch (ACPI_GET_OBJECT_TYPE (operand0)) { +switch (operand0->common.type) {case ACPI_TYPE_INTEGER :/* Result of two Integers is a Buffer */
@@ -379,7 +379,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,/* Invalid object type, should not happen here */ ACPI_ERROR ((AE_INFO ,"Invalid object type: %X" , -ACPI_GET_OBJECT_TYPE (operand0))); + operand0->common.type)); status =AE_AML_INTERNAL ; goto cleanup; }
@@ -581,7 +581,7 @@ acpi_ex_do_logical_op(u16 opcode,* guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism. */ -switch (ACPI_GET_OBJECT_TYPE (operand0)) { +switch (operand0->common.type) {case ACPI_TYPE_INTEGER : status =acpi_ex_convert_to_integer (operand1, &local_operand1,16 );
@@ -608,7 +608,7 @@ acpi_ex_do_logical_op(u16 opcode,/* * Two cases: 1) Both Integers, 2) Both Strings or Buffers */ -if (ACPI_GET_OBJECT_TYPE (operand0) ==ACPI_TYPE_INTEGER ) { +if (operand0->common.type ==ACPI_TYPE_INTEGER ) {/* * 1) Both operands are of type integer * Note: local_operand1 may have changed above
drivers/acpi/acpica/exoparg1.c +5 -8
@@ -807,11 +807,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) acpi_namespace_node *) operand[0]);if (temp_desc - && - ((ACPI_GET_OBJECT_TYPE (temp_desc) == -ACPI_TYPE_STRING ) - || (ACPI_GET_OBJECT_TYPE (temp_desc) == -ACPI_TYPE_LOCAL_REFERENCE ))) { + && ((temp_desc->common.type ==ACPI_TYPE_STRING ) + || (temp_desc->common.type == +ACPI_TYPE_LOCAL_REFERENCE ))) { operand[0 ] = temp_desc;acpi_ut_add_reference (temp_desc); }else {
@@ -819,7 +817,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) goto cleanup; } }else { -switch (ACPI_GET_OBJECT_TYPE (operand[0 ])) { +switch ((operand[0 ])->common.type) {case ACPI_TYPE_LOCAL_REFERENCE :/* * This is a deref_of (local_x | arg_x)
@@ -877,8 +875,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)if (ACPI_GET_DESCRIPTOR_TYPE (operand[0 ]) !=ACPI_DESC_TYPE_NAMED ) { -if (ACPI_GET_OBJECT_TYPE (operand[0 ]) == -ACPI_TYPE_STRING ) { +if ((operand[0 ])->common.type ==ACPI_TYPE_STRING ) {/* * This is a deref_of (String). The string is a reference * to a named ACPI object.
drivers/acpi/acpica/exoparg2.c +1 -1
@@ -399,7 +399,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)* At this point, the Source operand is a String, Buffer, or Package. * Verify that the index is within range. */ -switch (ACPI_GET_OBJECT_TYPE (operand[0 ])) { +switch ((operand[0 ])->common.type) {case ACPI_TYPE_STRING :if (index >= operand[0 ]->string.length) {
drivers/acpi/acpica/exoparg3.c +3 -4
@@ -161,9 +161,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)* Create the return object. The Source operand is guaranteed to be * either a String or a Buffer, so just use its type. */ - return_desc = -acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE - (operand[0 ])); + return_desc =acpi_ut_create_internal_object ((operand[0 ])-> + common.type);if (!return_desc) { status =AE_NO_MEMORY ; goto cleanup;
@@ -191,7 +190,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)/* Strings always have a sub-pointer, not so for buffers */ -switch (ACPI_GET_OBJECT_TYPE (operand[0 ])) { +switch ((operand[0 ])->common.type) {case ACPI_TYPE_STRING :/* Always allocate a new buffer for the String */
drivers/acpi/acpica/exprep.c +1 -1
@@ -279,7 +279,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,return_UINT32 (0 ); } -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_BUFFER_FIELD ) { +if (obj_desc->common.type ==ACPI_TYPE_BUFFER_FIELD ) {/* * buffer_field access can be on any byte boundary, so the * byte_alignment is always 1 byte -- regardless of any byte_alignment
drivers/acpi/acpica/exresnte.c +4 -4
@@ -136,7 +136,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,switch (entry_type) {case ACPI_TYPE_PACKAGE : -if (ACPI_GET_OBJECT_TYPE (source_desc) !=ACPI_TYPE_PACKAGE ) { +if (source_desc->common.type !=ACPI_TYPE_PACKAGE ) {ACPI_ERROR ((AE_INFO ,"Object not a Package, type %s" ,acpi_ut_get_object_type_name (source_desc)));return_ACPI_STATUS (AE_AML_OPERAND_TYPE );
@@ -154,7 +154,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,case ACPI_TYPE_BUFFER : -if (ACPI_GET_OBJECT_TYPE (source_desc) !=ACPI_TYPE_BUFFER ) { +if (source_desc->common.type !=ACPI_TYPE_BUFFER ) {ACPI_ERROR ((AE_INFO ,"Object not a Buffer, type %s" ,acpi_ut_get_object_type_name (source_desc)));return_ACPI_STATUS (AE_AML_OPERAND_TYPE );
@@ -172,7 +172,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,case ACPI_TYPE_STRING : -if (ACPI_GET_OBJECT_TYPE (source_desc) !=ACPI_TYPE_STRING ) { +if (source_desc->common.type !=ACPI_TYPE_STRING ) {ACPI_ERROR ((AE_INFO ,"Object not a String, type %s" ,acpi_ut_get_object_type_name (source_desc)));return_ACPI_STATUS (AE_AML_OPERAND_TYPE );
@@ -186,7 +186,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,case ACPI_TYPE_INTEGER : -if (ACPI_GET_OBJECT_TYPE (source_desc) !=ACPI_TYPE_INTEGER ) { +if (source_desc->common.type !=ACPI_TYPE_INTEGER ) {ACPI_ERROR ((AE_INFO ,"Object not a Integer, type %s" ,acpi_ut_get_object_type_name (source_desc)));return_ACPI_STATUS (AE_AML_OPERAND_TYPE );
drivers/acpi/acpica/exresolv.c +4 -5
@@ -149,7 +149,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,/* This is a union acpi_operand_object */ -switch (ACPI_GET_OBJECT_TYPE (stack_desc)) { +switch (stack_desc->common.type) {case ACPI_TYPE_LOCAL_REFERENCE : ref_type = stack_desc->reference.class;
@@ -297,8 +297,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"FieldRead SourceDesc=%p Type=%X\n" , - stack_desc, -ACPI_GET_OBJECT_TYPE (stack_desc))); + stack_desc, stack_desc->common.type)); status = acpi_ex_read_data_from_field(walk_state, stack_desc,
@@ -386,7 +385,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,* specification of the object_type and size_of operators). This means * traversing the list of possibly many nested references. */ -while (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_LOCAL_REFERENCE ) { +while (obj_desc->common.type ==ACPI_TYPE_LOCAL_REFERENCE ) {switch (obj_desc->reference.class) {case ACPI_REFCLASS_REFOF :case ACPI_REFCLASS_NAME :
@@ -518,7 +517,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,* Now we are guaranteed to have an object that has not been created * via the ref_of or Index operators. */ - type =ACPI_GET_OBJECT_TYPE (obj_desc); + type = obj_desc->common.type; exit:/* Convert internal types to external types */
drivers/acpi/acpica/exresop.c +11 -12
@@ -212,7 +212,7 @@ acpi_ex_resolve_operands(u16 opcode,/* ACPI internal object */ - object_type =ACPI_GET_OBJECT_TYPE (obj_desc); + object_type = obj_desc->common.type;/* Check for bad acpi_object_type */
@@ -287,8 +287,7 @@ acpi_ex_resolve_operands(u16 opcode,if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) ==ACPI_DESC_TYPE_OPERAND ) - && (ACPI_GET_OBJECT_TYPE (obj_desc) == -ACPI_TYPE_STRING )) { + && (obj_desc->common.type ==ACPI_TYPE_STRING )) {/* * String found - the string references a named object and * must be resolved to a node
@@ -336,7 +335,7 @@ acpi_ex_resolve_operands(u16 opcode,* -- All others must be resolved below. */ if ((opcode ==AML_STORE_OP ) && - (ACPI_GET_OBJECT_TYPE (*stack_ptr) == + ((*stack_ptr)->common.type ==ACPI_TYPE_LOCAL_REFERENCE ) && ((*stack_ptr)->reference.class ==ACPI_REFCLASS_INDEX )) { goto next_operand;
@@ -490,7 +489,7 @@ acpi_ex_resolve_operands(u16 opcode,/* Need an operand of type INTEGER, STRING or BUFFER */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_INTEGER :case ACPI_TYPE_STRING :case ACPI_TYPE_BUFFER :
@@ -512,7 +511,7 @@ acpi_ex_resolve_operands(u16 opcode,/* Need an operand of type STRING or BUFFER */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_STRING :case ACPI_TYPE_BUFFER :
@@ -553,7 +552,7 @@ acpi_ex_resolve_operands(u16 opcode,* The only reference allowed here is a direct reference to * a namespace node. */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_PACKAGE :case ACPI_TYPE_STRING :case ACPI_TYPE_BUFFER :
@@ -576,7 +575,7 @@ acpi_ex_resolve_operands(u16 opcode,/* Need a buffer or package or (ACPI 2.0) String */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_PACKAGE :case ACPI_TYPE_STRING :case ACPI_TYPE_BUFFER :
@@ -598,7 +597,7 @@ acpi_ex_resolve_operands(u16 opcode,/* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_BUFFER :case ACPI_TYPE_REGION :
@@ -619,7 +618,7 @@ acpi_ex_resolve_operands(u16 opcode,/* Used by the Store() operator only */ -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_INTEGER :case ACPI_TYPE_PACKAGE :case ACPI_TYPE_STRING :
@@ -677,8 +676,8 @@ acpi_ex_resolve_operands(u16 opcode,* required object type (Simple cases only). */ status =acpi_ex_check_object_type (type_needed, -ACPI_GET_OBJECT_TYPE - (*stack_ptr), *stack_ptr); + (*stack_ptr)->common.type, + *stack_ptr);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
drivers/acpi/acpica/exstore.c +8 -10
@@ -129,7 +129,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,/* source_desc is of type ACPI_DESC_TYPE_OPERAND */ -switch (ACPI_GET_OBJECT_TYPE (source_desc)) { +switch (source_desc->common.type) {case ACPI_TYPE_INTEGER :/* Output correct integer width */
@@ -324,7 +324,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,/* Destination object must be a Reference or a Constant object */ -switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { +switch (dest_desc->common.type) {case ACPI_TYPE_LOCAL_REFERENCE :break ;
@@ -460,9 +460,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,*/ obj_desc = *(index_desc->reference.where); -if (ACPI_GET_OBJECT_TYPE (source_desc) == -ACPI_TYPE_LOCAL_REFERENCE - && source_desc->reference.class ==ACPI_REFCLASS_TABLE ) { +if (source_desc->common.type ==ACPI_TYPE_LOCAL_REFERENCE && + source_desc->reference.class ==ACPI_REFCLASS_TABLE ) {/* This is a DDBHandle, just add a reference to it */
@@ -520,8 +519,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,* by the INDEX_OP code. */ obj_desc = index_desc->reference.object; -if ((ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_BUFFER ) && - (ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_STRING )) { +if ((obj_desc->common.type !=ACPI_TYPE_BUFFER ) && + (obj_desc->common.type !=ACPI_TYPE_STRING )) {return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); }
@@ -529,7 +528,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,* The assignment of the individual elements will be slightly * different for each source type. */ -switch (ACPI_GET_OBJECT_TYPE (source_desc)) { +switch (source_desc->common.type) {case ACPI_TYPE_INTEGER :/* Use the least-significant byte of the integer */
@@ -707,8 +706,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,/* No conversions for all other types. Just attach the source object */ status =acpi_ns_attach_object (node, source_desc, -ACPI_GET_OBJECT_TYPE - (source_desc)); + source_desc->common.type);break ; }
drivers/acpi/acpica/exstoren.c +12 -17
@@ -96,8 +96,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,* are all essentially the same. This case handles the * "interchangeable" types Integer, String, and Buffer. */ -if (ACPI_GET_OBJECT_TYPE (source_desc) == -ACPI_TYPE_LOCAL_REFERENCE ) { +if (source_desc->common.type ==ACPI_TYPE_LOCAL_REFERENCE ) {/* Resolve a reference object first */
@@ -117,13 +116,11 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,/* Must have a Integer, Buffer, or String */ -if ((ACPI_GET_OBJECT_TYPE (source_desc) !=ACPI_TYPE_INTEGER ) && - (ACPI_GET_OBJECT_TYPE (source_desc) !=ACPI_TYPE_BUFFER ) && - (ACPI_GET_OBJECT_TYPE (source_desc) !=ACPI_TYPE_STRING ) && - !((ACPI_GET_OBJECT_TYPE (source_desc) == -ACPI_TYPE_LOCAL_REFERENCE ) - && (source_desc->reference.class == -ACPI_REFCLASS_TABLE ))) { +if ((source_desc->common.type !=ACPI_TYPE_INTEGER ) && + (source_desc->common.type !=ACPI_TYPE_BUFFER ) && + (source_desc->common.type !=ACPI_TYPE_STRING ) && + !((source_desc->common.type ==ACPI_TYPE_LOCAL_REFERENCE ) && + (source_desc->reference.class ==ACPI_REFCLASS_TABLE ))) {/* Conversion successful but still not a valid type */
@@ -218,8 +215,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,return_ACPI_STATUS (status); } -if (ACPI_GET_OBJECT_TYPE (source_desc) != -ACPI_GET_OBJECT_TYPE (dest_desc)) { +if (source_desc->common.type != dest_desc->common.type) {/* * The source type does not match the type of the destination. * Perform the "implicit conversion" of the source to the current type
@@ -229,11 +225,10 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,* Otherwise, actual_src_desc is a temporary object to hold the * converted object. */ - status = -acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE - (dest_desc), source_desc, - &actual_src_desc, - walk_state); + status =acpi_ex_convert_to_target_type (dest_desc->common.type, + source_desc, + &actual_src_desc, + walk_state);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -252,7 +247,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,* We now have two objects of identical types, and we can perform a * copy of the *value* of the source object. */ -switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { +switch (dest_desc->common.type) {case ACPI_TYPE_INTEGER : dest_desc->integer.value = actual_src_desc->integer.value;
drivers/acpi/acpica/exutils.c +1 -1
@@ -221,7 +221,7 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)*/ if ((!obj_desc) || (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) !=ACPI_DESC_TYPE_OPERAND ) || - (ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_INTEGER )) { + (obj_desc->common.type !=ACPI_TYPE_INTEGER )) {return ; }
drivers/acpi/acpica/hwxface.c +3 -3
@@ -532,7 +532,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)/* It must be of type Package */ - else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { + else if (info->return_object->common.type != ACPI_TYPE_PACKAGE) {ACPI_ERROR ((AE_INFO ,"Sleep State return object is not a Package" )); status =AE_AML_OPERAND_TYPE ;
@@ -553,9 +553,9 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)/* The first two elements must both be of type Integer */ - else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) + else if (((info->return_object->package.elements[0])->common.type != ACPI_TYPE_INTEGER) || - (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) + ((info->return_object->package.elements[1])->common.type != ACPI_TYPE_INTEGER)) { ACPI_ERROR((AE_INFO, "Sleep State return package elements are not both Integers (%s, %s)",
drivers/acpi/acpica/nsaccess.c +1 -2
@@ -234,8 +234,7 @@ acpi_status acpi_ns_root_initialize(void)/* Store pointer to value descriptor in the Node */ status =acpi_ns_attach_object (new_node, obj_desc, -ACPI_GET_OBJECT_TYPE - (obj_desc)); + obj_desc->common.type);/* Remove local reference to the object */
drivers/acpi/acpica/nsdump.c +1 -1
@@ -515,7 +515,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,case ACPI_DESC_TYPE_OPERAND : - obj_type =ACPI_GET_OBJECT_TYPE (obj_desc); + obj_type = obj_desc->common.type;if (obj_type >ACPI_TYPE_LOCAL_MAX ) { acpi_os_printf
drivers/acpi/acpica/nsobject.c +8 -10
@@ -209,8 +209,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) obj_desc = node->object; -if (!obj_desc || - (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_LOCAL_DATA )) { +if (!obj_desc || (obj_desc->common.type ==ACPI_TYPE_LOCAL_DATA )) { return_VOID; }
@@ -220,8 +219,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node)if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) ==ACPI_DESC_TYPE_OPERAND ) { node->object = obj_desc->common.next_object;if (node->object && - (ACPI_GET_OBJECT_TYPE (node->object) != -ACPI_TYPE_LOCAL_DATA )) { + ((node->object)->common.type !=ACPI_TYPE_LOCAL_DATA )) { node->object = node->object->common.next_object; } }
@@ -267,7 +265,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct ((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND) && (ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_NAMED)) - || (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) { + || ((node->object)->common.type == ACPI_TYPE_LOCAL_DATA)) {return_PTR (NULL ); }
@@ -294,9 +292,9 @@ union acpi_operand_object *acpi_ns_get_secondary_object(unionACPI_FUNCTION_TRACE_PTR (ns_get_secondary_object, obj_desc);if ((!obj_desc) || - (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_LOCAL_DATA ) || + (obj_desc->common.type ==ACPI_TYPE_LOCAL_DATA ) || (!obj_desc->common.next_object) || - (ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == + ((obj_desc->common.next_object)->common.type ==ACPI_TYPE_LOCAL_DATA )) {return_PTR (NULL ); }
@@ -331,7 +329,7 @@ acpi_ns_attach_data(struct acpi_namespace_node *node, prev_obj_desc =NULL ; obj_desc = node->object;while (obj_desc) { -if ((ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_LOCAL_DATA ) && +if ((obj_desc->common.type ==ACPI_TYPE_LOCAL_DATA ) && (obj_desc->data.handler == handler)) {return (AE_ALREADY_EXISTS ); }
@@ -385,7 +383,7 @@ acpi_ns_detach_data(struct acpi_namespace_node * node, prev_obj_desc =NULL ; obj_desc = node->object;while (obj_desc) { -if ((ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_LOCAL_DATA ) && +if ((obj_desc->common.type ==ACPI_TYPE_LOCAL_DATA ) && (obj_desc->data.handler == handler)) {if (prev_obj_desc) { prev_obj_desc->common.next_object =
@@ -428,7 +426,7 @@ acpi_ns_get_attached_data(struct acpi_namespace_node * node, obj_desc = node->object;while (obj_desc) { -if ((ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_LOCAL_DATA ) && +if ((obj_desc->common.type ==ACPI_TYPE_LOCAL_DATA ) && (obj_desc->data.handler == handler)) { *data = obj_desc->data.pointer;return (AE_OK );
drivers/acpi/acpica/nspredef.c +4 -4
@@ -221,7 +221,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,/* For returned Package objects, check the type of all sub-objects */ -if (ACPI_GET_OBJECT_TYPE (return_object) ==ACPI_TYPE_PACKAGE ) { +if (return_object->common.type ==ACPI_TYPE_PACKAGE ) { status =acpi_ns_check_package (pathname, return_object_ptr, predefined);
@@ -858,7 +858,7 @@ acpi_ns_check_object_type(char *pathname,* from all of the predefined names (including elements of returned * packages) */ -switch (ACPI_GET_OBJECT_TYPE (return_object)) { +switch (return_object->common.type) {case ACPI_TYPE_INTEGER : return_btype =ACPI_RTYPE_INTEGER ;break ;
@@ -901,7 +901,7 @@ acpi_ns_check_object_type(char *pathname,/* For reference objects, check that the reference type is correct */ -if (ACPI_GET_OBJECT_TYPE (return_object) ==ACPI_TYPE_LOCAL_REFERENCE ) { +if (return_object->common.type ==ACPI_TYPE_LOCAL_REFERENCE ) { status =acpi_ns_check_reference (pathname, return_object); }
@@ -1006,7 +1006,7 @@ acpi_ns_repair_object(u32 expected_btypes,union acpi_operand_object *new_object;acpi_size length; -switch (ACPI_GET_OBJECT_TYPE (return_object)) { +switch (return_object->common.type) {case ACPI_TYPE_BUFFER :if (!(expected_btypes &ACPI_RTYPE_STRING )) {
drivers/acpi/acpica/nsxfeval.c +1 -2
@@ -387,8 +387,7 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)/* We are interested in reference objects only */ -if (ACPI_GET_OBJECT_TYPE (info->return_object) != -ACPI_TYPE_LOCAL_REFERENCE ) { +if ((info->return_object)->common.type !=ACPI_TYPE_LOCAL_REFERENCE ) {return ; }
drivers/acpi/acpica/rscalc.c +3 -4
@@ -557,9 +557,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, table_index++) {if (*sub_object_list &&/* Null object allowed */ ((ACPI_TYPE_STRING == -ACPI_GET_OBJECT_TYPE (*sub_object_list)) || + (*sub_object_list)->common.type) || ((ACPI_TYPE_LOCAL_REFERENCE == -ACPI_GET_OBJECT_TYPE (*sub_object_list)) && + (*sub_object_list)->common.type) && ((*sub_object_list)->reference.class ==ACPI_REFCLASS_NAME )))) { name_found = TRUE;
@@ -575,8 +575,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,/* Was a String type found? */ if (name_found) { -if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == -ACPI_TYPE_STRING ) { +if ((*sub_object_list)->common.type ==ACPI_TYPE_STRING ) {/* * The length String.Length field does not include the * terminating NULL, add 1
drivers/acpi/acpica/rscreate.c +7 -8
@@ -212,7 +212,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,/* Each element of the top-level package must also be a package */ -if (ACPI_GET_OBJECT_TYPE (*top_object_list) !=ACPI_TYPE_PACKAGE ) { +if ((*top_object_list)->common.type !=ACPI_TYPE_PACKAGE ) { ACPI_ERROR((AE_INFO, "(PRT[%X]) Need sub-package, found %s", index,
@@ -240,7 +240,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,/* 1) First subobject: Dereference the PRT.Address */ obj_desc = sub_object_list[0 ]; -if (ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_INTEGER ) { +if (obj_desc->common.type !=ACPI_TYPE_INTEGER ) { ACPI_ERROR((AE_INFO, "(PRT[%X].Address) Need Integer, found %s", index,
@@ -253,7 +253,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,/* 2) Second subobject: Dereference the PRT.Pin */ obj_desc = sub_object_list[1 ]; -if (ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_INTEGER ) { +if (obj_desc->common.type !=ACPI_TYPE_INTEGER ) { ACPI_ERROR((AE_INFO, "(PRT[%X].Pin) Need Integer, found %s", index,
@@ -265,7 +265,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,* If BIOS erroneously reversed the _PRT source_name and source_index, * then reverse them back. */ -if (ACPI_GET_OBJECT_TYPE (sub_object_list[3 ]) != +if ((sub_object_list[3 ])->common.type !=ACPI_TYPE_INTEGER ) {if (acpi_gbl_enable_interpreter_slack) { source_name_index =3 ;
@@ -291,8 +291,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,* other ACPI implementations. */ obj_desc = sub_object_list[3 ]; -if (!obj_desc - || (ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_INTEGER )) { +if (!obj_desc || (obj_desc->common.type !=ACPI_TYPE_INTEGER )) { sub_object_list[3 ] = sub_object_list[2 ]; sub_object_list[2 ] = obj_desc;
@@ -307,7 +306,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,*/ obj_desc = sub_object_list[source_name_index];if (obj_desc) { -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_LOCAL_REFERENCE : if (obj_desc->reference.class !=
@@ -380,7 +379,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,/* 4) Fourth subobject: Dereference the PRT.source_index */ obj_desc = sub_object_list[source_index_index]; -if (ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_INTEGER ) { +if (obj_desc->common.type !=ACPI_TYPE_INTEGER ) { ACPI_ERROR((AE_INFO, "(PRT[%X].SourceIndex) Need Integer, found %s", index,
drivers/acpi/acpica/utcopy.c +12 -13
@@ -135,11 +135,11 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,* In general, the external object will be the same type as * the internal object */ - external_object->type =ACPI_GET_OBJECT_TYPE (internal_object); + external_object->type = internal_object->common.type;/* However, only a limited number of external types are supported */ -switch (ACPI_GET_OBJECT_TYPE (internal_object)) { +switch (internal_object->common.type) {case ACPI_TYPE_STRING : external_object->string.pointer = (char *)data_space;
@@ -222,8 +222,8 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,*/ ACPI_ERROR ((AE_INFO ,"Unsupported object type, cannot convert to external object: %s" , -acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE - (internal_object)))); +acpi_ut_get_type_name (internal_object->common. + type)));return_ACPI_STATUS (AE_SUPPORT ); }
@@ -355,7 +355,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, info.object_space =0 ; info.num_packages =1 ; - external_object->type =ACPI_GET_OBJECT_TYPE (internal_object); + external_object->type = internal_object->common.type; external_object->package.count = internal_object->package.count; external_object->package.elements = ACPI_CAST_PTR(union acpi_object, info.free_space);
@@ -399,7 +399,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,ACPI_FUNCTION_TRACE (ut_copy_iobject_to_eobject); -if (ACPI_GET_OBJECT_TYPE (internal_object) ==ACPI_TYPE_PACKAGE ) { +if (internal_object->common.type ==ACPI_TYPE_PACKAGE ) {/* * Package object: Copy all subobjects (including * nested packages)
@@ -697,7 +697,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,/* Handle the objects with extra data */ -switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { +switch (dest_desc->common.type) {case ACPI_TYPE_BUFFER :/* * Allocate and copy the actual buffer if and only if:
@@ -814,8 +814,8 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,* This is a simple object, just copy it */ target_object = -acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE - (source_object)); +acpi_ut_create_internal_object (source_object-> + common.type);if (!target_object) {return (AE_NO_MEMORY ); }
@@ -892,7 +892,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,ACPI_FUNCTION_TRACE (ut_copy_ipackage_to_ipackage); - dest_obj->common.type =ACPI_GET_OBJECT_TYPE (source_obj); + dest_obj->common.type = source_obj->common.type; dest_obj->common.flags = source_obj->common.flags; dest_obj->package.count = source_obj->package.count;
@@ -950,15 +950,14 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,/* Create the top level object */ - *dest_desc = -acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_desc)); + *dest_desc =acpi_ut_create_internal_object (source_desc->common.type);if (!*dest_desc) {return_ACPI_STATUS (AE_NO_MEMORY ); }/* Copy the object and possible subobjects */ -if (ACPI_GET_OBJECT_TYPE (source_desc) ==ACPI_TYPE_PACKAGE ) { +if (source_desc->common.type ==ACPI_TYPE_PACKAGE ) { status =acpi_ut_copy_ipackage_to_ipackage (source_desc, *dest_desc, walk_state);
drivers/acpi/acpica/utdelete.c +3 -3
@@ -86,7 +86,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)* Must delete or free any pointers within the object that are not * actual ACPI objects (for example, a raw buffer pointer). */ -switch (ACPI_GET_OBJECT_TYPE (object)) { +switch (object->common.type) {case ACPI_TYPE_STRING : ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
@@ -382,7 +382,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) object, new_count)); } -if (ACPI_GET_OBJECT_TYPE (object) ==ACPI_TYPE_METHOD ) { +if (object->common.type ==ACPI_TYPE_METHOD ) {ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS ,"Method Obj %p Refs=%X, [Decremented]\n" , object, new_count));
@@ -469,7 +469,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)* All sub-objects must have their reference count incremented also. * Different object types have different subobjects. */ -switch (ACPI_GET_OBJECT_TYPE (object)) { +switch (object->common.type) {case ACPI_TYPE_DEVICE :case ACPI_TYPE_PROCESSOR :case ACPI_TYPE_POWER :
drivers/acpi/acpica/uteval.c +6 -6
@@ -248,7 +248,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,/* Map the return object type to the bitmapped type */ -switch (ACPI_GET_OBJECT_TYPE (info->return_object)) { +switch ((info->return_object)->common.type) {case ACPI_TYPE_INTEGER : return_btype =ACPI_BTYPE_INTEGER ;break ;
@@ -418,7 +418,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,return_ACPI_STATUS (status); } -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_INTEGER ) { +if (obj_desc->common.type ==ACPI_TYPE_INTEGER ) {/* Convert the Numeric HID to string */
@@ -459,7 +459,7 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, struct acpi_compatible_id *one_cid) { -switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +switch (obj_desc->common.type) {case ACPI_TYPE_INTEGER :/* Convert the Numeric CID to string */
@@ -527,7 +527,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,/* Get the number of _CIDs returned */ count =1 ; -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_PACKAGE ) { +if (obj_desc->common.type ==ACPI_TYPE_PACKAGE ) { count = obj_desc->package.count; }
@@ -555,7 +555,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,/* The _CID object can be either a single CID or a package (list) of CIDs */ -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_PACKAGE ) { +if (obj_desc->common.type ==ACPI_TYPE_PACKAGE ) {/* Translate each package element */
@@ -620,7 +620,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,return_ACPI_STATUS (status); } -if (ACPI_GET_OBJECT_TYPE (obj_desc) ==ACPI_TYPE_INTEGER ) { +if (obj_desc->common.type ==ACPI_TYPE_INTEGER ) {/* Convert the Numeric UID to string */
drivers/acpi/acpica/utglobal.c +1 -1
@@ -473,7 +473,7 @@ char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)return ("[NULL Object Descriptor]" ); } -return (acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc))); +return (acpi_ut_get_type_name (obj_desc->common.type)); }/*******************************************************************************
drivers/acpi/acpica/utmisc.c +1 -2
@@ -938,8 +938,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,if ((!this_source_obj) || (ACPI_GET_DESCRIPTOR_TYPE (this_source_obj) !=ACPI_DESC_TYPE_OPERAND ) - || (ACPI_GET_OBJECT_TYPE (this_source_obj) != -ACPI_TYPE_PACKAGE )) { + || (this_source_obj->common.type !=ACPI_TYPE_PACKAGE )) { status =walk_callback (ACPI_COPY_TYPE_SIMPLE , this_source_obj, state, context);
drivers/acpi/acpica/utobject.c +3 -4
@@ -457,7 +457,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,* must be accessed bytewise or there may be alignment problems on * certain processors */ -switch (ACPI_GET_OBJECT_TYPE (internal_object)) { +switch (internal_object->common.type) {case ACPI_TYPE_STRING : length += (acpi_size ) internal_object->string.length +1 ;
@@ -518,8 +518,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,ACPI_ERROR ((AE_INFO ,"Cannot convert to external object - " "unsupported type [%s] %X in object %p" ,acpi_ut_get_object_type_name (internal_object), -ACPI_GET_OBJECT_TYPE (internal_object), - internal_object)); + internal_object->common.type, internal_object)); status =AE_TYPE ;break ; }
@@ -664,7 +663,7 @@ acpi_ut_get_object_size(union acpi_operand_object *internal_object,if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) ==ACPI_DESC_TYPE_OPERAND ) - && (ACPI_GET_OBJECT_TYPE (internal_object) ==ACPI_TYPE_PACKAGE )) { + && (internal_object->common.type ==ACPI_TYPE_PACKAGE )) { status =acpi_ut_get_package_object_size (internal_object, obj_length);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 30/98 ACPICA: Conditionally compile acpi_set_firmware_waking_vector64
In reply to Len BrownFrom: Bob Moore <[email protected]>
This function is only needed on 64-bit host operating systems.
--- drivers/acpi/acpica/hwsleep.c | 5 ++++- include/acpi/acpixf.h | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/acpi/acpica/hwsleep.c +4 -1
@@ -90,6 +90,7 @@ acpi_set_firmware_waking_vector(u32 physical_address) ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) +#if ACPI_MACHINE_WIDTH ==64 /******************************************************************************* * * FUNCTION: acpi_set_firmware_waking_vector64
@@ -100,7 +101,8 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)* RETURN: Status * * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if -* it exists in the table. +* it exists in the table. This function is intended for use with +* 64-bit host operating systems. * ******************************************************************************/ acpi_status
@@ -124,6 +126,7 @@ acpi_set_firmware_waking_vector64(u64 physical_address) } ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) +#endif /******************************************************************************* *
include/acpi/acpixf.h +4 -4
@@ -351,11 +351,11 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);acpi_status acpi_set_register (u32 register_id,u32 value); -acpi_status -acpi_set_firmware_waking_vector (u32 physical_address); +acpi_status acpi_set_firmware_waking_vector (u32 physical_address); -acpi_status -acpi_set_firmware_waking_vector64 (u64 physical_address); +#if ACPI_MACHINE_WIDTH ==64 +acpi_status acpi_set_firmware_waking_vector64 (u64 physical_address); +#endif acpi_status acpi_read (u32 *value,struct acpi_generic_address *reg);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 31/98 ACPICA: Debug output: print result of _OSI invocations
In reply to Len BrownFrom: Bob Moore <[email protected]>
Print input strings and the result (supported or not supported) for invocations of the _OSI method.
--- drivers/acpi/acpica/uteval.c | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-)
drivers/acpi/acpica/uteval.c +21 -11
@@ -98,6 +98,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)acpi_status status;union acpi_operand_object *string_desc;union acpi_operand_object *return_desc; +u32 return_value;u32 i;ACPI_FUNCTION_TRACE (ut_osi_implementation);
@@ -116,10 +117,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)return_ACPI_STATUS (AE_NO_MEMORY ); } -/* Default return value is 0, NOT-SUPPORTED */ +/* Default return value is 0, NOT SUPPORTED */ - return_desc->integer.value =0 ; - walk_state->return_desc = return_desc; + return_value =0 ;/* Compare input string to static table of supported interfaces */
@@ -127,8 +127,11 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)if (!ACPI_STRCMP (string_desc->string.pointer, acpi_interfaces_supported[i])) { - return_desc->integer.value =ACPI_UINT32_MAX ; - goto done; + +/* The interface is supported */ + + return_value =ACPI_UINT32_MAX ; + goto exit; } }
@@ -139,15 +142,22 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)*/ status =acpi_os_validate_interface (string_desc->string.pointer);if (ACPI_SUCCESS (status)) { - return_desc->integer.value =ACPI_UINT32_MAX ; + +/* The interface is supported */ + + return_value =ACPI_UINT32_MAX ; } -done: -ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO ,"ACPI: BIOS _OSI(%s) %ssupported\n" , - string_desc->string.pointer, - return_desc->integer.value ==0 ?"not-" :"" )); +exit: +ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO , +"ACPI: BIOS _OSI(%s) is %ssupported\n" , + string_desc->string.pointer, return_value ==0 ?"not " :"" )); -return_ACPI_STATUS (AE_OK ); +/* Complete the return value */ + + return_desc->integer.value = return_value; + walk_state->return_desc = return_desc; +return_ACPI_STATUS (AE_OK ); }/*******************************************************************************
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 32/98 ACPICA: Debug output: decrease verbosity of DB_INFO debug level
In reply to Len BrownFrom: Bob Moore <[email protected]>
Removed some of the extraneous debug prints using the DB_INFO level. This should make the DB_INFO more useful.
--- drivers/acpi/acpica/nseval.c | 2 +- drivers/acpi/acpica/nsutils.c | 2 +- drivers/acpi/acpica/utobject.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/acpi/acpica/nseval.c +1 -1
@@ -155,7 +155,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) } -ACPI_DUMP_PATHNAME (info->resolved_node,"Execute Method:" , +ACPI_DUMP_PATHNAME (info->resolved_node,"ACPI: Execute Method" ,ACPI_LV_INFO , _COMPONENT); ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
drivers/acpi/acpica/nsutils.c +1 -1
@@ -872,7 +872,7 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, (flags |ACPI_NS_DONT_OPEN_SCOPE ),NULL , return_node);if (ACPI_FAILURE (status)) { -ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"%s, %s\n" , +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"%s, %s\n" , pathname,acpi_format_exception (status))); }
drivers/acpi/acpica/utobject.c +2 -2
@@ -310,7 +310,7 @@ u8 acpi_ut_valid_internal_object(void *object)/* Check for a null pointer */ if (!object) { -ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"**** Null Object Ptr\n" )); +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"**** Null Object Ptr\n" ));return (FALSE); }
@@ -324,7 +324,7 @@ u8 acpi_ut_valid_internal_object(void *object)return (TRUE);default : -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"%p is not not an ACPI operand obj [%s]\n" , object,acpi_ut_get_descriptor_name (object)));break ;
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 33/98 ACPICA: Formatting update - no functional changes
In reply to Len BrownFrom: Bob Moore <[email protected]>
Split some long lines.
--- drivers/acpi/acpica/tbfadt.c | 33 ++++++++++++++++++++------------- drivers/acpi/acpica/tbinstal.c | 9 +++++---- drivers/acpi/acpica/tbutils.c | 17 +++++++++-------- drivers/acpi/acpica/tbxface.c | 37 ++++++++++++++++--------------------- drivers/acpi/acpica/tbxfroot.c | 4 ++-- drivers/acpi/acpica/utcopy.c | 5 +++-- drivers/acpi/acpica/uteval.c | 5 ++--- drivers/acpi/acpica/utglobal.c | 5 ++++- 8 files changed, 61 insertions(+), 54 deletions(-)
drivers/acpi/acpica/tbfadt.c +20 -13
@@ -132,7 +132,8 @@ static struct acpi_fadt_info fadt_info_table[] = { ACPI_FADT_SEPARATE_LENGTH} }; -#define ACPI_FADT_INFO_ENTRIES (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info)) +#define ACPI_FADT_INFO_ENTRIES \ + (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info))/* Table used to split Event Blocks into separate status/enable registers */
@@ -161,7 +162,8 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { 1} }; -#define ACPI_FADT_PM_INFO_ENTRIES (sizeof (fadt_pm_info_table) / sizeof (struct acpi_fadt_pm_info)) +#define ACPI_FADT_PM_INFO_ENTRIES \ + (sizeof (fadt_pm_info_table) / sizeof (struct acpi_fadt_pm_info))/******************************************************************************* *
@@ -416,7 +418,7 @@ static void acpi_tb_convert_fadt(void) } } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: acpi_tb_validate_fadt *
@@ -503,7 +505,8 @@ static void acpi_tb_validate_fadt(void)*/ if (!address64->address || !length) { ACPI_ERROR((AE_INFO, - "Required field %s has zero address and/or length: %8.8X%8.8X/%X", + "Required field %s has zero address and/or length:" + " %8.8X%8.8X/%X", name, ACPI_FORMAT_UINT64(address64-> address),
@@ -512,12 +515,14 @@ static void acpi_tb_validate_fadt(void) }else if (fadt_info_table[i].type &ACPI_FADT_SEPARATE_LENGTH ) {/* * Field is optional (PM2Control, GPE0, GPE1) AND has its own -* length field. If present, both the address and length must be valid. +* length field. If present, both the address and length must +* be valid. */ -if ((address64->address && !length) - || (!address64->address && length)) { +if ((address64->address && !length) || + (!address64->address && length)) { ACPI_WARNING((AE_INFO, - "Optional field %s has zero address or length: %8.8X%8.8X/%X", + "Optional field %s has zero address or length: " + "%8.8X%8.8X/%X", name, ACPI_FORMAT_UINT64(address64-> address),
@@ -525,8 +530,10 @@ static void acpi_tb_validate_fadt(void) } } -/* If both 32- and 64-bit addresses are valid (non-zero), they must match */ - +/* +* If both 32- and 64-bit addresses are valid (non-zero), +* they must match +*/ if (address64->address && *address32 && (address64->address != (u64) * address32)) { ACPI_ERROR((AE_INFO,
@@ -537,7 +544,7 @@ static void acpi_tb_validate_fadt(void) } } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: acpi_tb_setup_fadt_registers *
@@ -596,8 +603,8 @@ static void acpi_tb_setup_fadt_registers(void)* Each register is defined to be (event block length / 2). Extra divide * by 8 converts bits to bytes. */ - pm1_register_byte_width = - (u8 )ACPI_DIV_16 (acpi_gbl_FADT.xpm1a_event_block.bit_width); + pm1_register_byte_width = (u8 ) +ACPI_DIV_16 (acpi_gbl_FADT.xpm1a_event_block.bit_width);/* * Calculate separate GAS structs for the PM1x (A/B) Status and Enable
drivers/acpi/acpica/tbinstal.c +5 -4
@@ -273,8 +273,9 @@ acpi_status acpi_tb_resize_root_table_list(void)/* Increase the Table Array size */ tables =ACPI_ALLOCATE_ZEROED (((acpi_size ) acpi_gbl_root_table_list. - size +ACPI_ROOT_TABLE_SIZE_INCREMENT ) - *sizeof (struct acpi_table_desc )); + size + +ACPI_ROOT_TABLE_SIZE_INCREMENT ) * +sizeof (struct acpi_table_desc ));if (!tables) {ACPI_ERROR ((AE_INFO ,"Could not allocate new root table array" ));
@@ -561,8 +562,8 @@ u8 acpi_tb_is_table_loaded(u32 table_index) (void )acpi_ut_acquire_mutex (ACPI_MTX_TABLES );if (table_index < acpi_gbl_root_table_list.count) { is_loaded = (u8) - (acpi_gbl_root_table_list.tables[table_index]. - flags &ACPI_TABLE_IS_LOADED ); + (acpi_gbl_root_table_list.tables[table_index].flags & +ACPI_TABLE_IS_LOADED ); } (void )acpi_ut_release_mutex (ACPI_MTX_TABLES );
drivers/acpi/acpica/tbutils.c +9 -8
@@ -413,7 +413,8 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size) }else {/* * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return -* 64-bit platform, XSDT: Move (unaligned) 64-bit to local, return 64-bit +* 64-bit platform, XSDT: Move (unaligned) 64-bit to local, +* return 64-bit */ ACPI_MOVE_64_TO_64 (&address64, table_entry);
@@ -423,7 +424,8 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size)/* Will truncate 64-bit address to 32 bits, issue warning */ ACPI_WARNING ((AE_INFO , -"64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating" , +"64-bit Physical Address in XSDT is too large (%8.8X%8.8X)," +" truncating" , ACPI_FORMAT_UINT64(address64))); }#endif
@@ -546,13 +548,12 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address)/* Calculate the number of tables described in the root table */ - table_count = - (u32) ((table->length - -sizeof (struct acpi_table_header )) / table_entry_size); - + table_count = (u32)((table->length -sizeof (struct acpi_table_header )) / + table_entry_size);/* -* First two entries in the table array are reserved for the DSDT and FACS, -* which are not actually present in the RSDT/XSDT - they come from the FADT +* First two entries in the table array are reserved for the DSDT +* and FACS, which are not actually present in the RSDT/XSDT - they +* come from the FADT */ table_entry =ACPI_CAST_PTR (u8, table) +sizeof (struct acpi_table_header );
drivers/acpi/acpica/tbxface.c +16 -21
@@ -246,7 +246,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)ACPI_EXPORT_SYMBOL (acpi_load_table) -/****************************************************************************** +/******************************************************************************* * * FUNCTION: acpi_get_table_header *
@@ -261,7 +261,7 @@ ACPI_EXPORT_SYMBOL(acpi_load_table)* NOTE: Caller is responsible in unmapping the header with * acpi_os_unmap_memory * -*****************************************************************************/ +******************************************************************************/ acpi_status acpi_get_table_header (char *signature,u32 instance,struct acpi_table_header *out_table_header)
@@ -276,9 +276,8 @@ acpi_get_table_header(char *signature,return (AE_BAD_PARAMETER ); } -/* -* Walk the root table list -*/ +/* Walk the root table list */ + for (i = 0, j = 0; i < acpi_gbl_root_table_list.count; i++) { if (!ACPI_COMPARE_NAME (&(acpi_gbl_root_table_list.tables[i].signature),
@@ -291,8 +290,8 @@ acpi_get_table_header(char *signature, }if (!acpi_gbl_root_table_list.tables[i].pointer) { -if ((acpi_gbl_root_table_list.tables[i]. - flags &ACPI_TABLE_ORIGIN_MASK ) == +if ((acpi_gbl_root_table_list.tables[i].flags & +ACPI_TABLE_ORIGIN_MASK ) ==ACPI_TABLE_ORIGIN_MAPPED ) { header = acpi_os_map_memory(acpi_gbl_root_table_list.
@@ -323,7 +322,7 @@ acpi_get_table_header(char *signature,ACPI_EXPORT_SYMBOL (acpi_get_table_header) -/****************************************************************************** +/******************************************************************************* * * FUNCTION: acpi_unload_table_id *
@@ -374,7 +373,7 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id)* * DESCRIPTION: Finds and verifies an ACPI table. * -*****************************************************************************/ +******************************************************************************/ acpi_status acpi_get_table (char *signature,u32 instance,struct acpi_table_header **out_table)
@@ -389,9 +388,8 @@ acpi_get_table(char *signature,return (AE_BAD_PARAMETER ); } -/* -* Walk the root table list -*/ +/* Walk the root table list */ + for (i = 0, j = 0; i < acpi_gbl_root_table_list.count; i++) { if (!ACPI_COMPARE_NAME (&(acpi_gbl_root_table_list.tables[i].signature),
@@ -526,17 +524,15 @@ static acpi_status acpi_tb_load_namespace(void) (void )acpi_ut_release_mutex (ACPI_MTX_TABLES ); -/* -* Load and parse tables. -*/ +/* Load and parse tables */ + status =acpi_ns_load_table (ACPI_TABLE_INDEX_DSDT , acpi_gbl_root_node);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); } -/* -* Load any SSDT or PSDT tables. Note: Loop leaves tables locked -*/ +/* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ + (void )acpi_ut_acquire_mutex (ACPI_MTX_TABLES );for (i =0 ; i < acpi_gbl_root_table_list.count; ++i) { if ((!ACPI_COMPARE_NAME
@@ -589,9 +585,8 @@ acpi_status acpi_load_tables(void)ACPI_FUNCTION_TRACE (acpi_load_tables); -/* -* Load the namespace from the tables -*/ +/* Load the namespace from the tables */ + status =acpi_tb_load_namespace ();if (ACPI_FAILURE (status)) { ACPI_EXCEPTION((AE_INFO, status,
drivers/acpi/acpica/tbxfroot.c +2 -2
@@ -75,8 +75,8 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)* Note: Sometimes there exists more than one RSDP in memory; the valid * RSDP has a valid checksum, all others have an invalid checksum. */ -if (ACPI_STRNCMP ((char *)rsdp,ACPI_SIG_RSDP ,sizeof (ACPI_SIG_RSDP ) -1 ) - !=0 ) { +if (ACPI_STRNCMP ((char *)rsdp,ACPI_SIG_RSDP , +sizeof (ACPI_SIG_RSDP ) -1 ) !=0 ) {/* Nope, BAD Signature */
drivers/acpi/acpica/utcopy.c +3 -2
@@ -496,8 +496,9 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,case ACPI_TYPE_STRING : internal_object->string.pointer = -ACPI_ALLOCATE_ZEROED ((acpi_size ) external_object->string. - length +1 ); +ACPI_ALLOCATE_ZEROED ((acpi_size ) + external_object->string.length +1 ); +if (!internal_object->string.pointer) { goto error_exit; }
drivers/acpi/acpica/uteval.c +2 -3
@@ -124,9 +124,8 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)/* Compare input string to static table of supported interfaces */ for (i =0 ; i <ACPI_ARRAY_LENGTH (acpi_interfaces_supported); i++) { -if (!ACPI_STRCMP - (string_desc->string.pointer, - acpi_interfaces_supported[i])) { +if (!ACPI_STRCMP (string_desc->string.pointer, + acpi_interfaces_supported[i])) {/* The interface is supported */
drivers/acpi/acpica/utglobal.c +4 -1
@@ -746,7 +746,10 @@ acpi_status acpi_ut_init_globals(void)for (i =0 ; i <ACPI_NUM_OWNERID_MASKS ; i++) { acpi_gbl_owner_id_mask[i] =0 ; } - acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS -1 ] =0x80000000 ;/* Last ID is never valid */ + +/* Last owner_iD is never valid */ + + acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS -1 ] =0x80000000 ;/* GPE support */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 34/98 ACPICA: Optimize ACPI register locking
In reply to Len BrownFrom: Bob Moore <[email protected]>
Removed locking for reads from the ACPI bit registers in PM1 Status, Enable, Control, and PM2 Control. The lock is not required when reading the single-bit registers. The acpi_get_register_unlocked function is no longer needed and has been removed. This will improve performance for reads on these registers. ACPICA BZ 760.
http://www.acpica.org/bugzilla/show_bug.cgi?id=760
--- drivers/acpi/acpica/hwsleep.c | 2 +- drivers/acpi/acpica/hwxface.c | 65 +++++++++++++++++------------------------ drivers/acpi/processor_idle.c | 2 +- include/acpi/acpixf.h | 2 - 4 files changed, 29 insertions(+), 42 deletions(-)
drivers/acpi/acpica/hwsleep.c +1 -1
@@ -365,7 +365,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)/* Wait until we enter sleep state */ do { - status = acpi_get_register_unlocked(ACPI_BITREG_WAKE_STATUS, + status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status);
drivers/acpi/acpica/hwxface.c +27 -38
104 lines not on this page · raw message
drivers/acpi/processor_idle.c +1 -1
@@ -800,7 +800,7 @@ static int acpi_idle_bm_check(void) {u32 bm_status =0 ; -acpi_get_register_unlocked (ACPI_BITREG_BUS_MASTER_STATUS , &bm_status); +acpi_get_register (ACPI_BITREG_BUS_MASTER_STATUS , &bm_status);if (bm_status)acpi_set_register (ACPI_BITREG_BUS_MASTER_STATUS ,1 );/*
include/acpi/acpixf.h +0 -2
@@ -347,8 +347,6 @@ acpi_status acpi_reset(void);acpi_status acpi_get_register (u32 register_id,u32 * return_value); -acpi_status acpi_get_register_unlocked (u32 register_id,u32 *return_value); -acpi_status acpi_set_register (u32 register_id,u32 value);acpi_status acpi_set_firmware_waking_vector (u32 physical_address);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 35/98 ACPICA: Rename ACPI bit register access functions
In reply to Len BrownFrom: Bob Moore <[email protected]>
Rename acpi_get_register and acpi_set_register to clarify the purpose of these functions. New names are acpi_read_bit_register and acpi_write_bit_register.
--- drivers/acpi/acpica/evevent.c | 12 ++++++------ drivers/acpi/acpica/evmisc.c | 4 ++-- drivers/acpi/acpica/evxfevnt.c | 24 ++++++++++++------------ drivers/acpi/acpica/hwacpi.c | 2 +- drivers/acpi/acpica/hwsleep.c | 15 ++++++++------- drivers/acpi/acpica/hwxface.c | 16 ++++++++-------- drivers/acpi/processor_idle.c | 10 +++++----- drivers/acpi/sleep.c | 2 +- include/acpi/acpixf.h | 4 ++-- 9 files changed, 45 insertions(+), 44 deletions(-)
drivers/acpi/acpica/evevent.c +6 -6
@@ -204,8 +204,8 @@ static acpi_status acpi_ev_fixed_event_initialize(void)if (acpi_gbl_fixed_event_info[i].enable_register_id !=0xFF ) { status = -acpi_set_register (acpi_gbl_fixed_event_info[i]. - enable_register_id,0 ); +acpi_write_bit_register (acpi_gbl_fixed_event_info + [i].enable_register_id,0 );if (ACPI_FAILURE (status)) {return (status); }
@@ -288,16 +288,16 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)/* Clear the status bit */ - (void )acpi_set_register (acpi_gbl_fixed_event_info[event]. - status_register_id,1 ); + (void )acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. + status_register_id,1 );/* * Make sure we've got a handler. If not, report an error. The event is * disabled to prevent further interrupts. */ if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { - (void )acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,0 ); + (void )acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. + enable_register_id,0 ); ACPI_ERROR((AE_INFO, "No installed handler for fixed event [%08X]",
drivers/acpi/acpica/evmisc.c +2 -2
@@ -534,8 +534,8 @@ acpi_status acpi_ev_release_global_lock(void)*/ if (pending) { status = -acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE , -1 ); +acpi_write_bit_register + (ACPI_BITREG_GLOBAL_LOCK_RELEASE ,1 ); } ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
drivers/acpi/acpica/evxfevnt.c +12 -12
@@ -172,8 +172,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags)* register bit) */ status = -acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,1 ); +acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. + enable_register_id,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -181,8 +181,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags)/* Make sure that the hardware responded */ status = -acpi_get_register (acpi_gbl_fixed_event_info[event]. - enable_register_id, &value); +acpi_read_bit_register (acpi_gbl_fixed_event_info[event]. + enable_register_id, &value);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -354,15 +354,15 @@ acpi_status acpi_disable_event(u32 event, u32 flags)* register bit) */ status = -acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,0 ); +acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. + enable_register_id,0 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); } status = -acpi_get_register (acpi_gbl_fixed_event_info[event]. - enable_register_id, &value); +acpi_read_bit_register (acpi_gbl_fixed_event_info[event]. + enable_register_id, &value);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -407,8 +407,8 @@ acpi_status acpi_clear_event(u32 event)* register bit) */ status = -acpi_set_register (acpi_gbl_fixed_event_info[event]. - status_register_id,1 ); +acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. + status_register_id,1 );return_ACPI_STATUS (status); }
@@ -495,7 +495,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)/* Get the status of the requested fixed event */ status = -acpi_get_register (acpi_gbl_fixed_event_info[event]. +acpi_read_bit_register (acpi_gbl_fixed_event_info[event]. enable_register_id, &value);if (ACPI_FAILURE (status))return_ACPI_STATUS (status);
@@ -503,7 +503,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) *event_status = value; status = -acpi_get_register (acpi_gbl_fixed_event_info[event]. +acpi_read_bit_register (acpi_gbl_fixed_event_info[event]. status_register_id, &value);if (ACPI_FAILURE (status))return_ACPI_STATUS (status);
drivers/acpi/acpica/hwacpi.c +1 -1
@@ -172,7 +172,7 @@ u32 acpi_hw_get_mode(void)return_UINT32 (ACPI_SYS_MODE_ACPI ); } - status =acpi_get_register (ACPI_BITREG_SCI_ENABLE , &value); + status =acpi_read_bit_register (ACPI_BITREG_SCI_ENABLE , &value);if (ACPI_FAILURE (status)) {return_UINT32 (ACPI_SYS_MODE_LEGACY ); }
drivers/acpi/acpica/hwsleep.c +8 -7
@@ -250,7 +250,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)/* Clear wake status */ - status =acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 ); + status =acpi_write_bit_register (ACPI_BITREG_WAKE_STATUS ,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -365,7 +365,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)/* Wait until we enter sleep state */ do { - status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, + status = acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status);
@@ -399,7 +399,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)ACPI_FUNCTION_TRACE (acpi_enter_sleep_state_s4bios); - status =acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 ); + status =acpi_write_bit_register (ACPI_BITREG_WAKE_STATUS ,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -431,7 +431,8 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) do { acpi_os_stall(1000); - status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); + status = + acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }
@@ -592,18 +593,18 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)* it to determine whether the system is rebooting or resuming. Clear * it for compatibility. */ -acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 ); +acpi_write_bit_register (ACPI_BITREG_WAKE_STATUS ,1 ); acpi_gbl_system_awake_and_running = TRUE;/* Enable power button */ (void ) -acpi_set_register (acpi_gbl_fixed_event_info +acpi_write_bit_register (acpi_gbl_fixed_event_info [ACPI_EVENT_POWER_BUTTON ].enable_register_id,1 ); (void ) -acpi_set_register (acpi_gbl_fixed_event_info +acpi_write_bit_register (acpi_gbl_fixed_event_info [ACPI_EVENT_POWER_BUTTON ].status_register_id,1 ); arg.integer.value =ACPI_SST_WORKING ;
drivers/acpi/acpica/hwxface.c +8 -8
@@ -242,7 +242,7 @@ ACPI_EXPORT_SYMBOL(acpi_write)/******************************************************************************* * -* FUNCTION: acpi_get_register +* FUNCTION: acpi_read_bit_register * * PARAMETERS: register_id - ID of ACPI Bit Register to access * return_value - Value that was read from the register,
@@ -264,13 +264,13 @@ ACPI_EXPORT_SYMBOL(acpi_write)* it make much sense to actually read this field.) * ******************************************************************************/ -acpi_status acpi_get_register (u32 register_id,u32 *return_value) +acpi_status acpi_read_bit_register (u32 register_id,u32 *return_value) {u32 register_value =0 ;struct acpi_bit_register_info *bit_reg_info;acpi_status status; -ACPI_FUNCTION_TRACE (acpi_get_register); +ACPI_FUNCTION_TRACE (acpi_read_bit_register);/* Get the info structure corresponding to the requested ACPI Register */
@@ -302,11 +302,11 @@ acpi_status acpi_get_register(u32 register_id, u32 *return_value)return_ACPI_STATUS (status); } -ACPI_EXPORT_SYMBOL (acpi_get_register) +ACPI_EXPORT_SYMBOL (acpi_read_bit_register)/******************************************************************************* * -* FUNCTION: acpi_set_register +* FUNCTION: acpi_write_bit_register * * PARAMETERS: register_id - ID of ACPI Bit Register to access * Value - Value to write to the register, in bit
@@ -322,14 +322,14 @@ ACPI_EXPORT_SYMBOL(acpi_get_register)* PM2 Control. * ******************************************************************************/ -acpi_status acpi_set_register (u32 register_id,u32 value) +acpi_status acpi_write_bit_register (u32 register_id,u32 value) {u32 register_value =0 ;struct acpi_bit_register_info *bit_reg_info;acpi_status status;acpi_cpu_flags lock_flags; -ACPI_FUNCTION_TRACE_U32 (acpi_set_register, register_id); +ACPI_FUNCTION_TRACE_U32 (acpi_write_bit_register, register_id);/* Get the info structure corresponding to the requested ACPI Register */
@@ -459,7 +459,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)return_ACPI_STATUS (status); } -ACPI_EXPORT_SYMBOL (acpi_set_register) +ACPI_EXPORT_SYMBOL (acpi_write_bit_register)/******************************************************************************* *
drivers/acpi/processor_idle.c +5 -5
@@ -630,7 +630,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,* In either case, the proper way to * handle BM_RLD is to set it and leave it set. */ -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,1 ); +acpi_write_bit_register (ACPI_BITREG_BUS_MASTER_RLD ,1 );return ; }
@@ -800,9 +800,9 @@ static int acpi_idle_bm_check(void) {u32 bm_status =0 ; -acpi_get_register (ACPI_BITREG_BUS_MASTER_STATUS , &bm_status); +acpi_read_bit_register (ACPI_BITREG_BUS_MASTER_STATUS , &bm_status);if (bm_status) -acpi_set_register (ACPI_BITREG_BUS_MASTER_STATUS ,1 ); +acpi_write_bit_register (ACPI_BITREG_BUS_MASTER_STATUS ,1 );/* * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect * the true state of bus mastering activity; forcing us to
@@ -1028,7 +1028,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, c3_cpu_count++;/* Disable bus master arbitration when all CPUs are in C3 */ if (c3_cpu_count ==num_online_cpus ()) -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,1 ); +acpi_write_bit_register (ACPI_BITREG_ARB_DISABLE ,1 );spin_unlock (&c3_lock); }else if (!pr->flags.bm_check) {ACPI_FLUSH_CPU_CACHE ();
@@ -1041,7 +1041,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,/* Re-enable bus master arbitration */ if (pr->flags.bm_check && pr->flags.bm_control) {spin_lock (&c3_lock); -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 ); +acpi_write_bit_register (ACPI_BITREG_ARB_DISABLE ,0 ); c3_cpu_count--;spin_unlock (&c3_lock); }
drivers/acpi/sleep.c +1 -1
@@ -248,7 +248,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)/* If ACPI is not enabled by the BIOS, we need to enable it here. */ if (set_sci_en_on_resume) -acpi_set_register (ACPI_BITREG_SCI_ENABLE ,1 ); +acpi_write_bit_register (ACPI_BITREG_SCI_ENABLE ,1 );else acpi_enable ();
include/acpi/acpixf.h +2 -2
@@ -345,9 +345,9 @@ acpi_resource_to_address64(struct acpi_resource *resource,*/ acpi_status acpi_reset (void ); -acpi_status acpi_get_register (u32 register_id,u32 * return_value); +acpi_status acpi_read_bit_register (u32 register_id,u32 *return_value); -acpi_status acpi_set_register (u32 register_id,u32 value); +acpi_status acpi_write_bit_register (u32 register_id,u32 value);acpi_status acpi_set_firmware_waking_vector (u32 physical_address);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 36/98 ACPICA: Restructure bit register access functions
In reply to Len BrownFrom: Bob Moore <[email protected]>
Update code for acpi_read_bit_register and acpi_write_bit_register. Simplified code path, condensed duplicate code.
--- drivers/acpi/acpica/hwxface.c | 177 ++++++++++++++-------------------------- 1 files changed, 62 insertions(+), 115 deletions(-)
drivers/acpi/acpica/hwxface.c +62 -115
@@ -133,8 +133,8 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) *value =0 ;/* -* Two address spaces supported: Memory or IO. -* PCI_Config is not supported here because the GAS struct is insufficient +* Two address spaces supported: Memory or IO. PCI_Config is +* not supported here because the GAS structure is insufficient */ switch (reg->space_id) {case ACPI_ADR_SPACE_SYSTEM_MEMORY :
@@ -266,11 +266,12 @@ ACPI_EXPORT_SYMBOL(acpi_write)******************************************************************************/ acpi_status acpi_read_bit_register (u32 register_id,u32 *return_value) { -u32 register_value =0 ;struct acpi_bit_register_info *bit_reg_info; +u32 register_value; +u32 value;acpi_status status; -ACPI_FUNCTION_TRACE (acpi_read_bit_register); +ACPI_FUNCTION_TRACE_U32 (acpi_read_bit_register, register_id);/* Get the info structure corresponding to the requested ACPI Register */
@@ -283,23 +284,22 @@ acpi_status acpi_read_bit_register(u32 register_id, u32 *return_value) status =acpi_hw_register_read (bit_reg_info->parent_register, ®ister_value); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } -if (ACPI_SUCCESS (status)) { - -/* Normalize the value that was read */ - - register_value = - ((register_value & bit_reg_info->access_bit_mask) - >> bit_reg_info->bit_position); +/* Normalize the value that was read, mask off other bits */ - *return_value = register_value; + value = ((register_value & bit_reg_info->access_bit_mask) + >> bit_reg_info->bit_position); -ACPI_DEBUG_PRINT ((ACPI_DB_IO ,"Read value %8.8X register %X\n" , - register_value, - bit_reg_info->parent_register)); - } +ACPI_DEBUG_PRINT ((ACPI_DB_IO , +"BitReg %X, ParentReg %X, Actual %8.8X, ReturnValue %8.8X\n" , + register_id, bit_reg_info->parent_register, + register_value, value)); -return_ACPI_STATUS (status); + *return_value = value; +return_ACPI_STATUS (AE_OK ); }ACPI_EXPORT_SYMBOL (acpi_read_bit_register)
@@ -321,13 +321,16 @@ ACPI_EXPORT_SYMBOL(acpi_read_bit_register)* SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and * PM2 Control. * +* Note that at this level, the fact that there may be actually two +* hardware registers (A and B - and B may not exist) is abstracted. +* ******************************************************************************/ acpi_status acpi_write_bit_register (u32 register_id,u32 value) { -u32 register_value =0 ;struct acpi_bit_register_info *bit_reg_info; -acpi_status status;acpi_cpu_flags lock_flags; +u32 register_value; +acpi_status status =AE_OK ;ACPI_FUNCTION_TRACE_U32 (acpi_write_bit_register, register_id);
@@ -335,127 +338,71 @@ acpi_status acpi_write_bit_register(u32 register_id, u32 value) bit_reg_info =acpi_hw_get_bit_register_info (register_id);if (!bit_reg_info) { -ACPI_ERROR ((AE_INFO ,"Bad ACPI HW RegisterId: %X" , - register_id));return_ACPI_STATUS (AE_BAD_PARAMETER ); } lock_flags =acpi_os_acquire_lock (acpi_gbl_hardware_lock); -/* Always do a register read first so we can insert the new bits */ - - status =acpi_hw_register_read (bit_reg_info->parent_register, - ®ister_value); -if (ACPI_FAILURE (status)) { - goto unlock_and_exit; - } -/* -* Decode the Register ID -* Register ID = [Register block ID] | [bit ID] -* -* Check bit ID to fine locate Register offset. -* Check Mask to determine Register offset, and then read-write. +* At this point, we know that the parent register is one of the +* following: PM1 Status, PM1 Enable, PM1 Control, or PM2 Control */ -switch (bit_reg_info->parent_register) { -case ACPI_REGISTER_PM1_STATUS : - -/* -* Status Registers are different from the rest. Clear by -* writing 1, and writing 0 has no effect. So, the only relevant -* information is the single bit we're interested in, all others should -* be written as 0 so they will be left unchanged. -*/ - value =ACPI_REGISTER_PREPARE_BITS (value, - bit_reg_info->bit_position, - bit_reg_info-> - access_bit_mask); -if (value) { - status = -acpi_hw_register_write (ACPI_REGISTER_PM1_STATUS , - (u16 ) value); - register_value =0 ; - } -break ; - -case ACPI_REGISTER_PM1_ENABLE : - -ACPI_REGISTER_INSERT_VALUE (register_value, - bit_reg_info->bit_position, - bit_reg_info->access_bit_mask, - value); - - status =acpi_hw_register_write (ACPI_REGISTER_PM1_ENABLE , - (u16 ) register_value); -break ; - -case ACPI_REGISTER_PM1_CONTROL : - +if (bit_reg_info->parent_register !=ACPI_REGISTER_PM1_STATUS ) {/* -* Write the PM1 Control register. -* Note that at this level, the fact that there are actually TWO -* registers (A and B - and B may not exist) is abstracted. +* 1) Case for PM1 Enable, PM1 Control, and PM2 Control +* +* Perform a register read to preserve the bits that we are not +* interested in */ -ACPI_DEBUG_PRINT ((ACPI_DB_IO ,"PM1 control: Read %X\n" , - register_value)); - -ACPI_REGISTER_INSERT_VALUE (register_value, - bit_reg_info->bit_position, - bit_reg_info->access_bit_mask, - value); - - status =acpi_hw_register_write (ACPI_REGISTER_PM1_CONTROL , - (u16 ) register_value); -break ; - -case ACPI_REGISTER_PM2_CONTROL : - - status =acpi_hw_register_read (ACPI_REGISTER_PM2_CONTROL , + status =acpi_hw_register_read (bit_reg_info->parent_register, ®ister_value);if (ACPI_FAILURE (status)) { goto unlock_and_exit; } -ACPI_DEBUG_PRINT ((ACPI_DB_IO , -"PM2 control: Read %X from %8.8X%8.8X\n" , - register_value, -ACPI_FORMAT_UINT64 (acpi_gbl_FADT. - xpm2_control_block. - address))); - +/* +* Insert the input bit into the value that was just read +* and write the register +*/ ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask, value); -ACPI_DEBUG_PRINT ((ACPI_DB_IO , -"About to write %4.4X to %8.8X%8.8X\n" , - register_value, -ACPI_FORMAT_UINT64 (acpi_gbl_FADT. - xpm2_control_block. - address))); + status =acpi_hw_register_write (bit_reg_info->parent_register, + register_value); + }else { +/* +* 2) Case for PM1 Status +* +* The Status register is different from the rest. Clear an event +* by writing 1, writing 0 has no effect. So, the only relevant +* information is the single bit we're interested in, all others +* should be written as 0 so they will be left unchanged. +*/ + register_value =ACPI_REGISTER_PREPARE_BITS (value, + bit_reg_info-> + bit_position, + bit_reg_info-> + access_bit_mask); - status =acpi_hw_register_write (ACPI_REGISTER_PM2_CONTROL , - (u8) (register_value)); -break ; +/* No need to write the register if value is all zeros */ -default : -break ; +if (register_value) { + status = +acpi_hw_register_write (ACPI_REGISTER_PM1_STATUS , + register_value); + } } - unlock_and_exit: - -acpi_os_release_lock (acpi_gbl_hardware_lock, lock_flags); - -/* Normalize the value that was read */ +ACPI_DEBUG_PRINT ((ACPI_DB_IO , +"BitReg %X, ParentReg %X, Value %8.8X, Actual %8.8X\n" , + register_id, bit_reg_info->parent_register, value, + register_value)); -ACPI_DEBUG_EXEC (register_value = - ((register_value & bit_reg_info->access_bit_mask) >> - bit_reg_info->bit_position)); +unlock_and_exit: -ACPI_DEBUG_PRINT ((ACPI_DB_IO , -"Set bits: %8.8X actual %8.8X register %X\n" , value, - register_value, bit_reg_info->parent_register)); +acpi_os_release_lock (acpi_gbl_hardware_lock, lock_flags);return_ACPI_STATUS (status); }
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 37/98 ACPICA: Update table header print function
In reply to Len BrownFrom: Bob Moore <[email protected]>
Cleanup table header output.
--- drivers/acpi/acpica/tbutils.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
drivers/acpi/acpica/tbutils.c +11 -7
@@ -177,19 +177,23 @@ acpi_tb_print_table_header(acpi_physical_address address, struct acpi_table_header *header) { +/* +* The reason that the Address is cast to a void pointer is so that we +* can use %p which will work properly on both 32-bit and 64-bit hosts. +*/ if (ACPI_COMPARE_NAME (header->signature,ACPI_SIG_FACS )) { -/* FACS only has signature and length fields of common table header */ +/* FACS only has signature and length fields */ -ACPI_INFO ((AE_INFO ,"%4.4s %08lX, %04X" , - header->signature, (unsigned long )address, +ACPI_INFO ((AE_INFO ,"%4.4s %p %05X" , + header->signature,ACPI_CAST_PTR (void, address), header->length)); }else if (ACPI_COMPARE_NAME (header->signature,ACPI_SIG_RSDP )) {/* RSDP has no common fields */ - ACPI_INFO((AE_INFO, "RSDP %08lX, %04X (r%d %6.6s)", - (unsigned long)address, + ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", + ACPI_CAST_PTR (void, address), (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> revision > 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
@@ -202,8 +206,8 @@ acpi_tb_print_table_header(acpi_physical_address address,/* Standard ACPI table with full common header */ ACPI_INFO((AE_INFO, - "%4.4s %08lX, %04X (r%d %6.6s %8.8s %8X %4.4s %8X)", - header->signature, (unsigned long)address, + "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", + header->signature, ACPI_CAST_PTR (void, address), header->length, header->revision, header->oem_id, header->oem_table_id, header->oem_revision, header->asl_compiler_id,
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 38/98 ACPICA: Update version to 20090220
In reply to Len BrownFrom: Bob Moore <[email protected]>
Version 20090220.
--- include/acpi/acpixf.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acpixf.h +1 -1
@@ -47,7 +47,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20090123 +#define ACPI_CA_VERSION 0x20090220#include "actypes.h" #include "actbl.h"
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 39/98 ACPICA: Add manifest constants for bit register values
In reply to Len BrownFrom: Bob Moore <[email protected]>
Add and deploy constants for the PM status/enable/control registers.
--- drivers/acpi/acpica/evevent.c | 12 +++++++----- drivers/acpi/acpica/evmisc.c | 3 ++- drivers/acpi/acpica/evxfevnt.c | 6 +++--- drivers/acpi/acpica/hwsleep.c | 14 ++++++++++---- include/acpi/actypes.h | 9 +++++++++ 5 files changed, 31 insertions(+), 13 deletions(-)
drivers/acpi/acpica/evevent.c +7 -5
@@ -183,7 +183,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void)* * RETURN: Status * -* DESCRIPTION: Install the fixed event handlers and enable the fixed events. +* DESCRIPTION: Install the fixed event handlers and disable all fixed events. * ******************************************************************************/
@@ -200,12 +200,13 @@ static acpi_status acpi_ev_fixed_event_initialize(void) acpi_gbl_fixed_event_handlers[i].handler =NULL ; acpi_gbl_fixed_event_handlers[i].context =NULL ; -/* Enable the fixed event */ +/* Disable the fixed event */ if (acpi_gbl_fixed_event_info[i].enable_register_id !=0xFF ) { status =acpi_write_bit_register (acpi_gbl_fixed_event_info - [i].enable_register_id,0 ); + [i].enable_register_id, +ACPI_DISABLE_EVENT );if (ACPI_FAILURE (status)) {return (status); }
@@ -289,7 +290,7 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)/* Clear the status bit */ (void )acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. - status_register_id,1 ); + status_register_id,ACPI_CLEAR_STATUS );/* * Make sure we've got a handler. If not, report an error. The event is
@@ -297,7 +298,8 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)*/ if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { (void )acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,0 ); + enable_register_id, +ACPI_DISABLE_EVENT ); ACPI_ERROR((AE_INFO, "No installed handler for fixed event [%08X]",
drivers/acpi/acpica/evmisc.c +2 -1
@@ -535,7 +535,8 @@ acpi_status acpi_ev_release_global_lock(void)if (pending) { status =acpi_write_bit_register - (ACPI_BITREG_GLOBAL_LOCK_RELEASE ,1 ); + (ACPI_BITREG_GLOBAL_LOCK_RELEASE , +ACPI_ENABLE_EVENT ); } ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
drivers/acpi/acpica/evxfevnt.c +3 -3
@@ -173,7 +173,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags)*/ status =acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,1 ); + enable_register_id,ACPI_ENABLE_EVENT );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -355,7 +355,7 @@ acpi_status acpi_disable_event(u32 event, u32 flags)*/ status =acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,0 ); + enable_register_id,ACPI_DISABLE_EVENT );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -408,7 +408,7 @@ acpi_status acpi_clear_event(u32 event)*/ status =acpi_write_bit_register (acpi_gbl_fixed_event_info[event]. - status_register_id,1 ); + status_register_id,ACPI_CLEAR_STATUS );return_ACPI_STATUS (status); }
drivers/acpi/acpica/hwsleep.c +10 -4
@@ -250,7 +250,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)/* Clear wake status */ - status =acpi_write_bit_register (ACPI_BITREG_WAKE_STATUS ,1 ); + status = +acpi_write_bit_register (ACPI_BITREG_WAKE_STATUS ,ACPI_CLEAR_STATUS );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -399,7 +400,10 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)ACPI_FUNCTION_TRACE (acpi_enter_sleep_state_s4bios); - status =acpi_write_bit_register (ACPI_BITREG_WAKE_STATUS ,1 ); +/* Clear the wake status bit (PM1) */ + + status = +acpi_write_bit_register (ACPI_BITREG_WAKE_STATUS ,ACPI_CLEAR_STATUS );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -601,11 +605,13 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) (void )acpi_write_bit_register (acpi_gbl_fixed_event_info - [ACPI_EVENT_POWER_BUTTON ].enable_register_id,1 ); + [ACPI_EVENT_POWER_BUTTON ]. + enable_register_id,ACPI_ENABLE_EVENT ); (void )acpi_write_bit_register (acpi_gbl_fixed_event_info - [ACPI_EVENT_POWER_BUTTON ].status_register_id,1 ); + [ACPI_EVENT_POWER_BUTTON ]. + status_register_id,ACPI_CLEAR_STATUS ); arg.integer.value =ACPI_SST_WORKING ; status =acpi_evaluate_object (NULL ,METHOD_NAME__SST , &arg_list,NULL );
include/acpi/actypes.h +9 -0
@@ -787,6 +787,15 @@ typedef u8 acpi_adr_space_type;#define ACPI_BITREG_MAX 0x13#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 +/* Status register values. A 1 clears a status bit. 0 = no effect */ + +#define ACPI_CLEAR_STATUS 1 + +/* Enable and Control register values */ + +#define ACPI_ENABLE_EVENT 1 +#define ACPI_DISABLE_EVENT 0 +/* * External ACPI object definition */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 40/98 ACPICA: Formatting update - no functional changes
In reply to Len BrownFrom: Bob Moore <[email protected]>
Split long lines, update comments.
--- drivers/acpi/acpica/evgpe.c | 7 ++-- drivers/acpi/acpica/evgpeblk.c | 64 +++++++++++++++++++-------------------- drivers/acpi/acpica/evmisc.c | 11 ++++--- drivers/acpi/acpica/evregion.c | 3 +- drivers/acpi/acpica/evrgnini.c | 22 ++++++------- drivers/acpi/acpica/evxface.c | 3 +- drivers/acpi/acpica/evxfregn.c | 3 +- drivers/acpi/acpica/hwacpi.c | 3 +- drivers/acpi/acpica/hwgpe.c | 21 +++++------- drivers/acpi/acpica/hwsleep.c | 14 ++++----- drivers/acpi/acpica/hwxface.c | 3 +- drivers/acpi/acpica/nsaccess.c | 51 +++++++++++++++----------------- drivers/acpi/acpica/nsalloc.c | 24 +++++--------- drivers/acpi/acpica/nsdump.c | 16 ++++----- drivers/acpi/acpica/nsinit.c | 19 ++++++----- drivers/acpi/acpica/nsload.c | 4 +- drivers/acpi/acpica/nsparse.c | 10 ++---- drivers/acpi/acpica/nspredef.c | 6 ++- drivers/acpi/acpica/nssearch.c | 14 ++++---- drivers/acpi/acpica/nsutils.c | 25 +++++++-------- drivers/acpi/acpica/nswalk.c | 12 ++++---- 21 files changed, 161 insertions(+), 174 deletions(-)
drivers/acpi/acpica/evgpe.c +4 -3
@@ -88,10 +88,10 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) status =acpi_ev_disable_gpe (gpe_event_info); -/* Type was validated above */ +/* Clear the type bits and insert the new Type */ - gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK ;/* Clear type bits */ - gpe_event_info->flags |= type;/* Insert type */ + gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK ; + gpe_event_info->flags |= type;return_ACPI_STATUS (status); }
@@ -122,6 +122,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,if (!gpe_register_info) {return_ACPI_STATUS (AE_NOT_EXIST ); } + register_bit = (u8) (1 << (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
drivers/acpi/acpica/evgpeblk.c +31 -33
132 lines not on this page · raw message
drivers/acpi/acpica/evmisc.c +6 -5
@@ -163,10 +163,10 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,* 2) Global device notify handler * 3) Per-device notify handler */ -if ((acpi_gbl_system_notify.handler - && (notify_value <=ACPI_MAX_SYS_NOTIFY )) - || (acpi_gbl_device_notify.handler - && (notify_value >ACPI_MAX_SYS_NOTIFY )) || handler_obj) { +if ((acpi_gbl_system_notify.handler && + (notify_value <=ACPI_MAX_SYS_NOTIFY )) || + (acpi_gbl_device_notify.handler && + (notify_value >ACPI_MAX_SYS_NOTIFY )) || handler_obj) { notify_info =acpi_ut_create_generic_state ();if (!notify_info) {return (AE_NO_MEMORY );
@@ -174,7 +174,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,if (!handler_obj) {ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Executing system notify handler for Notify (%4.4s, %X) node %p\n" , +"Executing system notify handler for Notify (%4.4s, %X) " +"node %p\n" ,acpi_ut_get_node_name (node), notify_value, node)); }
drivers/acpi/acpica/evregion.c +2 -1
@@ -703,7 +703,8 @@ acpi_ev_install_handler(acpi_handle obj_handle,if (next_handler_obj->address_space.space_id == handler_obj->address_space.space_id) { ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Found handler for region [%s] in device %p(%p) handler %p\n", + "Found handler for region [%s] in device %p(%p) " + "handler %p\n", acpi_ut_get_region_name (handler_obj->address_space. space_id), obj_desc,
drivers/acpi/acpica/evrgnini.c +10 -12
@@ -241,7 +241,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, status =AE_OK ; }else {ACPI_EXCEPTION ((AE_INFO , status, -"Could not install PciConfig handler for Root Bridge %4.4s" , +"Could not install PciConfig handler " +"for Root Bridge %4.4s" ,acpi_ut_get_node_name (pci_root_node))); }
@@ -293,9 +294,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,* Get the PCI device and function numbers from the _ADR object contained * in the parent's scope. */ - status = -acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR , pci_device_node, - &pci_value); + status =acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR , + pci_device_node, &pci_value);/* * The default is zero, and since the allocation above zeroed the data,
@@ -308,18 +308,16 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,/* The PCI segment number comes from the _SEG method */ - status = -acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG , pci_root_node, - &pci_value); + status =acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG , + pci_root_node, &pci_value);if (ACPI_SUCCESS (status)) { pci_id->segment =ACPI_LOWORD (pci_value); }/* The PCI bus number comes from the _BBN method */ - status = -acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN , pci_root_node, - &pci_value); + status =acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN , + pci_root_node, &pci_value);if (ACPI_SUCCESS (status)) { pci_id->bus =ACPI_LOWORD (pci_value); }
@@ -632,8 +630,8 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, acpi_ns_locked);/* -* Tell all users that this region is usable by running the _REG -* method +* Tell all users that this region is usable by +* running the _REG method */ if (acpi_ns_locked) { status =
drivers/acpi/acpica/evxface.c +2 -1
@@ -631,7 +631,8 @@ acpi_install_gpe_handler(acpi_handle gpe_device,/* Setup up dispatch flags to indicate handler (vs. method) */ - gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK |ACPI_GPE_DISPATCH_MASK );/* Clear bits */ + gpe_event_info->flags &= + ~(ACPI_GPE_XRUPT_TYPE_MASK |ACPI_GPE_DISPATCH_MASK ); gpe_event_info->flags |= (u8) (type |ACPI_GPE_DISPATCH_HANDLER );acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
drivers/acpi/acpica/evxfregn.c +2 -1
@@ -193,7 +193,8 @@ acpi_remove_address_space_handler(acpi_handle device,/* Matched space_id, first dereference this in the Regions */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION , -"Removing address handler %p(%p) for region %s on Device %p(%p)\n" , +"Removing address handler %p(%p) for region %s " +"on Device %p(%p)\n" , handler_obj, handler,acpi_ut_get_region_name (space_id), node, obj_desc));
drivers/acpi/acpica/hwacpi.c +2 -1
@@ -86,7 +86,8 @@ acpi_status acpi_hw_set_mode(u32 mode)*/ if (!acpi_gbl_FADT.acpi_enable && !acpi_gbl_FADT.acpi_disable) {ACPI_ERROR ((AE_INFO , -"No ACPI mode transition supported in this system (enable/disable both zero)" )); +"No ACPI mode transition supported in this system " +"(enable/disable both zero)" ));return_ACPI_STATUS (AE_OK ); }
drivers/acpi/acpica/hwgpe.c +9 -12
@@ -89,10 +89,9 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)/* Clear just the bit that corresponds to this GPE */ -ACPI_CLEAR_BIT (enable_mask, - ((u32 )1 << - (gpe_event_info->gpe_number - - gpe_register_info->base_gpe_number))); +ACPI_CLEAR_BIT (enable_mask, ((u32 )1 << + (gpe_event_info->gpe_number - + gpe_register_info->base_gpe_number)));/* Write the updated enable mask */
@@ -156,10 +155,9 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)ACPI_FUNCTION_ENTRY (); - register_bit = (u8) - (1 << - (gpe_event_info->gpe_number - - gpe_event_info->register_info->base_gpe_number)); + register_bit = (u8)(1 << + (gpe_event_info->gpe_number - + gpe_event_info->register_info->base_gpe_number));/* * Write a one to the appropriate bit in the status register to
@@ -206,10 +204,9 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,/* Get the register bitmask for this GPE */ - register_bit = (u8) - (1 << - (gpe_event_info->gpe_number - - gpe_event_info->register_info->base_gpe_number)); + register_bit = (u8)(1 << + (gpe_event_info->gpe_number - + gpe_event_info->register_info->base_gpe_number));/* GPE currently enabled? (enabled for runtime?) */
drivers/acpi/acpica/hwsleep.c +6 -8
@@ -349,8 +349,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)* Wait ten seconds, then try again. This is to get S4/S5 to work on * all machines. * -* We wait so long to allow chipsets that poll this reg very slowly to -* still read the right value. Ideally, this block would go +* We wait so long to allow chipsets that poll this reg very slowly +* to still read the right value. Ideally, this block would go * away entirely. */ acpi_os_stall (10000000 );
@@ -501,12 +501,10 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)/* Insert the SLP_TYP bits */ - pm1a_control |= - (acpi_gbl_sleep_type_a << sleep_type_reg_info-> - bit_position); - pm1b_control |= - (acpi_gbl_sleep_type_b << sleep_type_reg_info-> - bit_position); + pm1a_control |= (acpi_gbl_sleep_type_a << + sleep_type_reg_info->bit_position); + pm1b_control |= (acpi_gbl_sleep_type_b << + sleep_type_reg_info->bit_position);/* Write the control registers and ignore any errors */
drivers/acpi/acpica/hwxface.c +2 -1
@@ -494,7 +494,8 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) ((info->return_object->package.elements[1])->common.type != ACPI_TYPE_INTEGER)) { ACPI_ERROR((AE_INFO, - "Sleep State return package elements are not both Integers (%s, %s)", + "Sleep State return package elements are not both Integers " + "(%s, %s)", acpi_ut_get_object_type_name(info->return_object-> package.elements[0]), acpi_ut_get_object_type_name(info->return_object->
drivers/acpi/acpica/nsaccess.c +24 -27
123 lines not on this page · raw message
drivers/acpi/acpica/nsalloc.c +9 -15
@@ -76,8 +76,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++);#ifdef ACPI_DBG_TRACK_ALLOCATIONS - temp = - acpi_gbl_ns_node_list->total_allocated - + temp = acpi_gbl_ns_node_list->total_allocated - acpi_gbl_ns_node_list->total_freed;if (temp > acpi_gbl_ns_node_list->max_occupied) { acpi_gbl_ns_node_list->max_occupied = temp;
@@ -145,9 +144,8 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++); -/* -* Detach an object if there is one, then delete the node -*/ +/* Detach an object if there is one, then delete the node */ +acpi_ns_detach_object (node); (void )acpi_os_release_object (acpi_gbl_namespace_cache, node); return_VOID;
@@ -183,9 +181,8 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namespACPI_FUNCTION_TRACE (ns_install_node);/* -* Get the owner ID from the Walk state -* The owner ID is used to track table deletion and -* deletion of objects created by methods +* Get the owner ID from the Walk state. The owner ID is used to track +* table deletion and deletion of objects created by methods. */ if (walk_state) { owner_id = walk_state->owner_id;
@@ -260,9 +257,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) return_VOID; } -/* -* Deallocate all children at this level -*/ +/* Deallocate all children at this level */ + do { /* Get the things we need */
@@ -285,9 +281,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)"Object %p, Remaining %X\n" , child_node, acpi_gbl_current_node_count)); -/* -* Detach an object if there is one, then free the child node -*/ +/* Detach an object if there is one, then free the child node */ +acpi_ns_detach_object (child_node);/* Now we can delete the node */
@@ -304,7 +299,6 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)/* Clear the parent's child pointer */ parent_node->child =NULL ; - return_VOID; }
drivers/acpi/acpica/nsdump.c +7 -9
@@ -220,9 +220,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,acpi_os_printf ("%4.4s" ,acpi_ut_get_node_name (this_node)); } -/* -* Now we can print out the pertinent information -*/ +/* Now we can print out the pertinent information */ +acpi_os_printf (" %-12s %p %2.2X " ,acpi_ut_get_type_name (type), this_node, this_node->owner_id);
@@ -545,9 +544,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, goto cleanup; } -/* -* Valid object, get the pointer to next level, if any -*/ +/* Valid object, get the pointer to next level, if any */ +switch (obj_type) {case ACPI_TYPE_BUFFER :case ACPI_TYPE_STRING :
@@ -608,14 +606,14 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,* display_type - 0 or ACPI_DISPLAY_SUMMARY * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX * for an effectively unlimited depth. -* owner_id - Dump only objects owned by this ID. Use +* owner_id - Dump only objects owned by this ID. Use * ACPI_UINT32_MAX to match all owners. * start_handle - Where in namespace to start/end search * * RETURN: None * -* DESCRIPTION: Dump typed objects within the loaded namespace. -* Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. +* DESCRIPTION: Dump typed objects within the loaded namespace. Uses +* acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. * ******************************************************************************/
drivers/acpi/acpica/nsinit.c +10 -9
@@ -103,7 +103,8 @@ acpi_status acpi_ns_initialize_objects(void) } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, - "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", + "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd " + "Buffers %hd/%hd Packages (%hd nodes)\n", info.op_region_init, info.op_region_count, info.field_init, info.field_count, info.buffer_init, info.buffer_count,
@@ -148,7 +149,8 @@ acpi_status acpi_ns_initialize_devices(void) info.num_INI =0 ;ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT , -"Initializing Device/Processor/Thermal objects by executing _INI methods:" )); +"Initializing Device/Processor/Thermal objects " +"by executing _INI methods:" ));/* Tree analysis: find all subtrees that contain _INI methods */
@@ -180,7 +182,8 @@ acpi_status acpi_ns_initialize_devices(void) }ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT , -"\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n" , +"\nExecuted %hd _INI methods requiring %hd _STA executions " +"(examined %hd objects)\n" , info.num_INI, info.num_STA, info.device_count));return_ACPI_STATUS (status);
@@ -263,16 +266,14 @@ acpi_ns_init_one_object(acpi_handle obj_handle,return (AE_OK ); } -/* -* If the object is already initialized, nothing else to do -*/ +/* If the object is already initialized, nothing else to do */ +if (obj_desc->common.flags &AOPOBJ_DATA_VALID ) {return (AE_OK ); } -/* -* Must lock the interpreter before executing AML code -*/ +/* Must lock the interpreter before executing AML code */ +acpi_ex_enter_interpreter ();/*
drivers/acpi/acpica/nsload.c +2 -2
@@ -128,12 +128,12 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)* parse trees. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"**** Begin Table Method Parsing and Object Initialization ****\n" )); +"**** Begin Table Method Parsing and Object Initialization\n" )); status =acpi_ds_initialize_objects (table_index, node);ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"**** Completed Table Method Parsing and Object Initialization ****\n" )); +"**** Completed Table Method Parsing and Object Initialization\n" ));return_ACPI_STATUS (status); }
drivers/acpi/acpica/nsparse.c +4 -6
@@ -176,9 +176,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)* performs another complete parse of the AML. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"**** Start pass 1\n" )); - status = -acpi_ns_one_complete_parse (ACPI_IMODE_LOAD_PASS1 , table_index, - start_node); + status =acpi_ns_one_complete_parse (ACPI_IMODE_LOAD_PASS1 , + table_index, start_node);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -193,9 +192,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)* parse objects are all cached. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"**** Start pass 2\n" )); - status = -acpi_ns_one_complete_parse (ACPI_IMODE_LOAD_PASS2 , table_index, - start_node); + status =acpi_ns_one_complete_parse (ACPI_IMODE_LOAD_PASS2 , + table_index, start_node);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
drivers/acpi/acpica/nspredef.c +4 -2
@@ -302,7 +302,8 @@ acpi_ns_check_parameter_count(char *pathname,if ((user_param_count != required_params_current) && (user_param_count != required_params_old)) {ACPI_WARNING ((AE_INFO , -"%s: Parameter count mismatch - caller passed %d, ACPI requires %d" , +"%s: Parameter count mismatch - " +"caller passed %d, ACPI requires %d" , pathname, user_param_count, required_params_current)); }
@@ -974,7 +975,8 @@ acpi_ns_check_reference(char *pathname, }ACPI_WARNING ((AE_INFO , -"%s: Return type mismatch - unexpected reference object type [%s] %2.2X" , +"%s: Return type mismatch - " +"unexpected reference object type [%s] %2.2X" , pathname,acpi_ut_get_reference_name (return_object), return_object->reference.class));
drivers/acpi/acpica/nssearch.c +7 -7
@@ -167,7 +167,8 @@ acpi_ns_search_one_scope(u32 target_name,/* Searched entire namespace level, not found */ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", + "Name [%4.4s] (%s) not found in search in scope [%4.4s] " + "%p first child %p\n", ACPI_CAST_PTR(char, &target_name), acpi_ut_get_type_name(type), acpi_ut_get_node_name(parent_node), parent_node,
@@ -239,9 +240,8 @@ acpi_ns_search_parent_tree(u32 target_name,acpi_ut_get_node_name (parent_node), ACPI_CAST_PTR(char, &target_name))); -/* -* Search parents until target is found or we have backed up to the root -*/ +/* Search parents until target is found or we have backed up to the root */ +while (parent_node) {/* * Search parent scope. Use TYPE_ANY because we don't care about the
@@ -395,9 +395,9 @@ acpi_ns_search_and_enter(u32 target_name,return_ACPI_STATUS (AE_NO_MEMORY ); }#ifdef ACPI_ASL_COMPILER -/* -* Node is an object defined by an External() statement -*/ + +/* Node is an object defined by an External() statement */ +if (flags &ACPI_NS_EXTERNAL ) { new_node->flags |=ANOBJ_IS_EXTERNAL ; }
drivers/acpi/acpica/nsutils.c +12 -13
@@ -325,9 +325,8 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) next_external_char++; } }else { -/* -* Handle Carat prefixes -*/ +/* Handle Carat prefixes */ +while (*next_external_char =='^' ) { info->num_carats++; next_external_char++;
@@ -552,9 +551,8 @@ acpi_ns_externalize_name(u32 internal_name_length,return_ACPI_STATUS (AE_BAD_PARAMETER ); } -/* -* Check for a prefix (one '\' | one or more '^'). -*/ +/* Check for a prefix (one '\' | one or more '^') */ +switch (internal_name[0 ]) {case '\\' : prefix_length =1 ;
@@ -580,7 +578,7 @@ acpi_ns_externalize_name(u32 internal_name_length, }/* -* Check for object names. Note that there could be 0-255 of these +* Check for object names. Note that there could be 0-255 of these * 4-byte elements. */ if (prefix_length < internal_name_length) {
@@ -637,9 +635,8 @@ acpi_ns_externalize_name(u32 internal_name_length,return_ACPI_STATUS (AE_BAD_PATHNAME ); } -/* -* Build converted_name -*/ +/* Build the converted_name */ + *converted_name =ACPI_ALLOCATE_ZEROED (required_length);if (!(*converted_name)) {return_ACPI_STATUS (AE_NO_MEMORY );
@@ -685,6 +682,9 @@ acpi_ns_externalize_name(u32 internal_name_length,* and keep all pointers within this subsystem - however this introduces * more (and perhaps unnecessary) overhead. * +* The current implemenation is basically a placeholder until such time comes +* that it is needed. +* ******************************************************************************/ struct acpi_namespace_node *acpi_ns_map_handle_to_node (acpi_handle handle)
@@ -692,9 +692,8 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)ACPI_FUNCTION_ENTRY (); -/* -* Simple implementation -*/ +/* Parameter validation */ +if ((!handle) || (handle ==ACPI_ROOT_OBJECT )) {return (acpi_gbl_root_node); }
drivers/acpi/acpica/nswalk.c +6 -6
@@ -135,8 +135,8 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct* starting (and ending) at the node specified by start_handle. * The user_function is called whenever a node that matches * the type parameter is found. If the user function returns -* a non-zero value, the search is terminated immediately and this -* value is returned to the caller. +* a non-zero value, the search is terminated immediately and +* this value is returned to the caller. * * The point of this procedure is to provide a generic namespace * walk routine that can be called from multiple places to
@@ -200,10 +200,10 @@ acpi_ns_walk_namespace(acpi_object_type type,/* * Ignore all temporary namespace nodes (created during control * method execution) unless told otherwise. These temporary nodes -* can cause a race condition because they can be deleted during the -* execution of the user function (if the namespace is unlocked before -* invocation of the user function.) Only the debugger namespace dump -* will examine the temporary nodes. +* can cause a race condition because they can be deleted during +* the execution of the user function (if the namespace is +* unlocked before invocation of the user function.) Only the +* debugger namespace dump will examine the temporary nodes. */ if ((child_node->flags &ANOBJ_TEMPORARY ) && !(flags &ACPI_NS_WALK_TEMP_NODES )) {
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 41/98 ACPICA: FADT: Fix extraneous length mismatch warning
In reply to Len BrownFrom: Bob Moore <[email protected]>
Incorrect register length mismatch between the 32 and 64 bit registers in some cases. Code was was checking the wrong pointer for non-zero, should be looking at the address within the GAS structure.
--- drivers/acpi/acpica/tbfadt.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/acpi/acpica/tbfadt.c +2 -1
@@ -491,7 +491,8 @@ static void acpi_tb_validate_fadt(void)* For each extended field, check for length mismatch between the * legacy length field and the corresponding 64-bit X length field. */ -if (address64 && (address64->bit_width !=ACPI_MUL_8 (length))) { +if (address64->address && + (address64->bit_width !=ACPI_MUL_8 (length))) { ACPI_WARNING((AE_INFO, "32/64X length mismatch in %s: %d/%d", name, ACPI_MUL_8(length),
Signature · 1 line
1.6.0.6
Re: [PATCH 41/98] ACPICA: FADT: Fix extraneous length mismatch warning
Quoted 7 lines · On Saturday 28 March 2009 05:31:16 Len Brown wrote:
From: Bob Moore <[email protected]>
Incorrect register length mismatch between the 32 and 64 bit registers in some cases. Code was was checking the wrong pointer for non-zero, should be looking at the address within the GAS structure.
Review
Quoted 8 lines
Signed-off-by Bob Moore <[email protected]>Signed-off-by Lin Ming <[email protected]>Signed-off-by Len Brown <[email protected]>--- drivers/acpi/acpica/tbfadt.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/drivers/acpi/acpica/tbfadt.c
drivers/acpi/acpica/tbfadt.c static void acpi_tb_validate_fadt(void) · line 492
Quoted 6 lines
index af8fbe1..ff89cfe 100644
drivers/acpi/acpica/tbfadt.c +0
-0@@ -491,7 +491,8 @@ static void acpi_tb_validate_fadt(void)* For each extended field, check for length mismatch between the * legacy length field and the corresponding 64-bit X length
field.
drivers/acpi/acpica/tbfadt.c static void acpi_tb_validate_fadt(void) · line 498
Quoted 7 lines
drivers/acpi/acpica/tbfadt.c +2
-1*/ -if (address64 && (address64->bit_width !=ACPI_MUL_8 (length))) { +if (address64->address && + (address64->bit_width !=ACPI_MUL_8 (length))) { ACPI_WARNING((AE_INFO, "32/64X length mismatch in %s: %d/%d", name, ACPI_MUL_8(length),
This is a firmware bug for sure and should be marked as such. ACPI_WARNING((AE_INFO, FW_BUG "32/64X
Can acpica take over and implement these from include/kernel.h if compiled standalone:
#define FW_BUG "[Firmware Bug]: " #define FW_WARN "[Firmware Warn]: " #define FW_INFO "[Firmware Info]: "
Thomas
Len Brown
reviewerPATCH 42/98 ACPICA: Fix AcpiWalkNamespace race condition with table unload
In reply to Len BrownFrom: Bob Moore <[email protected]>
Added a reader/writer locking mechanism to allow multiple concurrent namespace walks (readers), but a dynamic table unload will have exclusive access to the namespace. This fixes a problem where a table unload could delete the portion of the namespace that is currently being examined by a walk. Adds a new file, utlock.c that implements the reader/writer lock mechanism. ACPICA BZ 749.
http://www.acpica.org/bugzilla/show_bug.cgi?id=749
--- drivers/acpi/acpica/Makefile | 2 +- drivers/acpi/acpica/acglobal.h | 4 + drivers/acpi/acpica/aclocal.h | 8 ++ drivers/acpi/acpica/actables.h | 2 +- drivers/acpi/acpica/acutils.h | 15 ++++ drivers/acpi/acpica/dsinit.c | 16 +++- drivers/acpi/acpica/exconfig.c | 13 ++-- drivers/acpi/acpica/nsxfeval.c | 33 ++++++-- drivers/acpi/acpica/tbinstal.c | 45 +++++++++-- drivers/acpi/acpica/utlock.c | 175 ++++++++++++++++++++++++++++++++++++++++ drivers/acpi/acpica/utmutex.c | 23 ++++-- 11 files changed, 303 insertions(+), 33 deletions(-) create mode 100644 drivers/acpi/acpica/utlock.c
drivers/acpi/acpica/Makefile +1 -1
@@ -41,4 +41,4 @@ obj-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o obj-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ - utstate.o utmutex.o utobject.o utresrc.o + utstate.o utmutex.o utobject.o utresrc.o utlock.o
drivers/acpi/acpica/acglobal.h +4 -0
@@ -165,6 +165,10 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width; ACPI_EXTERN u8 acpi_gbl_integer_byte_width; ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; +/* Reader/Writer lock is used for namespace walk and dynamic table unload */ + +ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; +/***************************************************************************** * * Mutual exlusion within ACPICA subsystem
drivers/acpi/acpica/aclocal.h +8 -0
@@ -108,6 +108,14 @@ static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {#endif #endif +/* Lock structure for reader/writer interfaces */ + +struct acpi_rw_lock { +acpi_mutex writer_mutex; +acpi_mutex reader_mutex; +u32 num_readers; +}; +/* * Predefined handles for spinlocks used within the subsystem. * These spinlocks are created by acpi_ut_mutex_initialize
drivers/acpi/acpica/actables.h +1 -1
@@ -79,7 +79,7 @@ void acpi_tb_delete_table(struct acpi_table_desc *table_desc);void acpi_tb_terminate (void ); -void acpi_tb_delete_namespace_by_owner (u32 table_index); +acpi_status acpi_tb_delete_namespace_by_owner (u32 table_index);acpi_status acpi_tb_allocate_owner_id (u32 table_index);
drivers/acpi/acpica/acutils.h +15 -0
@@ -346,6 +346,21 @@ acpi_status acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest);/* +* utlock - reader/writer locks +*/ +acpi_status acpi_ut_create_rw_lock (struct acpi_rw_lock *lock); + +void acpi_ut_delete_rw_lock (struct acpi_rw_lock *lock); + +acpi_status acpi_ut_acquire_read_lock (struct acpi_rw_lock *lock); + +acpi_status acpi_ut_release_read_lock (struct acpi_rw_lock *lock); + +acpi_status acpi_ut_acquire_write_lock (struct acpi_rw_lock *lock); + +void acpi_ut_release_write_lock (struct acpi_rw_lock *lock); + +/* * utobject - internal object create/delete/cache routines */ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
drivers/acpi/acpica/dsinit.c +14 -2
@@ -180,11 +180,23 @@ acpi_ds_initialize_objects(u32 table_index,/* Walk entire namespace from the supplied root */ - status =acpi_walk_namespace (ACPI_TYPE_ANY , start_node,ACPI_UINT32_MAX , - acpi_ds_init_one_object, &info,NULL ); + status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE ); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +/* +* We don't use acpi_walk_namespace since we do not want to acquire +* the namespace reader lock. +*/ + status = +acpi_ns_walk_namespace (ACPI_TYPE_ANY , start_node,ACPI_UINT32_MAX , +ACPI_NS_WALK_UNLOCK , acpi_ds_init_one_object, + &info,NULL );if (ACPI_FAILURE (status)) {ACPI_EXCEPTION ((AE_INFO , status,"During WalkNamespace" )); } + (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE ); status =acpi_get_table_by_index (table_index, &table);if (ACPI_FAILURE (status)) {
drivers/acpi/acpica/exconfig.c +7 -6
@@ -520,13 +520,14 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) } } -/* -* Delete the entire namespace under this table Node -* (Offset contains the table_id) -*/ -acpi_tb_delete_namespace_by_owner (table_index); - (void )acpi_tb_release_owner_id (table_index); +/* Delete the portion of the namespace owned by this table */ + + status =acpi_tb_delete_namespace_by_owner (table_index); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + (void )acpi_tb_release_owner_id (table_index);acpi_tb_set_table_loaded_flag (table_index, FALSE);/* Table unloaded, remove a reference to the ddb_handle object */
drivers/acpi/acpica/nsxfeval.c +26 -7
@@ -475,21 +475,40 @@ acpi_walk_namespace(acpi_object_type type, }/* -* Lock the namespace around the walk. -* The namespace will be unlocked/locked around each call -* to the user function - since this function -* must be allowed to make Acpi calls itself. +* Need to acquire the namespace reader lock to prevent interference +* with any concurrent table unloads (which causes the deletion of +* namespace objects). We cannot allow the deletion of a namespace node +* while the user function is using it. The exception to this are the +* nodes created and deleted during control method execution -- these +* nodes are marked as temporary nodes and are ignored by the namespace +* walk. Thus, control methods can be executed while holding the +* namespace deletion lock (and the user function can execute control +* methods.) +*/ + status =acpi_ut_acquire_read_lock (&acpi_gbl_namespace_rw_lock); +if (ACPI_FAILURE (status)) { +return status; + } + +/* +* Lock the namespace around the walk. The namespace will be +* unlocked/locked around each call to the user function - since the user +* function must be allowed to make ACPICA calls itself (for example, it +* will typically execute control methods during device enumeration.) */ status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE );if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto unlock_and_exit; } status =acpi_ns_walk_namespace (type, start_object, max_depth, -ACPI_NS_WALK_UNLOCK , - user_function, context, return_value); +ACPI_NS_WALK_UNLOCK , user_function, + context, return_value); (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE ); + + unlock_and_exit: + (void )acpi_ut_release_read_lock (&acpi_gbl_namespace_rw_lock);return_ACPI_STATUS (status); }
drivers/acpi/acpica/tbinstal.c +37 -8
64 lines not on this page · raw message
drivers/acpi/acpica/utlock.c new file +175 -0
175 lines not on this page · raw message
drivers/acpi/acpica/utmutex.c +15 -8
@@ -60,7 +60,8 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id);* * RETURN: Status * -* DESCRIPTION: Create the system mutex objects. +* DESCRIPTION: Create the system mutex objects. This includes mutexes, +* spin locks, and reader/writer locks. * ******************************************************************************/
@@ -71,9 +72,8 @@ acpi_status acpi_ut_mutex_initialize(void)ACPI_FUNCTION_TRACE (ut_mutex_initialize); -/* -* Create each of the predefined mutex objects -*/ +/* Create each of the predefined mutex objects */ +for (i =0 ; i <ACPI_NUM_MUTEX ; i++) { status =acpi_ut_create_mutex (i);if (ACPI_FAILURE (status)) {
@@ -86,6 +86,9 @@ acpi_status acpi_ut_mutex_initialize(void)spin_lock_init (acpi_gbl_gpe_lock);spin_lock_init (acpi_gbl_hardware_lock); +/* Create the reader/writer lock for namespace access */ + + status =acpi_ut_create_rw_lock (&acpi_gbl_namespace_rw_lock);return_ACPI_STATUS (status); }
@@ -97,7 +100,8 @@ acpi_status acpi_ut_mutex_initialize(void)* * RETURN: None. * -* DESCRIPTION: Delete all of the system mutex objects. +* DESCRIPTION: Delete all of the system mutex objects. This includes mutexes, +* spin locks, and reader/writer locks. * ******************************************************************************/
@@ -107,9 +111,8 @@ void acpi_ut_mutex_terminate(void)ACPI_FUNCTION_TRACE (ut_mutex_terminate); -/* -* Delete each predefined mutex object -*/ +/* Delete each predefined mutex object */ +for (i =0 ; i <ACPI_NUM_MUTEX ; i++) { (void )acpi_ut_delete_mutex (i); }
@@ -118,6 +121,10 @@ void acpi_ut_mutex_terminate(void)acpi_os_delete_lock (acpi_gbl_gpe_lock);acpi_os_delete_lock (acpi_gbl_hardware_lock); + +/* Delete the reader/writer lock */ + +acpi_ut_delete_rw_lock (&acpi_gbl_namespace_rw_lock); return_VOID; }
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 43/98 ACPICA: Change handling of PM1 Status register ignored bit
In reply to Len BrownFrom: Bob Moore <[email protected]>
Ignored bits must be preserved according to the ACPI spec. Usually this means a read/modify/write when writing to the register. However, for status registers, writing a one means clear the event. Writing a zero means preserve the event (do not clear.) This behavior is clarified in the ACPI 4.0 spec, and the ACPICA code now simply always writes a zero to the ignored bit.
--- drivers/acpi/acpica/hwregs.c | 27 +++++++++++---------------- 1 files changed, 11 insertions(+), 16 deletions(-)
drivers/acpi/acpica/hwregs.c +11 -16
@@ -273,22 +273,17 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)switch (register_id) {case ACPI_REGISTER_PM1_STATUS :/* PM1 A/B: 16-bit access each */ - -/* Perform a read first to preserve certain bits (per ACPI spec) */ - - status =acpi_hw_read_multiple (&read_value, - &acpi_gbl_xpm1a_status, - &acpi_gbl_xpm1b_status); -if (ACPI_FAILURE (status)) { - goto exit; - } - -/* Insert the bits to be preserved */ - -ACPI_INSERT_BITS (value,ACPI_PM1_STATUS_PRESERVED_BITS , - read_value); - -/* Now we can write the data */ +/* +* Handle the "ignored" bit in PM1 Status. According to the ACPI +* specification, ignored bits are to be preserved when writing. +* Normally, this would mean a read/modify/write sequence. However, +* preserving a bit in the status register is different. Writing a +* one clears the status, and writing a zero preserves the status. +* Therefore, we must always write zero to the ignored bit. +* +* This behavior is clarified in the ACPI 4.0 specification. +*/ + value &= ~ACPI_PM1_STATUS_PRESERVED_BITS ; status = acpi_hw_write_multiple(value, &acpi_gbl_xpm1a_status,
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 44/98 ACPICA: Preserve all PM control reserved and ignored bits
In reply to Len BrownFrom: Bob Moore <[email protected]>
As per the ACPI specification, preserve (read/modify/write) all bits that are defined as either reserved or ignored (PM control control registers only.)
--- drivers/acpi/acpica/aclocal.h | 10 +++++++++- drivers/acpi/acpica/hwregs.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletions(-)
drivers/acpi/acpica/aclocal.h +9 -1
@@ -780,7 +780,15 @@ struct acpi_bit_register_info {* must be preserved. */ #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800/* Bit 11 */ -#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0200/* Bit 9 (whatever) */ + +/* For control registers, both ignored and reserved bits must be preserved */ + +#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0201/* Bits 9, 0(SCI_EN) */ +#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8/* Bits 14-15, 3-8 */ +#define ACPI_PM1_CONTROL_PRESERVED_BITS \ + (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) + +#define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE/* All except bit 0 */ /* * Register IDs
drivers/acpi/acpica/hwregs.c +15 -0
@@ -328,6 +328,21 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)case ACPI_REGISTER_PM2_CONTROL :/* 8-bit access */ +/* +* For control registers, all reserved bits must be preserved, +* as per the ACPI spec. +*/ + status = +acpi_read (&read_value, &acpi_gbl_FADT.xpm2_control_block); +if (ACPI_FAILURE (status)) { + goto exit; + } + +/* Insert the bits to be preserved */ + +ACPI_INSERT_BITS (value,ACPI_PM2_CONTROL_PRESERVED_BITS , + read_value); + status =acpi_write (value, &acpi_gbl_FADT.xpm2_control_block);break ;
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 45/98 ACPICA: New: I/O port protection
In reply to Len BrownFrom: Bob Moore <[email protected]>
Protect certain I/O ports from reads/writes. Provides MS compatibility. New module, hwvalid.c
--- drivers/acpi/acpica/Makefile | 2 +- drivers/acpi/acpica/acglobal.h | 1 + drivers/acpi/acpica/achware.h | 7 + drivers/acpi/acpica/aclocal.h | 24 ++++ drivers/acpi/acpica/exregion.c | 4 +- drivers/acpi/acpica/hwacpi.c | 4 +- drivers/acpi/acpica/hwregs.c | 4 +- drivers/acpi/acpica/hwsleep.c | 2 +- drivers/acpi/acpica/hwvalid.c | 240 ++++++++++++++++++++++++++++++++++++++++ drivers/acpi/acpica/hwxface.c | 4 +- drivers/acpi/acpica/uteval.c | 55 ++++++--- drivers/acpi/acpica/utglobal.c | 1 + 12 files changed, 319 insertions(+), 29 deletions(-) create mode 100644 drivers/acpi/acpica/hwvalid.c
drivers/acpi/acpica/Makefile +1 -1
@@ -18,7 +18,7 @@ obj-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o -obj-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o +obj-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o obj-$(ACPI_FUTURE_USAGE) += hwtimer.o
drivers/acpi/acpica/acglobal.h +1 -0
@@ -252,6 +252,7 @@ ACPI_EXTERN u8 acpi_gbl_step_to_next_call; ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; ACPI_EXTERN u8 acpi_gbl_events_initialized; ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; +ACPI_EXTERN u8 acpi_gbl_osi_data;#ifndef DEFINE_ACPI_GLOBALS
drivers/acpi/acpica/achware.h +7 -0
@@ -73,6 +73,13 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value);acpi_status acpi_hw_clear_acpi_status (void );/* +* hwvalid - Port I/O with validation +*/ +acpi_status acpi_hw_read_port (acpi_io_address address,u32 *value,u32 width); + +acpi_status acpi_hw_write_port (acpi_io_address address,u32 value,u32 width); + +/* * hwgpe - GPE support */ acpi_status acpi_hw_low_disable_gpe (struct acpi_gpe_event_info *gpe_event_info);
drivers/acpi/acpica/aclocal.h +24 -0
@@ -863,6 +863,30 @@ struct acpi_bit_register_info {#define ACPI_BITPOSITION_ARB_DISABLE 0x00 +/* Structs and definitions for _OSI support and I/O port validation */ + +#define ACPI_OSI_WIN_2000 0x01 +#define ACPI_OSI_WIN_XP 0x02 +#define ACPI_OSI_WIN_XP_SP1 0x03 +#define ACPI_OSI_WINSRV_2003 0x04 +#define ACPI_OSI_WIN_XP_SP2 0x05 +#define ACPI_OSI_WINSRV_2003_SP1 0x06 +#define ACPI_OSI_WIN_VISTA 0x07 + +#define ACPI_ALWAYS_ILLEGAL 0x00 + +struct acpi_interface_info { +char *name; +u8 value; +}; + +struct acpi_port_info { +char *name; +u16 start; +u16 end; +u8 osi_dependency; +}; +/***************************************************************************** * * Resource descriptors
drivers/acpi/acpica/exregion.c +2 -2
@@ -294,14 +294,14 @@ acpi_ex_system_io_space_handler(u32 function,switch (function) {case ACPI_READ : - status =acpi_os_read_port ((acpi_io_address ) address, + status =acpi_hw_read_port ((acpi_io_address ) address, &value32, bit_width); *value = value32;break ;case ACPI_WRITE : - status =acpi_os_write_port ((acpi_io_address ) address, + status =acpi_hw_write_port ((acpi_io_address ) address, (u32) * value, bit_width);break ;
drivers/acpi/acpica/hwacpi.c +2 -2
@@ -96,7 +96,7 @@ acpi_status acpi_hw_set_mode(u32 mode)/* BIOS should have disabled ALL fixed and GP events */ - status =acpi_os_write_port (acpi_gbl_FADT.smi_command, + status =acpi_hw_write_port (acpi_gbl_FADT.smi_command, (u32 ) acpi_gbl_FADT.acpi_enable,8 );ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Attempting to enable ACPI mode\n" ));
@@ -108,7 +108,7 @@ acpi_status acpi_hw_set_mode(u32 mode)* BIOS should clear all fixed status bits and restore fixed event * enable bits to default */ - status =acpi_os_write_port (acpi_gbl_FADT.smi_command, + status =acpi_hw_write_port (acpi_gbl_FADT.smi_command, (u32 ) acpi_gbl_FADT.acpi_disable,8 ); ACPI_DEBUG_PRINT((ACPI_DB_INFO,
drivers/acpi/acpica/hwregs.c +2 -2
@@ -222,7 +222,7 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)case ACPI_REGISTER_SMI_COMMAND_BLOCK :/* 8-bit access */ status = -acpi_os_read_port (acpi_gbl_FADT.smi_command, &value,8 ); +acpi_hw_read_port (acpi_gbl_FADT.smi_command, &value,8 );break ;default :
@@ -356,7 +356,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)/* SMI_CMD is currently always in IO space */ status = -acpi_os_write_port (acpi_gbl_FADT.smi_command, value,8 ); +acpi_hw_write_port (acpi_gbl_FADT.smi_command, value,8 );break ;default :
drivers/acpi/acpica/hwsleep.c +1 -1
@@ -430,7 +430,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)ACPI_FLUSH_CPU_CACHE (); - status =acpi_os_write_port (acpi_gbl_FADT.smi_command, + status =acpi_hw_write_port (acpi_gbl_FADT.smi_command, (u32 ) acpi_gbl_FADT.S4bios_request,8 ); do {
drivers/acpi/acpica/hwvalid.c new file +240 -0
240 lines not on this page · raw message
drivers/acpi/acpica/hwxface.c +2 -2
@@ -146,7 +146,7 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)case ACPI_ADR_SPACE_SYSTEM_IO : status = -acpi_os_read_port ((acpi_io_address ) address, value, width); +acpi_hw_read_port ((acpi_io_address ) address, value, width);break ;default :
@@ -220,7 +220,7 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)case ACPI_ADR_SPACE_SYSTEM_IO : - status =acpi_os_write_port ((acpi_io_address ) address, value, + status =acpi_hw_write_port ((acpi_io_address ) address, value, width);break ;
drivers/acpi/acpica/uteval.c +36 -19
79 lines not on this page · raw message
drivers/acpi/acpica/utglobal.c +1 -0
@@ -789,6 +789,7 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_trace_dbg_layer =0 ; acpi_gbl_debugger_configuration =DEBUGGER_THREADING ; acpi_gbl_db_output_flags =ACPI_DB_CONSOLE_OUTPUT ; + acpi_gbl_osi_data =0 ;/* Hardware oriented */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 46/98 ACPICA: Remove obsolete acpi_os_validate_address interface
In reply to Len BrownFrom: Bob Moore <[email protected]>
This interface is no longer necessary. Requests should be validated on a per-field basis, not on the entire operation region.
--- drivers/acpi/acpica/acobject.h | 1 - drivers/acpi/acpica/dsopcode.c | 24 ------------------------ drivers/acpi/acpica/exfldio.c | 6 ------ include/acpi/acpiosxf.h | 4 ---- 4 files changed, 0 insertions(+), 35 deletions(-)
drivers/acpi/acpica/acobject.h +0 -1
@@ -97,7 +97,6 @@#define AOPOBJ_OBJECT_INITIALIZED 0x08#define AOPOBJ_SETUP_COMPLETE 0x10#define AOPOBJ_SINGLE_DATUM 0x20 -#define AOPOBJ_INVALID 0x40/* Used if host OS won't allow an op_region address */ /****************************************************************************** *
drivers/acpi/acpica/dsopcode.c +0 -24
@@ -397,30 +397,6 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) status =acpi_ds_execute_arguments (node,acpi_ns_get_parent_node (node), extra_desc->extra.aml_length, extra_desc->extra.aml_start); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } - -/* Validate the region address/length via the host OS */ - - status =acpi_os_validate_address (obj_desc->region.space_id, - obj_desc->region.address, - (acpi_size ) obj_desc->region.length, -acpi_ut_get_node_name (node)); - -if (ACPI_FAILURE (status)) { -/* -* Invalid address/length. We will emit an error message and mark -* the region as invalid, so that it will cause an additional error if -* it is ever used. Then return AE_OK. -*/ -ACPI_EXCEPTION ((AE_INFO , status, -"During address validation of OpRegion [%4.4s]" , - node->name.ascii)); - obj_desc->common.flags |=AOPOBJ_INVALID ; - status =AE_OK ; - } -return_ACPI_STATUS (status); }
drivers/acpi/acpica/exfldio.c +0 -6
@@ -113,12 +113,6 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, } } -/* Exit if Address/Length have been disallowed by the host OS */ - -if (rgn_desc->common.flags &AOPOBJ_INVALID ) { -return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS ); - } -/* * Exit now for SMBus address space, it has a non-linear address space * and the request cannot be directly validated
include/acpi/acpiosxf.h +0 -4
@@ -241,10 +241,6 @@ acpi_os_derive_pci_id(acpi_handle rhandle,acpi_status acpi_os_validate_interface (char *interface);acpi_status acpi_osi_invalidate (char * interface); -acpi_status -acpi_os_validate_address (u8 space_id,acpi_physical_address address, -acpi_size length,char *name); -u64 acpi_os_get_timer (void );acpi_status acpi_os_signal (u32 function,void *info);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 47/98 ACPICA: Clear PM register write-only bits on reading
In reply to Len BrownFrom: Lin Ming <[email protected]>
Affects PM1 Control register only. When reading the register, zero the write-only bits as per the ACPI spec. ACPICA BZ 443. Lin Ming.
http://www.acpica.org/bugzilla/show_bug.cgi?id=443
--- drivers/acpi/acpica/aclocal.h | 4 ++++ drivers/acpi/acpica/hwregs.c | 7 +++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
drivers/acpi/acpica/aclocal.h +4 -0
@@ -781,6 +781,10 @@ struct acpi_bit_register_info {*/ #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800/* Bit 11 */ +/* Write-only bits must be zeroed by software */ + +#define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004/* Bits 13, 2 */ +/* For control registers, both ignored and reserved bits must be preserved */ #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0201/* Bits 9, 0(SCI_EN) */
drivers/acpi/acpica/hwregs.c +7 -0
@@ -207,6 +207,13 @@ acpi_hw_register_read(u32 register_id, u32 * return_value) xpm1a_control_block, &acpi_gbl_FADT. xpm1b_control_block); + +/* +* Zero the write-only bits. From the ACPI specification, "Hardware +* Write-Only Bits": "Upon reads to registers with write-only bits, +* software masks out all write-only bits." +*/ + value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS ;break ;case ACPI_REGISTER_PM2_CONTROL :/* 8-bit access */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 48/98 ACPICA: Remove unused code, no functional change
In reply to Len BrownFrom: Bob Moore <[email protected]>
Removed unused code for dump of args and locals. General cleanup and splitting of long lines.
--- drivers/acpi/acpica/exdump.c | 44 ++++++++--------------------------------- 1 files changed, 9 insertions(+), 35 deletions(-)
drivers/acpi/acpica/exdump.c +9 -35
@@ -350,6 +350,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,break ;case ACPI_EXD_TYPE : +acpi_ex_out_string ("Type" ,acpi_ut_get_object_type_name (obj_desc));
@@ -422,6 +423,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,break ;default : +acpi_os_printf ("**** Invalid table opcode [%X] ****\n" , info->opcode);return ;
@@ -527,44 +529,16 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) type));break ; -case ACPI_REFCLASS_ARG : - -acpi_os_printf ("%X" , obj_desc->reference.value); - -if (obj_desc->common.type ==ACPI_TYPE_INTEGER ) { - -/* Value is an Integer */ - -acpi_os_printf (" value is [%8.8X%8.8x]" , -ACPI_FORMAT_UINT64 (obj_desc-> - integer. - value)); - } +case ACPI_REFCLASS_NAME : -acpi_os_printf ("\n" ); +acpi_os_printf ("- [%4.4s]\n" , + obj_desc->reference.node->name.ascii);break ; +case ACPI_REFCLASS_ARG :case ACPI_REFCLASS_LOCAL : -acpi_os_printf ("%X" , obj_desc->reference.value); - -if (obj_desc->common.type ==ACPI_TYPE_INTEGER ) { - -/* Value is an Integer */ - -acpi_os_printf (" value is [%8.8X%8.8x]" , -ACPI_FORMAT_UINT64 (obj_desc-> - integer. - value)); - } - -acpi_os_printf ("\n" ); -break ; - -case ACPI_REFCLASS_NAME : - -acpi_os_printf ("- [%4.4s]\n" , - obj_desc->reference.node->name.ascii); +acpi_os_printf ("%X\n" , obj_desc->reference.value);break ;default :/* Unknown reference class */
@@ -661,8 +635,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)case ACPI_TYPE_LOCAL_REGION_FIELD : acpi_os_printf - ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", - obj_desc->field.bit_length, + ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at " + "byte=%X bit=%X of below:\n", obj_desc->field.bit_length, obj_desc->field.access_byte_width, obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 49/98 ACPICA: Condense some protected ports
In reply to Len BrownFrom: Bob Moore <[email protected]>
One entry in the protected port table eliminated. Added extra comments to describe each table entry.
--- drivers/acpi/acpica/hwvalid.c | 34 ++++++++++++++++++++++++++-------- 1 files changed, 26 insertions(+), 8 deletions(-)
drivers/acpi/acpica/hwvalid.c +26 -8
@@ -63,24 +63,42 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width);* * This provides ACPICA with the desired port protections and * Microsoft compatibility. +* +* Description of port entries: +* DMA: DMA controller +* PIC0: Programmable Interrupt Controller (8259_a) +* PIT1: System Timer 1 +* PIT2: System Timer 2 failsafe +* RTC: Real-time clock +* CMOS: Extended CMOS +* DMA1: DMA 1 page registers +* DMA1L: DMA 1 Ch 0 low page +* DMA2: DMA 2 page registers +* DMA2L: DMA 2 low page refresh +* ARBC: Arbitration control +* SETUP: Reserved system board setup +* POS: POS channel select +* PIC1: Cascaded PIC +* IDMA: ISA DMA +* ELCR: PIC edge/level registers +* PCI: PCI configuration space */ static const struct acpi_port_info acpi_protected_ports[] = { - {"DMA1" ,0x0000 ,0x000F ,ACPI_OSI_WIN_XP }, + {"DMA" ,0x0000 ,0x000F ,ACPI_OSI_WIN_XP }, {"PIC0" ,0x0020 ,0x0021 ,ACPI_ALWAYS_ILLEGAL }, {"PIT1" ,0x0040 ,0x0043 ,ACPI_OSI_WIN_XP }, {"PIT2" ,0x0048 ,0x004B ,ACPI_OSI_WIN_XP }, {"RTC" ,0x0070 ,0x0071 ,ACPI_OSI_WIN_XP }, {"CMOS" ,0x0074 ,0x0076 ,ACPI_OSI_WIN_XP }, {"DMA1" ,0x0081 ,0x0083 ,ACPI_OSI_WIN_XP }, - {"DMA1" ,0x0087 ,0x0087 ,ACPI_OSI_WIN_XP }, - {"DMA2" ,0x0089 ,0x0089 ,ACPI_OSI_WIN_XP }, - {"DMA2" ,0x008A ,0x008B ,ACPI_OSI_WIN_XP }, - {"DMA2" ,0x008F ,0x008F ,ACPI_OSI_WIN_XP }, - {"Arb" ,0x0090 ,0x0091 ,ACPI_OSI_WIN_XP }, - {"Setup" ,0x0093 ,0x0094 ,ACPI_OSI_WIN_XP }, + {"DMA1L" ,0x0087 ,0x0087 ,ACPI_OSI_WIN_XP }, + {"DMA2" ,0x0089 ,0x008B ,ACPI_OSI_WIN_XP }, + {"DMA2L" ,0x008F ,0x008F ,ACPI_OSI_WIN_XP }, + {"ARBC" ,0x0090 ,0x0091 ,ACPI_OSI_WIN_XP }, + {"SETUP" ,0x0093 ,0x0094 ,ACPI_OSI_WIN_XP }, {"POS" ,0x0096 ,0x0097 ,ACPI_OSI_WIN_XP }, {"PIC1" ,0x00A0 ,0x00A1 ,ACPI_ALWAYS_ILLEGAL }, - {"DMA" ,0x00C0 ,0x00DF ,ACPI_OSI_WIN_XP }, + {"IDMA" ,0x00C0 ,0x00DF ,ACPI_OSI_WIN_XP }, {"ELCR" ,0x04D0 ,0x04D1 ,ACPI_ALWAYS_ILLEGAL }, {"PCI" ,0x0CF8 ,0x0D00 ,ACPI_OSI_WIN_XP } };
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 50/98 ACPICA: Fix PCI configuration space port address range
In reply to Len BrownFrom: Bob Moore <[email protected]>
Microsoft website uses 0xCF8-0xD00. Should be 0xCF8-0xCFF (Two 32-bit registers.)
--- drivers/acpi/acpica/hwvalid.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/acpica/hwvalid.c +1 -1
@@ -100,7 +100,7 @@ static const struct acpi_port_info acpi_protected_ports[] = { {"PIC1", 0x00A0, 0x00A1, ACPI_ALWAYS_ILLEGAL}, {"IDMA", 0x00C0, 0x00DF, ACPI_OSI_WIN_XP}, {"ELCR", 0x04D0, 0x04D1, ACPI_ALWAYS_ILLEGAL}, - {"PCI", 0x0CF8, 0x0D00, ACPI_OSI_WIN_XP} + {"PCI", 0x0CF8, 0x0CFF, ACPI_OSI_WIN_XP} };#define ACPI_PORT_INFO_ENTRIES ACPI_ARRAY_LENGTH (acpi_protected_ports)
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 51/98 ACPICA: FADT: Favor 32-bit register addresses for compatibility
In reply to Len BrownFrom: Bob Moore <[email protected]>
Use the 32-bit register addresses whenever they are non-zero. This means that the 32-bit addresses are favored over the 64-bit (GAS) addresses. The 64-bit addresses are only used if the 32-bit addresses are zero. This change provides compatibility with all versions of Windows. The worst case that this solves is when both the 32-bit and 64-bit addresses are non-zero, but only the 32-bit addresses are actually valid. This appears to happen in some BIOSes because in this case, Windows uses the 32-bit addresses.
--- drivers/acpi/acpica/tbfadt.c | 86 +++++++++++++++++++++++++----------------- 1 files changed, 51 insertions(+), 35 deletions(-)
drivers/acpi/acpica/tbfadt.c +51 -35
@@ -320,29 +320,35 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)* RETURN: None * * DESCRIPTION: Converts all versions of the FADT to a common internal format. -* Expand all 32-bit addresses to 64-bit. +* Expand 32-bit addresses to 64-bit as necessary. * * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), * and must contain a copy of the actual FADT. * -* ACPICA will use the "X" fields of the FADT for all addresses. +* Notes on 64-bit register addresses: * -* "X" fields are optional extensions to the original V1.0 fields. Even if -* they are present in the structure, they can be optionally not used by -* setting them to zero. Therefore, we must selectively expand V1.0 fields -* if the corresponding X field is zero. +* After this FADT conversion, later ACPICA code will only use the 64-bit "X" +* fields of the FADT for all ACPI register addresses. * -* For ACPI 1.0 FADTs, all address fields are expanded to the corresponding -* "X" fields. +* The 64-bit "X" fields are optional extensions to the original 32-bit FADT +* V1.0 fields. Even if they are present in the FADT, they are optional and +* are unused if the BIOS sets them to zero. Therefore, we must copy/expand +* 32-bit V1.0 fields if the corresponding X field is zero. * -* For ACPI 2.0 FADTs, any "X" fields that are NULL are filled in by -* expanding the corresponding ACPI 1.0 field. +* For ACPI 1.0 FADTs, all 32-bit address fields are expanded to the +* corresponding "X" fields in the internal FADT. +* +* For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded +* to the corresponding 64-bit X fields. For compatibility with other ACPI +* implementations, we ignore the 64-bit field if the 32-bit field is valid, +* regardless of whether the host OS is 32-bit or 64-bit. * ******************************************************************************/ static void acpi_tb_convert_fadt (void ) { -struct acpi_generic_address *target64; +struct acpi_generic_address *address64; +u32 address32;u32 i;/* Update the local FADT table header length */
@@ -391,29 +397,51 @@ static void acpi_tb_convert_fadt(void)* Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" * generic address structures as necessary. Later code will always use * the 64-bit address structures. +* +* March 2009: +* We now always use the 32-bit address if it is valid (non-null). This +* is not in accordance with the ACPI specification which states that +* the 64-bit address supersedes the 32-bit version, but we do this for +* compatibility with other ACPI implementations. Most notably, in the +* case where both the 32 and 64 versions are non-null, we use the 32-bit +* version. This is the only address that is guaranteed to have been +* tested by the BIOS manufacturer. */ for (i =0 ; i <ACPI_FADT_INFO_ENTRIES ; i++) { - target64 = - ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, - fadt_info_table[i].address64); + address32 = *ACPI_ADD_PTR (u32, + &acpi_gbl_FADT, + fadt_info_table[i].address32); -/* Expand only if the 64-bit X target is null */ + address64 = ACPI_ADD_PTR(struct acpi_generic_address, + &acpi_gbl_FADT, + fadt_info_table[i].address64); -if (!target64->address) { +/* +* If both 32- and 64-bit addresses are valid (non-zero), +* they must match. +*/ +if (address64->address && address32 && + (address64->address != (u64 ) address32)) { +ACPI_ERROR ((AE_INFO , +"32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 32" , + fadt_info_table[i].name, address32, +ACPI_FORMAT_UINT64 (address64->address))); + } -/* The space_id is always I/O for the 32-bit legacy address fields */ +/* Always use 32-bit address if it is valid (non-null) */ -acpi_tb_init_generic_address (target64, +if (address32) { +/* +* Copy the 32-bit address to the 64-bit GAS structure. The +* Space ID is always I/O for 32-bit legacy address fields +*/ +acpi_tb_init_generic_address (address64,ACPI_ADR_SPACE_SYSTEM_IO , *ACPI_ADD_PTR (u8, &acpi_gbl_FADT, fadt_info_table [i].length), - (u64) *ACPI_ADD_PTR (u32, - &acpi_gbl_FADT, - fadt_info_table - [i]. - address32)); + address32); } } }
@@ -530,18 +558,6 @@ static void acpi_tb_validate_fadt(void) length)); } } - -/* -* If both 32- and 64-bit addresses are valid (non-zero), -* they must match -*/ -if (address64->address && *address32 && - (address64->address != (u64) * address32)) { -ACPI_ERROR ((AE_INFO , -"32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 64X" , - name, *address32, -ACPI_FORMAT_UINT64 (address64->address))); - } } }
Signature · 1 line
1.6.0.6
Re: [PATCH 51/98] ACPICA: FADT: Favor 32-bit register addresses for compatibility
Hi,
Quoted 10 lines · On Saturday 28 March 2009 05:31:26 Len Brown wrote:
From: Bob Moore <[email protected]>
Use the 32-bit register addresses whenever they are non-zero. This means that the 32-bit addresses are favored over the 64-bit (GAS) addresses. The 64-bit addresses are only used if the 32-bit addresses are zero. This change provides compatibility with all versions of Windows. The worst case that this solves is when both the 32-bit and 64-bit addresses are non-zero, but only the 32-bit addresses are actually valid. This appears to happen in some BIOSes because in this case, Windows uses the 32-bit addresses.
this one should finally make C-states on R40e work. This one still applies with a tiny offset, please apply. Not sure whether we can convince Mark for another test, it would be great if you could try out things during 2.6.30 test phase at some time at least.
Thanks,
Thomas
---
From: Thomas Renninger <[email protected]>
Subject: Remove R40e c-state blacklist
Patch-mainline: not yet
References: http://bugzilla.kernel.org/show_bug.cgi?id=8246
Remove R40e c-state blacklist
Previous patch makes this machine to use the right FADT HW addresses and C-states finally work fine.
--- drivers/acpi/processor_idle.c | 51 ------------------------------------------ 1 file changed, 51 deletions(-)
drivers/acpi/processor_idle.c +0 -51
@@ -127,57 +127,6 @@ static int set_max_cstate(const struct d/* Actually this shouldn't be __cpuinitdata, would be better to fix the callers to only run once -AK */ static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET70WW" )}, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET60WW" )}, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET43WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET45WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET47WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET50WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET52WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET55WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET56WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET59WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET60WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET61WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET62WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET64WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET65WW" ) }, (void *)1 }, - { set_max_cstate,"IBM ThinkPad R40e" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"IBM" ), -DMI_MATCH (DMI_BIOS_VERSION ,"1SET68WW" ) }, (void *)1 }, - { set_max_cstate,"Medion 41700" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"Phoenix Technologies LTD" ), -DMI_MATCH (DMI_BIOS_VERSION ,"R01-A1J" )}, (void *)1 }, { set_max_cstate,"Clevo 5600D" , {DMI_MATCH (DMI_BIOS_VENDOR ,"Phoenix Technologies LTD" ),DMI_MATCH (DMI_BIOS_VERSION ,"SHE845M0.86C.0013.D.0302131307" )},
Re: [PATCH 51/98] ACPICA: FADT: Favor 32-bit register addresses for compatibility
Quoted 1 line
Remove R40e c-state blacklist
applied
thanks,
Len Brown, Intel Open Source Technology Center
Len Brown
reviewerPATCH 52/98 ACPICA: FADT: Favor 32-bit FACS and DSDT addresses
In reply to Len BrownFrom: Bob Moore <[email protected]>
If both the 32-bit and 64-bit addresses are non-null, use the 32-bit address. Provides Windows compatibility.
--- drivers/acpi/acpica/tbfadt.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/acpi/acpica/tbfadt.c +6 -2
@@ -483,18 +483,22 @@ static void acpi_tb_validate_fadt(void) (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) {ACPI_WARNING ((AE_INFO ,"32/64X FACS address mismatch in FADT - " -"two FACS tables! %8.8X/%8.8X%8.8X" , +"%8.8X/%8.8X%8.8X, using 32" , acpi_gbl_FADT.facs,ACPI_FORMAT_UINT64 (acpi_gbl_FADT.Xfacs))); + + acpi_gbl_FADT.Xfacs = (u64 ) acpi_gbl_FADT.facs; }if (acpi_gbl_FADT.dsdt && (acpi_gbl_FADT.Xdsdt != (u64 ) acpi_gbl_FADT.dsdt)) {ACPI_WARNING ((AE_INFO ,"32/64X DSDT address mismatch in FADT - " -"two DSDT tables! %8.8X/%8.8X%8.8X" , +"%8.8X/%8.8X%8.8X, using 32" , acpi_gbl_FADT.dsdt,ACPI_FORMAT_UINT64 (acpi_gbl_FADT.Xdsdt))); + + acpi_gbl_FADT.Xdsdt = (u64 ) acpi_gbl_FADT.dsdt; }/* Examine all of the 64-bit extended address fields (X fields) */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 53/98 ACPICA: Fix index value in package warning message
In reply to Len BrownFrom: Bob Moore <[email protected]>
For predefined method validation. Index value in warning message could be off by one.
--- drivers/acpi/acpica/nspredef.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)
drivers/acpi/acpica/nspredef.c +16 -8
@@ -79,7 +79,9 @@ acpi_ns_check_package(char *pathname,static acpi_status acpi_ns_check_package_elements (char *pathname,union acpi_operand_object **elements, -u8 type1,u32 count1,u8 type2,u32 count2); +u8 type1, +u32 count1, +u8 type2,u32 count2,u32 start_index); static acpi_status acpi_ns_check_object_type(char *pathname,
@@ -473,7 +475,7 @@ acpi_ns_check_package(char *pathname, package->ret_info. object_type2, package->ret_info. - count2); + count2, 0);if (ACPI_FAILURE (status)) {return (status); }
@@ -624,7 +626,7 @@ acpi_ns_check_package(char *pathname, object_type2, package-> ret_info. - count2); + count2, 0);if (ACPI_FAILURE (status)) {return (status); }
@@ -673,7 +675,8 @@ acpi_ns_check_package(char *pathname, object_type1, sub_package-> package. - count, 0, 0); + count,0 ,0 , + 0);if (ACPI_FAILURE (status)) {return (status); }
@@ -711,7 +714,8 @@ acpi_ns_check_package(char *pathname, ret_info. object_type1, (expected_count - - 1), 0, 0); + -1 ),0 ,0 , + 1);if (ACPI_FAILURE (status)) {return (status); }
@@ -759,6 +763,7 @@ acpi_ns_check_package(char *pathname,* Count1 - Count for first group * Type2 - Object type for second group * Count2 - Count for second group +* start_index - Start of the first group of elements * * RETURN: Status *
@@ -770,7 +775,9 @@ acpi_ns_check_package(char *pathname,static acpi_status acpi_ns_check_package_elements (char *pathname,union acpi_operand_object **elements, -u8 type1,u32 count1,u8 type2,u32 count2) +u8 type1, +u32 count1, +u8 type2,u32 count2,u32 start_index) {union acpi_operand_object **this_element = elements;acpi_status status;
@@ -783,7 +790,7 @@ acpi_ns_check_package_elements(char *pathname,*/ for (i =0 ; i < count1; i++) { status =acpi_ns_check_object_type (pathname, this_element, - type1, i); + type1, i + start_index);if (ACPI_FAILURE (status)) {return (status); }
@@ -792,7 +799,8 @@ acpi_ns_check_package_elements(char *pathname,for (i =0 ; i < count2; i++) { status =acpi_ns_check_object_type (pathname, this_element, - type2, (i + count1)); + type2, + (i + count1 + start_index));if (ACPI_FAILURE (status)) {return (status); }
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 54/98 ACPICA: Update version to 20090320
In reply to Len BrownFrom: Bob Moore <[email protected]>
Version 20090320.
--- include/acpi/acpixf.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acpixf.h +1 -1
@@ -47,7 +47,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20090220 +#define ACPI_CA_VERSION 0x20090320#include "actypes.h" #include "actbl.h"
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 55/98 sony-laptop: Add support for new Sony platform API
In reply to Len BrownFrom: Matthew Garrett <[email protected]>
Newer Sony Vaios provide a new API for accessing platform functionality. It consists of a set of standardised methods for enabling events and performing queries. These are each identified by a unique handle. This patch adds support for calling functions based on their handle and ports the existing code for these machines over to it.
--- drivers/platform/x86/sony-laptop.c | 146 ++++++++++++++++-------------------- 1 files changed, 65 insertions(+), 81 deletions(-)
drivers/platform/x86/sony-laptop.c +65 -81
@@ -689,6 +689,31 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,return -1 ; } +static int sony_find_snc_handle (int handle) +{ +int i; +int result; + +for (i =0x20 ; i <0x30 ; i++) { +acpi_callsetfunc (sony_nc_acpi_handle,"SN00" , i, &result); +if (result == handle) +return i-0x20 ; + } + +return -1 ; +} + +static int sony_call_snc_handle (int handle,int argument,int *result) +{ +int offset =sony_find_snc_handle (handle); + +if (offset <0 ) +return -1 ; + +return acpi_callsetfunc (sony_nc_acpi_handle,"SN07" , offset | argument, + result); +} +/* * sony_nc_values input/output validate functions */
@@ -809,32 +834,6 @@ struct sony_nc_event {u8 event; }; -static struct sony_nc_event *sony_nc_events; - -/* Vaio C* --maybe also FE*, N* and AR* ?-- special init sequence -* for Fn keys -*/ -static int sony_nc_C_enable (const struct dmi_system_id *id) -{ -int result =0 ; - - printk(KERN_NOTICE DRV_PFX "detected %s\n", id->ident); - - sony_nc_events = id->driver_data; - -if (acpi_callsetfunc (sony_nc_acpi_handle,"SN02" ,0x4 , &result) <0 - ||acpi_callsetfunc (sony_nc_acpi_handle,"SN07" ,0x2 , &result) <0 - ||acpi_callsetfunc (sony_nc_acpi_handle,"SN02" ,0x10 , &result) <0 - ||acpi_callsetfunc (sony_nc_acpi_handle,"SN07" ,0x0 , &result) <0 - ||acpi_callsetfunc (sony_nc_acpi_handle,"SN03" ,0x2 , &result) <0 - ||acpi_callsetfunc (sony_nc_acpi_handle,"SN07" ,0x101 , &result) <0 ) { - printk(KERN_WARNING DRV_PFX "failed to initialize SNC, some " - "functionalities may be missing\n"); -return 1 ; - } -return 0 ; -} -static struct sony_nc_event sony_C_events[] = { {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },
@@ -851,57 +850,17 @@ static struct sony_nc_event sony_C_events[] = { { 0, 0 }, }; -/* SNC-only model map */ -static const struct dmi_system_id sony_nc_ids[] = { - { - .ident ="Sony Vaio FE Series" , - .callback = sony_nc_C_enable, - .driver_data = sony_C_events, - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Sony Corporation" ), -DMI_MATCH (DMI_PRODUCT_NAME ,"VGN-FE" ), - }, - }, - { - .ident ="Sony Vaio FZ Series" , - .callback = sony_nc_C_enable, - .driver_data = sony_C_events, - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Sony Corporation" ), -DMI_MATCH (DMI_PRODUCT_NAME ,"VGN-FZ" ), - }, - }, - { - .ident ="Sony Vaio C Series" , - .callback = sony_nc_C_enable, - .driver_data = sony_C_events, - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Sony Corporation" ), -DMI_MATCH (DMI_PRODUCT_NAME ,"VGN-C" ), - }, - }, - { - .ident ="Sony Vaio N Series" , - .callback = sony_nc_C_enable, - .driver_data = sony_C_events, - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Sony Corporation" ), -DMI_MATCH (DMI_PRODUCT_NAME ,"VGN-N" ), - }, - }, - { } -}; -/* * ACPI callbacks */ static void sony_acpi_notify (acpi_handle handle,u32 event,void *data) { -struct sony_nc_event *evmap; +int i;u32 ev = event;int result; -if (ev ==0x92 ) { +if (ev ==0x92 || ev ==0x90 ) { +int origev = ev;/* read the key pressed from EC.GECR * A call to SN07 with 0x0202 will do it as well respecting * the current protocol on different OSes
@@ -913,20 +872,23 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)* TODO: we may want to do the same for the older GHKE -need * dmi list- so this snippet may become one more callback. */ -if (acpi_callsetfunc (handle,"SN07" ,0x0202 , &result) <0 ) +if (sony_call_snc_handle (0x100 ,0x200 , &result))dprintk ("sony_acpi_notify, unable to decode event 0x%.2x\n" , ev);else ev = result &0xFF ; - } -if (sony_nc_events) -for (evmap = sony_nc_events; evmap->event; evmap++) { -if (evmap->data == ev) { - ev = evmap->event; +for (i =0 ; sony_C_events[i].data; i++) { +if (sony_C_events[i].data == ev) { + ev = sony_C_events[i].event;break ; } } +if (!sony_C_events[i].data) + printk(KERN_INFO DRV_PFX "Unknown event: %x %x\n", + origev, ev); + } +dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev);sony_laptop_report_input_event (ev);acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev);
@@ -953,9 +915,25 @@ static acpi_status sony_walk_callback(acpi_handle handle, u32 level,/* * ACPI device */ +static int sony_nc_function_setup (struct acpi_device *device) +{ +int result; + +/* Enable all events */ +acpi_callsetfunc (sony_nc_acpi_handle,"SN02" ,0xffff , &result); + +/* Setup hotkeys */ +sony_call_snc_handle (0x0100 ,0 , &result); +sony_call_snc_handle (0x0101 ,0 , &result); +sony_call_snc_handle (0x0102 ,0x100 , &result); + +return 0 ; +} +static int sony_nc_resume (struct acpi_device *device) {struct sony_nc_value *item; +acpi_handle handle;for (item = sony_nc_values; item->name; item++) {int ret;
@@ -970,14 +948,17 @@ static int sony_nc_resume(struct acpi_device *device) } } +if (ACPI_SUCCESS (acpi_get_handle (sony_nc_acpi_handle,"SN00" , + &handle))) { +dprintk ("Doing SNC setup\n" ); +sony_nc_function_setup (device); + } +/* set the last requested brightness level */ if (sony_backlight_device && !sony_backlight_update_status (sony_backlight_device)) printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n"); -/* re-initialize models with specific requirements */ -dmi_check_system (sony_nc_ids); -return 0 ; }
@@ -1024,6 +1005,12 @@ static int sony_nc_add(struct acpi_device *device)dprintk ("_INI Method failed\n" ); } +if (ACPI_SUCCESS (acpi_get_handle (sony_nc_acpi_handle,"SN00" , + &handle))) { +dprintk ("Doing SNC setup\n" ); +sony_nc_function_setup (device); + } +/* setup input devices and helper fifo */ result =sony_laptop_setup_input (device);if (result) {
@@ -1063,9 +1050,6 @@ static int sony_nc_add(struct acpi_device *device) } -/* initialize models with specific requirements */ -dmi_check_system (sony_nc_ids); - result =sony_pf_add ();if (result) goto outbacklight;
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 56/98 sony-laptop: Enable EC on newer hardware
In reply to Len BrownFrom: Matthew Garrett <[email protected]>
The latest Vaios can execute certain codepaths in two ways - either using system management mode or using pure ACPI methods. The latter is only used if the OS has called the ECON method. Ensure that this is done where the method is available.
--- drivers/platform/x86/sony-laptop.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/platform/x86/sony-laptop.c +12 -0
@@ -948,6 +948,12 @@ static int sony_nc_resume(struct acpi_device *device) } } +if (ACPI_SUCCESS (acpi_get_handle (sony_nc_acpi_handle,"ECON" , + &handle))) { +if (acpi_callsetfunc (sony_nc_acpi_handle,"ECON" ,1 ,NULL )) +dprintk ("ECON Method failed\n" ); + } +if (ACPI_SUCCESS (acpi_get_handle (sony_nc_acpi_handle,"SN00" , &handle))) {dprintk ("Doing SNC setup\n" );
@@ -1005,6 +1011,12 @@ static int sony_nc_add(struct acpi_device *device)dprintk ("_INI Method failed\n" ); } +if (ACPI_SUCCESS (acpi_get_handle (sony_nc_acpi_handle,"ECON" , + &handle))) { +if (acpi_callsetfunc (sony_nc_acpi_handle,"ECON" ,1 ,NULL )) +dprintk ("ECON Method failed\n" ); + } +if (ACPI_SUCCESS (acpi_get_handle (sony_nc_acpi_handle,"SN00" , &handle))) {dprintk ("Doing SNC setup\n" );
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 57/98 sony-laptop: Add support for extra keyboard events
In reply to Len BrownFrom: Matthew Garrett <[email protected]>
The current sony-laptop code assumes that the keyboard event method is always located at slot 2 in the platform code. Remove this assumption and add support for some additional hotkeys.
--- drivers/platform/x86/sony-laptop.c | 61 +++++++++++++++++++---------------- include/linux/sonypi.h | 1 + 2 files changed, 34 insertions(+), 28 deletions(-)
drivers/platform/x86/sony-laptop.c +32 -27
@@ -211,6 +211,7 @@ static int sony_laptop_input_index[] = {48 ,/* 61 SONYPI_EVENT_WIRELESS_OFF */ 49 ,/* 62 SONYPI_EVENT_ZOOM_IN_PRESSED */ 50 ,/* 63 SONYPI_EVENT_ZOOM_OUT_PRESSED */ + 51, /* 64 SONYPI_EVENT_CD_EJECT_PRESSED */ }; static int sony_laptop_input_keycode_map[] = {
@@ -264,7 +265,8 @@ static int sony_laptop_input_keycode_map[] = {KEY_WLAN ,/* 47 SONYPI_EVENT_WIRELESS_ON */ KEY_WLAN ,/* 48 SONYPI_EVENT_WIRELESS_OFF */ KEY_ZOOMIN ,/* 49 SONYPI_EVENT_ZOOM_IN_PRESSED */ - KEY_ZOOMOUT /* 50 SONYPI_EVENT_ZOOM_OUT_PRESSED */ +KEY_ZOOMOUT ,/* 50 SONYPI_EVENT_ZOOM_OUT_PRESSED */ + KEY_EJECTCD /* 51 SONYPI_EVENT_CD_EJECT_PRESSED */ };/* release buttons after a short delay if pressed */
@@ -834,7 +836,11 @@ struct sony_nc_event {u8 event; }; -static struct sony_nc_event sony_C_events[] = { +static struct sony_nc_event sony_nc_events[] = { + {0x90 ,SONYPI_EVENT_PKEY_P1 }, + {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED }, {0x85 ,SONYPI_EVENT_FNKEY_F5 },
@@ -843,10 +849,14 @@ static struct sony_nc_event sony_C_events[] = { { 0x06, SONYPI_EVENT_FNKEY_RELEASED }, { 0x87, SONYPI_EVENT_FNKEY_F7 }, { 0x07, SONYPI_EVENT_FNKEY_RELEASED }, + { 0x89, SONYPI_EVENT_FNKEY_F9 }, + { 0x09, SONYPI_EVENT_FNKEY_RELEASED }, { 0x8A, SONYPI_EVENT_FNKEY_F10 }, { 0x0A, SONYPI_EVENT_FNKEY_RELEASED }, { 0x8C, SONYPI_EVENT_FNKEY_F12 }, { 0x0C, SONYPI_EVENT_FNKEY_RELEASED }, + { 0x9f, SONYPI_EVENT_CD_EJECT_PRESSED }, + { 0x1f, SONYPI_EVENT_ANYBUTTON_RELEASED }, { 0, 0 }, };
@@ -855,38 +865,33 @@ static struct sony_nc_event sony_C_events[] = {*/ static void sony_acpi_notify (acpi_handle handle,u32 event,void *data) { -int i;u32 ev = event;int result; -if (ev ==0x92 || ev ==0x90 ) { +if (ev >=0x90 ) { +/* New-style event */ int origev = ev; -/* read the key pressed from EC.GECR -* A call to SN07 with 0x0202 will do it as well respecting -* the current protocol on different OSes -* -* Note: the path for GECR may be -* \_SB.PCI0.LPCB.EC (C, FE, AR, N and friends) -* \_SB.PCI0.PIB.EC0 (VGN-FR notifications are sent directly, no GECR) -* -* TODO: we may want to do the same for the older GHKE -need -* dmi list- so this snippet may become one more callback. -*/ -if (sony_call_snc_handle (0x100 ,0x200 , &result)) -dprintk ("sony_acpi_notify, unable to decode event 0x%.2x\n" , ev); -else - ev = result &0xFF ; + ev -=0x90 ; -for (i =0 ; sony_C_events[i].data; i++) { -if (sony_C_events[i].data == ev) { - ev = sony_C_events[i].event; -break ; +if (sony_find_snc_handle (0x100 ) == ev) { +int i; + +if (sony_call_snc_handle (0x100 ,0x200 , &result)) +dprintk ("sony_acpi_notify, unable to decode event 0x%.2x\n" , ev); +else + ev = result &0xFF ; + +for (i =0 ; sony_nc_events[i].event; i++) { +if (sony_nc_events[i].data == ev) { + ev = sony_nc_events[i].event; +break ; + } } - } -if (!sony_C_events[i].data) - printk(KERN_INFO DRV_PFX "Unknown event: %x %x\n", - origev, ev); +if (!sony_nc_events[i].data) + printk(KERN_INFO DRV_PFX +"Unknown event: %x %x\n" , origev, ev); + } }dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev);
include/linux/sonypi.h +1 -0
@@ -103,6 +103,7 @@#define SONYPI_EVENT_WIRELESS_OFF 61#define SONYPI_EVENT_ZOOM_IN_PRESSED 62#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 +#define SONYPI_EVENT_CD_EJECT_PRESSED 64/* get/set brightness */ #define SONYPI_IOCGBRT _IOR('v', 0, __u8)
Signature · 1 line
1.6.0.6
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 3 lines · On Saturday 28 March 2009 05:31:32 Len Brown wrote:
The current sony-laptop code assumes that the keyboard event method is always located at slot 2 in the platform code. Remove this assumption and add support for some additional hotkeys.
I suggest the following patch to fix a couple of bugs on Vaio Z21:
- fix S1 and S2 hotkeys reporting same key event
- fix undecoded/unknown keys reporting bogus key events
sony-laptop.c renamed from sony-laptop.c.orig +4 -4
@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },
@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))
@@ -959,11 +959,11 @@ }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update ();return ; - } + }else +sony_laptop_report_input_event (ev); }dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev);acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); }
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
sony-laptop.c line 871
Quoted 7 lines · Matthias Welwarsky
sony-laptop.c renamed from sony-laptop.c.orig +1
-1{ 0x90, SONYPI_EVENT_PKEY_P1 }, { 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED }, - { 0x91, SONYPI_EVENT_PKEY_P1 }, + { 0x91, SONYPI_EVENT_PKEY_P2 }, { 0x11, SONYPI_EVENT_ANYBUTTON_RELEASED }, { 0x81, SONYPI_EVENT_FNKEY_F1 }, { 0x01, SONYPI_EVENT_FNKEY_RELEASED },
Oops, yes...
sony-laptop.c line 932
Quoted 6 lines
sony-laptop.c renamed from sony-laptop.c.orig +1
-1@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {
Indeed.
sony-laptop.c line 963
Quoted 3 lines
sony-laptop.c renamed from sony-laptop.c.orig +2
-1- } + }else +sony_laptop_report_input_event (ev);
That doesn't look right, though - sony_laptop_report_input_event expects a value that matches the input_index array, and an unprocessed event
Quoted 1 line
0x90isn't going to satisfy that.
Signature · 1 line
Matthew Garrett | [email protected]
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 20 lines · On Sunday 29 March 2009 17:03:38 Matthew Garrett wrote:
sony-laptop.c line 871
Quoted 7 lines · Matthias Welwarsky
sony-laptop.c renamed from sony-laptop.c.orig +1
-1{ 0x90, SONYPI_EVENT_PKEY_P1 }, { 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED }, - { 0x91, SONYPI_EVENT_PKEY_P1 }, + { 0x91, SONYPI_EVENT_PKEY_P2 }, { 0x11, SONYPI_EVENT_ANYBUTTON_RELEASED }, { 0x81, SONYPI_EVENT_FNKEY_F1 }, { 0x01, SONYPI_EVENT_FNKEY_RELEASED },Oops, yes...
sony-laptop.c line 932
Quoted 6 lines
sony-laptop.c renamed from sony-laptop.c.orig +1
-1@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {Indeed.
Quoted 7 lines
sony-laptop.c line 963
Quoted 3 lines
sony-laptop.c renamed from sony-laptop.c.orig +2
-1- } + }else +sony_laptop_report_input_event (ev);That doesn't look right, though -
sony_laptop_report_input_eventexpects a value that matches theinput_indexarray, and an unprocessed eventQuoted 1 line
0x90isn't going to satisfy that.
The call to sony_laptop_report_input_event() used to be further down, right before the call to acpi_bus_generate_proc_event(). It was called unconditionally, with whatever value ev happened to have at that time, i.e. also unprocessed events < 0x90 or events where the translation failed. Moving the call makes sure that only properly processed events are reported. Without, I was seeing a lot of bogus events reported, e.g. volume-down when the stamina switch was flipped, or when the rf kill switch was operated.
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 6 lines · Matthias Welwarsky
before the call to
acpi_bus_generate_proc_event(). It was called unconditionally, with whatever value ev happened to have at that time, i.e. also unprocessed events <0x90or events where the translation failed. Moving the call makes sure that only properly processed events are reported. Without, I was seeing a lot of bogus events reported, e.g. volume-down when the stamina switch was flipped, or when the rf kill switch was operated.
Oh, I see. No, you can't just remove it from there - that'll break older-style events. I'd add it there without removing the original, but then make the rest of the block conditional on the original event not being >= 0x90.
Signature · 1 line
Matthew Garrett | [email protected]
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 9 lines · On Sunday 29 March 2009 18:02:12 Matthew Garrett wrote:
Quoted 7 lines · Matthias Welwarsky
before the call to
acpi_bus_generate_proc_event(). It was called unconditionally, with whatever value ev happened to have at that time, i.e. also unprocessed events <0x90or events where the translation failed. Moving the call makes sure that only properly processed events are reported. Without, I was seeing a lot of bogus events reported, e.g. volume-down when the stamina switch was flipped, or when the rf kill switch was operated.
Quoted 4 lines
Oh, I see. No, you can't just remove it from there - that'll break older-style events. I'd add it there without removing the original, but then make the rest of the block conditional on the original event not being >=
0x90.
Whoops, just noticed that there was a bug in my patch. No wonder it confused you. Should untranslated events >= 0x90 still generate ACPI events? In that case, the following patch would fix it. If not, the acpi event reporting must be moved into the else path, too.
sony-laptop.c renamed from sony-laptop.c.orig +6 -5
@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },
@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))
@@ -955,15 +955,16 @@ printk(KERN_INFO DRV_PFX"Unknown event: 0x%x 0x%x\n" , key_handle, ev); - } + }else +sony_laptop_report_input_event (ev); }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update ();return ; } - } + }else +sony_laptop_report_input_event (ev);dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev);acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); }
Matthew Garrett
Acked-byRe: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 4 lines · Matthias Welwarsky
Whoops, just noticed that there was a bug in my patch. No wonder it confused you. Should untranslated events >=
0x90still generate ACPI events? In that case, the following patch would fix it. If not, the acpi event reporting must be moved into the else path, too.
I don't think it's likely to be useful - if we ever implement support for them then we'll generate different events and generate user confusion.
Quoted 29 lines
sony-laptop.c renamed from sony-laptop.c.orig +4
-3@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))@@ -955,15 +955,16 @@ printk(KERN_INFO DRV_PFX"Unknown event: 0x%x 0x%x\n" , key_handle, ev); - } + }else +sony_laptop_report_input_event (ev); }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update ();
sony-laptop.c line 969
Quoted 10 lines
sony-laptop.c renamed from sony-laptop.c.orig +2
-2return ; } - } + }else +sony_laptop_report_input_event (ev);dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev);acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); }
Yes, that looks good, just move the acpi_bus_generate_proc_event into the same blocks as sony_laptop_report_input_event.
Signature · 1 line
Matthew Garrett | [email protected]
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 4 lines · On Sunday 29 March 2009 18:41:07 Matthew Garrett wrote:
Yes, that looks good, just move the
acpi_bus_generate_proc_eventinto the same blocks assony_laptop_report_input_event.Acked-by Matthew Garrett <[email protected]>
final version:
sony-laptop.c renamed from sony-laptop.c.orig +8 -7
@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },
@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))
@@ -955,16 +955,17 @@ printk(KERN_INFO DRV_PFX"Unknown event: 0x%x 0x%x\n" , key_handle, ev); - } + }else +sony_laptop_report_input_event (ev); }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update ();return ; } + }else { +dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); +sony_laptop_report_input_event (ev); +acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); } - -dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev); -acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); } static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
sony-laptop.c line 962
Quoted 5 lines · Matthias Welwarsky
sony-laptop.c renamed from sony-laptop.c.orig +2
-0+ }else +sony_laptop_report_input_event (ev); }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update ();return ;
Nitpicky, but with this codeflow I think we can skip the return there?
Signature · 1 line
Matthew Garrett | [email protected]
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 8 lines · On Sunday 29 March 2009 19:13:45 Matthew Garrett wrote:
Review
Quoted 5 lines · Matthias Welwarsky
(quoted diff) +2
-0+ } else + sony_laptop_report_input_event(ev); } else if (sony_find_snc_handle(0x124) == ev) { sony_nc_rfkill_update(); return;Nitpicky, but with this codeflow I think we can skip the return there?
Yes We Can!
SCNR :)
sony-laptop.c renamed from sony-laptop.c.orig +8 -8
@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },
@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))
@@ -955,16 +955,16 @@ printk(KERN_INFO DRV_PFX"Unknown event: 0x%x 0x%x\n" , key_handle, ev); - } + }else +sony_laptop_report_input_event (ev); }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update (); -return ; } + }else { +dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); +sony_laptop_report_input_event (ev); +acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); } - -dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev); -acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); } static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
Mattia Dongili
maintainerRe: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
In reply to Matthew GarrettQuoted 10 lines · Matthew Garrett
Quoted 4 lines · Matthias Welwarsky
Whoops, just noticed that there was a bug in my patch. No wonder it confused you. Should untranslated events >=
0x90still generate ACPI events? In that case, the following patch would fix it. If not, the acpi event reporting must be moved into the else path, too.I don't think it's likely to be useful - if we ever implement support for them then we'll generate different events and generate user confusion.
yes, but up to 2.6.29 they are being reported for all the models supported by the former SNC initialization code. I'd rather keep them until /proc/acpi/event goes away.
Quoted 43 lines
Quoted 29 lines
sony-laptop.c renamed from sony-laptop.c.orig +4
-3@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))@@ -955,15 +955,16 @@ printk(KERN_INFO DRV_PFX"Unknown event: 0x%x 0x%x\n" , key_handle, ev); - } + }else +sony_laptop_report_input_event (ev); }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update ();sony-laptop.c line 969
Quoted 10 lines
sony-laptop.c renamed from sony-laptop.c.orig +2
-2return ; } - } + }else +sony_laptop_report_input_event (ev);dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev);acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); }Yes, that looks good, just move the
acpi_bus_generate_proc_eventinto the same blocks assony_laptop_report_input_event.
Quoted 1 line
Acked-by Matthew Garrett <[email protected]>
I'll take this version of the patch.
Len, this patch isn't upstream yet, would you prefer me to resend only this one with the fixes from Matthias merged in or do you want it as a separate fix?
Also, Matthias can we have your signoff line?
Thanks
Signature · 2 lines
mattia :wq!
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 7 lines · On Monday 30 March 2009 05:52:39 Mattia Dongili wrote:
Quoted 6 lines · Matthew Garrett
Quoted 4 lines · Matthias Welwarsky
Whoops, just noticed that there was a bug in my patch. No wonder it confused you. Should untranslated events >=
0x90still generate ACPI events? In that case, the following patch would fix it. If not, the acpi event reporting must be moved into the else path, too.
Quoted 7 lines
Quoted 3 lines
I don't think it's likely to be useful - if we ever implement support for them then we'll generate different events and generate user confusion.
yes, but up to 2.6.29 they are being reported for all the models supported by the former SNC initialization code. I'd rather keep them until
/proc/acpi/eventgoes away.
Hm, but if you keep them, there would be the possibility of ambiguous events. Events >= 0x90 are being translated and possibly (mostly) become < 0x90, so there's something like a namespace clash here. I think there should be a marker for translated events.
Quoted 43 lines
Quoted 43 lines
Quoted 29 lines
sony-laptop.c renamed from sony-laptop.c.orig +4
-3@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))@@ -955,15 +955,16 @@ printk(KERN_INFO DRV_PFX"Unknown event: 0x%x 0x%x\n" , key_handle, ev); - } + }else +sony_laptop_report_input_event (ev); }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update ();sony-laptop.c line 969
Quoted 10 lines
sony-laptop.c renamed from sony-laptop.c.orig +2
-2return ; } - } + }else +sony_laptop_report_input_event (ev);dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev);acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); }Yes, that looks good, just move the
acpi_bus_generate_proc_eventinto the same blocks assony_laptop_report_input_event.
Quoted 3 lines
Quoted 1 line
Acked-by Matthew Garrett <[email protected]>I'll take this version of the patch.
What's about rfkill then? Should rfkill hardware switch activations also send an acpi event in addition? Currently they don't.
Quoted 5 lines
Len, this patch isn't upstream yet, would you prefer me to resend only this one with the fixes from Matthias merged in or do you want it as a separate fix?
Also, Matthias can we have your signoff line?
I'll resend the patch with a proper sign-off once we're clear about these questions, ok?
regards,
matthias
Re: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 20 lines · On Monday 30 March 2009 08:20:23 Matthias Welwarsky wrote:
Quoted 7 lines · On Monday 30 March 2009 05:52:39 Mattia Dongili wrote:
Quoted 6 lines · Matthew Garrett
Quoted 4 lines · Matthias Welwarsky
Whoops, just noticed that there was a bug in my patch. No wonder it confused you. Should untranslated events >=
0x90still generate ACPI events? In that case, the following patch would fix it. If not, the acpi event reporting must be moved into the else path, too.Quoted 7 lines
Quoted 3 lines
I don't think it's likely to be useful - if we ever implement support for them then we'll generate different events and generate user confusion.
yes, but up to 2.6.29 they are being reported for all the models supported by the former SNC initialization code. I'd rather keep them until
/proc/acpi/eventgoes away.Hm, but if you keep them, there would be the possibility of ambiguous events. Events >=
0x90are being translated and possibly (mostly) become <0x90, so there's something like a namespace clash here. I think there should be a marker for translated events.
[snip]
Quoted 4 lines
Quoted 1 line
Also, Matthias can we have your signoff line?
I'll resend the patch with a proper sign-off once we're clear about these questions, ok?
And here's an updated patch, it fixes bogus input events reported for untranslateable "new-style" hotkey events, reports unique events for Vaio Z21 S1 and S2 buttons and restores the previous behavior of reporting ACPI events even for translated "new-style" hotkeys. To disambiguate them, those events start at 0x8000, maybe not quite deliberate - any other suggestions? Also, ACPI events are generated for rf killswitch status changes. That's probably of limited use, because the state of the killswitch is not reported, but one can still iterate all switches in a script to find out about the status.
sony-laptop.c renamed from sony-laptop.c.orig +14 -7
@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },
@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))
@@ -955,15 +955,22 @@ printk(KERN_INFO DRV_PFX"Unknown event: 0x%x 0x%x\n" , key_handle, ev); +/* restore original event number */ + ev = event; + }else { +sony_laptop_report_input_event (ev); +/* mark event as translated */ + ev |=0x8000 ; } }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update (); -return ; - } - } - +/* restore original event number */ + ev = event; + } + }else +sony_laptop_report_input_event (ev); +dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev);acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); }
Mattia Dongili
maintainerRe: [PATCH 57/98] sony-laptop: Add support for extra keyboard events
Quoted 26 lines · Matthias Welwarsky
Quoted 20 lines · On Monday 30 March 2009 08:20:23 Matthias Welwarsky wrote:
Quoted 7 lines · On Monday 30 March 2009 05:52:39 Mattia Dongili wrote:
Quoted 6 lines · Matthew Garrett
Quoted 4 lines · Matthias Welwarsky
Whoops, just noticed that there was a bug in my patch. No wonder it confused you. Should untranslated events >=
0x90still generate ACPI events? In that case, the following patch would fix it. If not, the acpi event reporting must be moved into the else path, too.Quoted 7 lines
Quoted 3 lines
I don't think it's likely to be useful - if we ever implement support for them then we'll generate different events and generate user confusion.
yes, but up to 2.6.29 they are being reported for all the models supported by the former SNC initialization code. I'd rather keep them until
/proc/acpi/eventgoes away.Hm, but if you keep them, there would be the possibility of ambiguous events. Events >=
0x90are being translated and possibly (mostly) become <0x90, so there's something like a namespace clash here. I think there should be a marker for translated events.[snip]
Quoted 2 lines
Quoted 1 line
Also, Matthias can we have your signoff line?
Quoted 8 lines
Quoted 2 lines
I'll resend the patch with a proper sign-off once we're clear about these questions, ok?
And here's an updated patch, it fixes bogus input events reported for untranslateable "new-style" hotkey events, reports unique events for Vaio Z21 S1 and S2 buttons and restores the previous behavior of reporting ACPI events even for translated "new-style" hotkeys. To disambiguate them, those events start at
0x8000, maybe not quite deliberate - any other
Actually I thought the problem was the event ambiguity for vaios having both the sony_100_events and sony_127_events (like the SR). Not really concerned about the the other events as we are not changing their behaviour here.
The 0x8000 marker is not going to help much here since we are still generating the same acpi event for i.e. SONYPI_EVENT_FNKEY_F1 and SONYPI_EVENT_MODEKEY_PRESSED.
Honestly, rather than trying to fix an already likely broken interface with more kludges I would just throw the event through /proc/acpi/event untouched, those having ambiguous events should just use the input layer.
The only way I can think of actually fixing the sony_100/127 ambiguity without breaking compatibility with older kernels would be to send 2 events, first the untranslated event, then the translated one. Not sure how usable it would be in the SR case though.
Quoted 28 lines
suggestions? Also, ACPI events are generated for rf killswitch status changes. That's probably of limited use, because the state of the killswitch is not reported, but one can still iterate all switches in a script to find out about the status.
Signed-off-by Matthias Welwarsky <[email protected]>sony-laptop.c renamed from sony-laptop.c.orig +2
-2@@ -865,7 +865,7 @@static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, - {0x91 ,SONYPI_EVENT_PKEY_P1 }, + {0x91 ,SONYPI_EVENT_PKEY_P2 }, {0x11 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x81 ,SONYPI_EVENT_FNKEY_F1 }, {0x01 ,SONYPI_EVENT_FNKEY_RELEASED },@@ -929,7 +929,7 @@if (sony_find_snc_handle (0x127 ) == ev) key_handle =0x127 ; -if (handle) { +if (key_handle) {struct sony_nc_event *key_event;if (sony_call_snc_handle (key_handle,0x200 , &result))
sony-laptop.c line 959
Quoted 5 lines
sony-laptop.c renamed from sony-laptop.c.orig +2
-0@@ -955,15 +955,22 @@ printk(KERN_INFO DRV_PFX"Unknown event: 0x%x 0x%x\n" , key_handle, ev); +/* restore original event number */ + ev = event;
good catch.
Quoted 22 lines
sony-laptop.c renamed from sony-laptop.c.orig +10
-5+ }else { +sony_laptop_report_input_event (ev); +/* mark event as translated */ + ev |=0x8000 ; } }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update (); -return ; - } - } - +/* restore original event number */ + ev = event; + } + }else +sony_laptop_report_input_event (ev); +dprintk ("sony_acpi_notify, event: 0x%.2x\n" , ev); -sony_laptop_report_input_event (ev);acpi_bus_generate_proc_event (sony_nc_acpi_device,1 , ev); }
Signature · 2 lines
mattia :wq!
Len Brown
reviewerPATCH 58/98 sony-laptop: Add rfkill support on new models
In reply to Len BrownFrom: Matthew Garrett <[email protected]>
Newer Vaios provide a full featured rfkill implementation via their platform methods. Add support for enumerating the available devices and providing rfkill access to them. Support for the physical kill switch is added, with the devices moving into the HARD_BLOCKED state when toggled.
--- drivers/platform/x86/sony-laptop.c | 186 ++++++++++++++++++++++++++++++++++++ 1 files changed, 186 insertions(+), 0 deletions(-)
drivers/platform/x86/sony-laptop.c +186 -0
@@ -64,6 +64,7 @@#include <asm/uaccess.h> #include <linux/sonypi.h> #include <linux/sony-laptop.h> +#include <linux/rfkill.h> #ifdef CONFIG_SONYPI_COMPAT #include <linux/poll.h> #include <linux/miscdevice.h>
@@ -123,6 +124,18 @@ MODULE_PARM_DESC(minor, "default is -1 (automatic)");#endif +enum sony_nc_rfkill { +SONY_WIFI , +SONY_BLUETOOTH , +SONY_WWAN , +SONY_WIMAX , +SONY_RFKILL_MAX , +}; + +static struct rfkill *sony_rfkill_devices[SONY_RFKILL_MAX ]; +static int sony_rfkill_address[SONY_RFKILL_MAX ] = {0x300 ,0x500 ,0x700 ,0x900 }; +static void sony_nc_rfkill_update (void ); +/*********** Input Devices ***********/ #define SONY_LAPTOP_BUF_SIZE 128
@@ -134,6 +147,7 @@ struct sony_laptop_input_s {spinlock_t fifo_lock;struct workqueue_struct *wq; }; +static struct sony_laptop_input_s sony_laptop_input = { .users =ATOMIC_INIT (0 ), };
@@ -891,6 +905,9 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)if (!sony_nc_events[i].data) printk(KERN_INFO DRV_PFX"Unknown event: %x %x\n" , origev, ev); + }else if (sony_find_snc_handle (0x124 ) == ev) { +sony_nc_rfkill_update (); +return ; } }
@@ -973,6 +990,172 @@ static int sony_nc_resume(struct acpi_device *device)return 0 ; } +static void sony_nc_rfkill_cleanup (void ) +{ +int i; + +for (i =0 ; i <SONY_RFKILL_MAX ; i++) { +if (sony_rfkill_devices[i]) +rfkill_unregister (sony_rfkill_devices[i]); + } +} + +static int sony_nc_rfkill_get (void *data,enum rfkill_state *state) +{ +int result; +int argument = sony_rfkill_address[(long ) data]; + +sony_call_snc_handle (0x124 ,0x200 , &result); +if (result &0x1 ) { +sony_call_snc_handle (0x124 , argument, &result); +if (result &0xf ) + *state =RFKILL_STATE_UNBLOCKED ; +else + *state =RFKILL_STATE_SOFT_BLOCKED ; + }else { + *state =RFKILL_STATE_HARD_BLOCKED ; + } + +return 0 ; +} + +static int sony_nc_rfkill_set (void *data,enum rfkill_state state) +{ +int result; +int argument = sony_rfkill_address[(long ) data] +0x100 ; + +if (state ==RFKILL_STATE_UNBLOCKED ) + argument |=0xff0000 ; + +return sony_call_snc_handle (0x124 , argument, &result); +} + +static int sony_nc_setup_wifi_rfkill (struct acpi_device *device) +{ +int err =0 ; +struct rfkill *sony_wifi_rfkill; + + sony_wifi_rfkill =rfkill_allocate (&device->dev,RFKILL_TYPE_WLAN ); +if (!sony_wifi_rfkill) +return -1 ; + sony_wifi_rfkill->name ="sony-wifi" ; + sony_wifi_rfkill->toggle_radio = sony_nc_rfkill_set; + sony_wifi_rfkill->get_state = sony_nc_rfkill_get; + sony_wifi_rfkill->user_claim_unsupported =1 ; + sony_wifi_rfkill->data = (void *)SONY_WIFI ; + err =rfkill_register (sony_wifi_rfkill); +if (err) +rfkill_free (sony_wifi_rfkill); +else + sony_rfkill_devices[SONY_WIFI ] = sony_wifi_rfkill; +return err; +} + +static int sony_nc_setup_bluetooth_rfkill (struct acpi_device *device) +{ +int err =0 ; +struct rfkill *sony_bluetooth_rfkill; + + sony_bluetooth_rfkill =rfkill_allocate (&device->dev, +RFKILL_TYPE_BLUETOOTH ); +if (!sony_bluetooth_rfkill) +return -1 ; + sony_bluetooth_rfkill->name ="sony-bluetooth" ; + sony_bluetooth_rfkill->toggle_radio = sony_nc_rfkill_set; + sony_bluetooth_rfkill->get_state = sony_nc_rfkill_get; + sony_bluetooth_rfkill->user_claim_unsupported =1 ; + sony_bluetooth_rfkill->data = (void *)SONY_BLUETOOTH ; + err =rfkill_register (sony_bluetooth_rfkill); +if (err) +rfkill_free (sony_bluetooth_rfkill); +else + sony_rfkill_devices[SONY_BLUETOOTH ] = sony_bluetooth_rfkill; +return err; +} + +static int sony_nc_setup_wwan_rfkill (struct acpi_device *device) +{ +int err =0 ; +struct rfkill *sony_wwan_rfkill; + + sony_wwan_rfkill =rfkill_allocate (&device->dev,RFKILL_TYPE_WWAN ); +if (!sony_wwan_rfkill) +return -1 ; + sony_wwan_rfkill->name ="sony-wwan" ; + sony_wwan_rfkill->toggle_radio = sony_nc_rfkill_set; + sony_wwan_rfkill->get_state = sony_nc_rfkill_get; + sony_wwan_rfkill->user_claim_unsupported =1 ; + sony_wwan_rfkill->data = (void *)SONY_WWAN ; + err =rfkill_register (sony_wwan_rfkill); +if (err) +rfkill_free (sony_wwan_rfkill); +else + sony_rfkill_devices[SONY_WWAN ] = sony_wwan_rfkill; +return err; +} + +static int sony_nc_setup_wimax_rfkill (struct acpi_device *device) +{ +int err =0 ; +struct rfkill *sony_wimax_rfkill; + + sony_wimax_rfkill =rfkill_allocate (&device->dev,RFKILL_TYPE_WIMAX ); +if (!sony_wimax_rfkill) +return -1 ; + sony_wimax_rfkill->name ="sony-wimax" ; + sony_wimax_rfkill->toggle_radio = sony_nc_rfkill_set; + sony_wimax_rfkill->get_state = sony_nc_rfkill_get; + sony_wimax_rfkill->user_claim_unsupported =1 ; + sony_wimax_rfkill->data = (void *)SONY_WIMAX ; + err =rfkill_register (sony_wimax_rfkill); +if (err) +rfkill_free (sony_wimax_rfkill); +else + sony_rfkill_devices[SONY_WIMAX ] = sony_wimax_rfkill; +return err; +} + +static void sony_nc_rfkill_update () +{ +int i; +enum rfkill_state state; + +for (i =0 ; i <SONY_RFKILL_MAX ; i++) { +if (sony_rfkill_devices[i]) { + sony_rfkill_devices[i]-> +get_state (sony_rfkill_devices[i]->data, + &state); +rfkill_force_state (sony_rfkill_devices[i], state); + } + } +} + +static int sony_nc_rfkill_setup (struct acpi_device *device) +{ +int result, ret; + +if (sony_find_snc_handle (0x124 ) ==-1 ) +return -1 ; + + ret =sony_call_snc_handle (0x124 ,0xb00 , &result); +if (ret) { + printk(KERN_INFO DRV_PFX + "Unable to enumerate rfkill devices: %x\n", ret); +return ret; + } + +if (result &0x1 ) +sony_nc_setup_wifi_rfkill (device); +if (result &0x2 ) +sony_nc_setup_bluetooth_rfkill (device); +if (result &0x1c ) +sony_nc_setup_wwan_rfkill (device); +if (result &0x20 ) +sony_nc_setup_wimax_rfkill (device); + +return 0 ; +} +static int sony_nc_add (struct acpi_device *device) {acpi_status status;
@@ -1026,6 +1209,7 @@ static int sony_nc_add(struct acpi_device *device) &handle))) {dprintk ("Doing SNC setup\n" );sony_nc_function_setup (device); +sony_nc_rfkill_setup (device); }/* setup input devices and helper fifo */
@@ -1132,6 +1316,7 @@ static int sony_nc_add(struct acpi_device *device)sony_laptop_remove_input (); outwalk: +sony_nc_rfkill_cleanup ();return result; }
@@ -1157,6 +1342,7 @@ static int sony_nc_remove(struct acpi_device *device, int type)sony_pf_remove ();sony_laptop_remove_input (); +sony_nc_rfkill_cleanup ();dprintk (SONY_NC_DRIVER_NAME " removed.\n" );return 0 ;
Signature · 1 line
1.6.0.6
Re: [PATCH 58/98] sony-laptop: Add rfkill support on new models
Quoted 6 lines · On Saturday 28 March 2009 05:31:33 you wrote:
From: Matthew Garrett <[email protected]>
Newer Vaios provide a full featured rfkill implementation via their platform methods. Add support for enumerating the available devices and providing rfkill access to them. Support for the physical kill switch is added, with the devices moving into the
HARD_BLOCKEDstate when toggled.
Bug: If you insert the module with hardware kill switch enabled, it cannot be disabled any more, i.e. despite operating the hardware kill switch, devices will not become enabled.
Any hint how I could debug this?
regards,
matthias
PS: Len, sorry for the bogus message, hit the wrong reply button
Re: [PATCH 58/98] sony-laptop: Add rfkill support on new models
Quoted 8 lines · Matthias Welwarsky
Quoted 6 lines · On Saturday 28 March 2009 05:31:33 you wrote:
From: Matthew Garrett <[email protected]>
Newer Vaios provide a full featured rfkill implementation via their platform methods. Add support for enumerating the available devices and providing rfkill access to them. Support for the physical kill switch is added, with the devices moving into the
HARD_BLOCKEDstate when toggled.
Quoted 5 lines
Bug: If you insert the module with hardware kill switch enabled, it cannot be disabled any more, i.e. despite operating the hardware kill switch, devices will not become enabled.
Any hint how I could debug this?
Put debug prints through the rfkill_update and rfkill_get functions? I don't see anything especially obvious that would prevent this from working.
Signature · 1 line
Matthew Garrett | [email protected]
Mattia Dongili
maintainerRe: [PATCH 58/98] sony-laptop: Add rfkill support on new models
Quoted 13 lines · Matthew Garrett
Quoted 12 lines · Matthias Welwarsky
Quoted 6 lines · On Saturday 28 March 2009 05:31:33 you wrote:
From: Matthew Garrett <[email protected]>
Newer Vaios provide a full featured rfkill implementation via their platform methods. Add support for enumerating the available devices and providing rfkill access to them. Support for the physical kill switch is added, with the devices moving into the
HARD_BLOCKEDstate when toggled.Bug: If you insert the module with hardware kill switch enabled, it cannot be disabled any more, i.e. despite operating the hardware kill switch, devices will not become enabled.
Quoted 5 lines
Quoted 1 line
Any hint how I could debug this?
Put debug prints through the
rfkill_updateandrfkill_getfunctions? I don't see anything especially obvious that would prevent this from working.
Matthias, any progress in debugging this?
Signature · 2 lines
mattia :wq!
Re: [PATCH 58/98] sony-laptop: Add rfkill support on new models
Quoted 15 lines · On Wednesday 01 April 2009 15:00:39 Mattia Dongili wrote:
Quoted 14 lines · Matthew Garrett
Quoted 13 lines · Matthias Welwarsky
Quoted 7 lines · On Saturday 28 March 2009 05:31:33 you wrote:
From: Matthew Garrett <[email protected]>
Newer Vaios provide a full featured rfkill implementation via their platform methods. Add support for enumerating the available devices and providing rfkill access to them. Support for the physical kill switch is added, with the devices moving into the
HARD_BLOCKEDstate when toggled.Bug: If you insert the module with hardware kill switch enabled, it cannot be disabled any more, i.e. despite operating the hardware kill switch, devices will not become enabled.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Any hint how I could debug this?
Put debug prints through the
rfkill_updateandrfkill_getfunctions? I don't see anything especially obvious that would prevent this from working.Matthias, any progress in debugging this?
Not yet. Not sure I'll have time to work on it for the next few days (upcoming easter holidays).
regards,
matthias
Mattia Dongili
maintainerRe: [PATCH 58/98] sony-laptop: Add rfkill support on new models
Quoted 18 lines · Matthias Welwarsky
Quoted 17 lines · On Wednesday 01 April 2009 15:00:39 Mattia Dongili wrote:
Quoted 16 lines · Matthew Garrett
Quoted 14 lines · Matthias Welwarsky
Quoted 7 lines · On Saturday 28 March 2009 05:31:33 you wrote:
From: Matthew Garrett <[email protected]>
Newer Vaios provide a full featured rfkill implementation via their platform methods. Add support for enumerating the available devices and providing rfkill access to them. Support for the physical kill switch is added, with the devices moving into the
HARD_BLOCKEDstate when toggled.Bug: If you insert the module with hardware kill switch enabled, it cannot be disabled any more, i.e. despite operating the hardware kill switch, devices will not become enabled.
Any hint how I could debug this?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Put debug prints through the
rfkill_updateandrfkill_getfunctions? I don't see anything especially obvious that would prevent this from working.Matthias, any progress in debugging this?
Not yet. Not sure I'll have time to work on it for the next few days (upcoming easter holidays).
I got my hands on a "new style" vaio and reproduced the problem. What happens is that when loading the driver with the kill switch on and then turning it on the status reading call to the 0x124 handle returns a soft blocked state.
Just echoing 1 into the appropriate sysfs rfkill files turns the devices on.
In short we should make sure that if the device was never turned on since loading, then the switch being turned off really means "turn it off!".
I'll prepare a patch tomorrow.
Signature · 2 lines
mattia :wq!
A message that is not in the archive (sent off-list or not yet received): [email protected]
Len Brown
reviewerRe: [PATCH 58/98] sony-laptop: Add rfkill support on new models
<adding linux-acpi>
Quoted 8 lines · Matthias Welwarsky
Quoted 6 lines · On Saturday 28 March 2009 05:31:33 you wrote:
From: Matthew Garrett <[email protected]>
Newer Vaios provide a full featured rfkill implementation via their platform methods. Add support for enumerating the available devices and providing rfkill access to them. Support for the physical kill switch is added, with the devices moving into the
HARD_BLOCKEDstate when toggled.
Quoted 8 lines
Bug: If you insert the module with hardware kill switch enabled, it cannot be disabled any more, i.e. despite operating the hardware kill switch, devices will not become enabled.
Any hint how I could debug this?
regards,
matthias
Matthew,
Should we proceed with patch 58 and fix later, or scrap patch 58?
thanks,
-Len Brown, Intel Open Source Technology Center
Re: [PATCH 58/98] sony-laptop: Add rfkill support on new models
Quoted 5 lines · Len Brown
Quoted 4 lines · Matthias Welwarsky
Bug: If you insert the module with hardware kill switch enabled, it cannot be disabled any more, i.e. despite operating the hardware kill switch, devices will not become enabled.
Quoted 7 lines
Quoted 4 lines
Any hint how I could debug this?
regards,
matthiasMatthew,
Should we proceed with patch 58 and fix later, or scrap patch 58?
That could have been triggered before the bugfixes to the notify handler
- is it still a problem?
Signature · 1 line
Matthew Garrett | [email protected]
Len Brown
reviewerPATCH 59/98 sony-laptop: Add support for extended hotkeys
In reply to Len BrownFrom: Matthew Garrett <[email protected]>
Recent Sony SR-series machines have an additional set of buttons accessed via the 0x127 method rather than the 0x100 method. Add support for these.
--- drivers/platform/x86/sony-laptop.c | 65 +++++++++++++++++++++++++++++------- include/linux/sonypi.h | 4 ++ 2 files changed, 57 insertions(+), 12 deletions(-)
drivers/platform/x86/sony-laptop.c +53 -12
@@ -226,6 +226,10 @@ static int sony_laptop_input_index[] = {49 ,/* 62 SONYPI_EVENT_ZOOM_IN_PRESSED */ 50 ,/* 63 SONYPI_EVENT_ZOOM_OUT_PRESSED */ 51 ,/* 64 SONYPI_EVENT_CD_EJECT_PRESSED */ +52 ,/* 65 SONYPI_EVENT_MODEKEY_PRESSED */ +53 ,/* 66 SONYPI_EVENT_PKEY_P4 */ +54 ,/* 67 SONYPI_EVENT_PKEY_P5 */ + 55, /* 68 SONYPI_EVENT_SETTINGKEY_PRESSED */ }; static int sony_laptop_input_keycode_map[] = {
@@ -280,7 +284,11 @@ static int sony_laptop_input_keycode_map[] = {KEY_WLAN ,/* 48 SONYPI_EVENT_WIRELESS_OFF */ KEY_ZOOMIN ,/* 49 SONYPI_EVENT_ZOOM_IN_PRESSED */ KEY_ZOOMOUT ,/* 50 SONYPI_EVENT_ZOOM_OUT_PRESSED */ - KEY_EJECTCD /* 51 SONYPI_EVENT_CD_EJECT_PRESSED */ +KEY_EJECTCD ,/* 51 SONYPI_EVENT_CD_EJECT_PRESSED */ +KEY_F13 ,/* 52 SONYPI_EVENT_MODEKEY_PRESSED */ +KEY_PROG4 ,/* 53 SONYPI_EVENT_PKEY_P4 */ +KEY_F14 ,/* 54 SONYPI_EVENT_PKEY_P5 */ + KEY_F15, /* 55 SONYPI_EVENT_SETTINGKEY_PRESSED */ };/* release buttons after a short delay if pressed */
@@ -850,7 +858,7 @@ struct sony_nc_event {u8 event; }; -static struct sony_nc_event sony_nc_events[] = { +static struct sony_nc_event sony_100_events[] = { {0x90 ,SONYPI_EVENT_PKEY_P1 }, {0x10 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, {0x91 ,SONYPI_EVENT_PKEY_P1 },
@@ -874,6 +882,25 @@ static struct sony_nc_event sony_nc_events[] = { { 0, 0 }, }; +static struct sony_nc_event sony_127_events[] = { + {0x81 ,SONYPI_EVENT_MODEKEY_PRESSED }, + {0x01 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0x82 ,SONYPI_EVENT_PKEY_P1 }, + {0x02 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0x83 ,SONYPI_EVENT_PKEY_P2 }, + {0x03 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0x84 ,SONYPI_EVENT_PKEY_P3 }, + {0x04 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0x85 ,SONYPI_EVENT_PKEY_P4 }, + {0x05 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0x86 ,SONYPI_EVENT_PKEY_P5 }, + {0x06 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0x06 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0x87 ,SONYPI_EVENT_SETTINGKEY_PRESSED }, + {0x07 ,SONYPI_EVENT_ANYBUTTON_RELEASED }, + {0 ,0 }, +}; +/* * ACPI callbacks */
@@ -884,27 +911,41 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)if (ev >=0x90 ) {/* New-style event */ -int origev = ev; +int key_handle =0 ; ev -=0x90 ; -if (sony_find_snc_handle (0x100 ) == ev) { -int i; +if (sony_find_snc_handle (0x100 ) == ev) + key_handle =0x100 ; +if (sony_find_snc_handle (0x127 ) == ev) + key_handle =0x127 ; + +if (handle) { +struct sony_nc_event *key_event; -if (sony_call_snc_handle (0x100 ,0x200 , &result)) -dprintk ("sony_acpi_notify, unable to decode event 0x%.2x\n" , ev); +if (sony_call_snc_handle (key_handle,0x200 , &result)) +dprintk ("sony_acpi_notify, unable to decode" +" event 0x%.2x 0x%.2x\n" , key_handle, + ev);else ev = result &0xFF ; -for (i =0 ; sony_nc_events[i].event; i++) { -if (sony_nc_events[i].data == ev) { - ev = sony_nc_events[i].event; +if (key_handle ==0x100 ) + key_event = sony_100_events; +else + key_event = sony_127_events; + +for (; key_event->data; key_event++) { +if (key_event->data == ev) { + ev = key_event->event;break ; } } -if (!sony_nc_events[i].data) +if (!key_event->data) { printk(KERN_INFO DRV_PFX -"Unknown event: %x %x\n" , origev, ev); +"Unknown event: 0x%x 0x%x\n" , key_handle, + ev); + } }else if (sony_find_snc_handle (0x124 ) == ev) {sony_nc_rfkill_update ();return ;
include/linux/sonypi.h +4 -0
@@ -104,6 +104,10 @@#define SONYPI_EVENT_ZOOM_IN_PRESSED 62#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63#define SONYPI_EVENT_CD_EJECT_PRESSED 64 +#define SONYPI_EVENT_MODEKEY_PRESSED 65 +#define SONYPI_EVENT_PKEY_P4 66 +#define SONYPI_EVENT_PKEY_P5 67 +#define SONYPI_EVENT_SETTINGKEY_PRESSED 68/* get/set brightness */ #define SONYPI_IOCGBRT _IOR('v', 0, __u8)
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 60/98 sony-laptop: merge Type4 into Type3
In reply to Len BrownFrom: Mattia Dongili <[email protected]>
Creating Type4 was a mistake in the first place. Some users report that also Type3 vaios require the same extra hotkey handling which the Type4 for was menat to guard from.
Merging down Type4 into Type3 will just remove a useless distinction.
--- drivers/platform/x86/sony-laptop.c | 28 ++++++---------------------- 1 files changed, 6 insertions(+), 22 deletions(-)
drivers/platform/x86/sony-laptop.c +6 -22
@@ -1423,7 +1423,6 @@ static struct acpi_driver sony_nc_driver = {#define SONYPI_TYPE1_OFFSET 0x04#define SONYPI_TYPE2_OFFSET 0x12#define SONYPI_TYPE3_OFFSET 0x12 -#define SONYPI_TYPE4_OFFSET 0x12struct sony_pic_ioport {struct acpi_resource_io io1;
@@ -1666,14 +1665,6 @@ static struct sonypi_eventtypes type3_events[] = { { 0x31, SONYPI_MEMORYSTICK_MASK, sonypi_memorystickev }, { 0x41, SONYPI_BATTERY_MASK, sonypi_batteryev }, { 0x31, SONYPI_PKEY_MASK, sonypi_pkeyev }, - { 0 }, -}; -static struct sonypi_eventtypes type4_events[] = { - {0 ,0xffffffff , sonypi_releaseev }, - {0x21 ,SONYPI_FNKEY_MASK , sonypi_fnkeyev }, - {0x31 ,SONYPI_WIRELESS_MASK , sonypi_wlessev }, - {0x31 ,SONYPI_MEMORYSTICK_MASK , sonypi_memorystickev }, - {0x41 ,SONYPI_BATTERY_MASK , sonypi_batteryev }, { 0x05, SONYPI_PKEY_MASK, sonypi_pkeyev }, { 0x05, SONYPI_ZOOM_MASK, sonypi_zoomev }, { 0x05, SONYPI_CAPTURE_MASK, sonypi_captureev },
@@ -1739,11 +1730,11 @@ static u8 sony_pic_call3(u8 dev, u8 fn, u8 v)/* * minidrivers for SPIC models */ -static int type4_handle_irq (const u8 data_mask,const u8 ev) +static int type3_handle_irq (const u8 data_mask,const u8 ev) {/* * 0x31 could mean we have to take some extra action and wait for -* the next irq for some Type4 models, it will generate a new +* the next irq for some Type3 models, it will generate a new * irq and we can read new data from the device: * - 0x5c and 0x5f requires 0xA0 * - 0x61 requires 0xB3
@@ -1773,16 +1764,10 @@ static struct device_ctrl spic_types[] = { }, { .model = SONYPI_DEVICE_TYPE3, - .handle_irq = NULL, + .handle_irq = type3_handle_irq, .evport_offset = SONYPI_TYPE3_OFFSET, .event_types = type3_events, }, - { - .model = SONYPI_DEVICE_TYPE4, - .handle_irq = type4_handle_irq, - .evport_offset = SONYPI_TYPE4_OFFSET, - .event_types = type4_events, - }, };static void sony_pic_detect_device_type (struct sony_pic_dev *dev)
@@ -1806,14 +1791,14 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev) pcidev =pci_get_device (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_ICH7_1 ,NULL );if (pcidev) { - dev->control = &spic_types[3 ]; + dev->control = &spic_types[2 ]; goto out; } pcidev =pci_get_device (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_ICH8_4 ,NULL );if (pcidev) { - dev->control = &spic_types[3 ]; + dev->control = &spic_types[2 ]; goto out; }
@@ -1826,8 +1811,7 @@ out: printk(KERN_INFO DRV_PFX "detected Type%d model\n", dev->control->model ==SONYPI_DEVICE_TYPE1 ?1 : - dev->control->model ==SONYPI_DEVICE_TYPE2 ?2 : - dev->control->model == SONYPI_DEVICE_TYPE3 ? 3 : 4); + dev->control->model == SONYPI_DEVICE_TYPE2 ? 2 : 3); }/* camera tests and poweron/poweroff */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 61/98 sony-laptop: VGN-A317M hotkey support
In reply to Len BrownFrom: Harald Jenny <[email protected]>
This laptop has 5 SPIC managed buttons above the keyboard:
sound + and - as well as brightness, zoom and S1. Possibly the entire VGN-A serie behaves the same.
--- drivers/platform/x86/sony-laptop.c | 22 ++++++++++++++++++++++ include/linux/sonypi.h | 3 +++ 2 files changed, 25 insertions(+), 0 deletions(-)
drivers/platform/x86/sony-laptop.c +22 -0
@@ -230,6 +230,9 @@ static int sony_laptop_input_index[] = {53 ,/* 66 SONYPI_EVENT_PKEY_P4 */ 54 ,/* 67 SONYPI_EVENT_PKEY_P5 */ 55 ,/* 68 SONYPI_EVENT_SETTINGKEY_PRESSED */ +56 ,/* 69 SONYPI_EVENT_VOLUME_INC_PRESSED */ +57 ,/* 70 SONYPI_EVENT_VOLUME_DEC_PRESSED */ + -1, /* 71 SONYPI_EVENT_BRIGHTNESS_PRESSED */ }; static int sony_laptop_input_keycode_map[] = {
@@ -289,6 +292,8 @@ static int sony_laptop_input_keycode_map[] = {KEY_PROG4 ,/* 53 SONYPI_EVENT_PKEY_P4 */ KEY_F14 ,/* 54 SONYPI_EVENT_PKEY_P5 */ KEY_F15 ,/* 55 SONYPI_EVENT_SETTINGKEY_PRESSED */ +KEY_VOLUMEUP ,/* 56 SONYPI_EVENT_VOLUME_INC_PRESSED */ + KEY_VOLUMEDOWN, /* 57 SONYPI_EVENT_VOLUME_DEC_PRESSED */ };/* release buttons after a short delay if pressed */
@@ -1555,6 +1560,7 @@ static struct sonypi_event sonypi_pkeyev[] = { { 0x01, SONYPI_EVENT_PKEY_P1 }, { 0x02, SONYPI_EVENT_PKEY_P2 }, { 0x04, SONYPI_EVENT_PKEY_P3 }, + { 0x20, SONYPI_EVENT_PKEY_P1 }, { 0, 0 } };
@@ -1598,6 +1604,7 @@ static struct sonypi_event sonypi_zoomev[] = { { 0x39, SONYPI_EVENT_ZOOM_PRESSED }, { 0x10, SONYPI_EVENT_ZOOM_IN_PRESSED }, { 0x20, SONYPI_EVENT_ZOOM_OUT_PRESSED }, + { 0x04, SONYPI_EVENT_ZOOM_PRESSED }, { 0, 0 } };
@@ -1628,6 +1635,19 @@ static struct sonypi_event sonypi_batteryev[] = { { 0, 0 } }; +/* The set of possible volume events */ +static struct sonypi_event sonypi_volumeev[] = { + {0x01 ,SONYPI_EVENT_VOLUME_INC_PRESSED }, + {0x02 ,SONYPI_EVENT_VOLUME_DEC_PRESSED }, + {0 ,0 } +}; + +/* The set of possible brightness events */ +static struct sonypi_event sonypi_brightnessev[] = { + {0x80 ,SONYPI_EVENT_BRIGHTNESS_PRESSED }, + {0 ,0 } +}; +static struct sonypi_eventtypes type1_events[] = { {0 ,0xffffffff , sonypi_releaseev }, {0x70 ,SONYPI_MEYE_MASK , sonypi_meyeev },
@@ -1668,6 +1688,8 @@ static struct sonypi_eventtypes type3_events[] = { { 0x05, SONYPI_PKEY_MASK, sonypi_pkeyev }, { 0x05, SONYPI_ZOOM_MASK, sonypi_zoomev }, { 0x05, SONYPI_CAPTURE_MASK, sonypi_captureev }, + { 0x05, SONYPI_PKEY_MASK, sonypi_volumeev }, + { 0x05, SONYPI_PKEY_MASK, sonypi_brightnessev }, { 0 }, };
include/linux/sonypi.h +3 -0
@@ -108,6 +108,9 @@#define SONYPI_EVENT_PKEY_P4 66#define SONYPI_EVENT_PKEY_P5 67#define SONYPI_EVENT_SETTINGKEY_PRESSED 68 +#define SONYPI_EVENT_VOLUME_INC_PRESSED 69 +#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 +#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71/* get/set brightness */ #define SONYPI_IOCGBRT _IOR('v', 0, __u8)
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 62/98 sony-laptop: Eliminate BKL in ioctls
In reply to Len BrownFrom: Alan Cox <[email protected]>
--- drivers/platform/x86/sony-laptop.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/platform/x86/sony-laptop.c +3 -3
@@ -2224,8 +2224,8 @@ static int ec_read16(u8 addr, u16 *value)return 0 ; } -static int sonypi_misc_ioctl (struct inode *ip,struct file *fp, -unsigned int cmd,unsigned long arg) +static long sonypi_misc_ioctl (struct file *fp,unsigned int cmd, +unsigned long arg) {int ret =0 ;void __user *argp = (void __user *)arg;
@@ -2359,7 +2359,7 @@ static const struct file_operations sonypi_misc_fops = { .open = sonypi_misc_open, .release = sonypi_misc_release, .fasync = sonypi_misc_fasync, - .ioctl = sonypi_misc_ioctl, + .unlocked_ioctl = sonypi_misc_ioctl, };static struct miscdevice sonypi_misc_device = {
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 63/98 sony-laptop: detect the ICH9 chipset as Type3
In reply to Len BrownFrom: ISHIKAWA Mutsumi <[email protected]>
--- drivers/platform/x86/sony-laptop.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/platform/x86/sony-laptop.c +7 -0
@@ -1824,6 +1824,13 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev) goto out; } + pcidev =pci_get_device (PCI_VENDOR_ID_INTEL , +PCI_DEVICE_ID_INTEL_ICH9_1 ,NULL ); +if (pcidev) { + dev->control = &spic_types[2 ]; + goto out; + } +/* default */ dev->control = &spic_types[1 ];
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 64/98 sony-laptop: notify the hardware of a state change in wwanpower
In reply to Len BrownFrom: Sergey Yanovich <[email protected]>
--- drivers/platform/x86/sony-laptop.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/platform/x86/sony-laptop.c +1 -0
@@ -2004,6 +2004,7 @@ static void sony_pic_set_wwanpower(u8 state)return ; }sony_pic_call2 (0xB0 , state); +sony_pic_call1 (0x82 ); spic_dev.wwan_power = state;mutex_unlock (&spic_dev.lock); }
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 65/98 sony-laptop: Add FW specific hotkey events
In reply to Len BrownFrom: Anton Veretenenko <[email protected]>
--- drivers/platform/x86/sony-laptop.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/platform/x86/sony-laptop.c +6 -0
@@ -870,6 +870,12 @@ static struct sony_nc_event sony_100_events[] = { { 0x11, SONYPI_EVENT_ANYBUTTON_RELEASED }, { 0x81, SONYPI_EVENT_FNKEY_F1 }, { 0x01, SONYPI_EVENT_FNKEY_RELEASED }, + { 0x82, SONYPI_EVENT_FNKEY_F2 }, + { 0x02, SONYPI_EVENT_FNKEY_RELEASED }, + { 0x83, SONYPI_EVENT_FNKEY_F3 }, + { 0x03, SONYPI_EVENT_FNKEY_RELEASED }, + { 0x84, SONYPI_EVENT_FNKEY_F4 }, + { 0x04, SONYPI_EVENT_FNKEY_RELEASED }, { 0x85, SONYPI_EVENT_FNKEY_F5 }, { 0x05, SONYPI_EVENT_FNKEY_RELEASED }, { 0x86, SONYPI_EVENT_FNKEY_F6 },
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 66/98 sony-laptop: Make sony_pic_set_wwanpower not take mutexes
In reply to Len BrownFrom: Mattia Dongili <[email protected]>
For consistency with __sony_pic_set_bluetoothpower, this is also needed later to allow setting the wwanpower attribute from the resume path and only lock the mutex once.
--- drivers/platform/x86/sony-laptop.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
drivers/platform/x86/sony-laptop.c +5 -7
@@ -2001,18 +2001,14 @@ int sony_pic_camera_command(int command, u8 value)EXPORT_SYMBOL (sony_pic_camera_command);/* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */ -static void sony_pic_set_wwanpower (u8 state) +static void __sony_pic_set_wwanpower (u8 state) { state = !!state; -mutex_lock (&spic_dev.lock); -if (spic_dev.wwan_power == state) { -mutex_unlock (&spic_dev.lock); +if (spic_dev.wwan_power == state)return ; - }sony_pic_call2 (0xB0 , state);sony_pic_call1 (0x82 ); spic_dev.wwan_power = state; -mutex_unlock (&spic_dev.lock); } static ssize_t sony_pic_wwanpower_store(struct device *dev,
@@ -2024,7 +2020,9 @@ static ssize_t sony_pic_wwanpower_store(struct device *dev,return -EINVAL ; value =simple_strtoul (buffer,NULL ,10 ); -sony_pic_set_wwanpower (value); +mutex_lock (&spic_dev.lock); +__sony_pic_set_wwanpower (value); +mutex_unlock (&spic_dev.lock);return count; }
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 67/98 sony-laptop: update copyright
In reply to Len BrownFrom: Mattia Dongili <[email protected]>
--- drivers/platform/x86/sony-laptop.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/sony-laptop.c +1 -1
@@ -2,7 +2,7 @@* ACPI Sony Notebook Control Driver (SNC and SPIC) * * Copyright (C) 2004-2005 Stelian Pop <[email protected]> -* Copyright (C) 2007 Mattia Dongili <[email protected]> +* Copyright (C) 2007-2009 Mattia Dongili <[email protected]> * * Parts of this driver inspired from asus_acpi.c and ibm_acpi.c * which are copyrighted by their respective authors.
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 68/98 sony-laptop: Kill the BKL
In reply to Len BrownFrom: Alessio Igor Bogani <[email protected]>
--- drivers/platform/x86/sony-laptop.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
drivers/platform/x86/sony-laptop.c +8 -4
@@ -46,7 +46,6 @@#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> -#include <linux/smp_lock.h> #include <linux/types.h> #include <linux/backlight.h> #include <linux/platform_device.h>
@@ -2180,10 +2179,15 @@ static int sonypi_misc_release(struct inode *inode, struct file *file)static int sonypi_misc_open (struct inode *inode,struct file *file) {/* Flush input queue on first open */ -lock_kernel (); +unsigned long flags; + +spin_lock_irqsave (sonypi_compat.fifo->lock, flags); +if (atomic_inc_return (&sonypi_compat.open_count) ==1 ) -kfifo_reset (sonypi_compat.fifo); -unlock_kernel (); +__kfifo_reset (sonypi_compat.fifo); + +spin_unlock_irqrestore (sonypi_compat.fifo->lock, flags); +return 0 ; }
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 69/98 ACPI: skip DMI power state check when ACPI disabled
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() exit early when ACPI is disabled.
This skips a DMI check that affects ACPI power management. The
DMI check prints a notice that is misleading when ACPI is disabled.
--- drivers/acpi/bus.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/acpi/bus.c +4 -0
@@ -869,6 +869,10 @@ static int __init acpi_init(void) } }else disable_acpi (); + +if (acpi_disabled) +return result; +/* * If the laptop falls into the DMI check table, the power state check * will be disabled in the course of device power transistion.
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 70/98 ACPI: call acpi_scan_init() explicitly rather than as initcall
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() call acpi_scan_init() directly.
Previously, both acpi_init() and acpi_scan_init() were subsys_initcalls, and acpi_init() was called first based on the link order from the makefile (bus.o before scan.o).
acpi_scan_init() registers the ACPI bus type, creates the root device, and enumerates fixed-feature and namespace devices. All of this must be done after acpi_init(), and it's better to call acpi_scan_init() explicitly rather than rely on the link ordering.
--- drivers/acpi/bus.c | 2 ++ drivers/acpi/internal.h | 2 ++ drivers/acpi/scan.c | 9 +-------- 3 files changed, 5 insertions(+), 8 deletions(-)
drivers/acpi/bus.c +2 -0
@@ -878,6 +878,8 @@ static int __init acpi_init(void)* will be disabled in the course of device power transistion. */ dmi_check_system (power_nocheck_dmi_table); + +acpi_scan_init ();return result; }
drivers/acpi/internal.h +2 -0
@@ -1,5 +1,7 @@/* For use by Linux/ACPI infrastructure, not drivers */ +int acpi_scan_init (void ); +/* -------------------------------------------------------------------------- Power Resource -------------------------------------------------------------------------- */
drivers/acpi/scan.c +1 -8
@@ -1526,16 +1526,11 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)return result; } - -static int __init acpi_scan_init (void ) +int __init acpi_scan_init (void ) {int result;struct acpi_bus_ops ops; - -if (acpi_disabled) -return 0 ; -memset (&ops,0 ,sizeof (ops)); ops.acpi_op_add =1 ; ops.acpi_op_start =1 ;
@@ -1568,5 +1563,3 @@ static int __init acpi_scan_init(void) Done:return result; } - -subsys_initcall (acpi_scan_init);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 71/98 ACPI: call acpi_ec_init() explicitly rather than as initcall
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() call acpi_ec_init() directly. Previously, both were subsys_initcalls. acpi_ec_init() must happen after acpi_init(), and it's better to call it explicitly rather than rely on link ordering.
--- drivers/acpi/bus.c | 1 + drivers/acpi/ec.c | 7 +------ drivers/acpi/internal.h | 1 + 3 files changed, 3 insertions(+), 6 deletions(-)
drivers/acpi/bus.c +1 -0
@@ -880,6 +880,7 @@ static int __init acpi_init(void)dmi_check_system (power_nocheck_dmi_table);acpi_scan_init (); +acpi_ec_init ();return result; }
drivers/acpi/ec.c +1 -6
@@ -1069,13 +1069,10 @@ static struct acpi_driver acpi_ec_driver = { }, }; -static int __init acpi_ec_init (void ) +int __init acpi_ec_init (void ) {int result =0 ; -if (acpi_disabled) -return 0 ; - acpi_ec_dir =proc_mkdir (ACPI_EC_CLASS , acpi_root_dir);if (!acpi_ec_dir)return -ENODEV ;
@@ -1090,8 +1087,6 @@ static int __init acpi_ec_init(void)return result; } -subsys_initcall (acpi_ec_init); -/* EC driver currently not unloadable */ #if 0 static void __exit acpi_ec_exit(void)
drivers/acpi/internal.h +1 -0
@@ -17,6 +17,7 @@ extern int acpi_power_nocheck;/* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */ +int acpi_ec_init (void );int acpi_ec_ecdt_probe (void );int acpi_boot_ec_enable (void );
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 72/98 ACPI: call acpi_power_init() explicitly rather than as initcall
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() call acpi_power_init() directly. Previously, both were subsys_initcalls. acpi_power_init() must happen after acpi_init(), and it's better to call it explicitly rather than rely on link ordering.
--- drivers/acpi/bus.c | 1 + drivers/acpi/internal.h | 2 +- drivers/acpi/power.c | 8 +------- 3 files changed, 3 insertions(+), 8 deletions(-)
drivers/acpi/bus.c +1 -0
@@ -881,6 +881,7 @@ static int __init acpi_init(void)acpi_scan_init ();acpi_ec_init (); +acpi_power_init ();return result; }
drivers/acpi/internal.h +1 -1
@@ -5,7 +5,7 @@ int acpi_scan_init(void);/* -------------------------------------------------------------------------- Power Resource -------------------------------------------------------------------------- */ - +int acpi_power_init (void );int acpi_device_sleep_wake (struct acpi_device *dev,int enable,int sleep_state,int dev_state);int acpi_enable_wakeup_device_power (struct acpi_device *dev,int sleep_state);
drivers/acpi/power.c +1 -7
@@ -773,14 +773,10 @@ static int acpi_power_resume(struct acpi_device *device)return 0 ; } -static int __init acpi_power_init (void ) +int __init acpi_power_init (void ) {int result =0 ; - -if (acpi_disabled) -return 0 ; -INIT_LIST_HEAD (&acpi_power_resource_list); acpi_power_dir =proc_mkdir (ACPI_POWER_CLASS , acpi_root_dir);
@@ -795,5 +791,3 @@ static int __init acpi_power_init(void)return 0 ; } - -subsys_initcall (acpi_power_init);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 73/98 ACPI: call acpi_system_init() explicitly rather than as initcall
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() call acpi_system_init() directly. Previously, both were subsys_initcalls. acpi_system_init() must happen after acpi_init(), and it's better to call it explicitly rather than rely on link ordering.
--- drivers/acpi/bus.c | 1 + drivers/acpi/internal.h | 1 + drivers/acpi/system.c | 9 ++------- 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/acpi/bus.c +1 -0
@@ -882,6 +882,7 @@ static int __init acpi_init(void)acpi_scan_init ();acpi_ec_init ();acpi_power_init (); +acpi_system_init ();return result; }
drivers/acpi/internal.h +1 -0
@@ -1,6 +1,7 @@/* For use by Linux/ACPI infrastructure, not drivers */ int acpi_scan_init (void ); +int acpi_system_init (void );/* -------------------------------------------------------------------------- Power Resource
drivers/acpi/system.c +2 -7
@@ -571,12 +571,9 @@ static int acpi_system_procfs_init(void) }#endif -static int __init acpi_system_init (void ) +int __init acpi_system_init (void ) { -int result =0 ; - -if (acpi_disabled) -return 0 ; +int result; result =acpi_system_procfs_init ();if (result)
@@ -586,5 +583,3 @@ static int __init acpi_system_init(void)return result; } - -subsys_initcall (acpi_system_init);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 74/98 ACPI: call acpi_debug_init() explicitly rather than as initcall
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() call acpi_debug_init() directly. Previously, both were subsys_initcalls. acpi_debug_init() must happen after acpi_init(), and it's better to call it explicitly rather than rely on link ordering.
--- drivers/acpi/bus.c | 1 + drivers/acpi/debug.c | 14 ++++++-------- drivers/acpi/internal.h | 6 ++++++ 3 files changed, 13 insertions(+), 8 deletions(-)
drivers/acpi/bus.c +1 -0
@@ -883,6 +883,7 @@ static int __init acpi_init(void)acpi_ec_init ();acpi_power_init ();acpi_system_init (); +acpi_debug_init ();return result; }
drivers/acpi/debug.c +6 -8
@@ -297,17 +297,15 @@ acpi_system_write_debug(struct file *file,return count; } +#endif -static int __init acpi_debug_init (void ) +int __init acpi_debug_init (void ) { +#ifdef CONFIG_ACPI_PROCFS struct proc_dir_entry *entry;int error =0 ;char *name; - -if (acpi_disabled) -return 0 ; -/* 'debug_layer' [R/W] */ name =ACPI_SYSTEM_FILE_DEBUG_LAYER ; entry =
@@ -338,7 +336,7 @@ static int __init acpi_debug_init(void)remove_proc_entry (ACPI_SYSTEM_FILE_DEBUG_LAYER , acpi_root_dir); error = -ENODEV ; goto Done; -} - -subsys_initcall (acpi_debug_init); +#else +return 0 ;#endif +}
drivers/acpi/internal.h +6 -0
@@ -3,6 +3,12 @@int acpi_scan_init (void );int acpi_system_init (void ); +#ifdef CONFIG_ACPI_DEBUG +int acpi_debug_init (void ); +#else +static inline int acpi_debug_init (void ) {return 0 ; } +#endif +/* -------------------------------------------------------------------------- Power Resource -------------------------------------------------------------------------- */
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 75/98 ACPI: call init_acpi_device_notify() explicitly rather than as initcall
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() call init_acpi_device_notify() directly. Previously, init_acpi_device_notify() was an arch_initcall (sequence 3), so it was called before acpi_init() (a subsys_initcall at sequence 4).
init_acpi_device_notify() sets the platform_notify and platform_notify_remove function pointers. These pointers are not used until acpi_init() enumerates ACPI devices in this path:
acpi_init() acpi_scan_init() acpi_bus_scan() acpi_add_single_object() acpi_device_register() device_add() <use platform_notify>
So it is sufficient to have acpi_init() call init_acpi_device_notify() directly before it enumerates devices.
--- drivers/acpi/bus.c | 1 + drivers/acpi/glue.c | 6 +----- drivers/acpi/internal.h | 1 + 3 files changed, 3 insertions(+), 5 deletions(-)
drivers/acpi/bus.c +1 -0
@@ -855,6 +855,7 @@ static int __init acpi_init(void) acpi_kobj =NULL ; } +init_acpi_device_notify (); result =acpi_bus_init ();if (!result) {
drivers/acpi/glue.c +1 -5
@@ -286,10 +286,8 @@ static int acpi_platform_notify_remove(struct device *dev)return 0 ; } -static int __init init_acpi_device_notify (void ) +int __init init_acpi_device_notify (void ) { -if (acpi_disabled) -return 0 ;if (platform_notify || platform_notify_remove) { printk(KERN_ERR PREFIX "Can't use platform_notify\n");return 0 ;
@@ -298,5 +296,3 @@ static int __init init_acpi_device_notify(void) platform_notify_remove = acpi_platform_notify_remove;return 0 ; } - -arch_initcall (init_acpi_device_notify);
drivers/acpi/internal.h +1 -0
@@ -1,5 +1,6 @@/* For use by Linux/ACPI infrastructure, not drivers */ +int init_acpi_device_notify (void );int acpi_scan_init (void );int acpi_system_init (void );
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 76/98 ACPI: call acpi_sleep_proc_init() explicitly rather than as initcall
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() call acpi_sleep_proc_init() directly. Previously, acpi_sleep_proc_init() was a late_initcall (sequence 7), apparently to make sure that the /proc hierarchy already exists:
2003/02/13 12:38:03-06:00 mochel
acpi sleep: demote sleep proc file creation.
- Make acpi_sleep_proc_init() a late_initcall(), and not called from acpi_sleep_init(). This guarantees that the acpi proc hierarchy is at least there when we create the dang file.
This should no longer be an issue because acpi_bus_init() (called early in acpi_init()) creates acpi_root_dir (/proc/acpi).
--- drivers/acpi/bus.c | 1 + drivers/acpi/internal.h | 6 ++++++ drivers/acpi/proc.c | 7 +------ 3 files changed, 8 insertions(+), 6 deletions(-)
drivers/acpi/bus.c +1 -0
@@ -885,6 +885,7 @@ static int __init acpi_init(void)acpi_power_init ();acpi_system_init ();acpi_debug_init (); +acpi_sleep_proc_init ();return result; }
drivers/acpi/internal.h +6 -0
@@ -33,3 +33,9 @@ int acpi_boot_ec_enable(void);Suspend/Resume -------------------------------------------------------------------------- */ extern int acpi_sleep_init (void ); + +#ifdef CONFIG_ACPI_SLEEP +int acpi_sleep_proc_init (void ); +#else +static inline int acpi_sleep_proc_init (void ) {return 0 ; } +#endif
drivers/acpi/proc.c +1 -6
@@ -496,11 +496,8 @@ static u32 rtc_handler(void *context) }#endif /* HAVE_ACPI_LEGACY_ALARM */ -static int __init acpi_sleep_proc_init (void ) +int __init acpi_sleep_proc_init (void ) { -if (acpi_disabled) -return 0 ; -#ifdef CONFIG_ACPI_PROCFS /* 'sleep' [R/W] */ proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR,
@@ -527,5 +524,3 @@ static int __init acpi_sleep_proc_init(void)return 0 ; } - -late_initcall (acpi_sleep_proc_init);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 77/98 ACPI: call acpi_wakeup_device_init() explicitly rather than as initcall
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch makes acpi_init() call acpi_wakeup_device_init() directly. Previously, acpi_wakeup_device_init() was a late_initcall (sequence 7).
acpi_wakeup_device_init() depends on acpi_wakeup_device_list, which is populated when ACPI devices are enumerated by acpi_init() -> acpi_scan_init(). Using late_initcall is certainly enough to make sure acpi_wakeup_device_list is populated, but it is more than necessary. We can just as easily call acpi_wakeup_device_init() directly from acpi_init(), which avoids the initcall magic.
--- drivers/acpi/bus.c | 1 + drivers/acpi/internal.h | 2 ++ drivers/acpi/wakeup.c | 7 +------ 3 files changed, 4 insertions(+), 6 deletions(-)
drivers/acpi/bus.c +1 -0
@@ -886,6 +886,7 @@ static int __init acpi_init(void)acpi_system_init ();acpi_debug_init ();acpi_sleep_proc_init (); +acpi_wakeup_device_init ();return result; }
drivers/acpi/internal.h +2 -0
@@ -22,6 +22,8 @@ int acpi_power_get_inferred_state(struct acpi_device *device);int acpi_power_transition (struct acpi_device *device,int state);extern int acpi_power_nocheck; +int acpi_wakeup_device_init (void ); +/* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */
drivers/acpi/wakeup.c +1 -6
@@ -138,13 +138,10 @@ void acpi_disable_wakeup_device(u8 sleep_state)spin_unlock (&acpi_device_lock); } -static int __init acpi_wakeup_device_init (void ) +int __init acpi_wakeup_device_init (void ) {struct list_head *node, *next; -if (acpi_disabled) -return 0 ; -spin_lock (&acpi_device_lock);list_for_each_safe (node, next, &acpi_wakeup_device_list) { struct acpi_device *dev = container_of(node,
@@ -165,5 +162,3 @@ static int __init acpi_wakeup_device_init(void)spin_unlock (&acpi_device_lock);return 0 ; } - -late_initcall (acpi_wakeup_device_init);
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 78/98 ACPI: tidy up makefile
In reply to Len BrownFrom: Bjorn Helgaas <[email protected]>
This patch removes the suggestion that ec.o link order is important, because it doesn't matter since acpi_ec_init() is no longer an initcall. And it puts together most of the core modules that are not configurable.
--- drivers/acpi/Makefile | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
drivers/acpi/Makefile +2 -6
@@ -32,10 +32,8 @@ ifdef CONFIG_CPU_FREQ processor-objs += processor_perflib.o endif -obj-y += bus.o glue.o -obj-y += scan.o -# Keep EC driver first. Initialization of others depend on it. -obj-y += ec.o +obj-y += bus.o glue.o scan.o ec.o \ + power.o system.o event.o obj-$(CONFIG_ACPI_AC) += ac.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BUTTON) += button.o
@@ -51,8 +49,6 @@ obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o obj-$(CONFIG_ACPI_PROCESSOR) += processor.o obj-$(CONFIG_ACPI_CONTAINER) += container.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o -obj-y += power.o -obj-y += system.o event.o obj-$(CONFIG_ACPI_DEBUG) += debug.o obj-$(CONFIG_ACPI_NUMA) += numa.o obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 79/98 ACPI: cpufreq: use new bit register access function
In reply to Len BrownFrom: Lin Ming <[email protected]>
Quoted 2 lines
arch/x86/kernel/cpu/cpufreq/longhaul.c: In function 'longhaul_setstate':arch/x86/kernel/cpu/cpufreq/longhaul.c:308: error: implicit declaration of function 'acpi_set_register'
--- arch/x86/kernel/cpu/cpufreq/longhaul.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/cpufreq/longhaul.c +3 -3
@@ -303,7 +303,7 @@ retry_loop:outb (3 ,0x22 ); }else if ((pr !=NULL ) && pr->flags.bm_control) {/* Disable bus master arbitration */ -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,1 ); +acpi_write_bit_register (ACPI_BITREG_ARB_DISABLE ,1 ); }switch (longhaul_version) {
@@ -326,7 +326,7 @@ retry_loop:case TYPE_POWERSAVER :if (longhaul_flags &USE_ACPI_C3 ) {/* Don't allow wakeup */ -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 ); +acpi_write_bit_register (ACPI_BITREG_BUS_MASTER_RLD ,0 );do_powersaver (cx->address, clock_ratio_index, dir); }else {do_powersaver (0 , clock_ratio_index, dir);
@@ -339,7 +339,7 @@ retry_loop:outb (0 ,0x22 ); }else if ((pr !=NULL ) && pr->flags.bm_control) {/* Enable bus master arbitration */ -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 ); +acpi_write_bit_register (ACPI_BITREG_ARB_DISABLE ,0 ); }outb (pic2_mask,0xA1 );/* restore mask */ outb (pic1_mask,0x21 );
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 80/98 ACPI: update thermal for bus_id removal
In reply to Len BrownFrom: Stephen Rothwell <[email protected]>
Quoted 8 lines
drivers/acpi/thermal.c: In function 'thermal_notify':drivers/acpi/thermal.c:768: error: 'struct device' has no member named 'bus_id'Caused by commit
b1569e99c795bf83b4ddf41c4f1c42761ab7f75e("ACPI: move thermal trip handling to generic thermal layer") interacting with commitd4a078fca590911cdf87a8eaffee1b6e643c2558("driver core: get rid of struct device'sbus_idstring array").
--- drivers/acpi/thermal.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/acpi/thermal.c +2 -1
@@ -41,6 +41,7 @@#include <linux/kmod.h> #include <linux/seq_file.h> #include <linux/reboot.h> +#include <linux/device.h> #include <asm/uaccess.h> #include <linux/thermal.h> #include <acpi/acpi_bus.h>
@@ -765,7 +766,7 @@ static int thermal_notify(struct thermal_zone_device *thermal, int trip,acpi_bus_generate_proc_event (tz->device, type,1 );acpi_bus_generate_netlink_event (tz->device->pnp.device_class, - tz->device->dev.bus_id, type,1 ); +dev_name (&tz->device->dev), type,1 );if (trip_type ==THERMAL_TRIP_CRITICAL && nocrt)return 1 ;
Signature · 1 line
1.6.0.6