ACPI patches for 2.6.21
Subsystems (10)
Len Brown
reviewerThis is the main body of patches queued in the ACPI release tree for Linux-2.6.21. If you see any problems with any of them, please speak up now.
Yes, there will be more patches following this batch -- mainly bug-fixes. Please ping me now on any bug fixes that you think are worthy for 2.6.21 inclusion to make sure I've do not miss them.
thanks,
-Len
Len Brown
reviewerThe following series of patches are
in the acpi release tree for inclusion in 2.6.21.
If you see any problems with them, please speak up now.
Yes, there are more coming for 2.6.21 after this. If you are excited about a patch for 2.6.21 that is not included in this patch, please ping me about it now, to be sure I don't miss it.
thanks,
-Len
GIT: Please enter your email below.
GIT: Lines beginning in "GIT: " will be removed.
GIT: Consider including an overall diffstat or table of contents
GIT: for the patch you are writing.
Len Brown
reviewerThe following series of patches are
in the acpi release tree for inclusion in 2.6.21.
If you see any problems with them, please speak up now.
Yes, there are more coming for 2.6.21 after this. If you are excited about a patch for 2.6.21 that is not included in this patch, please ping me about it now, to be sure I don't miss it.
thanks,
-Len
Len Brown
reviewerPATCH 1/140 ACPI: clean up scan.c
From: Zhang Rui <[email protected]>
Adjust the code and make code doing similar things together. No logic changes.
--- drivers/acpi/scan.c | 645 +++++++++++++++++++++++++-------------------------- 1 files changed, 316 insertions(+), 329 deletions(-)
drivers/acpi/scan.c +316 -329
@@ -111,233 +111,6 @@ static struct kset acpi_namespace_kset = { .uevent_ops = &namespace_uevent_ops, }; -static void acpi_device_register (struct acpi_device *device, -struct acpi_device *parent) -{ -int err; - -/* -* Linkage -* ------- -* Link this device to its parent and siblings. -*/ -INIT_LIST_HEAD (&device->children); -INIT_LIST_HEAD (&device->node); -INIT_LIST_HEAD (&device->g_list); -INIT_LIST_HEAD (&device->wakeup_list); - -spin_lock (&acpi_device_lock); -if (device->parent) { -list_add_tail (&device->node, &device->parent->children); -list_add_tail (&device->g_list, &device->parent->g_list); - }else -list_add_tail (&device->g_list, &acpi_device_list); -if (device->wakeup.flags.valid) -list_add_tail (&device->wakeup_list, &acpi_wakeup_device_list); -spin_unlock (&acpi_device_lock); - -strlcpy (device->kobj.name, device->pnp.bus_id,KOBJ_NAME_LEN ); -if (parent) - device->kobj.parent = &parent->kobj; - device->kobj.ktype = &ktype_acpi_ns; - device->kobj.kset = &acpi_namespace_kset; - err =kobject_register (&device->kobj); -if (err <0 ) -printk (KERN_WARNING "%s: kobject_register error: %d\n" , - __FUNCTION__, err); -create_sysfs_device_files (device); -} - -static void acpi_device_unregister (struct acpi_device *device,int type) -{ -spin_lock (&acpi_device_lock); -if (device->parent) { -list_del (&device->node); -list_del (&device->g_list); - }else -list_del (&device->g_list); - -list_del (&device->wakeup_list); - -spin_unlock (&acpi_device_lock); - -acpi_detach_data (device->handle, acpi_bus_data_handler); -remove_sysfs_device_files (device); -kobject_unregister (&device->kobj); -} - -void acpi_bus_data_handler (acpi_handle handle,u32 function,void *context) -{ - -/* TBD */ - -return ; -} - -static int acpi_bus_get_power_flags (struct acpi_device *device) -{ -acpi_status status =0 ; -acpi_handle handle =NULL ; -u32 i =0 ; - - -/* -* Power Management Flags -*/ - status =acpi_get_handle (device->handle,"_PSC" , &handle); -if (ACPI_SUCCESS (status)) - device->power.flags.explicit_get =1 ; - status =acpi_get_handle (device->handle,"_IRC" , &handle); -if (ACPI_SUCCESS (status)) - device->power.flags.inrush_current =1 ; - -/* -* Enumerate supported power management states -*/ -for (i =ACPI_STATE_D0 ; i <=ACPI_STATE_D3 ; i++) { -struct acpi_device_power_state *ps = &device->power.states[i]; -char object_name[5 ] = {'_' ,'P' ,'R' ,'0' + i,'\0' }; - -/* Evaluate "_PRx" to se if power resources are referenced */ -acpi_evaluate_reference (device->handle, object_name,NULL , - &ps->resources); -if (ps->resources.count) { - device->power.flags.power_resources =1 ; - ps->flags.valid =1 ; - } - -/* Evaluate "_PSx" to see if we can do explicit sets */ - object_name[2 ] ='S' ; - status =acpi_get_handle (device->handle, object_name, &handle); -if (ACPI_SUCCESS (status)) { - ps->flags.explicit_set =1 ; - ps->flags.valid =1 ; - } - -/* State is valid if we have some power control */ -if (ps->resources.count || ps->flags.explicit_set) - ps->flags.valid =1 ; - - ps->power =-1 ;/* Unknown - driver assigned */ - ps->latency =-1 ;/* Unknown - driver assigned */ - } - -/* Set defaults for D0 and D3 states (always valid) */ - device->power.states[ACPI_STATE_D0 ].flags.valid =1 ; - device->power.states[ACPI_STATE_D0 ].power =100 ; - device->power.states[ACPI_STATE_D3 ].flags.valid =1 ; - device->power.states[ACPI_STATE_D3 ].power =0 ; - -/* TBD: System wake support and resource requirements. */ - - device->power.state =ACPI_STATE_UNKNOWN ; - -return 0 ; -} - -int acpi_match_ids (struct acpi_device *device,char *ids) -{ -if (device->flags.hardware_id) -if (strstr (ids, device->pnp.hardware_id)) -return 0 ; - -if (device->flags.compatible_ids) { -struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; -int i; - -/* compare multiple _CID entries against driver ids */ -for (i =0 ; i < cid_list->count; i++) { -if (strstr (ids, cid_list->id[i].value)) -return 0 ; - } - } -return -ENOENT ; -} - -static acpi_status -acpi_bus_extract_wakeup_device_power_package (struct acpi_device *device, -union acpi_object *package) -{ -int i =0 ; -union acpi_object *element =NULL ; - -if (!device || !package || (package->package.count <2 )) -return AE_BAD_PARAMETER ; - - element = &(package->package.elements[0 ]); -if (!element) -return AE_BAD_PARAMETER ; -if (element->type ==ACPI_TYPE_PACKAGE ) { -if ((element->package.count <2 ) || - (element->package.elements[0 ].type != -ACPI_TYPE_LOCAL_REFERENCE ) - || (element->package.elements[1 ].type !=ACPI_TYPE_INTEGER )) -return AE_BAD_DATA ; - device->wakeup.gpe_device = - element->package.elements[0 ].reference.handle; - device->wakeup.gpe_number = - (u32 ) element->package.elements[1 ].integer.value; - }else if (element->type ==ACPI_TYPE_INTEGER ) { - device->wakeup.gpe_number = element->integer.value; - }else -return AE_BAD_DATA ; - - element = &(package->package.elements[1 ]); -if (element->type !=ACPI_TYPE_INTEGER ) { -return AE_BAD_DATA ; - } - device->wakeup.sleep_state = element->integer.value; - -if ((package->package.count -2 ) >ACPI_MAX_HANDLES ) { -return AE_NO_MEMORY ; - } - device->wakeup.resources.count = package->package.count -2 ; -for (i =0 ; i < device->wakeup.resources.count; i++) { - element = &(package->package.elements[i +2 ]); -if (element->type !=ACPI_TYPE_ANY ) { -return AE_BAD_DATA ; - } - - device->wakeup.resources.handles[i] = element->reference.handle; - } - -return AE_OK ; -} - -static int acpi_bus_get_wakeup_device_flags (struct acpi_device *device) -{ -acpi_status status =0 ; -struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL }; -union acpi_object *package =NULL ; - - -/* _PRW */ - status =acpi_evaluate_object (device->handle,"_PRW" ,NULL , &buffer); -if (ACPI_FAILURE (status)) { -ACPI_EXCEPTION ((AE_INFO , status,"Evaluating _PRW" )); - goto end; - } - - package = (union acpi_object *)buffer.pointer; - status =acpi_bus_extract_wakeup_device_power_package (device, package); -if (ACPI_FAILURE (status)) { -ACPI_EXCEPTION ((AE_INFO , status,"Extracting _PRW package" )); - goto end; - } - -kfree (buffer.pointer); - - device->wakeup.flags.valid =1 ; -/* Power button, Lid switch always enable wakeup */ -if (!acpi_match_ids (device,"PNP0C0D,PNP0C0C,PNP0C0E" )) - device->wakeup.flags.run_wake =1 ; - - end: -if (ACPI_FAILURE (status)) - device->flags.wake_capable =0 ; -return 0 ; -} -/* -------------------------------------------------------------------------- ACPI sysfs device file support -------------------------------------------------------------------------- */
@@ -447,20 +220,86 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) }/* -------------------------------------------------------------------------- -Performance Management +ACPI Bus operations -------------------------------------------------------------------------- */ +static inline struct acpi_device *to_acpi_dev (struct device * dev) +{ + return container_of(dev, struct acpi_device, dev); +} -static int acpi_bus_get_perf_flags (struct acpi_device *device) +static int root_suspend (struct acpi_device * acpi_dev,pm_message_t state) { - device->performance.state =ACPI_STATE_UNKNOWN ; +struct acpi_device * dev, * next; +int result; + +spin_lock (&acpi_device_lock); +list_for_each_entry_safe_reverse (dev, next, &acpi_device_list, g_list) { +if (dev->driver && dev->driver->ops.suspend) { +spin_unlock (&acpi_device_lock); + result = dev->driver->ops.suspend (dev,0 ); +if (result) { + printk(KERN_ERR PREFIX "[%s - %s] Suspend failed: %d\n", +acpi_device_name (dev), + acpi_device_bid(dev), result); + } +spin_lock (&acpi_device_lock); + } + } +spin_unlock (&acpi_device_lock);return 0 ; } -/* -------------------------------------------------------------------------- -Driver Management --------------------------------------------------------------------------- */ +static int acpi_device_suspend (struct device * dev,pm_message_t state) +{ +struct acpi_device * acpi_dev =to_acpi_dev (dev); -static LIST_HEAD (acpi_bus_drivers); +/* +* For now, we should only register 1 generic device - +* the ACPI root device - and from there, we walk the +* tree of ACPI devices to suspend each one using the +* ACPI driver methods. +*/ +if (acpi_dev->handle ==ACPI_ROOT_OBJECT ) +root_suspend (acpi_dev, state); +return 0 ; +} + +static int root_resume (struct acpi_device * acpi_dev) +{ +struct acpi_device * dev, * next; +int result; + +spin_lock (&acpi_device_lock); +list_for_each_entry_safe (dev, next, &acpi_device_list, g_list) { +if (dev->driver && dev->driver->ops.resume) { +spin_unlock (&acpi_device_lock); + result = dev->driver->ops.resume (dev,0 ); +if (result) { + printk(KERN_ERR PREFIX "[%s - %s] resume failed: %d\n", +acpi_device_name (dev), + acpi_device_bid(dev), result); + } +spin_lock (&acpi_device_lock); + } + } +spin_unlock (&acpi_device_lock); +return 0 ; +} + +static int acpi_device_resume (struct device * dev) +{ +struct acpi_device * acpi_dev =to_acpi_dev (dev); + +/* +* For now, we should only register 1 generic device - +* the ACPI root device - and from there, we walk the +* tree of ACPI devices to resume each one using the +* ACPI driver methods. +*/ +if (acpi_dev->handle ==ACPI_ROOT_OBJECT ) +root_resume (acpi_dev); +return 0 ; +}/** * acpi_bus_match - match device IDs to driver's supported IDs
@@ -478,6 +317,72 @@ acpi_bus_match(struct acpi_device *device, struct acpi_driver *driver)return acpi_match_ids (device, driver->ids); } +static struct bus_type acpi_bus_type = { + .name ="acpi" , + .suspend = acpi_device_suspend, + .resume = acpi_device_resume, +}; + +static void acpi_device_register (struct acpi_device *device, +struct acpi_device *parent) +{ +int err; + +/* +* Linkage +* ------- +* Link this device to its parent and siblings. +*/ +INIT_LIST_HEAD (&device->children); +INIT_LIST_HEAD (&device->node); +INIT_LIST_HEAD (&device->g_list); +INIT_LIST_HEAD (&device->wakeup_list); + +spin_lock (&acpi_device_lock); +if (device->parent) { +list_add_tail (&device->node, &device->parent->children); +list_add_tail (&device->g_list, &device->parent->g_list); + }else +list_add_tail (&device->g_list, &acpi_device_list); +if (device->wakeup.flags.valid) +list_add_tail (&device->wakeup_list, &acpi_wakeup_device_list); +spin_unlock (&acpi_device_lock); + +strlcpy (device->kobj.name, device->pnp.bus_id,KOBJ_NAME_LEN ); +if (parent) + device->kobj.parent = &parent->kobj; + device->kobj.ktype = &ktype_acpi_ns; + device->kobj.kset = &acpi_namespace_kset; + err =kobject_register (&device->kobj); +if (err <0 ) +printk (KERN_WARNING "%s: kobject_register error: %d\n" , + __FUNCTION__, err); +create_sysfs_device_files (device); +} + +static void acpi_device_unregister (struct acpi_device *device,int type) +{ +spin_lock (&acpi_device_lock); +if (device->parent) { +list_del (&device->node); +list_del (&device->g_list); + }else +list_del (&device->g_list); + +list_del (&device->wakeup_list); + +spin_unlock (&acpi_device_lock); + +acpi_detach_data (device->handle, acpi_bus_data_handler); +remove_sysfs_device_files (device); +kobject_unregister (&device->kobj); +} + +/* -------------------------------------------------------------------------- +Driver Management +-------------------------------------------------------------------------- */ +static LIST_HEAD (acpi_bus_drivers); +/** * acpi_bus_driver_init - add a device to a driver * @device: the device to add and initialize
@@ -668,7 +573,6 @@ static int acpi_bus_find_driver(struct acpi_device *device)/* -------------------------------------------------------------------------- Device Enumeration -------------------------------------------------------------------------- */ -acpi_status acpi_bus_get_ejd (acpi_handle handle,acpi_handle *ejd) {
@@ -691,6 +595,183 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) }EXPORT_SYMBOL_GPL (acpi_bus_get_ejd); +void acpi_bus_data_handler (acpi_handle handle,u32 function,void *context) +{ + +/* TBD */ + +return ; +} + +int acpi_match_ids (struct acpi_device *device,char *ids) +{ +if (device->flags.hardware_id) +if (strstr (ids, device->pnp.hardware_id)) +return 0 ; + +if (device->flags.compatible_ids) { +struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; +int i; + +/* compare multiple _CID entries against driver ids */ +for (i =0 ; i < cid_list->count; i++) { +if (strstr (ids, cid_list->id[i].value)) +return 0 ; + } + } +return -ENOENT ; +} + +static int acpi_bus_get_perf_flags (struct acpi_device *device) +{ + device->performance.state =ACPI_STATE_UNKNOWN ; +return 0 ; +} + +static acpi_status +acpi_bus_extract_wakeup_device_power_package (struct acpi_device *device, +union acpi_object *package) +{ +int i =0 ; +union acpi_object *element =NULL ; + +if (!device || !package || (package->package.count <2 )) +return AE_BAD_PARAMETER ; + + element = &(package->package.elements[0 ]); +if (!element) +return AE_BAD_PARAMETER ; +if (element->type ==ACPI_TYPE_PACKAGE ) { +if ((element->package.count <2 ) || + (element->package.elements[0 ].type != +ACPI_TYPE_LOCAL_REFERENCE ) + || (element->package.elements[1 ].type !=ACPI_TYPE_INTEGER )) +return AE_BAD_DATA ; + device->wakeup.gpe_device = + element->package.elements[0 ].reference.handle; + device->wakeup.gpe_number = + (u32 ) element->package.elements[1 ].integer.value; + }else if (element->type ==ACPI_TYPE_INTEGER ) { + device->wakeup.gpe_number = element->integer.value; + }else +return AE_BAD_DATA ; + + element = &(package->package.elements[1 ]); +if (element->type !=ACPI_TYPE_INTEGER ) { +return AE_BAD_DATA ; + } + device->wakeup.sleep_state = element->integer.value; + +if ((package->package.count -2 ) >ACPI_MAX_HANDLES ) { +return AE_NO_MEMORY ; + } + device->wakeup.resources.count = package->package.count -2 ; +for (i =0 ; i < device->wakeup.resources.count; i++) { + element = &(package->package.elements[i +2 ]); +if (element->type !=ACPI_TYPE_ANY ) { +return AE_BAD_DATA ; + } + + device->wakeup.resources.handles[i] = element->reference.handle; + } + +return AE_OK ; +} + +static int acpi_bus_get_wakeup_device_flags (struct acpi_device *device) +{ +acpi_status status =0 ; +struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL }; +union acpi_object *package =NULL ; + + +/* _PRW */ + status =acpi_evaluate_object (device->handle,"_PRW" ,NULL , &buffer); +if (ACPI_FAILURE (status)) { +ACPI_EXCEPTION ((AE_INFO , status,"Evaluating _PRW" )); + goto end; + } + + package = (union acpi_object *)buffer.pointer; + status =acpi_bus_extract_wakeup_device_power_package (device, package); +if (ACPI_FAILURE (status)) { +ACPI_EXCEPTION ((AE_INFO , status,"Extracting _PRW package" )); + goto end; + } + +kfree (buffer.pointer); + + device->wakeup.flags.valid =1 ; +/* Power button, Lid switch always enable wakeup */ +if (!acpi_match_ids (device,"PNP0C0D,PNP0C0C,PNP0C0E" )) + device->wakeup.flags.run_wake =1 ; + + end: +if (ACPI_FAILURE (status)) + device->flags.wake_capable =0 ; +return 0 ; +} + +static int acpi_bus_get_power_flags (struct acpi_device *device) +{ +acpi_status status =0 ; +acpi_handle handle =NULL ; +u32 i =0 ; + + +/* +* Power Management Flags +*/ + status =acpi_get_handle (device->handle,"_PSC" , &handle); +if (ACPI_SUCCESS (status)) + device->power.flags.explicit_get =1 ; + status =acpi_get_handle (device->handle,"_IRC" , &handle); +if (ACPI_SUCCESS (status)) + device->power.flags.inrush_current =1 ; + +/* +* Enumerate supported power management states +*/ +for (i =ACPI_STATE_D0 ; i <=ACPI_STATE_D3 ; i++) { +struct acpi_device_power_state *ps = &device->power.states[i]; +char object_name[5 ] = {'_' ,'P' ,'R' ,'0' + i,'\0' }; + +/* Evaluate "_PRx" to se if power resources are referenced */ +acpi_evaluate_reference (device->handle, object_name,NULL , + &ps->resources); +if (ps->resources.count) { + device->power.flags.power_resources =1 ; + ps->flags.valid =1 ; + } + +/* Evaluate "_PSx" to see if we can do explicit sets */ + object_name[2 ] ='S' ; + status =acpi_get_handle (device->handle, object_name, &handle); +if (ACPI_SUCCESS (status)) { + ps->flags.explicit_set =1 ; + ps->flags.valid =1 ; + } + +/* State is valid if we have some power control */ +if (ps->resources.count || ps->flags.explicit_set) + ps->flags.valid =1 ; + + ps->power =-1 ;/* Unknown - driver assigned */ + ps->latency =-1 ;/* Unknown - driver assigned */ + } + +/* Set defaults for D0 and D3 states (always valid) */ + device->power.states[ACPI_STATE_D0 ].flags.valid =1 ; + device->power.states[ACPI_STATE_D0 ].power =100 ; + device->power.states[ACPI_STATE_D3 ].flags.valid =1 ; + device->power.states[ACPI_STATE_D3 ].power =0 ; + +/* TBD: System wake support and resource requirements. */ + + device->power.state =ACPI_STATE_UNKNOWN ; + +return 0 ; +}static int acpi_bus_get_flags (struct acpi_device *device) {
@@ -1353,100 +1434,6 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)return result; } - -static inline struct acpi_device *to_acpi_dev (struct device * dev) -{ - return container_of(dev, struct acpi_device, dev); -} - - -static int root_suspend (struct acpi_device * acpi_dev,pm_message_t state) -{ -struct acpi_device * dev, * next; -int result; - -spin_lock (&acpi_device_lock); -list_for_each_entry_safe_reverse (dev, next, &acpi_device_list, g_list) { -if (dev->driver && dev->driver->ops.suspend) { -spin_unlock (&acpi_device_lock); - result = dev->driver->ops.suspend (dev,0 ); -if (result) { - printk(KERN_ERR PREFIX "[%s - %s] Suspend failed: %d\n", -acpi_device_name (dev), - acpi_device_bid(dev), result); - } -spin_lock (&acpi_device_lock); - } - } -spin_unlock (&acpi_device_lock); -return 0 ; -} - - -static int acpi_device_suspend (struct device * dev,pm_message_t state) -{ -struct acpi_device * acpi_dev =to_acpi_dev (dev); - -/* -* For now, we should only register 1 generic device - -* the ACPI root device - and from there, we walk the -* tree of ACPI devices to suspend each one using the -* ACPI driver methods. -*/ -if (acpi_dev->handle ==ACPI_ROOT_OBJECT ) -root_suspend (acpi_dev, state); -return 0 ; -} - - - -static int root_resume (struct acpi_device * acpi_dev) -{ -struct acpi_device * dev, * next; -int result; - -spin_lock (&acpi_device_lock); -list_for_each_entry_safe (dev, next, &acpi_device_list, g_list) { -if (dev->driver && dev->driver->ops.resume) { -spin_unlock (&acpi_device_lock); - result = dev->driver->ops.resume (dev,0 ); -if (result) { - printk(KERN_ERR PREFIX "[%s - %s] resume failed: %d\n", -acpi_device_name (dev), - acpi_device_bid(dev), result); - } -spin_lock (&acpi_device_lock); - } - } -spin_unlock (&acpi_device_lock); -return 0 ; -} - - -static int acpi_device_resume (struct device * dev) -{ -struct acpi_device * acpi_dev =to_acpi_dev (dev); - -/* -* For now, we should only register 1 generic device - -* the ACPI root device - and from there, we walk the -* tree of ACPI devices to resume each one using the -* ACPI driver methods. -*/ -if (acpi_dev->handle ==ACPI_ROOT_OBJECT ) -root_resume (acpi_dev); -return 0 ; -} - - -static struct bus_type acpi_bus_type = { - .name ="acpi" , - .suspend = acpi_device_suspend, - .resume = acpi_device_resume, -}; - - -static int __init acpi_scan_init (void ) {int result;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 2/140 ACPI: rename some functions
From: Zhang Rui <[email protected]>
We want the name 'to_acpi_device'.
And the current macro 'to_acpi_device' will be removed after device model is setup.
So just simply rename them.
--- drivers/acpi/scan.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/acpi/scan.c +7 -7
@@ -49,13 +49,13 @@ static void setup_sys_fs_device_files(struct acpi_device *dev,#define remove_sysfs_device_files (dev) \ setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_remove_file) -#define to_acpi_device (n) container_of(n, struct acpi_device, kobj) +#define to_acpi_dev (n) container_of(n, struct acpi_device, kobj)#define to_handle_attr (n) container_of(n, struct acpi_device_attribute, attr);static ssize_t acpi_device_attr_show (struct kobject *kobj,struct attribute *attr,char *buf) { -struct acpi_device *device =to_acpi_device (kobj); +struct acpi_device *device =to_acpi_dev (kobj);struct acpi_device_attribute *attribute =to_handle_attr (attr);return attribute->show ? attribute->show (device, buf) : -EIO ; }
@@ -63,7 +63,7 @@ static ssize_t acpi_device_attr_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t len) { - struct acpi_device *device = to_acpi_device(kobj); + struct acpi_device *device = to_acpi_dev(kobj);struct acpi_device_attribute *attribute =to_handle_attr (attr);return attribute->store ? attribute->store (device, buf, len) : -EIO ; }
@@ -82,7 +82,7 @@ static int namespace_uevent(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size) { - struct acpi_device *dev = to_acpi_device(kobj); + struct acpi_device *dev = to_acpi_dev(kobj);int i =0 ;int len =0 ;
@@ -222,7 +222,7 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count)/* -------------------------------------------------------------------------- ACPI Bus operations -------------------------------------------------------------------------- */ -static inline struct acpi_device *to_acpi_dev (struct device * dev) +static inline struct acpi_device *to_acpi_device (struct device * dev) { return container_of(dev, struct acpi_device, dev); }
@@ -251,7 +251,7 @@ static int root_suspend(struct acpi_device * acpi_dev, pm_message_t state)static int acpi_device_suspend (struct device * dev,pm_message_t state) { -struct acpi_device * acpi_dev =to_acpi_dev (dev); +struct acpi_device * acpi_dev =to_acpi_device (dev);/* * For now, we should only register 1 generic device -
@@ -288,7 +288,7 @@ static int root_resume(struct acpi_device * acpi_dev)static int acpi_device_resume (struct device * dev) { -struct acpi_device * acpi_dev =to_acpi_dev (dev); +struct acpi_device * acpi_dev =to_acpi_device (dev);/* * For now, we should only register 1 generic device -
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 3/140 ACPI: add device_driver and hepler functions
From: Patrick Mochel <[email protected]>
Add device_driver into acpi_driver for driver model. Add helper functions 'to_acpi_device' and 'to_acpi_driver' to get structure acpi_device/acpi_driver by device/device_driver.
--- drivers/acpi/scan.c | 5 ----- include/acpi/acpi_bus.h | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/acpi/scan.c +0 -5
@@ -222,11 +222,6 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count)/* -------------------------------------------------------------------------- ACPI Bus operations -------------------------------------------------------------------------- */ -static inline struct acpi_device *to_acpi_device (struct device * dev) -{ - return container_of(dev, struct acpi_device, dev); -} -static int root_suspend (struct acpi_device * acpi_dev,pm_message_t state) {struct acpi_device * dev, * next;
include/acpi/acpi_bus.h +3 -0
@@ -136,6 +136,7 @@ struct acpi_driver {atomic_t references;char *ids;/* Supported Hardware IDs */ struct acpi_device_ops ops; +struct device_driver drv; };/*
@@ -301,6 +302,8 @@ struct acpi_device { };#define acpi_driver_data (d) ((d)->driver_data) +#define to_acpi_device (d) container_of(d, struct acpi_device, dev) +#define to_acpi_driver (d) container_of(d, struct acpi_driver, drv)/* * Events
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 4/140 ACPI: add ACPI bus_type for driver model
From: Patrick Mochel <[email protected]>
Add ACPI bus_type for Linux driver model.
1. .shutdown method is added into acpi_driver.ops
needed by bus_type operations.
2. remove useless parameter 'int state' in .resume method.
3. change parameter 'int state'
to 'pm_message_t state' in .suspend method.
Note: The new .uevent method mark ACPI drivers by PNPID instead of by name.
Udev script needs to look for "HWID=" or "COMPTID=" to load ACPI drivers as a result.
--- drivers/acpi/battery.c | 4 +- drivers/acpi/fan.c | 8 +- drivers/acpi/scan.c | 158 +++++++++++++++++++++++++++-------------------- drivers/acpi/thermal.c | 4 +- include/acpi/acpi_bus.h | 9 ++- 5 files changed, 105 insertions(+), 78 deletions(-)
drivers/acpi/battery.c +2 -2
@@ -64,7 +64,7 @@ extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);static int acpi_battery_add (struct acpi_device *device);static int acpi_battery_remove (struct acpi_device *device,int type); -static int acpi_battery_resume (struct acpi_device *device,int status); +static int acpi_battery_resume (struct acpi_device *device);static struct acpi_driver acpi_battery_driver = { .name =ACPI_BATTERY_DRIVER_NAME ,
@@ -756,7 +756,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) }/* this is needed to learn about changes made in suspended state */ -static int acpi_battery_resume (struct acpi_device *device,int state) +static int acpi_battery_resume (struct acpi_device *device) {struct acpi_battery *battery;
drivers/acpi/fan.c +4 -4
@@ -48,8 +48,8 @@ MODULE_LICENSE("GPL");static int acpi_fan_add (struct acpi_device *device);static int acpi_fan_remove (struct acpi_device *device,int type); -static int acpi_fan_suspend (struct acpi_device *device,int state); -static int acpi_fan_resume (struct acpi_device *device,int state); +static int acpi_fan_suspend (struct acpi_device *device,pm_message_t state); +static int acpi_fan_resume (struct acpi_device *device);static struct acpi_driver acpi_fan_driver = { .name =ACPI_FAN_DRIVER_NAME ,
@@ -238,7 +238,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type)return 0 ; } -static int acpi_fan_suspend (struct acpi_device *device,int state) +static int acpi_fan_suspend (struct acpi_device *device,pm_message_t state) {if (!device)return -EINVAL ;
@@ -248,7 +248,7 @@ static int acpi_fan_suspend(struct acpi_device *device, int state)return AE_OK ; } -static int acpi_fan_resume (struct acpi_device *device,int state) +static int acpi_fan_resume (struct acpi_device *device) {int result =0 ;int power_state =0 ;
drivers/acpi/scan.c +91 -67
205 lines not on this page · raw message
drivers/acpi/thermal.c +2 -2
@@ -82,7 +82,7 @@ MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");static int acpi_thermal_add (struct acpi_device *device);static int acpi_thermal_remove (struct acpi_device *device,int type); -static int acpi_thermal_resume (struct acpi_device *device,int state); +static int acpi_thermal_resume (struct acpi_device *device);static int acpi_thermal_state_open_fs (struct inode *inode,struct file *file);static int acpi_thermal_temp_open_fs (struct inode *inode,struct file *file);static int acpi_thermal_trip_open_fs (struct inode *inode,struct file *file);
@@ -1356,7 +1356,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)return 0 ; } -static int acpi_thermal_resume (struct acpi_device *device,int state) +static int acpi_thermal_resume (struct acpi_device *device) {struct acpi_thermal *tz =NULL ;int i;
include/acpi/acpi_bus.h +6 -3
@@ -92,13 +92,14 @@ typedef int (*acpi_op_remove) (struct acpi_device * device, int type);typedef int (*acpi_op_lock ) (struct acpi_device * device,int type);typedef int (*acpi_op_start ) (struct acpi_device * device);typedef int (*acpi_op_stop ) (struct acpi_device * device,int type); -typedef int (*acpi_op_suspend ) (struct acpi_device * device,int state); -typedef int (*acpi_op_resume ) (struct acpi_device * device,int state); +typedef int (*acpi_op_suspend ) (struct acpi_device * device,pm_message_t state); +typedef int (*acpi_op_resume ) (struct acpi_device * device);typedef int (*acpi_op_scan ) (struct acpi_device * device);typedef int (*acpi_op_bind ) (struct acpi_device * device);typedef int (*acpi_op_unbind ) (struct acpi_device * device);typedef int (*acpi_op_match ) (struct acpi_device * device,struct acpi_driver * driver); +typedef int (*acpi_op_shutdown ) (struct acpi_device * device);struct acpi_bus_ops {u32 acpi_op_add:1 ;
@@ -112,7 +113,8 @@ struct acpi_bus_ops { u32 acpi_op_bind:1; u32 acpi_op_unbind:1; u32 acpi_op_match:1; - u32 reserved:21; + u32 acpi_op_shutdown:1; + u32 reserved:20; };struct acpi_device_ops {
@@ -127,6 +129,7 @@ struct acpi_device_ops {acpi_op_bind bind;acpi_op_unbind unbind;acpi_op_match match; +acpi_op_shutdown shutdown; };struct acpi_driver {
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 5/140 ACPI: change registration interface to follow driver model
From: Patrick Mochel <[email protected]>
ACPI device/driver registration Interfaces are modified to follow Linux driver model.
--- drivers/acpi/scan.c | 175 ++++++++--------------------------------------- include/acpi/acpi_bus.h | 3 +- 2 files changed, 30 insertions(+), 148 deletions(-)
drivers/acpi/scan.c +29 -146
@@ -25,7 +25,7 @@ DEFINE_SPINLOCK(acpi_device_lock);LIST_HEAD (acpi_wakeup_device_list); -static void acpi_device_release (struct kobject *kobj) +static void acpi_device_release_legacy (struct kobject *kobj) { struct acpi_device *dev = container_of(kobj, struct acpi_device, kobj);kfree (dev->pnp.cid_list);
@@ -75,7 +75,7 @@ static struct sysfs_ops acpi_device_sysfs_ops = {static struct kobj_type ktype_acpi_ns = { .sysfs_ops = &acpi_device_sysfs_ops, - .release = acpi_device_release, + .release = acpi_device_release_legacy, }; static int namespace_uevent(struct kset *kset, struct kobject *kobj,
@@ -222,6 +222,14 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count)/* -------------------------------------------------------------------------- ACPI Bus operations -------------------------------------------------------------------------- */ +static void acpi_device_release (struct device *dev) +{ +struct acpi_device *acpi_dev =to_acpi_device (dev); + +kfree (acpi_dev->pnp.cid_list); +kfree (acpi_dev); +} +static int acpi_device_suspend (struct device *dev,pm_message_t state) {struct acpi_device *acpi_dev =to_acpi_device (dev);
@@ -377,6 +385,14 @@ static void acpi_device_register(struct acpi_device *device,printk (KERN_WARNING "%s: kobject_register error: %d\n" , __FUNCTION__, err);create_sysfs_device_files (device); + +if (device->parent) + device->dev.parent = &parent->dev; + device->dev.bus = &acpi_bus_type; +device_initialize (&device->dev); +sprintf (device->dev.bus_id,"%s" , device->pnp.bus_id); + device->dev.release = &acpi_device_release; +device_add (&device->dev); }static void acpi_device_unregister (struct acpi_device *device,int type)
@@ -395,20 +411,20 @@ static void acpi_device_unregister(struct acpi_device *device, int type)acpi_detach_data (device->handle, acpi_bus_data_handler);remove_sysfs_device_files (device);kobject_unregister (&device->kobj); + +device_unregister (&device->dev); }/* -------------------------------------------------------------------------- Driver Management -------------------------------------------------------------------------- */ -static LIST_HEAD (acpi_bus_drivers); -/** * acpi_bus_driver_init - add a device to a driver * @device: the device to add and initialize * @driver: driver for the device * * Used to initialize a device via its device driver. Called whenever a -* driver is bound to a device. Invokes the driver's add() and start() ops. +* driver is bound to a device. Invokes the driver's add() ops. */ static int acpi_bus_driver_init (struct acpi_device *device,struct acpi_driver *driver)
@@ -459,57 +475,6 @@ static int acpi_start_single_object(struct acpi_device *device)return result; } -static void acpi_driver_attach (struct acpi_driver *drv) -{ -struct list_head *node, *next; - - -spin_lock (&acpi_device_lock); -list_for_each_safe (node, next, &acpi_device_list) { -struct acpi_device *dev = - container_of(node, struct acpi_device, g_list); - -if (dev->driver || !dev->status.present) -continue ; -spin_unlock (&acpi_device_lock); - -if (!acpi_bus_match (&(dev->dev), &(drv->drv))) { -if (!acpi_bus_driver_init (dev, drv)) { -acpi_start_single_object (dev); -atomic_inc (&drv->references); -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Found driver [%s] for device [%s]\n" , - drv->name, dev->pnp.bus_id)); - } - } -spin_lock (&acpi_device_lock); - } -spin_unlock (&acpi_device_lock); -} - -static void acpi_driver_detach (struct acpi_driver *drv) -{ -struct list_head *node, *next; - - -spin_lock (&acpi_device_lock); -list_for_each_safe (node, next, &acpi_device_list) { -struct acpi_device *dev = - container_of(node, struct acpi_device, g_list); - -if (dev->driver == drv) { -spin_unlock (&acpi_device_lock); -if (drv->ops.remove) - drv->ops.remove (dev,ACPI_BUS_REMOVAL_NORMAL ); -spin_lock (&acpi_device_lock); - dev->driver =NULL ; - dev->driver_data =NULL ; -atomic_dec (&drv->references); - } - } -spin_unlock (&acpi_device_lock); -} -/** * acpi_bus_register_driver - register a driver with the ACPI bus * @driver: driver being registered
@@ -520,16 +485,16 @@ static void acpi_driver_detach(struct acpi_driver *drv)*/ int acpi_bus_register_driver (struct acpi_driver *driver) { +int ret;if (acpi_disabled)return -ENODEV ; + driver->drv.name = driver->name; + driver->drv.bus = &acpi_bus_type; + driver->drv.owner = driver->owner; -spin_lock (&acpi_device_lock); -list_add_tail (&driver->node, &acpi_bus_drivers); -spin_unlock (&acpi_device_lock); -acpi_driver_attach (driver); - -return 0 ; + ret =driver_register (&driver->drv); +return ret; }EXPORT_SYMBOL (acpi_bus_register_driver);
@@ -543,52 +508,11 @@ EXPORT_SYMBOL(acpi_bus_register_driver);*/ void acpi_bus_unregister_driver (struct acpi_driver *driver) { -acpi_driver_detach (driver); - -if (!atomic_read (&driver->references)) { -spin_lock (&acpi_device_lock); -list_del_init (&driver->node); -spin_unlock (&acpi_device_lock); - } -return ; +driver_unregister (&driver->drv); }EXPORT_SYMBOL (acpi_bus_unregister_driver); -/** -* acpi_bus_find_driver - check if there is a driver installed for the device -* @device: device that we are trying to find a supporting driver for -* -* Parses the list of registered drivers looking for a driver applicable for -* the specified device. -*/ -static int acpi_bus_find_driver (struct acpi_device *device) -{ -int result =0 ; -struct list_head *node, *next; - - -spin_lock (&acpi_device_lock); -list_for_each_safe (node, next, &acpi_bus_drivers) { -struct acpi_driver *driver = - container_of(node, struct acpi_driver, node); - -atomic_inc (&driver->references); -spin_unlock (&acpi_device_lock); -if (!acpi_bus_match (&(device->dev), &(driver->drv))) { - result =acpi_bus_driver_init (device, driver); -if (!result) - goto Done; - } -atomic_dec (&driver->references); -spin_lock (&acpi_device_lock); - } -spin_unlock (&acpi_device_lock); - - Done: -return result; -} -/* -------------------------------------------------------------------------- Device Enumeration -------------------------------------------------------------------------- */
@@ -1033,32 +957,10 @@ static void acpi_device_get_debug_info(struct acpi_device *device,static int acpi_bus_remove (struct acpi_device *dev,int rmdevice) { -int result =0 ; -struct acpi_driver *driver; - -if (!dev)return -EINVAL ; - driver = dev->driver; - -if ((driver) && (driver->ops.remove)) { - -if (driver->ops.stop) { - result = driver->ops.stop (dev,ACPI_BUS_REMOVAL_EJECT ); -if (result) -return result; - } - - result = dev->driver->ops.remove (dev,ACPI_BUS_REMOVAL_EJECT ); -if (result) { -return result; - } - -atomic_dec (&dev->driver->references); - dev->driver =NULL ; -acpi_driver_data (dev) =NULL ; - } +device_release_driver (&dev->dev);if (!rmdevice)return 0 ;
@@ -1193,17 +1095,6 @@ acpi_add_single_object(struct acpi_device **child, device->parent->ops.bind (device); } -/* -* Locate & Attach Driver -* ---------------------- -* If there's a hardware id (_HID) or compatible ids (_CID) we check -* to see if there's a driver installed for this kind of device. Note -* that drivers can install before or after a device is enumerated. -* -* TBD: Assumes LDM provides driver hot-plug capability. -*/ -acpi_bus_find_driver (device); - end:if (!result) *child = device;
@@ -1484,14 +1375,6 @@ static int __init acpi_scan_init(void)if (result) goto Done; - acpi_root->dev.bus = &acpi_bus_type; -snprintf (acpi_root->dev.bus_id,BUS_ID_SIZE ,"%s" , acpi_bus_type.name); - result =device_register (&acpi_root->dev); -if (result) { -/* We don't want to quit even if we failed to add suspend/resume */ - printk(KERN_ERR PREFIX "Could not register device\n"); - } -/* * Enumerate devices in the ACPI namespace. */
include/acpi/acpi_bus.h +1 -2
@@ -133,13 +133,12 @@ struct acpi_device_ops { };struct acpi_driver { -struct list_head node;char name[80 ];char class[80 ]; -atomic_t references;char *ids;/* Supported Hardware IDs */ struct acpi_device_ops ops;struct device_driver drv; +struct module *owner; };/*
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 6/140 ACPI: adjust init order
From: Li Shaohua <[email protected]>
Adjust link order to add ACPI devices to global list before PCI devices. In addition, acpi_bus type must be initialized before any driver loads.
--- drivers/acpi/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/Makefile +1 -1
@@ -37,6 +37,7 @@ endif obj-y += sleep/ obj-y += bus.o glue.o +obj-y += scan.o motherboard.o obj-$(CONFIG_ACPI_AC) += ac.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BUTTON) += button.o
@@ -56,7 +57,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o obj-$(CONFIG_ACPI_IBM) += ibm_acpi.o obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o -obj-y += scan.o motherboard.o obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o obj-y += cm_sbs.o obj-$(CONFIG_ACPI_SBS) += i2c_ec.o sbs.o
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 7/140 ACPI: convert to sysfs framework
From: Patrick Mochel <[email protected]>
Setup new sysfs framework
1. Remove /sys/firmware/acpi
2. Add ACPI device in device tree.
File "eject" for every device that has _EJ0 method is moved from /sys/firmware to /sys/devices.
Operation on this file is exactly the same as before. i.e. echo 1 to "eject" will cause hot removal of this device. Corresponding changes should be made in userspace for hot removal.
--- drivers/acpi/bus.c | 2 +- drivers/acpi/container.c | 6 +- drivers/acpi/processor_core.c | 8 +- drivers/acpi/scan.c | 187 +++++++++-------------------------------- include/acpi/acpi_bus.h | 1 - 5 files changed, 49 insertions(+), 155 deletions(-)
drivers/acpi/bus.c +1 -1
@@ -195,7 +195,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)if (!device->flags.power_manageable) {ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Device `[%s]' is not power manageable\n" , - device->kobj.name)); + device->dev.kobj.name));return -ENODEV ; }/*
drivers/acpi/container.c +3 -3
@@ -168,7 +168,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)if (ACPI_FAILURE (status) || !device) { result =container_device_add (&device, handle);if (!result) -kobject_uevent (&device->kobj, +kobject_uevent (&device->dev.kobj,KOBJ_ONLINE );else printk ("Failed to add container\n" );
@@ -176,13 +176,13 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) }else {if (ACPI_SUCCESS (status)) {/* device exist and this is a remove request */ -kobject_uevent (&device->kobj,KOBJ_OFFLINE ); +kobject_uevent (&device->dev.kobj,KOBJ_OFFLINE ); } }break ;case ACPI_NOTIFY_EJECT_REQUEST :if (!acpi_bus_get_device (handle, &device) && device) { -kobject_uevent (&device->kobj,KOBJ_OFFLINE ); +kobject_uevent (&device->dev.kobj,KOBJ_OFFLINE ); }break ;default :
drivers/acpi/processor_core.c +4 -4
@@ -711,7 +711,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)return -ENODEV ;if ((pr->id >=0 ) && (pr->id <NR_CPUS )) { -kobject_uevent (&(*device)->kobj,KOBJ_ONLINE ); +kobject_uevent (&(*device)->dev.kobj,KOBJ_ONLINE ); }return 0 ; }
@@ -749,13 +749,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) }if (pr->id >=0 && (pr->id <NR_CPUS )) { -kobject_uevent (&device->kobj,KOBJ_OFFLINE ); +kobject_uevent (&device->dev.kobj,KOBJ_OFFLINE );break ; } result =acpi_processor_start (device);if ((!result) && ((pr->id >=0 ) && (pr->id <NR_CPUS ))) { -kobject_uevent (&device->kobj,KOBJ_ONLINE ); +kobject_uevent (&device->dev.kobj,KOBJ_ONLINE ); }else { printk(KERN_ERR PREFIX "Device [%s] failed to start\n", acpi_device_bid(device));
@@ -778,7 +778,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) }if ((pr->id <NR_CPUS ) && (cpu_present (pr->id))) -kobject_uevent (&device->kobj,KOBJ_OFFLINE ); +kobject_uevent (&device->dev.kobj,KOBJ_OFFLINE );break ;default : ACPI_DEBUG_PRINT((ACPI_DB_INFO,
drivers/acpi/scan.c +41 -146
256 lines not on this page · raw message
include/acpi/acpi_bus.h +0 -1
@@ -299,7 +299,6 @@ struct acpi_device {struct acpi_device_ops ops;struct acpi_driver *driver;void *driver_data; -struct kobject kobj;struct device dev; };
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 8/140 ACPI: add acpi_bus_ops in acpi_device
From: Li Shaohua <[email protected]>
Add acpi_bus_ops in acpi_device to support acpi hot plug.
NOTE: Two methods .add and .start in acpi_driver.ops are
called separately to probe ACPI devices, while only .probe method is called in driver model. As executing .add and .start separately is critical for ACPI device hot plug, we use acpi_bus_ops to distinguish different code path.
--- drivers/acpi/scan.c | 55 ++++++++++++++++++++++++----------------------- include/acpi/acpi_bus.h | 1 + 2 files changed, 29 insertions(+), 27 deletions(-)
drivers/acpi/scan.c +28 -27
@@ -212,7 +212,8 @@ static int acpi_device_probe(struct device * dev) ret =acpi_bus_driver_init (acpi_dev, acpi_drv);if (!ret) { -acpi_start_single_object (acpi_dev); +if (acpi_dev->bus_ops.acpi_op_start) +acpi_start_single_object (acpi_dev);ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Found driver [%s] for device [%s]\n" , acpi_drv->name, acpi_dev->pnp.bus_id));
@@ -305,7 +306,6 @@ static void acpi_device_unregister(struct acpi_device *device, int type)list_del (&device->g_list);list_del (&device->wakeup_list); -spin_unlock (&acpi_device_lock);acpi_detach_data (device->handle, acpi_bus_data_handler);
@@ -876,7 +876,8 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)static int acpi_add_single_object (struct acpi_device **child, -struct acpi_device *parent,acpi_handle handle,int type) +struct acpi_device *parent,acpi_handle handle,int type, +struct acpi_bus_ops *ops) {int result =0 ;struct acpi_device *device =NULL ;
@@ -894,6 +895,8 @@ acpi_add_single_object(struct acpi_device **child, device->handle = handle; device->parent = parent; + device->bus_ops = *ops;/* workround for not call .start */ +acpi_device_get_busid (device, handle, type);
@@ -1079,14 +1082,14 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)if (ops->acpi_op_add) status =acpi_add_single_object (&child, parent, - chandle, type); + chandle, type, ops);else status =acpi_bus_get_device (chandle, &child);if (ACPI_FAILURE (status))continue ; -if (ops->acpi_op_start) { +if (ops->acpi_op_start && !(ops->acpi_op_add)) { status =acpi_start_single_object (child);if (ACPI_FAILURE (status))continue ;
@@ -1124,13 +1127,13 @@ acpi_bus_add(struct acpi_device **child,int result;struct acpi_bus_ops ops; +memset (&ops,0 ,sizeof (ops)); + ops.acpi_op_add =1 ; - result =acpi_add_single_object (child, parent, handle, type); -if (!result) { -memset (&ops,0 ,sizeof (ops)); - ops.acpi_op_add =1 ; + result =acpi_add_single_object (child, parent, handle, type, &ops); +if (!result) result =acpi_bus_scan (*child, &ops); - } +return result; }
@@ -1216,28 +1219,30 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) {int result =0 ;struct acpi_device *device =NULL ; - +struct acpi_bus_ops ops;if (!root)return -ENODEV ; +memset (&ops,0 ,sizeof (ops)); + ops.acpi_op_add =1 ; + ops.acpi_op_start =1 ; +/* * Enumerate all fixed-feature devices. */ if (acpi_fadt.pwr_button ==0 ) { result =acpi_add_single_object (&device, acpi_root,NULL , -ACPI_BUS_TYPE_POWER_BUTTON ); -if (!result) - result =acpi_start_single_object (device); +ACPI_BUS_TYPE_POWER_BUTTON , + &ops); }if (acpi_fadt.sleep_button ==0 ) { result =acpi_add_single_object (&device, acpi_root,NULL , -ACPI_BUS_TYPE_SLEEP_BUTTON ); -if (!result) - result =acpi_start_single_object (device); +ACPI_BUS_TYPE_SLEEP_BUTTON , + &ops); }return result;
@@ -1252,6 +1257,10 @@ static int __init acpi_scan_init(void)if (acpi_disabled)return 0 ; +memset (&ops,0 ,sizeof (ops)); + ops.acpi_op_add =1 ; + ops.acpi_op_start =1 ; + result =bus_register (&acpi_bus_type);if (result) {/* We don't want to quit even if we failed to add suspend/resume */
@@ -1262,11 +1271,7 @@ static int __init acpi_scan_init(void)* Create the root device in the bus's device tree */ result =acpi_add_single_object (&acpi_root,NULL ,ACPI_ROOT_OBJECT , -ACPI_BUS_TYPE_SYSTEM ); -if (result) - goto Done; - - result =acpi_start_single_object (acpi_root); +ACPI_BUS_TYPE_SYSTEM , &ops);if (result) goto Done;
@@ -1274,12 +1279,8 @@ static int __init acpi_scan_init(void)* Enumerate devices in the ACPI namespace. */ result =acpi_bus_scan_fixed (acpi_root); -if (!result) { -memset (&ops,0 ,sizeof (ops)); - ops.acpi_op_add =1 ; - ops.acpi_op_start =1 ; +if (!result) result =acpi_bus_scan (acpi_root, &ops); - }if (result)acpi_device_unregister (acpi_root,ACPI_BUS_REMOVAL_NORMAL );
include/acpi/acpi_bus.h +1 -0
@@ -300,6 +300,7 @@ struct acpi_device {struct acpi_driver *driver;void *driver_data;struct device dev; +struct acpi_bus_ops bus_ops;/* workaround for different code path for hotplug */ };#define acpi_driver_data (d) ((d)->driver_data)
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 9/140 ACPI: add acpi_bus_removal_type in acpi_device
From: Li Shaohua <[email protected]>
Add removal_type in structure acpi_device for hot removal.
ACPI_BUS_REMOVAL_EJECT is used for ACPI device hot removal. Only one parameter is allowed in .remove method due to driver model. So removal_type is added to indicate different removal type.
--- drivers/acpi/scan.c | 6 ++++-- include/acpi/acpi_bus.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/acpi/scan.c +4 -2
@@ -229,9 +229,9 @@ static int acpi_device_remove(struct device * dev)if (acpi_drv) {if (acpi_drv->ops.stop) - acpi_drv->ops.stop (acpi_dev,ACPI_BUS_REMOVAL_NORMAL ); + acpi_drv->ops.stop (acpi_dev, acpi_dev->removal_type);if (acpi_drv->ops.remove) - acpi_drv->ops.remove (acpi_dev,ACPI_BUS_REMOVAL_NORMAL ); + acpi_drv->ops.remove (acpi_dev, acpi_dev->removal_type); } acpi_dev->driver =NULL ;acpi_driver_data (dev) =NULL ;
@@ -294,6 +294,7 @@ static void acpi_device_register(struct acpi_device *device,device_add (&device->dev);acpi_device_setup_files (device); + device->removal_type =ACPI_BUS_REMOVAL_NORMAL ; }static void acpi_device_unregister (struct acpi_device *device,int type)
@@ -859,6 +860,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)if (!dev)return -EINVAL ; + dev->removal_type =ACPI_BUS_REMOVAL_EJECT ;device_release_driver (&dev->dev);if (!rmdevice)
include/acpi/acpi_bus.h +1 -0
@@ -301,6 +301,7 @@ struct acpi_device {void *driver_data;struct device dev;struct acpi_bus_ops bus_ops;/* workaround for different code path for hotplug */ +enum acpi_bus_removal_type removal_type;/* indicate for different removal type */ };#define acpi_driver_data (d) ((d)->driver_data)
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 10/140 ACPI: consolidate two motherboard drivers into one
From: Li Shaohua <[email protected]>
Consolidate motherboard1 and motherboard2 drivers into one so that driver core doesn't complain that two drivers have the same name.
--- drivers/acpi/motherboard.c | 19 ++++--------------- 1 files changed, 4 insertions(+), 15 deletions(-)
drivers/acpi/motherboard.c +4 -15
@@ -33,8 +33,7 @@ACPI_MODULE_NAME ("acpi_motherboard" ) /* Dell use PNP0C01 instead of PNP0C02 */ -#define ACPI_MB_HID1 "PNP0C01" -#define ACPI_MB_HID2 "PNP0C02" +#define ACPI_MB_HID "PNP0C01,PNP0C02"/** * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved * Doesn't care about the failure of 'request_region', since other may reserve
@@ -110,19 +109,10 @@ static int acpi_motherboard_add(struct acpi_device *device)return 0 ; } -static struct acpi_driver acpi_motherboard_driver1 = { +static struct acpi_driver acpi_motherboard_driver = { .name ="motherboard" , .class ="" , - .ids =ACPI_MB_HID1 , - .ops = { - .add = acpi_motherboard_add, - }, -}; - -static struct acpi_driver acpi_motherboard_driver2 = { - .name ="motherboard" , - .class ="" , - .ids =ACPI_MB_HID2 , + .ids =ACPI_MB_HID , .ops = { .add = acpi_motherboard_add, },
@@ -173,8 +163,7 @@ static void __init acpi_reserve_resources(void)static int __init acpi_motherboard_init (void ) { -acpi_bus_register_driver (&acpi_motherboard_driver1); -acpi_bus_register_driver (&acpi_motherboard_driver2); +acpi_bus_register_driver (&acpi_motherboard_driver);/* * Guarantee motherboard IO reservation first * This module must run after scan.c
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 11/140 ACPI: Convert ACPI PCI .bind/.unbind to use PCI bridge driver
From: Li Shaohua <[email protected]>
acpi_device had a .bind/.unbind methods, but Linux driver model does not. Cut ACPI PCI code over to use the Linux driver model methods.
Convert bind/unbind to use a new pci bridge driver. The driver will add/remove _PRT, so we can eventually remove .bind/.unbind methods.
--- drivers/acpi/pci_bind.c | 56 +++++++++++++++++++++++++++++++++++++++++++--- drivers/acpi/pci_root.c | 5 ---- drivers/acpi/scan.c | 17 -------------- 3 files changed, 52 insertions(+), 26 deletions(-)
drivers/acpi/pci_bind.c +52 -4
@@ -223,8 +223,6 @@ int acpi_pci_bind(struct acpi_device *device) data->id.segment, data->id.bus, data->id.device, data->id.function)); data->bus = data->dev->subordinate; - device->ops.bind = acpi_pci_bind; - device->ops.unbind = acpi_pci_unbind; }/*
@@ -354,8 +352,6 @@ acpi_pci_bind_root(struct acpi_device *device, data->id = *id; data->bus = bus; - device->ops.bind = acpi_pci_bind; - device->ops.unbind = acpi_pci_unbind;acpi_get_name (device->handle,ACPI_FULL_PATHNAME , &buffer);
@@ -378,3 +374,55 @@ acpi_pci_bind_root(struct acpi_device *device,return result; } + +#define ACPI_PCI_BRIDGE_DRIVER_NAME "ACPI PCI Bridge Driver" + +static int acpi_pci_bridge_add (struct acpi_device *device); +static int acpi_pci_bridge_remove (struct acpi_device *device,int type); +static int acpi_pci_bridge_match (struct acpi_device *device, +struct acpi_driver *driver); +static struct acpi_driver acpi_pci_bridge_driver = { + .name =ACPI_PCI_BRIDGE_DRIVER_NAME , + .ops = { + .add = acpi_pci_bridge_add, + .remove = acpi_pci_bridge_remove, + .match = acpi_pci_bridge_match, + }, +}; + +static int acpi_pci_bridge_match (struct acpi_device *device, +struct acpi_driver *driver) +{ +acpi_status status; +acpi_handle handle; + +/* pci bridge has _PRT but isn't PNP0A03 */ + status =acpi_get_handle (device->handle,METHOD_NAME__PRT , &handle); +if (ACPI_FAILURE (status)) +return -ENODEV ; +if (!acpi_match_ids (device,"PNP0A03" )) +return -ENODEV ; +return 0 ; +} + +static int acpi_pci_bridge_add (struct acpi_device *device) +{ +return acpi_pci_bind (device); +} + +static int acpi_pci_bridge_remove (struct acpi_device *device,int type) +{ +return acpi_pci_unbind (device); +} + +static int __init acpi_pci_bridge_init (void ) +{ +if (acpi_pci_disabled) +return 0 ; +if (acpi_bus_register_driver (&acpi_pci_bridge_driver) <0 ) +return -ENODEV ; +return 0 ; +} + +/* Should be called after ACPI pci root driver */ +subsys_initcall (acpi_pci_bridge_init);
drivers/acpi/pci_root.c +0 -5
@@ -175,11 +175,6 @@ static int acpi_pci_root_add(struct acpi_device *device)strcpy (acpi_device_class (device),ACPI_PCI_ROOT_CLASS );acpi_driver_data (device) = root; -/* -* TBD: Doesn't the bus driver automatically set this? -*/ - device->ops.bind = acpi_pci_bind; -/* * Segment * -------
drivers/acpi/scan.c +0 -17
@@ -866,11 +866,6 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)if (!rmdevice)return 0 ; -if (dev->flags.bus_address) { -if ((dev->parent) && (dev->parent->ops.unbind)) - dev->parent->ops.unbind (dev); - } -acpi_device_unregister (dev,ACPI_BUS_REMOVAL_EJECT );return 0 ;
@@ -987,18 +982,6 @@ acpi_add_single_object(struct acpi_device **child,acpi_device_register (device, parent); -/* -* Bind _ADR-Based Devices -* ----------------------- -* If there's a a bus address (_ADR) then we utilize the parent's -* 'bind' function (if exists) to bind the ACPI- and natively- -* enumerated device representations. -*/ -if (device->flags.bus_address) { -if (device->parent && device->parent->ops.bind) - device->parent->ops.bind (device); - } - end:if (!result) *child = device;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 12/140 ACPI: Set fake hid for non-PNPID ACPI devices
From: Zhang Rui <[email protected]>
We do this mainly because:
1. hid is used to match ACPI devices and drivers.
.match method which is incompatible to driver model can be deleted from acpi_driver.ops then.
2. As the .uevent method mark ACPI drivers by PNPID,
fake hid is set to non-PNPID devices so that udev script can load the right ACPI driver by looking for "HWID = " or "COMPTID = ".
--- drivers/acpi/pci_bind.c | 20 +------------- drivers/acpi/scan.c | 59 +++++++++++++++++++++++++++++++++++++++++- drivers/acpi/video.c | 37 +-------------------------- include/acpi/acpi_bus.h | 6 +--- include/acpi/acpi_drivers.h | 2 + 5 files changed, 63 insertions(+), 61 deletions(-)
drivers/acpi/pci_bind.c +2 -18
@@ -379,32 +379,16 @@ acpi_pci_bind_root(struct acpi_device *device,static int acpi_pci_bridge_add (struct acpi_device *device);static int acpi_pci_bridge_remove (struct acpi_device *device,int type); -static int acpi_pci_bridge_match (struct acpi_device *device, -struct acpi_driver *driver); +static struct acpi_driver acpi_pci_bridge_driver = { .name =ACPI_PCI_BRIDGE_DRIVER_NAME , + .ids =ACPI_PCI_BRIDGE_HID , .ops = { .add = acpi_pci_bridge_add, .remove = acpi_pci_bridge_remove, - .match = acpi_pci_bridge_match, }, }; -static int acpi_pci_bridge_match (struct acpi_device *device, -struct acpi_driver *driver) -{ -acpi_status status; -acpi_handle handle; - -/* pci bridge has _PRT but isn't PNP0A03 */ - status =acpi_get_handle (device->handle,METHOD_NAME__PRT , &handle); -if (ACPI_FAILURE (status)) -return -ENODEV ; -if (!acpi_match_ids (device,"PNP0A03" )) -return -ENODEV ; -return 0 ; -} -static int acpi_pci_bridge_add (struct acpi_device *device) {return acpi_pci_bind (device);
drivers/acpi/scan.c +57 -2
77 lines not on this page · raw message
drivers/acpi/video.c +1 -36
@@ -65,16 +65,14 @@ MODULE_LICENSE("GPL");static int acpi_video_bus_add (struct acpi_device *device);static int acpi_video_bus_remove (struct acpi_device *device,int type); -static int acpi_video_bus_match (struct acpi_device *device, -struct acpi_driver *driver);static struct acpi_driver acpi_video_bus = { .name =ACPI_VIDEO_DRIVER_NAME , .class =ACPI_VIDEO_CLASS , + .ids =ACPI_VIDEO_HID , .ops = { .add = acpi_video_bus_add, .remove = acpi_video_bus_remove, - .match = acpi_video_bus_match, }, };
@@ -1774,39 +1772,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)return 0 ; } -static int -acpi_video_bus_match (struct acpi_device *device,struct acpi_driver *driver) -{ -acpi_handle h_dummy1; -acpi_handle h_dummy2; -acpi_handle h_dummy3; - - -if (!device || !driver) -return -EINVAL ; - -/* Since there is no HID, CID for ACPI Video drivers, we have -* to check well known required nodes for each feature we support. -*/ - -/* Does this device able to support video switching ? */ -if (ACPI_SUCCESS (acpi_get_handle (device->handle,"_DOD" , &h_dummy1)) && -ACPI_SUCCESS (acpi_get_handle (device->handle,"_DOS" , &h_dummy2))) -return 0 ; - -/* Does this device able to retrieve a video ROM ? */ -if (ACPI_SUCCESS (acpi_get_handle (device->handle,"_ROM" , &h_dummy1))) -return 0 ; - -/* Does this device able to configure which video head to be POSTed ? */ -if (ACPI_SUCCESS (acpi_get_handle (device->handle,"_VPO" , &h_dummy1)) && -ACPI_SUCCESS (acpi_get_handle (device->handle,"_GPD" , &h_dummy2)) && -ACPI_SUCCESS (acpi_get_handle (device->handle,"_SPD" , &h_dummy3))) -return 0 ; - -return -ENODEV ; -} -static int __init acpi_video_init (void ) {int result =0 ;
include/acpi/acpi_bus.h +1 -5
@@ -97,8 +97,6 @@ typedef int (*acpi_op_resume) (struct acpi_device * device);typedef int (*acpi_op_scan ) (struct acpi_device * device);typedef int (*acpi_op_bind ) (struct acpi_device * device);typedef int (*acpi_op_unbind ) (struct acpi_device * device); -typedef int (*acpi_op_match ) (struct acpi_device * device, -struct acpi_driver * driver);typedef int (*acpi_op_shutdown ) (struct acpi_device * device);struct acpi_bus_ops {
@@ -112,9 +110,8 @@ struct acpi_bus_ops { u32 acpi_op_scan:1; u32 acpi_op_bind:1; u32 acpi_op_unbind:1; - u32 acpi_op_match:1; u32 acpi_op_shutdown:1; - u32 reserved:20; + u32 reserved:21; };struct acpi_device_ops {
@@ -128,7 +125,6 @@ struct acpi_device_ops {acpi_op_scan scan;acpi_op_bind bind;acpi_op_unbind unbind; -acpi_op_match match;acpi_op_shutdown shutdown; };
include/acpi/acpi_drivers.h +2 -0
@@ -43,6 +43,8 @@#define ACPI_BUTTON_HID_POWERF "ACPI_FPB"#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" +#define ACPI_VIDEO_HID "ACPI_VID" +#define ACPI_PCI_BRIDGE_HID "ACPI_PCI"/* -------------------------------------------------------------------------- PCI -------------------------------------------------------------------------- */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 13/140 output: Add display output class support
From: Yu Luming <[email protected]>
Add generic abstract layer for display output switch control. The output sysfs class driver provides an abstract video output layer that can be used to hook platform specific methods to enable/disable video output device through common sysfs interface.
--- drivers/video/output.c | 129 ++++++++++++++++++++++++++++++++++++++++++ include/linux/video_output.h | 42 ++++++++++++++ 2 files changed, 171 insertions(+), 0 deletions(-) create mode 100644 drivers/video/output.c create mode 100644 include/linux/video_output.h
drivers/video/output.c new file +129 -0
@@ -0,0 +1,129 @@ +/* +* output.c - Display Output Switch driver +* +* Copyright (C) 2006 Luming Yu <[email protected]> +* +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +* +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +#include <linux/module.h> +#include <linux/video_output.h> +#include <linux/err.h> +#include <linux/ctype.h> + + +MODULE_DESCRIPTION ("Display Output Switcher Lowlevel Control Abstraction" ); +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("Luming Yu <[email protected]>" ); + +static ssize_t video_output_show_state (struct class_device *dev,char *buf) +{ +ssize_t ret_size =0 ; +struct output_device *od =to_output_device (dev); +if (od->props) + ret_size =sprintf (buf,"%.8x\n" ,od->props->get_status (od)); +return ret_size; +} + +static ssize_t video_output_store_state (struct class_device *dev, +const char *buf,size_t count) +{ +char *endp; +struct output_device *od =to_output_device (dev); +int request_state =simple_strtoul (buf,&endp,0 ); +size_t size = endp - buf; + +if (*endp &&isspace (*endp)) + size++; +if (size != count) +return -EINVAL ; + +if (od->props) { + od->request_state = request_state; + od->props->set_state (od); + } +return count; +} + +static void video_output_class_release (struct class_device *dev) +{ +struct output_device *od =to_output_device (dev); +kfree (od); +} + +static struct class_device_attribute video_output_attributes[] = { +__ATTR (state,0644 , video_output_show_state, video_output_store_state), + __ATTR_NULL, +}; + +static struct class video_output_class = { + .name ="video_output" , + .release = video_output_class_release, + .class_dev_attrs = video_output_attributes, +}; + +struct output_device *video_output_register (const char *name, +struct device *dev, +void *devdata, +struct output_properties *op) +{ +struct output_device *new_dev; +int ret_code =0 ; + + new_dev =kzalloc (sizeof (struct output_device ),GFP_KERNEL ); +if (!new_dev) { + ret_code = -ENOMEM ; + goto error_return; + } + new_dev->props = op; + new_dev->class_dev.class = &video_output_class; + new_dev->class_dev.dev = dev; +strlcpy (new_dev->class_dev.class_id,name,KOBJ_NAME_LEN ); +class_set_devdata (&new_dev->class_dev,devdata); + ret_code =class_device_register (&new_dev->class_dev); +if (ret_code) { +kfree (new_dev); + goto error_return; + } +return new_dev; + +error_return: +return ERR_PTR (ret_code); +} +EXPORT_SYMBOL (video_output_register); + +void video_output_unregister (struct output_device *dev) +{ +if (!dev) +return ; +class_device_unregister (&dev->class_dev); +} +EXPORT_SYMBOL (video_output_unregister); + +static void __exit video_output_class_exit(void) +{ +class_unregister (&video_output_class); +} + +static int __init video_output_class_init (void ) +{ +return class_register (&video_output_class); +} + +postcore_initcall (video_output_class_init); +module_exit (video_output_class_exit);
include/linux/video_output.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 14/140 output: Add output class document
From: Yu Luming <[email protected]>
--- Documentation/video-output.txt | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) create mode 100644 Documentation/video-output.txt
Documentation/video-output.txt new file +34 -0
@@ -0,0 +1,34 @@ + + Video Output Switcher Control + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2006 [email protected] + +The output sysfs class driver provides an abstract video output layer that +can be used to hook platform specific methods to enable/disable video output +device through common sysfs interface. For example, on my IBM ThinkPad T42 +laptop, The ACPI video driver registered its output devices and read/write +method for 'state' with output sysfs class. The user interface under sysfs is: + +linux:/sys/class/video_output # tree . +. +|-- CRT0 +| |-- device -> ../../../devices/pci0000:00/0000:00:01.0 +| |-- state +| |-- subsystem -> ../../../class/video_output +| `-- uevent +|-- DVI0 +| |-- device -> ../../../devices/pci0000:00/0000:00:01.0 +| |-- state +| |-- subsystem -> ../../../class/video_output +| `-- uevent +|-- LCD0 +| |-- device -> ../../../devices/pci0000:00/0000:00:01.0 +| |-- state +| |-- subsystem -> ../../../class/video_output +| `-- uevent +`-- TV0 + |-- device -> ../../../devices/pci0000:00/0000:00:01.0 + |-- state + |-- subsystem -> ../../../class/video_output + `-- uevent +
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 15/140 ACPI: Adds backlight sysfs support for acpi video driver.
From: Yu Luming <[email protected]>
Adds backlight sysfs support for acpi video driver.
--- drivers/acpi/Kconfig | 2 +- drivers/acpi/video.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 3 deletions(-)
drivers/acpi/Kconfig +1 -1
@@ -106,7 +106,7 @@ config ACPI_BUTTON config ACPI_VIDEO tristate "Video" - depends on X86 + depends on X86 && BACKLIGHT_CLASS_DEVICE help This driver implement the ACPI Extensions For Display Adapters for integrated graphics devices on motherboard, as specified in
drivers/acpi/video.c +69 -2
140 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 16/140 ACPI: use PNPID:instance_no as bus_id of ACPI device
From: Zhang Rui <[email protected]>
Previously we used the device name in the DSDT, but would crash upon encountering a duplicate. Also, exposing the DSDT device name to the user in a patch isn't a good idea, because it is arbitrary.
After some discussion, we finally decided to use "PNPID:instance_no" as the bus_id of ACPI devices.
Two attributes for each device are added at the same time, the full pathname in ACPI namespace and hardware_id if it has.
NOTE: acpi_bus_id_list is used to keep the information of PNPID
and instance number of the given PNPID. Loop the
acpi_bus_id_list to find the instance_no of the same PNPID
when register a device. If failed, i.e. we don't have a node with this PNPID, allocate one and link it to this list.
NOTE: Now I don't take the memory free work in charge.
If necessary, I can add a reference count in struct acpi_device_bus_id, and check the reference and when unregister a device, i.e. memory is freed when the reference count of a given PNPID is 0.
--- drivers/acpi/scan.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 109 insertions(+), 9 deletions(-)
drivers/acpi/scan.c +109 -9
@@ -21,9 +21,15 @@ extern struct acpi_device *acpi_root;#define ACPI_BUS_DEVICE_NAME "System Bus"static LIST_HEAD (acpi_device_list); +static LIST_HEAD (acpi_bus_id_list);DEFINE_SPINLOCK (acpi_device_lock);LIST_HEAD (acpi_wakeup_device_list); +struct acpi_device_bus_id { +char bus_id[9 ]; +unsigned int instance_no; +struct list_head node; +};static int acpi_eject_operation (acpi_handle handle,int lockable) {struct acpi_object_list arg_list;
@@ -103,18 +109,61 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); -static void acpi_device_setup_files (struct acpi_device *dev) +static ssize_t +acpi_device_hid_show (struct device *dev,struct device_attribute *attr,char *buf) { +struct acpi_device *acpi_dev =to_acpi_device (dev); + +return sprintf (buf,"%s\n" , acpi_dev->pnp.hardware_id); +} +static DEVICE_ATTR(hid, 0444, acpi_device_hid_show, NULL); + +static ssize_t +acpi_device_path_show (struct device *dev,struct device_attribute *attr,char *buf) { +struct acpi_device *acpi_dev =to_acpi_device (dev); +struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER ,NULL }; +int result; + + result =acpi_get_name (acpi_dev->handle,ACPI_FULL_PATHNAME , &path); +if (result) + goto end; + + result =sprintf (buf,"%s\n" , (char *)path.pointer); +kfree (path.pointer); + end: +return result; +} +static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL); + +static int acpi_device_setup_files (struct acpi_device *dev) {acpi_status status;acpi_handle temp; +int result =0 ;/* -* If device has _EJ0, 'eject' file is created that is used to trigger -* hot-removal function from userland. +* Devices gotten from FADT don't have a "path" attribute */ +if (dev->handle) { + result =device_create_file (&dev->dev, &dev_attr_path); +if (result) + goto end; + } + +if (dev->flags.hardware_id) { + result =device_create_file (&dev->dev, &dev_attr_hid); +if (result) + goto end; + } + +/* +* If device has _EJ0, 'eject' file is created that is used to trigger +* hot-removal function from userland. +*/ status =acpi_get_handle (dev->handle,"_EJ0" , &temp);if (ACPI_SUCCESS (status)) -device_create_file (&dev->dev, &dev_attr_eject); + result =device_create_file (&dev->dev, &dev_attr_eject); + end: +return result; }static void acpi_device_remove_files (struct acpi_device *dev)
@@ -129,6 +178,11 @@ static void acpi_device_remove_files(struct acpi_device *dev) status =acpi_get_handle (dev->handle,"_EJ0" , &temp);if (ACPI_SUCCESS (status))device_remove_file (&dev->dev, &dev_attr_eject); + +if (dev->flags.hardware_id) +device_remove_file (&dev->dev, &dev_attr_hid); +if (dev->handle) +device_remove_file (&dev->dev, &dev_attr_path); }/* -------------------------------------------------------------------------- ACPI Bus operations
@@ -260,9 +314,12 @@ static struct bus_type acpi_bus_type = { .uevent = acpi_device_uevent, }; -static void acpi_device_register (struct acpi_device *device, +static int acpi_device_register (struct acpi_device *device,struct acpi_device *parent) { +int result; +struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id; +int found =0 ;/* * Linkage * -------
@@ -273,7 +330,33 @@ static void acpi_device_register(struct acpi_device *device,INIT_LIST_HEAD (&device->g_list);INIT_LIST_HEAD (&device->wakeup_list); + new_bus_id =kzalloc (sizeof (struct acpi_device_bus_id ),GFP_KERNEL ); +if (!new_bus_id) { + printk(KERN_ERR PREFIX "Memory allocation error\n"); +return -ENOMEM ; + } +spin_lock (&acpi_device_lock); +/* +* Find suitable bus_id and instance number in acpi_bus_id_list +* If failed, create one and link it into acpi_bus_id_list +*/ +list_for_each_entry (acpi_device_bus_id, &acpi_bus_id_list, node) { +if (!strcmp (acpi_device_bus_id->bus_id, device->flags.hardware_id? device->pnp.hardware_id :"PNPIDNON" )) { + acpi_device_bus_id->instance_no ++; + found =1 ; +kfree (new_bus_id); +break ; + } + } +if (!found) { + acpi_device_bus_id = new_bus_id; +strcpy (acpi_device_bus_id->bus_id, device->flags.hardware_id ? device->pnp.hardware_id :"PNPIDNON" ); + acpi_device_bus_id->instance_no =0 ; +list_add_tail (&acpi_device_bus_id->node, &acpi_bus_id_list); + } +sprintf (device->dev.bus_id,"%s:%02x" , acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); +if (device->parent) {list_add_tail (&device->node, &device->parent->children);list_add_tail (&device->g_list, &device->parent->g_list);
@@ -287,12 +370,29 @@ static void acpi_device_register(struct acpi_device *device, device->dev.parent = &parent->dev; device->dev.bus = &acpi_bus_type;device_initialize (&device->dev); -sprintf (device->dev.bus_id,"%s" , device->pnp.bus_id); device->dev.release = &acpi_device_release; -device_add (&device->dev); + result =device_add (&device->dev); +if (result) { +printk ("Error adding device %s" , device->dev.bus_id); + goto end; + } + + result =acpi_device_setup_files (device); +if (result) +ACPI_DEBUG_PRINT ((ACPI_DB_ERROR ,"Error creating sysfs interface for device %s\n" , device->dev.bus_id)); -acpi_device_setup_files (device); device->removal_type =ACPI_BUS_REMOVAL_NORMAL ; +return 0 ; + end: +spin_lock (&acpi_device_lock); +if (device->parent) { +list_del (&device->node); +list_del (&device->g_list); + }else +list_del (&device->g_list); +list_del (&device->wakeup_list); +spin_unlock (&acpi_device_lock); +return result; }static void acpi_device_unregister (struct acpi_device *device,int type)
@@ -1035,7 +1135,7 @@ acpi_add_single_object(struct acpi_device **child,acpi_device_get_debug_info (device, handle, type); -acpi_device_register (device, parent); + result =acpi_device_register (device, parent); end:if (!result)
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 17/140 ACPI: fix Supermicro X7DB8+ Boot regression
From: Rui Zhang <[email protected]>
http://bugzilla.kernel.org/show_bug.cgi?id=7695
Originally we converted bind/unbind to use a new pci bridge driver. The driver will add/remove _PRT, so we can eventually remove .bind/.unbind methods.
But we found that some of the _ADR-Based devices don't have _PRT, i.e. they are not managed by the new ACPI PCI bridge driver. So that .bind method is not called for some _ADR-Based devices, which leads to a failure.
Now we make ACPI PCI Root Bridge Driver scan and binds all _ADR-Based devices once the driver is loaded, in the .add method of ACPI PCI Root Bridge driver.
Extra code path for calling .bind/.unbind when _ADR-Based devices are hot added/removed is also added.
--- drivers/acpi/pci_bind.c | 40 ++++------------------------------------ drivers/acpi/pci_root.c | 24 ++++++++++++++++++++++++ drivers/acpi/scan.c | 33 +++++++++++++++------------------ include/acpi/acpi_drivers.h | 1 - 4 files changed, 43 insertions(+), 55 deletions(-)
drivers/acpi/pci_bind.c +4 -36
@@ -223,6 +223,8 @@ int acpi_pci_bind(struct acpi_device *device) data->id.segment, data->id.bus, data->id.device, data->id.function)); data->bus = data->dev->subordinate; + device->ops.bind = acpi_pci_bind; + device->ops.unbind = acpi_pci_unbind; }/*
@@ -352,6 +354,8 @@ acpi_pci_bind_root(struct acpi_device *device, data->id = *id; data->bus = bus; + device->ops.bind = acpi_pci_bind; + device->ops.unbind = acpi_pci_unbind;acpi_get_name (device->handle,ACPI_FULL_PATHNAME , &buffer);
@@ -374,39 +378,3 @@ acpi_pci_bind_root(struct acpi_device *device,return result; } - -#define ACPI_PCI_BRIDGE_DRIVER_NAME "ACPI PCI Bridge Driver" - -static int acpi_pci_bridge_add (struct acpi_device *device); -static int acpi_pci_bridge_remove (struct acpi_device *device,int type); - -static struct acpi_driver acpi_pci_bridge_driver = { - .name =ACPI_PCI_BRIDGE_DRIVER_NAME , - .ids =ACPI_PCI_BRIDGE_HID , - .ops = { - .add = acpi_pci_bridge_add, - .remove = acpi_pci_bridge_remove, - }, -}; - -static int acpi_pci_bridge_add (struct acpi_device *device) -{ -return acpi_pci_bind (device); -} - -static int acpi_pci_bridge_remove (struct acpi_device *device,int type) -{ -return acpi_pci_unbind (device); -} - -static int __init acpi_pci_bridge_init (void ) -{ -if (acpi_pci_disabled) -return 0 ; -if (acpi_bus_register_driver (&acpi_pci_bridge_driver) <0 ) -return -ENODEV ; -return 0 ; -} - -/* Should be called after ACPI pci root driver */ -subsys_initcall (acpi_pci_bridge_init);
drivers/acpi/pci_root.c +24 -0
@@ -151,6 +151,21 @@ static acpi_status try_get_root_bridge_busnr(acpi_handle handle, int *busnum)return AE_OK ; } +static void acpi_pci_bridge_scan (struct acpi_device *device) +{ +int status; +struct acpi_device *child =NULL ; + +if (device->flags.bus_address) +if (device->parent && device->parent->ops.bind) { + status = device->parent->ops.bind (device); +if (!status) { +list_for_each_entry (child, &device->children, node) +acpi_pci_bridge_scan (child); + } + } +} +static int acpi_pci_root_add (struct acpi_device *device) {int result =0 ;
@@ -159,6 +174,7 @@ static int acpi_pci_root_add(struct acpi_device *device)acpi_status status =AE_OK ;unsigned long value =0 ;acpi_handle handle =NULL ; +struct acpi_device *child;if (!device)
@@ -175,6 +191,8 @@ static int acpi_pci_root_add(struct acpi_device *device)strcpy (acpi_device_class (device),ACPI_PCI_ROOT_CLASS );acpi_driver_data (device) = root; + device->ops.bind = acpi_pci_bind; +/* * Segment * -------
@@ -294,6 +312,12 @@ static int acpi_pci_root_add(struct acpi_device *device) result =acpi_pci_irq_add_prt (device->handle, root->id.segment, root->id.bus); +/* +* Scan and bind all _ADR-Based Devices +*/ +list_for_each_entry (child, &device->children, node) +acpi_pci_bridge_scan (child); + end:if (result) {if (!list_empty (&root->node))
drivers/acpi/scan.c +15 -18
@@ -837,20 +837,6 @@ acpi_video_bus_match(struct acpi_device *device)return -ENODEV ; } -static int acpi_pci_bridge_match (struct acpi_device *device) -{ -acpi_status status; -acpi_handle handle; - -/* pci bridge has _PRT but isn't PNP0A03 */ - status =acpi_get_handle (device->handle,METHOD_NAME__PRT , &handle); -if (ACPI_FAILURE (status)) -return -ENODEV ; -if (!acpi_match_ids (device,"PNP0A03" )) -return -ENODEV ; -return 0 ; -} -static void acpi_device_set_id (struct acpi_device *device,struct acpi_device *parent,acpi_handle handle,int type)
@@ -886,10 +872,6 @@ static void acpi_device_set_id(struct acpi_device *device, status =acpi_video_bus_match (device);if (ACPI_SUCCESS (status)) hid =ACPI_VIDEO_HID ; - - status =acpi_pci_bridge_match (device); -if (ACPI_SUCCESS (status)) - hid =ACPI_PCI_BRIDGE_HID ; }break ;case ACPI_BUS_TYPE_POWER :
@@ -1021,6 +1003,13 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)if (!rmdevice)return 0 ; +/* +* unbind _ADR-Based Devices when hot removal +*/ +if (dev->flags.bus_address) { +if ((dev->parent) && (dev->parent->ops.unbind)) + dev->parent->ops.unbind (dev); + }acpi_device_unregister (dev,ACPI_BUS_REMOVAL_EJECT );return 0 ;
@@ -1137,6 +1126,14 @@ acpi_add_single_object(struct acpi_device **child, result =acpi_device_register (device, parent); +/* +* Bind _ADR-Based Devices when hot add +*/ +if (device->flags.bus_address) { +if (device->parent && device->parent->ops.bind) + device->parent->ops.bind (device); + } + end:if (!result) *child = device;
include/acpi/acpi_drivers.h +0 -1
@@ -44,7 +44,6 @@#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB"#define ACPI_VIDEO_HID "ACPI_VID" -#define ACPI_PCI_BRIDGE_HID "ACPI_PCI"/* -------------------------------------------------------------------------- PCI -------------------------------------------------------------------------- */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 18/140 ACPI: video: fix LCD monitor seen as CRT
From: Rui Zhang <[email protected]>
http://bugzilla.kernel.org/show_bug.cgi?id=7349
--- drivers/acpi/video.c | 58 +++++++++++++++++++++++++++++++++++++------------- 1 files changed, 43 insertions(+), 15 deletions(-)
drivers/acpi/video.c +43 -15
@@ -57,6 +57,11 @@#define ACPI_VIDEO_HEAD_INVALID (~0u - 1)#define ACPI_VIDEO_HEAD_END (~0u) +#define ACPI_VIDEO_DISPLAY_CRT 1 +#define ACPI_VIDEO_DISPLAY_TV 2 +#define ACPI_VIDEO_DISPLAY_DVI 3 +#define ACPI_VIDEO_DISPLAY_LCD 4 +#define _COMPONENT ACPI_VIDEO_COMPONENTACPI_MODULE_NAME ("acpi_video" )
@@ -133,9 +138,10 @@ struct acpi_video_device_flags { u8 crt:1; u8 lcd:1; u8 tvout:1; + u8 dvi:1; u8 bios:1; u8 unknown:1; - u8 reserved:3; + u8 reserved:2; };struct acpi_video_device_cap {
@@ -668,6 +674,8 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)seq_printf (seq,"LCD\n" ); else if (dev->flags.tvout) seq_printf(seq, "TVOUT\n"); + else if (dev->flags.dvi) + seq_printf(seq, "DVI\n"); else seq_printf(seq, "UNKNOWN\n");
@@ -1242,6 +1250,16 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device)-------------------------------------------------------------------------- */ /* device interface */ +static struct acpi_video_device_attrib * +acpi_video_get_device_attr (struct acpi_video_bus *video,unsigned long device_id) +{ +int count; + +for (count =0 ; count < video->attached_count; count++) +if ((video->attached_array[count].value.int_val &0xffff ) == device_id) +return &(video->attached_array[count].value.attrib); +return NULL ; +} static int acpi_video_bus_get_one_device(struct acpi_device *device,
@@ -1250,7 +1268,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,unsigned long device_id;int status;struct acpi_video_device *data; - +struct acpi_video_device_attrib * attribute;if (!device || !video)return -EINVAL ;
@@ -1271,20 +1289,30 @@ acpi_video_bus_get_one_device(struct acpi_device *device, data->video = video; data->dev = device; -switch (device_id &0xffff ) { -case 0x0100 : - data->flags.crt =1 ; -break ; -case 0x0400 : - data->flags.lcd =1 ; -break ; -case 0x0200 : - data->flags.tvout =1 ; -break ; -default : + attribute =acpi_video_get_device_attr (video, device_id); + +if ((attribute !=NULL ) && attribute->device_id_scheme) { +switch (attribute->display_type) { +case ACPI_VIDEO_DISPLAY_CRT : + data->flags.crt =1 ; +break ; +case ACPI_VIDEO_DISPLAY_TV : + data->flags.tvout =1 ; +break ; +case ACPI_VIDEO_DISPLAY_DVI : + data->flags.dvi =1 ; +break ; +case ACPI_VIDEO_DISPLAY_LCD : + data->flags.lcd =1 ; +break ; +default : + data->flags.unknown =1 ; +break ; + } +if (attribute->bios_can_detect) + data->flags.bios =1 ; + }else data->flags.unknown =1 ; -break ; - }acpi_video_device_bind (video, data);acpi_video_device_find_cap (data);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 19/140 ACPI: use more understandable bus_id for ACPI devices
From: Zhang Rui <[email protected]>
Some of the ACPI devices use the internal fake hids
which are exposed to userspace as devces' bus_id after sysfs conversion. To make it more friendly, we convert them to more understandable strings.
For those devices w/o PNPids, we use "device:instance_no" as the bus_id instead of "PNPIDNON:instance_no".
--- drivers/acpi/scan.c | 6 +++--- include/acpi/acpi_bus.h | 2 +- include/acpi/acpi_drivers.h | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-)
drivers/acpi/scan.c +3 -3
@@ -26,7 +26,7 @@ DEFINE_SPINLOCK(acpi_device_lock);LIST_HEAD (acpi_wakeup_device_list);struct acpi_device_bus_id { -char bus_id[9 ]; +char bus_id[15 ];unsigned int instance_no;struct list_head node; };
@@ -342,7 +342,7 @@ static int acpi_device_register(struct acpi_device *device,* If failed, create one and link it into acpi_bus_id_list */ list_for_each_entry (acpi_device_bus_id, &acpi_bus_id_list, node) { -if (!strcmp (acpi_device_bus_id->bus_id, device->flags.hardware_id? device->pnp.hardware_id :"PNPIDNON" )) { +if (!strcmp (acpi_device_bus_id->bus_id, device->flags.hardware_id? device->pnp.hardware_id :"device" )) { acpi_device_bus_id->instance_no ++; found =1 ;kfree (new_bus_id);
@@ -351,7 +351,7 @@ static int acpi_device_register(struct acpi_device *device, }if (!found) { acpi_device_bus_id = new_bus_id; -strcpy (acpi_device_bus_id->bus_id, device->flags.hardware_id ? device->pnp.hardware_id :"PNPIDNON" ); +strcpy (acpi_device_bus_id->bus_id, device->flags.hardware_id ? device->pnp.hardware_id :"device" ); acpi_device_bus_id->instance_no =0 ;list_add_tail (&acpi_device_bus_id->node, &acpi_bus_id_list); }
include/acpi/acpi_bus.h +1 -1
@@ -184,7 +184,7 @@ struct acpi_device_dir {typedef char acpi_bus_id [5 ];typedef unsigned long acpi_bus_address ; -typedef char acpi_hardware_id [9 ]; +typedef char acpi_hardware_id [15 ];typedef char acpi_unique_id [9 ];typedef char acpi_device_name [40 ];typedef char acpi_device_class [20 ];
include/acpi/acpi_drivers.h +8 -8
@@ -36,14 +36,14 @@/* _HID definitions */ -#define ACPI_POWER_HID "ACPI_PWR" -#define ACPI_PROCESSOR_HID "ACPI_CPU" -#define ACPI_SYSTEM_HID "ACPI_SYS" -#define ACPI_THERMAL_HID "ACPI_THM" -#define ACPI_BUTTON_HID_POWERF "ACPI_FPB" -#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" - -#define ACPI_VIDEO_HID "ACPI_VID" +#define ACPI_POWER_HID "power_resource" +#define ACPI_PROCESSOR_HID "processor" +#define ACPI_SYSTEM_HID "acpi_system" +#define ACPI_THERMAL_HID "thermal" +#define ACPI_BUTTON_HID_POWERF "button_power" +#define ACPI_BUTTON_HID_SLEEPF "button_sleep" +#define ACPI_VIDEO_HID "video" +#define ACPI_BAY_HID "bay"/* -------------------------------------------------------------------------- PCI -------------------------------------------------------------------------- */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 20/140 ACPI: Optimize acpi_get_pci_rootbridge_handle() to boot faster
From: Justin Chen <[email protected]>
Move acpi_get_pci_rootbridge_handle() from glue.c to pci_root.c and get the root bridge ACPI handles by searching the &acpi_pci_roots list instead of walking through the ACPI name space. This significantly reduces boot time on large I/O systems.
--- drivers/acpi/glue.c | 123 ----------------------------------------------- drivers/acpi/pci_root.c | 13 +++++ 2 files changed, 13 insertions(+), 123 deletions(-)
drivers/acpi/glue.c +0 -123
@@ -86,129 +86,6 @@ static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle)return ret; } -/* Get PCI root bridge's handle from its segment and bus number */ -struct acpi_find_pci_root { -unsigned int seg; -unsigned int bus; -acpi_handle handle; -}; - -static acpi_status -do_root_bridge_busnr_callback (struct acpi_resource *resource,void *data) -{ -unsigned long *busnr = data; -struct acpi_resource_address64 address; - -if (resource->type !=ACPI_RESOURCE_TYPE_ADDRESS16 && - resource->type !=ACPI_RESOURCE_TYPE_ADDRESS32 && - resource->type !=ACPI_RESOURCE_TYPE_ADDRESS64 ) -return AE_OK ; - -acpi_resource_to_address64 (resource, &address); -if ((address.address_length >0 ) && - (address.resource_type ==ACPI_BUS_NUMBER_RANGE )) - *busnr = address.minimum; - -return AE_OK ; -} - -static int get_root_bridge_busnr (acpi_handle handle) -{ -acpi_status status; -unsigned long bus, bbn; -struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL }; - -acpi_get_name (handle,ACPI_FULL_PATHNAME , &buffer); - - status =acpi_evaluate_integer (handle,METHOD_NAME__BBN ,NULL , - &bbn); -if (status ==AE_NOT_FOUND ) { -/* Assume bus = 0 */ - printk(KERN_INFO PREFIX -"Assume root bridge [%s] bus is 0\n" , - (char *)buffer.pointer); - status =AE_OK ; - bbn =0 ; - } -if (ACPI_FAILURE (status)) { - bbn = -ENODEV ; - goto exit; - } -if (bbn >0 ) - goto exit; - -/* _BBN in some systems return 0 for all root bridges */ - bus =-1 ; - status =acpi_walk_resources (handle,METHOD_NAME__CRS , - do_root_bridge_busnr_callback, &bus); -/* If _CRS failed, we just use _BBN */ -if (ACPI_FAILURE (status) || (bus ==-1 )) - goto exit; -/* We select _CRS */ -if (bbn != bus) { - printk(KERN_INFO PREFIX -"_BBN and _CRS returns different value for %s. Select _CRS\n" , - (char *)buffer.pointer); - bbn = bus; - } - exit: -kfree (buffer.pointer); -return (int )bbn; -} - -static acpi_status -find_pci_rootbridge (acpi_handle handle,u32 lvl,void *context,void **rv) -{ -struct acpi_find_pci_root *find = (struct acpi_find_pci_root *)context; -unsigned long seg, bus; -acpi_status status; -int tmp; -struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL }; - -acpi_get_name (handle,ACPI_FULL_PATHNAME , &buffer); - - status =acpi_evaluate_integer (handle,METHOD_NAME__SEG ,NULL , &seg); -if (status ==AE_NOT_FOUND ) { -/* Assume seg = 0 */ - status =AE_OK ; - seg =0 ; - } -if (ACPI_FAILURE (status)) { - status =AE_CTRL_DEPTH ; - goto exit; - } - - tmp =get_root_bridge_busnr (handle); -if (tmp <0 ) { - printk(KERN_ERR PREFIX -"Find root bridge failed for %s\n" , - (char *)buffer.pointer); - status =AE_CTRL_DEPTH ; - goto exit; - } - bus = tmp; - -if (seg == find->seg && bus == find->bus) - { - find->handle = handle; - status =AE_CTRL_TERMINATE ; - } -else - status =AE_OK ; - exit: -kfree (buffer.pointer); -return status; -} - -acpi_handle acpi_get_pci_rootbridge_handle (unsigned int seg,unsigned int bus) -{ -struct acpi_find_pci_root find = { seg, bus,NULL }; - -acpi_get_devices (PCI_ROOT_HID_STRING , find_pci_rootbridge, &find,NULL ); -return find.handle; -} -EXPORT_SYMBOL_GPL (acpi_get_pci_rootbridge_handle); -/* Get device's handler per its address under its parent */ struct acpi_find_child {acpi_handle handle;
drivers/acpi/pci_root.c +13 -0
@@ -117,6 +117,19 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)EXPORT_SYMBOL (acpi_pci_unregister_driver); +acpi_handle acpi_get_pci_rootbridge_handle (unsigned int seg,unsigned int bus) +{ +struct acpi_pci_root *tmp; + +list_for_each_entry (tmp, &acpi_pci_roots, node) { +if ((tmp->id.segment == (u16 ) seg) && (tmp->id.bus == (u16 ) bus)) +return tmp->device->handle; + } +return NULL ; +} + +EXPORT_SYMBOL_GPL (acpi_get_pci_rootbridge_handle); +static acpi_status get_root_bridge_busnr_callback (struct acpi_resource *resource,void *data) {
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 21/140 ACPI: move FADT resource reservations from motherboard driver to osl
From: Bjorn Helgaas <[email protected]>
Resources described by the FADT aren't really a good fit for the ACPI motherboard driver.
The motherboard driver cares about PNP0C01 and PNP0C02 devices and their resources.
The FADT describes some resources used by the ACPI core. Often, they are also described by by the _CRS of a motherboard device, but I think it's better to reserve them specifically in the ACPI osl.c because
(a) the motherboard driver is optional and ACPI uses the resources even if the driver is absent, and (b) I want to remove the ACPI motherboard driver because it's mostly redundant with the PNP system.c driver.
--- drivers/acpi/motherboard.c | 49 -------------------------------------------- drivers/acpi/osl.c | 48 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 49 deletions(-)
drivers/acpi/motherboard.c +0 -49
@@ -118,58 +118,9 @@ static struct acpi_driver acpi_motherboard_driver = { }, }; -static void __init acpi_request_region (struct acpi_generic_address *addr, -unsigned int length,char *desc) -{ -if (!addr->address || !length) -return ; - -if (addr->address_space_id ==ACPI_ADR_SPACE_SYSTEM_IO ) -request_region (addr->address, length, desc); -else if (addr->address_space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) -request_mem_region (addr->address, length, desc); -} - -static void __init acpi_reserve_resources (void ) -{ -acpi_request_region (&acpi_gbl_FADT->xpm1a_evt_blk, - acpi_gbl_FADT->pm1_evt_len,"ACPI PM1a_EVT_BLK" ); - -acpi_request_region (&acpi_gbl_FADT->xpm1b_evt_blk, - acpi_gbl_FADT->pm1_evt_len,"ACPI PM1b_EVT_BLK" ); - -acpi_request_region (&acpi_gbl_FADT->xpm1a_cnt_blk, - acpi_gbl_FADT->pm1_cnt_len,"ACPI PM1a_CNT_BLK" ); - -acpi_request_region (&acpi_gbl_FADT->xpm1b_cnt_blk, - acpi_gbl_FADT->pm1_cnt_len,"ACPI PM1b_CNT_BLK" ); - -if (acpi_gbl_FADT->pm_tm_len ==4 ) -acpi_request_region (&acpi_gbl_FADT->xpm_tmr_blk,4 ,"ACPI PM_TMR" ); - -acpi_request_region (&acpi_gbl_FADT->xpm2_cnt_blk, - acpi_gbl_FADT->pm2_cnt_len,"ACPI PM2_CNT_BLK" ); - -/* Length of GPE blocks must be a non-negative multiple of 2 */ - -if (!(acpi_gbl_FADT->gpe0_blk_len &0x1 )) -acpi_request_region (&acpi_gbl_FADT->xgpe0_blk, - acpi_gbl_FADT->gpe0_blk_len,"ACPI GPE0_BLK" ); - -if (!(acpi_gbl_FADT->gpe1_blk_len &0x1 )) -acpi_request_region (&acpi_gbl_FADT->xgpe1_blk, - acpi_gbl_FADT->gpe1_blk_len,"ACPI GPE1_BLK" ); -} -static int __init acpi_motherboard_init (void ) {acpi_bus_register_driver (&acpi_motherboard_driver); -/* -* Guarantee motherboard IO reservation first -* This module must run after scan.c -*/ -if (!acpi_disabled) -acpi_reserve_resources ();return 0 ; }
drivers/acpi/osl.c +48 -0
54 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 22/140 PNP: reserve system board iomem resources as well as ioport resources
From: Bjorn Helgaas <[email protected]>
Most x86 boxes have no iomem system board resources, but some ia64 boxes do.
--- drivers/pnp/system.c | 26 +++++++++++++++++++------- 1 files changed, 19 insertions(+), 7 deletions(-)
drivers/pnp/system.c +19 -7
@@ -3,7 +3,8 @@* * Some code is based on pnpbios_core.c * Copyright 2002 Adam Belay <[email protected]> -* +* (c) Copyright 2007 Hewlett-Packard Development Company, L.P. +* Bjorn Helgaas <[email protected]> */ #include <linux/pnp.h>
@@ -21,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = { { "", 0 } }; -static void reserve_ioport_range (char *pnpid,int start,int end) +static void reserve_range (char *pnpid,int start,int end,int port) {struct resource *res;char *regionid;
@@ -30,7 +31,10 @@ static void reserve_ioport_range(char *pnpid, int start, int end)if ( regionid ==NULL )return ;snprintf (regionid,16 ,"pnp %s" , pnpid); - res =request_region (start,end-start+1 ,regionid); +if (port) + res =request_region (start,end-start+1 ,regionid); +else + res =request_mem_region (start,end-start+1 ,regionid);if ( res ==NULL )kfree ( regionid );else
@@ -41,8 +45,8 @@ static void reserve_ioport_range(char *pnpid, int start, int end)* have double reservations. */ printk (KERN_INFO -"pnp: %s: ioport range 0x%x-0x%x %s reserved\n" , - pnpid, start, end, +"pnp: %s: %s range 0x%x-0x%x %s reserved\n" , + pnpid, port ?"ioport" :"iomem" , start, end,NULL != res ?"has been" :"could not be" );
@@ -75,13 +79,21 @@ static void reserve_resources_of_dev( struct pnp_dev *dev )/* invalid endpoint */ /* Do nothing */ continue ; -reserve_ioport_range ( +reserve_range ( dev->dev.bus_id,pnp_port_start (dev, i), -pnp_port_end (dev, i) +pnp_port_end (dev, i),1 ); } +for (i =0 ; i <PNP_MAX_MEM ; i++) { +if (!pnp_mem_valid (dev, i)) +continue ; + +reserve_range (dev->dev.bus_id,pnp_mem_start (dev, i), +pnp_mem_end (dev, i),0 ); + } +return ; }
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 23/140 PNP: system.c whitespace cleanup
From: Bjorn Helgaas <[email protected]>
No functional change.
--- drivers/pnp/system.c | 32 +++++++++++--------------------- 1 files changed, 11 insertions(+), 21 deletions(-)
drivers/pnp/system.c +11 -21
@@ -28,15 +28,15 @@ static void reserve_range(char *pnpid, int start, int end, int port)char *regionid; regionid =kmalloc (16 ,GFP_KERNEL ); -if ( regionid ==NULL ) +if (regionid ==NULL )return ;snprintf (regionid,16 ,"pnp %s" , pnpid);if (port) res =request_region (start,end-start+1 ,regionid);else res =request_mem_region (start,end-start+1 ,regionid); -if ( res ==NULL ) -kfree ( regionid ); +if (res ==NULL ) +kfree (regionid);else res->flags &= ~IORESOURCE_BUSY ;/*
@@ -47,24 +47,18 @@ static void reserve_range(char *pnpid, int start, int end, int port)printk (KERN_INFO "pnp: %s: %s range 0x%x-0x%x %s reserved\n" , pnpid, port ?"ioport" :"iomem" , start, end, -NULL != res ?"has been" :"could not be" - ); - -return ; +NULL != res ?"has been" :"could not be" ); } -static void reserve_resources_of_dev (struct pnp_dev *dev ) +static void reserve_resources_of_dev (struct pnp_dev *dev) {int i; -for (i=0 ;i<PNP_MAX_PORT ;i++) { +for (i =0 ; i <PNP_MAX_PORT ; i++) {if (!pnp_port_valid (dev, i)) -/* end of resources */ continue ;if (pnp_port_start (dev, i) ==0 ) -/* disabled */ -/* Do nothing */ -continue ; +continue ;/* disabled */ if (pnp_port_start (dev, i) <0x100 )/* * Below 0x100 is only standard PC hardware
@@ -76,14 +70,10 @@ static void reserve_resources_of_dev( struct pnp_dev *dev )*/ continue ;if (pnp_port_end (dev, i) <pnp_port_start (dev, i)) -/* invalid endpoint */ -/* Do nothing */ -continue ; -reserve_range ( - dev->dev.bus_id, -pnp_port_start (dev, i), -pnp_port_end (dev, i),1 - ); +continue ;/* invalid */ + +reserve_range (dev->dev.bus_id,pnp_port_start (dev, i), +pnp_port_end (dev, i),1 ); }for (i =0 ; i <PNP_MAX_MEM ; i++) {
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 24/140 i386: turn on CONFIG_PNP in defconfig
From: Bjorn Helgaas <[email protected]>
I'm trying to remove drivers/acpi/motherboard.c, which is mostly redundant with drivers/pnp/system.c. So make sure that we include the PNP driver in the default config. Most distros enable this already.
Turning on CONFIG_PNP also causes the following options to be enabled:
CONFIG_PNPACPI
CONFIG_SERIAL_8250_PNPCONFIG_SERIAL_8250_PNP causes legacy serial ports to be discovered twice, which is ugly but harmless:
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A--- arch/i386/defconfig | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/i386/defconfig +2 -1
@@ -466,7 +466,8 @@ CONFIG_FW_LOADER=y # # Plug and Play support # -# CONFIG_PNP is not set +CONFIG_PNP=y +CONFIG_PNPACPI=y # # Block devices
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 25/140 ACPI: remove motherboard driver (redundant with PNP system driver)
From: Bjorn Helgaas <[email protected]>
The PNP system board driver (drivers/pnp/system.c) contains all the same functionality, so we don't need the ACPI version.
Previously, a motherboard device would be claimed by *both* the ACPI and PNP drivers, resulting in stuff like this in /proc/ioports:
1200-121f : motherboard <-- from drivers/acpi/motherboard.c
1200-121f : pnp 00:0d <-- from drivers/pnp/system.cMake sure to enable CONFIG_PNP (and CONFIG_PNPACPI) to include the PNP system board driver.
--- drivers/acpi/Makefile | 2 +- drivers/acpi/motherboard.c | 131 -------------------------------------------- 2 files changed, 1 insertions(+), 132 deletions(-) delete mode 100644 drivers/acpi/motherboard.c
drivers/acpi/Makefile +1 -1
@@ -37,7 +37,7 @@ endif obj-y += sleep/ obj-y += bus.o glue.o -obj-y += scan.o motherboard.o +obj-y += scan.o obj-$(CONFIG_ACPI_AC) += ac.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BUTTON) += button.o
drivers/acpi/motherboard.c deleted +0 -131
131 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 26/140 PNPACPI: remove EXPERIMENTAL dependency
From: Bjorn Helgaas <[email protected]>
PNPACPI is pretty widely used and seems fairly stable, so remove the dependency on EXPERIMENTAL.
--- drivers/pnp/pnpacpi/Kconfig | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/pnp/pnpacpi/Kconfig +2 -2
@@ -2,8 +2,8 @@ # Plug and Play ACPI configuration # config PNPACPI - bool "Plug and Play ACPI support (EXPERIMENTAL)" - depends on PNP && ACPI && EXPERIMENTAL + bool "Plug and Play ACPI support" + depends on PNP && ACPI default y ---help--- Linux uses the PNPACPI to autodetect built-in
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 27/140 ACPI: add a Kconfig option for ACPI procfs interface
From: Zhang Rui <[email protected]>
Add a kconfig option CONFIG_ACPI_PROCFS to make procfs interface a configurable attribute of ACPI.
No procfs interface is actually deprecated,
and no sysfs interface is added in this patch.
CONGI_ACPI_PROCFS is used to mark procfs interface as deprecated once the same function is duplicated in sysfs.
--- Documentation/feature-removal-schedule.txt | 9 +++++++++ drivers/acpi/Kconfig | 10 ++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-)
Documentation/feature-removal-schedule.txt +9 -0
@@ -256,3 +256,12 @@ Why: Speedstep-centrino driver with ACPI hooks and acpi-cpufreq driver are Who: Venkatesh Pallipadi <[email protected]> --------------------------- + +What: ACPI procfs interface +When: July 2007 +Why: After ACPI sysfs conversion, ACPI attributes will be duplicated + in sysfs and the ACPI procfs interface should be removed. +Who: Zhang Rui <[email protected]> + +--------------------------- +
drivers/acpi/Kconfig +10 -0
@@ -77,6 +77,16 @@ config ACPI_SLEEP_PROC_SLEEP Create /proc/acpi/sleep Deprecated by /sys/power/state +config ACPI_PROCFS + bool "Procfs interface (deprecated)" + depends on ACPI + default y + ---help--- + Procfs interface for ACPI is made optional for back-compatible. + As the same functions are duplicated in sysfs interface + and this proc interface will be removed some time later, + it's marked as deprecated. + config ACPI_AC tristate "AC Adapter" depends on X86
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 28/140 ACPI: add ACPI debug attribute in sysfs
From: Zhang Rui <[email protected]>
Add ACPI debug attributes in sysfs. /proc/acpi/debug_layer && debug_level are deprecated by /sys/module/acpi/parameters/debug_layer && debug_level.
NOTE: The operations to them are quite the same. E.g. if you want to enable ACPI_DB_INFO, ACPI_DB_WARN,
ACPI_DB_ERROR and disable the others,
#echo 0x13 >/sys/module/acpi/parameters/debug_level is OK, and a boot option "acpi.debug_level = 0x13" also works.
--- drivers/acpi/Kconfig | 2 + drivers/acpi/debug.c | 62 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 5 deletions(-)
drivers/acpi/Kconfig +2 -0
@@ -86,6 +86,8 @@ config ACPI_PROCFS As the same functions are duplicated in sysfs interface and this proc interface will be removed some time later, it's marked as deprecated. + ( /proc/acpi/debug_layer && debug_level are deprecated by + /sys/module/acpi/parameters/debug_layer && debug_level. ) config ACPI_AC tristate "AC Adapter"
drivers/acpi/debug.c +57 -5
80 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 29/140 ACPI: add ACPICA version in sysfs
From: Zhang Rui <[email protected]>
Add an ACPI attribute to indicate ACPICA version. /proc/acpi/version is deprecated by /sys/module/acpi/parameters/acpica_version.
--- drivers/acpi/Kconfig | 4 +++- drivers/acpi/system.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletions(-)
drivers/acpi/Kconfig +3 -1
@@ -87,7 +87,9 @@ config ACPI_PROCFS and this proc interface will be removed some time later, it's marked as deprecated. ( /proc/acpi/debug_layer && debug_level are deprecated by - /sys/module/acpi/parameters/debug_layer && debug_level. ) + /sys/module/acpi/parameters/debug_layer && debug_level. + /proc/acpi/info is deprecated by + /sys/module/acpi/parameters/acpica_version ) config ACPI_AC tristate "AC Adapter"
drivers/acpi/system.c +24 -0
@@ -32,6 +32,11 @@#define _COMPONENT ACPI_SYSTEM_COMPONENT ACPI_MODULE_NAME("acpi_system") +#ifdef MODULE_PARAM_PREFIX +#undef MODULE_PARAM_PREFIX +#endif +#define MODULE_PARAM_PREFIX "acpi." +#define ACPI_SYSTEM_CLASS "system"#define ACPI_SYSTEM_DRIVER_NAME "ACPI System Driver"#define ACPI_SYSTEM_DEVICE_NAME "System"
@@ -41,9 +46,23 @@ ACPI_MODULE_NAME("acpi_system")#define ACPI_SYSTEM_FILE_FADT "fadt"extern struct fadt_descriptor acpi_fadt; +/* +* Make ACPICA version work as module param +*/ +static int param_get_acpica_version (char *buffer,struct kernel_param *kp) { +int result; + + result =sprintf (buffer,"%x" ,ACPI_CA_VERSION ); + +return result; +} + +module_param_call (acpica_version,NULL , param_get_acpica_version,NULL ,0444 ); +/* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ +#ifdef CONFIG_ACPI_PROCFS static int acpi_system_read_info (struct seq_file *seq,void *offset) {
@@ -63,6 +82,7 @@ static const struct file_operations acpi_system_info_ops = { .llseek = seq_lseek, .release = single_release, }; +#endif static ssize_t acpi_system_read_dsdt (struct file *,char __user *,size_t ,loff_t *);
@@ -128,6 +148,7 @@ static int __init acpi_system_init(void)if (acpi_disabled)return 0 ; +#ifdef CONFIG_ACPI_PROCFS /* 'info' [R] */ name =ACPI_SYSTEM_FILE_INFO ; entry =create_proc_entry (name,S_IRUGO , acpi_root_dir);
@@ -136,6 +157,7 @@ static int __init acpi_system_init(void) else { entry->proc_fops = &acpi_system_info_ops; } +#endif /* 'dsdt' [R] */ name =ACPI_SYSTEM_FILE_DSDT ;
@@ -159,7 +181,9 @@ static int __init acpi_system_init(void) Error:remove_proc_entry (ACPI_SYSTEM_FILE_FADT , acpi_root_dir);remove_proc_entry (ACPI_SYSTEM_FILE_DSDT , acpi_root_dir); +#ifdef CONFIG_ACPI_PROCFS remove_proc_entry (ACPI_SYSTEM_FILE_INFO , acpi_root_dir); +#endif error = -EFAULT ; goto Done;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 30/140 asus-laptop: add base driver
From: Corentin Chary <[email protected]>
Adds the new driver and make ASUS_LAPTOP and ACPI_ASUS incompatible. It may be strange to use ASUS_CREATE_DEVICE_ATTR and ASUS_SET_DEVICE_ATTR now, but these macro will be very usefull in next patchs. ASUS_HANDLE and ASUS_HANDLE_INIT comes from IBM_HANDLE and IBM_HANDLE_INIT, with some modification, and will also be used in next patchs.
--- MAINTAINERS | 8 + drivers/acpi/Kconfig | 13 +- drivers/misc/Kconfig | 17 ++ drivers/misc/Makefile | 1 + drivers/misc/asus-laptop.c | 530 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 564 insertions(+), 5 deletions(-) create mode 100644 drivers/misc/asus-laptop.c
MAINTAINERS +8 -0
@@ -584,6 +584,14 @@ W: http://sourceforge.net/projects/acpi4asus W: http://xf.iksaif.net/acpi4asus S: Maintained +ASUS LAPTOP EXTRAS DRIVER +P: Corentin Chary +M: [email protected] +L: [email protected] +W: http://sourceforge.net/projects/acpi4asus +W: http://xf.iksaif.net/acpi4asus +S: Maintained + ATA OVER ETHERNET DRIVER P: Ed L. Cashin M: [email protected]
drivers/acpi/Kconfig +8 -5
@@ -186,19 +186,22 @@ config ACPI_ASUS Note: display switching code is currently considered EXPERIMENTAL, toying with these values may even lock your machine. - + All settings are changed via /proc/acpi/asus directory entries. Owner and group for these entries can be set with asus_uid and asus_gid parameters. - + More information and a userspace daemon for handling the extra buttons at <http://sourceforge.net/projects/acpi4asus/>. - + If you have an ACPI-compatible ASUS laptop, say Y or M here. This driver is still under development, so if your laptop is unsupported or something works not quite as expected, please use the mailing list - available on the above page ([email protected]) - + available on the above page ([email protected]). + + NOTE: This driver is deprecated and will probably be removed soon, + use asus-laptop instead. + config ACPI_IBM tristate "IBM ThinkPad Laptop Extras" depends on X86
drivers/misc/Kconfig +17 -0
@@ -69,6 +69,23 @@ config TIFM_7XX1 To compile this driver as a module, choose M here: the module will be called tifm_7xx1. +config ASUS_LAPTOP + tristate "Asus Laptop Extras (EXPERIMENTAL)" + depends on X86 + depends on ACPI + depends on EXPERIMENTAL && !ACPI_ASUS + ---help--- + This is the new Linux driver for Asus laptops. It may also support some + MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate + standard ACPI events that go through /proc/acpi/events. It also adds + support for video output switching, LCD backlight control, Bluetooth and + Wlan control, and most importantly, allows you to blink those fancy LEDs. + + For more information and a userspace daemon for handling the extra + buttons see <http://acpi4asus.sf.net/>. + + If you have an ACPI-compatible ASUS laptop, say Y or M here. + config MSI_LAPTOP tristate "MSI Laptop Extras" depends on X86
drivers/misc/Makefile +1 -0
@@ -6,6 +6,7 @@ obj- := misc.o # Dummy rule to force built-in.o to be made obj-$(CONFIG_IBM_ASM) += ibmasm/ obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o +obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o obj-$(CONFIG_LKDTM) += lkdtm.o obj-$(CONFIG_TIFM_CORE) += tifm_core.o obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
drivers/misc/asus-laptop.c new file +530 -0
530 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 31/140 asus-laptop: add led support
From: Corentin Chary <[email protected]>
Add led support, using generic led class. Thomas Tuttle's patch
<http://lkml.org/lkml/2006/7/6/247> was very usefull. We use hotk->status to store led status because it's very hard to find acpi method to get the right status... To reduce the code, I use a lot of macro (ASUS_LED, ASUS_LED_REGISTER, etc ...), because the code is the same for all leds ...
--- drivers/misc/Kconfig | 1 + drivers/misc/asus-laptop.c | 145 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 0 deletions(-)
drivers/misc/Kconfig +1 -0
@@ -74,6 +74,7 @@ config ASUS_LAPTOP depends on X86 depends on ACPI depends on EXPERIMENTAL && !ACPI_ASUS + depends on LEDS_CLASS ---help--- This is the new Linux driver for Asus laptops. It may also support some MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate
drivers/misc/asus-laptop.c +145 -0
209 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 32/140 asus-laptop: add bluetooth and wlan support
From: Corentin Chary <[email protected]>
WLED and BLED are not handled like other leds (MLED, etc ..), because sometime they also control the wlan/bluetooth device. If the method for wireless_status is found, it's used to get the status, otherwise hotk->status is used. We also use the HWRS method, which tell if the bluetooth/wlan device is present or not. This patch show why we need a ASUS_SET_DEVICE_ATTR macro : if there is a bluetooth device, /sys/dev.../asus-laptop/bluetooth is usable, else it's not but it's clean.
--- drivers/misc/asus-laptop.c | 115 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 113 insertions(+), 2 deletions(-)
drivers/misc/asus-laptop.c +113 -2
@@ -56,8 +56,17 @@#define ASUS_HOTK_PREFIX "\\_SB.ATKD."/* +* Known bits returned by \_SB.ATKD.HWRS +*/ +#define WL_HWRS 0x80 +#define BT_HWRS 0x100 + +/* * Flags for hotk status +* WL_ON and BT_ON are also used for wireless_status() */ +#define WL_ON 0x01 //internal Wifi +#define BT_ON 0x02 //internal Bluetooth#define MLED_ON 0x04 //mail LED#define TLED_ON 0x08 //touchpad LED#define RLED_ON 0x10 //Record LED
@@ -84,6 +93,14 @@ ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED");ASUS_HANDLE (rled_set,ASUS_HOTK_PREFIX "RLED" );/* W1JC */ ASUS_HANDLE (pled_set,ASUS_HOTK_PREFIX "PLED" );/* A7J */ +/* Bluetooth and WLAN +* WLED and BLED are not handled like other XLED, because in some dsdt +* they also control the WLAN/Bluetooth device. +*/ +ASUS_HANDLE (wl_switch,ASUS_HOTK_PREFIX "WLED" ); +ASUS_HANDLE (bt_switch,ASUS_HOTK_PREFIX "BLED" ); +ASUS_HANDLE (wireless_status,ASUS_HOTK_PREFIX "RSTS" );/* All new models */ +/* * This is the main structure, we can use it to store anything interesting * about the hotk device
@@ -181,14 +198,32 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val,return (status ==AE_OK ) && (out_obj.type ==ACPI_TYPE_INTEGER ); } +static int read_wireless_status (int mask) { +int status; + +if (!wireless_status_handle) +return (hotk->status & mask) ?1 :0 ; + +if (read_acpi_int (wireless_status_handle,NULL , &status,NULL )) { +return (status & mask) ?1 :0 ; + }else +printk (ASUS_WARNING "Error reading Wireless status\n" ); + +return (hotk->status & mask) ?1 :0 ; +} +/* Generic LED functions */ static int read_status (int mask) { +/* There is a special method for both wireless devices */ +if (mask ==BT_ON || mask ==WL_ON ) +return read_wireless_status (mask); +return (hotk->status & mask) ?1 :0 ; }static void write_status (acpi_handle handle,int out,int mask, -int invert) +int invert) { hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask);
@@ -292,6 +327,51 @@ static int parse_arg(const char *buf, unsigned long count, int *val)return count; } +static ssize_t store_status (const char *buf,size_t count, +acpi_handle handle,int mask,int invert) +{ +int rv, value; +int out =0 ; + + rv =parse_arg (buf, count, &value); +if (rv >0 ) + out = value ?1 :0 ; + +write_status (handle, out, mask, invert); + +return rv; +} + +/* +* WLAN +*/ +static ssize_t show_wlan (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,read_status (WL_ON )); +} + +static ssize_t store_wlan (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +return store_status (buf, count, wl_switch_handle,WL_ON ,0 ); +} + +/* +* Bluetooth +*/ +static ssize_t show_bluetooth (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,read_status (BT_ON )); +} + +static ssize_t store_bluetooth (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +return store_status (buf, count, bt_switch_handle,BT_ON ,0 ); +} +static void asus_hotk_notify (acpi_handle handle,u32 event,void *data) {/* TODO Find a better way to handle events count. */
@@ -322,9 +402,13 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) }while (0 ) static ASUS_CREATE_DEVICE_ATTR(infos); +static ASUS_CREATE_DEVICE_ATTR (wlan); +static ASUS_CREATE_DEVICE_ATTR (bluetooth);static struct attribute *asuspf_attributes[] = { &dev_attr_infos.attr, + &dev_attr_wlan.attr, + &dev_attr_bluetooth.attr,NULL };
@@ -345,6 +429,13 @@ static struct platform_device *asuspf_device;static void asus_hotk_add_fs (void ) {ASUS_SET_DEVICE_ATTR (infos,0444 , show_infos,NULL ); + +if (wl_switch_handle) +ASUS_SET_DEVICE_ATTR (wlan,0644 , show_wlan, store_wlan); + +if (bt_switch_handle) +ASUS_SET_DEVICE_ATTR (bluetooth,0644 , + show_bluetooth, store_bluetooth); } static int asus_handle_init(char *name, acpi_handle *handle,
@@ -377,7 +468,7 @@ static int asus_hotk_get_info(void)struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL };struct acpi_buffer dsdt = {ACPI_ALLOCATE_BUFFER ,NULL };union acpi_object *model =NULL ; -int bsts_result; +int bsts_result, hwrs_result;char *string =NULL ;acpi_status status;
@@ -440,6 +531,22 @@ static int asus_hotk_get_info(void)ASUS_HANDLE_INIT (rled_set);ASUS_HANDLE_INIT (pled_set); +/* +* The HWRS method return informations about the hardware. +* 0x80 bit is for WLAN, 0x100 for Bluetooth. +* The significance of others is yet to be found. +* If we don't find the method, we assume the device are present. +*/ +if (!read_acpi_int (hotk->handle,"HRWS" , &hwrs_result,NULL )) + hwrs_result =WL_HWRS |BT_HWRS ; + +if (hwrs_result &WL_HWRS ) +ASUS_HANDLE_INIT (wl_switch); +if (hwrs_result &BT_HWRS ) +ASUS_HANDLE_INIT (bt_switch); + +ASUS_HANDLE_INIT (wireless_status); +kfree (model);return AE_OK ;
@@ -504,6 +611,10 @@ static int asus_hotk_add(struct acpi_device *device) asus_hotk_found =1 ; +/* WLED and BLED are on by default */ +write_status (bt_switch_handle,1 ,BT_ON ,0 ); +write_status (wl_switch_handle,1 ,WL_ON ,0 ); + end:if (result) {kfree (hotk->name);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 33/140 asus-laptop: add backlight support
From: Corentin Chary <[email protected]>
Adds backlight support using backlight class. We now change the brightness *and toggle the backlight !* via /sys/class/backlight/asus-laptop/.
If the user switchs the backlight using the keyboard, asus_hotk_notify looks for ATKD_LCD_OFF and ATKD_LCD_ON events, and stores the right state into hotk->status and bd->props->power .
--- drivers/misc/Kconfig | 1 + drivers/misc/asus-laptop.c | 183 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 183 insertions(+), 1 deletions(-)
drivers/misc/Kconfig +1 -0
@@ -75,6 +75,7 @@ config ASUS_LAPTOP depends on ACPI depends on EXPERIMENTAL && !ACPI_ASUS depends on LEDS_CLASS + depends on BACKLIGHT_CLASS_DEVICE ---help--- This is the new Linux driver for Asus laptops. It may also support some MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate
drivers/misc/asus-laptop.c +182 -1
270 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 34/140 asus-laptop: add display switching support
From: Corentin Chary <[email protected]>
/sys/.../asus-laptop/display can now be used to switch displays like the old /proc/acpi/asus/disp does
--- drivers/misc/asus-laptop.c | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+), 0 deletions(-)
drivers/misc/asus-laptop.c +82 -0
@@ -125,6 +125,23 @@ ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */"\\_SB.PCI0.PX40.Q10" ,/* S1x */ "\\Q10"); /* A2x, L2D, L3D, M2E */ +/* Display */ +ASUS_HANDLE (display_set,ASUS_HOTK_PREFIX "SDSP" ); +ASUS_HANDLE (display_get, +"\\_SB.PCI0.P0P1.VGA.GETD" ,/* A6B, A6K A6R A7D F3JM L4R M6R A3G +M6A M6V VX-1 V6J V6V W3Z */ +"\\_SB.PCI0.P0P2.VGA.GETD" ,/* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V +S5A M5A z33A W1Jc W2V */ +"\\_SB.PCI0.P0P3.VGA.GETD" ,/* A6V A6Q */ +"\\_SB.PCI0.P0PA.VGA.GETD" ,/* A6T, A6M */ +"\\_SB.PCI0.PCI1.VGAC.NMAP" ,/* L3C */ +"\\_SB.PCI0.VGA.GETD" ,/* Z96F */ +"\\ACTD" ,/* A2D */ +"\\ADVG" ,/* A4G Z71A W1N W5A W5F M2N M3N M5N M6N S1N S5N */ +"\\DNXT" ,/* P30 */ +"\\INFB" ,/* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */ +"\\SSTE" );/* A3F A6F A3N A3L M6N W3N W6A */ +/* * This is the main structure, we can use it to store anything interesting * about the hotk device
@@ -491,6 +508,60 @@ static ssize_t store_bluetooth(struct device *dev, struct device_attribute *attrreturn store_status (buf, count, bt_switch_handle,BT_ON ,0 ); } +/* +* Display +*/ +static void set_display (int value) +{ +/* no sanity check needed for now */ +if (!write_acpi_int (display_set_handle,NULL , value,NULL )) +printk (ASUS_WARNING "Error setting display\n" ); +return ; +} + +static int read_display (void ) +{ +int value =0 ; + +/* In most of the case, we know how to set the display, but sometime +we can't read it */ +if (display_get_handle) { +if (!read_acpi_int (display_get_handle,NULL , &value,NULL )) +printk (ASUS_WARNING "Error reading display status\n" ); + } + + value &=0x0F ;/* needed for some models, shouldn't hurt others */ + +return value; +} +/* +* Now, *this* one could be more user-friendly, but so far, no-one has +* complained. The significance of bits is the same as in store_disp() +*/ +static ssize_t show_disp (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,read_display ()); +} + +/* +* Experimental support for display switching. As of now: 1 should activate +* the LCD output, 2 should do for CRT, 4 for TV-Out and 8 for DVI. +* Any combination (bitwise) of these will suffice. I never actually tested 4 +* displays hooked up simultaneously, so be warned. See the acpi4asus README +* for more info. +*/ +static ssize_t store_disp (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +int rv, value; + + rv =parse_arg (buf, count, &value); +if (rv >0 ) +set_display (value); +return rv; +} +static void asus_hotk_notify (acpi_handle handle,u32 event,void *data) {/* TODO Find a better way to handle events count. */
@@ -535,11 +606,13 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)static ASUS_CREATE_DEVICE_ATTR (infos);static ASUS_CREATE_DEVICE_ATTR (wlan);static ASUS_CREATE_DEVICE_ATTR (bluetooth); +static ASUS_CREATE_DEVICE_ATTR (display);static struct attribute *asuspf_attributes[] = { &dev_attr_infos.attr, &dev_attr_wlan.attr, &dev_attr_bluetooth.attr, + &dev_attr_display.attr,NULL };
@@ -567,6 +640,12 @@ static void asus_hotk_add_fs(void)if (bt_switch_handle)ASUS_SET_DEVICE_ATTR (bluetooth,0644 , show_bluetooth, store_bluetooth); + +if (display_set_handle && display_get_handle) +ASUS_SET_DEVICE_ATTR (display,0644 , show_disp, store_disp); +else if (display_set_handle) +ASUS_SET_DEVICE_ATTR (display,0200 ,NULL , store_disp); + } static int asus_handle_init(char *name, acpi_handle *handle,
@@ -683,6 +762,9 @@ static int asus_hotk_get_info(void)ASUS_HANDLE_INIT (lcd_switch); +ASUS_HANDLE_INIT (display_set); +ASUS_HANDLE_INIT (display_get); +kfree (model);return AE_OK ;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 35/140 asus-laptop: add ledd support
From: Corentin Chary <[email protected]>
Ledd is a special led ... /sys/.../asus-laptop/ledd works like /proc/acpi/asus/ledd
--- drivers/misc/asus-laptop.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
drivers/misc/asus-laptop.c +38 -0
@@ -104,6 +104,9 @@ ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED");ASUS_HANDLE (rled_set,ASUS_HOTK_PREFIX "RLED" );/* W1JC */ ASUS_HANDLE (pled_set,ASUS_HOTK_PREFIX "PLED" );/* A7J */ +/* LEDD */ +ASUS_HANDLE (ledd_set,ASUS_HOTK_PREFIX "SLCM" ); +/* Bluetooth and WLAN * WLED and BLED are not handled like other XLED, because in some dsdt * they also control the WLAN/Bluetooth device.
@@ -151,6 +154,7 @@ struct asus_hotk {struct acpi_device *device;//the device we are in acpi_handle handle;//the handle of the hotk device char status;//status of the hotk, for LEDs, ... +u32 ledd_status;//status of the LED display u16 event_count[128 ];//count for each event TODO make this better };
@@ -479,6 +483,30 @@ static ssize_t store_status(const char *buf, size_t count, }/* +* LEDD display +*/ +static ssize_t show_ledd (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"0x%08x\n" , hotk->ledd_status); +} + +static ssize_t store_ledd (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +int rv, value; + + rv =parse_arg (buf, count, &value); +if (rv >0 ) { +if (!write_acpi_int (ledd_set_handle,NULL , value,NULL )) +printk (ASUS_WARNING "LED display write failed\n" ); +else + hotk->ledd_status = (u32 ) value; + } +return rv; +} + +/* * WLAN */ static ssize_t show_wlan(struct device *dev,
@@ -607,12 +635,14 @@ static ASUS_CREATE_DEVICE_ATTR(infos);static ASUS_CREATE_DEVICE_ATTR (wlan);static ASUS_CREATE_DEVICE_ATTR (bluetooth);static ASUS_CREATE_DEVICE_ATTR (display); +static ASUS_CREATE_DEVICE_ATTR (ledd);static struct attribute *asuspf_attributes[] = { &dev_attr_infos.attr, &dev_attr_wlan.attr, &dev_attr_bluetooth.attr, &dev_attr_display.attr, + &dev_attr_ledd.attr,NULL };
@@ -646,6 +676,9 @@ static void asus_hotk_add_fs(void)else if (display_set_handle)ASUS_SET_DEVICE_ATTR (display,0200 ,NULL , store_disp); +if (ledd_set_handle) +ASUS_SET_DEVICE_ATTR (ledd,0644 , show_ledd, store_ledd); + } static int asus_handle_init(char *name, acpi_handle *handle,
@@ -741,6 +774,8 @@ static int asus_hotk_get_info(void)ASUS_HANDLE_INIT (rled_set);ASUS_HANDLE_INIT (pled_set); +ASUS_HANDLE_INIT (ledd_set); +/* * The HWRS method return informations about the hardware. * 0x80 bit is for WLAN, 0x100 for Bluetooth.
@@ -836,6 +871,9 @@ static int asus_hotk_add(struct acpi_device *device)/* LCD Backlight is on by default */ write_status (NULL ,1 ,LCD_ON ,0 ); +/* LED display is off by default */ + hotk->ledd_status =0xFFF ; + end:if (result) {kfree (hotk->name);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 36/140 asus-laptop: add light sensor support
From: Corentin Chary <[email protected]>
/proc/acpi/asus/lslvl is now /sys/.../asus-laptop/ls_level /proc/acpi/asus/lssw is now /sys/.../asus-laptop/ls_switch nothing else ..
--- drivers/misc/asus-laptop.c | 84 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 84 insertions(+), 0 deletions(-)
drivers/misc/asus-laptop.c +84 -0
@@ -145,6 +145,9 @@ ASUS_HANDLE(display_get,"\\INFB" ,/* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */ "\\SSTE"); /* A3F A6F A3N A3L M6N W3N W6A */ +ASUS_HANDLE (ls_switch,ASUS_HOTK_PREFIX "ALSC" );/* Z71A Z71V */ +ASUS_HANDLE (ls_level,ASUS_HOTK_PREFIX "ALSL" );/* Z71A Z71V */ +/* * This is the main structure, we can use it to store anything interesting * about the hotk device
@@ -155,6 +158,8 @@ struct asus_hotk {acpi_handle handle;//the handle of the hotk device char status;//status of the hotk, for LEDs, ... u32 ledd_status;//status of the LED display +u8 light_level;//light sensor level +u8 light_switch;//light sensor switch value u16 event_count[128 ];//count for each event TODO make this better };
@@ -590,6 +595,62 @@ static ssize_t store_disp(struct device *dev, struct device_attribute *attr,return rv; } +/* +* Light Sens +*/ +static void set_light_sens_switch (int value) +{ +if (!write_acpi_int (ls_switch_handle,NULL , value,NULL )) +printk (ASUS_WARNING "Error setting light sensor switch\n" ); + hotk->light_switch = value; +} + +static ssize_t show_lssw (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , hotk->light_switch); +} + +static ssize_t store_lssw (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +int rv, value; + + rv =parse_arg (buf, count, &value); +if (rv >0 ) +set_light_sens_switch (value ?1 :0 ); + +return rv; +} + +static void set_light_sens_level (int value) +{ +if (!write_acpi_int (ls_level_handle,NULL , value,NULL )) +printk (ASUS_WARNING "Error setting light sensor level\n" ); + hotk->light_level = value; +} + +static ssize_t show_lslvl (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , hotk->light_level); +} + +static ssize_t store_lslvl (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +int rv, value; + + rv =parse_arg (buf, count, &value); +if (rv >0 ) { + value = (0 < value) ? ((15 < value) ?15 : value) :0 ; +/* 0 <= value <= 15 */ +set_light_sens_level (value); + } + +return rv; +} +static void asus_hotk_notify (acpi_handle handle,u32 event,void *data) {/* TODO Find a better way to handle events count. */
@@ -636,6 +697,8 @@ static ASUS_CREATE_DEVICE_ATTR(wlan);static ASUS_CREATE_DEVICE_ATTR (bluetooth);static ASUS_CREATE_DEVICE_ATTR (display);static ASUS_CREATE_DEVICE_ATTR (ledd); +static ASUS_CREATE_DEVICE_ATTR (ls_switch); +static ASUS_CREATE_DEVICE_ATTR (ls_level);static struct attribute *asuspf_attributes[] = { &dev_attr_infos.attr,
@@ -643,6 +706,8 @@ static struct attribute *asuspf_attributes[] = { &dev_attr_bluetooth.attr, &dev_attr_display.attr, &dev_attr_ledd.attr, + &dev_attr_ls_switch.attr, + &dev_attr_ls_level.attr, NULL };
@@ -679,6 +744,10 @@ static void asus_hotk_add_fs(void)if (ledd_set_handle)ASUS_SET_DEVICE_ATTR (ledd,0644 , show_ledd, store_ledd); +if (ls_switch_handle && ls_level_handle) { +ASUS_SET_DEVICE_ATTR (ls_level,0644 , show_lslvl, store_lslvl); +ASUS_SET_DEVICE_ATTR (ls_switch,0644 , show_lssw, store_lssw); + } } static int asus_handle_init(char *name, acpi_handle *handle,
@@ -800,6 +869,11 @@ static int asus_hotk_get_info(void)ASUS_HANDLE_INIT (display_set);ASUS_HANDLE_INIT (display_get); +/* There is a lot of models with "ALSL", but a few get +a real light sens, so we need to check it. */ +if (ASUS_HANDLE_INIT (ls_switch)) +ASUS_HANDLE_INIT (ls_level); +kfree (model);return AE_OK ;
@@ -874,6 +948,16 @@ static int asus_hotk_add(struct acpi_device *device)/* LED display is off by default */ hotk->ledd_status =0xFFF ; +/* Set initial values of light sensor and level */ + hotk->light_switch =1 ;/* Default to light sensor disabled */ + hotk->light_level =0 ;/* level 5 for sensor sensitivity */ + +if (ls_switch_handle) +set_light_sens_switch (hotk->light_switch); + +if (ls_level_handle) +set_light_sens_level (hotk->light_level); + end:if (result) {kfree (hotk->name);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 37/140 asus-laptop: Lindent
From: Len Brown <[email protected]>
--- drivers/misc/asus-laptop.c | 247 ++++++++++++++++++++++---------------------- 1 files changed, 123 insertions(+), 124 deletions(-)
drivers/misc/asus-laptop.c +123 -124
@@ -79,9 +79,9 @@#define BT_ON 0x02 //internal Bluetooth#define MLED_ON 0x04 //mail LED#define TLED_ON 0x08 //touchpad LED -#define RLED_ON 0x10 //Record LED -#define PLED_ON 0x20 //Phone LED -#define LCD_ON 0x40 //LCD backlight +#define RLED_ON 0x10 //Record LED +#define PLED_ON 0x20 //Phone LED +#define LCD_ON 0x40 //LCD backlight#define ASUS_LOG ASUS_HOTK_FILE ": "#define ASUS_ERR KERN_ERR ASUS_LOG
@@ -101,8 +101,8 @@ MODULE_LICENSE("GPL");/* LED */ ASUS_HANDLE (mled_set,ASUS_HOTK_PREFIX "MLED" );ASUS_HANDLE (tled_set,ASUS_HOTK_PREFIX "TLED" ); -ASUS_HANDLE (rled_set,ASUS_HOTK_PREFIX "RLED" );/* W1JC */ -ASUS_HANDLE (pled_set,ASUS_HOTK_PREFIX "PLED" );/* A7J */ +ASUS_HANDLE (rled_set,ASUS_HOTK_PREFIX "RLED" );/* W1JC */ +ASUS_HANDLE (pled_set,ASUS_HOTK_PREFIX "PLED" );/* A7J */ /* LEDD */ ASUS_HANDLE (ledd_set,ASUS_HOTK_PREFIX "SLCM" );
@@ -113,53 +113,52 @@ ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM");*/ ASUS_HANDLE (wl_switch,ASUS_HOTK_PREFIX "WLED" );ASUS_HANDLE (bt_switch,ASUS_HOTK_PREFIX "BLED" ); -ASUS_HANDLE (wireless_status,ASUS_HOTK_PREFIX "RSTS" );/* All new models */ +ASUS_HANDLE (wireless_status,ASUS_HOTK_PREFIX "RSTS" );/* All new models */ /* Brightness */ ASUS_HANDLE (brightness_set,ASUS_HOTK_PREFIX "SPLV" );ASUS_HANDLE (brightness_get,ASUS_HOTK_PREFIX "GPLV" );/* Backlight */ -ASUS_HANDLE (lcd_switch,"\\_SB.PCI0.SBRG.EC0._Q10" ,/* All new models */ -"\\_SB.PCI0.ISA.EC0._Q10" ,/* A1x */ -"\\_SB.PCI0.PX40.ECD0._Q10" ,/* L3C */ -"\\_SB.PCI0.PX40.EC0.Q10" ,/* M1A */ -"\\_SB.PCI0.LPCB.EC0._Q10" ,/* P30 */ -"\\_SB.PCI0.PX40.Q10" ,/* S1x */ -"\\Q10" );/* A2x, L2D, L3D, M2E */ +ASUS_HANDLE (lcd_switch,"\\_SB.PCI0.SBRG.EC0._Q10" ,/* All new models */ +"\\_SB.PCI0.ISA.EC0._Q10" ,/* A1x */ +"\\_SB.PCI0.PX40.ECD0._Q10" ,/* L3C */ +"\\_SB.PCI0.PX40.EC0.Q10" ,/* M1A */ +"\\_SB.PCI0.LPCB.EC0._Q10" ,/* P30 */ +"\\_SB.PCI0.PX40.Q10" ,/* S1x */ +"\\Q10" );/* A2x, L2D, L3D, M2E */ /* Display */ ASUS_HANDLE (display_set,ASUS_HOTK_PREFIX "SDSP" ); -ASUS_HANDLE (display_get, -"\\_SB.PCI0.P0P1.VGA.GETD" ,/* A6B, A6K A6R A7D F3JM L4R M6R A3G -M6A M6V VX-1 V6J V6V W3Z */ -"\\_SB.PCI0.P0P2.VGA.GETD" ,/* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V +ASUS_HANDLE (display_get,"\\_SB.PCI0.P0P1.VGA.GETD" ,/* A6B, A6K A6R A7D F3JM L4R M6R A3G +M6A M6V VX-1 V6J V6V W3Z */ +"\\_SB.PCI0.P0P2.VGA.GETD" ,/* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V S5A M5A z33A W1Jc W2V */ -"\\_SB.PCI0.P0P3.VGA.GETD" ,/* A6V A6Q */ -"\\_SB.PCI0.P0PA.VGA.GETD" ,/* A6T, A6M */ -"\\_SB.PCI0.PCI1.VGAC.NMAP" ,/* L3C */ -"\\_SB.PCI0.VGA.GETD" ,/* Z96F */ -"\\ACTD" ,/* A2D */ -"\\ADVG" ,/* A4G Z71A W1N W5A W5F M2N M3N M5N M6N S1N S5N */ -"\\DNXT" ,/* P30 */ -"\\INFB" ,/* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */ -"\\SSTE" );/* A3F A6F A3N A3L M6N W3N W6A */ - -ASUS_HANDLE (ls_switch,ASUS_HOTK_PREFIX "ALSC" );/* Z71A Z71V */ -ASUS_HANDLE (ls_level,ASUS_HOTK_PREFIX "ALSL" );/* Z71A Z71V */ +"\\_SB.PCI0.P0P3.VGA.GETD" ,/* A6V A6Q */ +"\\_SB.PCI0.P0PA.VGA.GETD" ,/* A6T, A6M */ +"\\_SB.PCI0.PCI1.VGAC.NMAP" ,/* L3C */ +"\\_SB.PCI0.VGA.GETD" ,/* Z96F */ +"\\ACTD" ,/* A2D */ +"\\ADVG" ,/* A4G Z71A W1N W5A W5F M2N M3N M5N M6N S1N S5N */ +"\\DNXT" ,/* P30 */ +"\\INFB" ,/* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */ +"\\SSTE" );/* A3F A6F A3N A3L M6N W3N W6A */ + +ASUS_HANDLE (ls_switch,ASUS_HOTK_PREFIX "ALSC" );/* Z71A Z71V */ +ASUS_HANDLE (ls_level,ASUS_HOTK_PREFIX "ALSL" );/* Z71A Z71V */ /* * This is the main structure, we can use it to store anything interesting * about the hotk device */ struct asus_hotk { -char *name;//laptop name +char *name;//laptop name struct acpi_device *device;//the device we are in acpi_handle handle;//the handle of the hotk device char status;//status of the hotk, for LEDs, ... u32 ledd_status;//status of the LED display -u8 light_level;//light sensor level -u8 light_switch;//light sensor switch value +u8 light_level;//light sensor level +u8 light_switch;//light sensor switch value u16 event_count[128 ];//count for each event TODO make this better };
@@ -197,10 +196,10 @@ static struct backlight_device *asus_backlight_device;static int read_brightness (struct backlight_device *bd);static int update_bl_status (struct backlight_device *bd);static struct backlight_properties asusbl_data = { - .owner =THIS_MODULE , - .get_brightness = read_brightness, - .update_status = update_bl_status, - .max_brightness =15 , + .owner =THIS_MODULE , + .get_brightness = read_brightness, + .update_status = update_bl_status, + .max_brightness =15 , };/* These functions actually update the LED's, and are called from a
@@ -263,7 +262,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val,return (status ==AE_OK ) && (out_obj.type ==ACPI_TYPE_INTEGER ); } -static int read_wireless_status (int mask) { +static int read_wireless_status (int mask) +{int status;if (!wireless_status_handle)
@@ -287,8 +287,7 @@ static int read_status(int mask)return (hotk->status & mask) ?1 :0 ; } -static void write_status (acpi_handle handle,int out,int mask, -int invert) +static void write_status (acpi_handle handle,int out,int mask,int invert) { hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask);
@@ -333,7 +332,7 @@ static int set_lcd_state(int value)if (lcd ==get_lcd_state ())return 0 ; -if (lcd_switch_handle) { +if (lcd_switch_handle) { status =acpi_evaluate_object (lcd_switch_handle,NULL ,NULL ,NULL );
@@ -349,12 +348,12 @@ static void lcd_blank(int blank) {struct backlight_device *bd = asus_backlight_device; -if (bd) { +if (bd) {down (&bd->sem); -if (likely (bd->props)) { +if (likely (bd->props)) { bd->props->power = blank; -if (likely (bd->props->update_status)) - bd->props->update_status (bd); +if (likely (bd->props->update_status)) + bd->props->update_status (bd); }up (&bd->sem); }
@@ -391,7 +390,7 @@ static int update_bl_status(struct backlight_device *bd)int value = bd->props->brightness; rv =set_brightness (bd, value); -if (rv) +if (rv)return rv; value = (bd->props->power ==FB_BLANK_UNBLANK ) ?1 :0 ;
@@ -408,7 +407,7 @@ static int update_bl_status(struct backlight_device *bd)* number of bytes written in page */ static ssize_t show_infos (struct device *dev, -struct device_attribute *attr,char *page) +struct device_attribute *attr,char *page) {int len =0 ;int temp;
@@ -535,8 +534,9 @@ static ssize_t show_bluetooth(struct device *dev,return sprintf (buf,"%d\n" ,read_status (BT_ON )); } -static ssize_t store_bluetooth (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t store_bluetooth (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {return store_status (buf, count, bt_switch_handle,BT_ON ,0 ); }
@@ -558,7 +558,7 @@ static int read_display(void)/* In most of the case, we know how to set the display, but sometime we can't read it */ -if (display_get_handle) { +if (display_get_handle) {if (!read_acpi_int (display_get_handle,NULL , &value,NULL ))printk (ASUS_WARNING "Error reading display status\n" ); }
@@ -567,6 +567,7 @@ static int read_display(void)return value; } +/* * Now, *this* one could be more user-friendly, but so far, no-one has * complained. The significance of bits is the same as in store_disp()
@@ -664,7 +665,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)if (event ==ATKD_LCD_ON ) {write_status (NULL ,1 ,LCD_ON ,0 );lcd_blank (FB_BLANK_UNBLANK ); - }else if (event ==ATKD_LCD_OFF ) { + }else if (event ==ATKD_LCD_OFF ) {write_status (NULL ,0 ,LCD_ON ,0 );lcd_blank (FB_BLANK_POWERDOWN ); }
@@ -701,30 +702,29 @@ static ASUS_CREATE_DEVICE_ATTR(ls_switch);static ASUS_CREATE_DEVICE_ATTR (ls_level);static struct attribute *asuspf_attributes[] = { - &dev_attr_infos.attr, - &dev_attr_wlan.attr, - &dev_attr_bluetooth.attr, - &dev_attr_display.attr, - &dev_attr_ledd.attr, - &dev_attr_ls_switch.attr, - &dev_attr_ls_level.attr, -NULL + &dev_attr_infos.attr, + &dev_attr_wlan.attr, + &dev_attr_bluetooth.attr, + &dev_attr_display.attr, + &dev_attr_ledd.attr, + &dev_attr_ls_switch.attr, + &dev_attr_ls_level.attr, +NULL };static struct attribute_group asuspf_attribute_group = { - .attrs = asuspf_attributes + .attrs = asuspf_attributes };static struct platform_driver asuspf_driver = { - .driver = { - .name =ASUS_HOTK_FILE , - .owner =THIS_MODULE , - } + .driver = { + .name =ASUS_HOTK_FILE , + .owner =THIS_MODULE , + } };static struct platform_device *asuspf_device; -static void asus_hotk_add_fs (void ) {ASUS_SET_DEVICE_ATTR (infos,0444 , show_infos,NULL );
@@ -738,7 +738,7 @@ static void asus_hotk_add_fs(void)if (display_set_handle && display_get_handle)ASUS_SET_DEVICE_ATTR (display,0644 , show_disp, store_disp); -else if (display_set_handle) +else if (display_set_handle)ASUS_SET_DEVICE_ATTR (display,0200 ,NULL , store_disp);if (ledd_set_handle)
@@ -750,7 +750,7 @@ static void asus_hotk_add_fs(void) } } -static int asus_handle_init (char *name,acpi_handle *handle, +static int asus_handle_init (char *name,acpi_handle * handle,char **paths,int num_paths) {int i;
@@ -770,7 +770,6 @@ static int asus_handle_init(char *name, acpi_handle *handle, asus_handle_init(#object, &object##_handle, object##_paths, \ ARRAY_SIZE(object##_paths)) -/* * This function is used to initialize the hotk with right values. In this * method, we can make all the detection we want, and modify the hotk struct
@@ -835,7 +834,7 @@ static int asus_hotk_get_info(void)if (!hotk->name)return -ENOMEM ; -if (*string) +if (*string)printk (ASUS_NOTICE " %s model detected\n" , string);ASUS_HANDLE_INIT (mled_set);
@@ -854,9 +853,9 @@ static int asus_hotk_get_info(void)if (!read_acpi_int (hotk->handle,"HRWS" , &hwrs_result,NULL )) hwrs_result =WL_HWRS |BT_HWRS ; -if (hwrs_result &WL_HWRS ) +if (hwrs_result &WL_HWRS )ASUS_HANDLE_INIT (wl_switch); -if (hwrs_result &BT_HWRS ) +if (hwrs_result &BT_HWRS )ASUS_HANDLE_INIT (bt_switch);ASUS_HANDLE_INIT (wireless_status);
@@ -871,7 +870,7 @@ static int asus_hotk_get_info(void)/* There is a lot of models with "ALSL", but a few get a real light sens, so we need to check it. */ -if (ASUS_HANDLE_INIT (ls_switch)) +if (ASUS_HANDLE_INIT (ls_switch))ASUS_HANDLE_INIT (ls_level);kfree (model);
@@ -948,15 +947,15 @@ static int asus_hotk_add(struct acpi_device *device)/* LED display is off by default */ hotk->ledd_status =0xFFF ; -/* Set initial values of light sensor and level */ - hotk->light_switch =1 ;/* Default to light sensor disabled */ - hotk->light_level =0 ;/* level 5 for sensor sensitivity */ +/* Set initial values of light sensor and level */ + hotk->light_switch =1 ;/* Default to light sensor disabled */ + hotk->light_level =0 ;/* level 5 for sensor sensitivity */ -if (ls_switch_handle) -set_light_sens_switch (hotk->light_switch); +if (ls_switch_handle) +set_light_sens_switch (hotk->light_switch); -if (ls_level_handle) -set_light_sens_level (hotk->light_level); +if (ls_level_handle) +set_light_sens_level (hotk->light_level); end:if (result) {
@@ -987,7 +986,7 @@ static int asus_hotk_remove(struct acpi_device *device, int type)static void asus_backlight_exit (void ) { -if (asus_backlight_device) +if (asus_backlight_device)backlight_device_unregister (asus_backlight_device); }
@@ -1012,21 +1011,21 @@ static void __exit asus_laptop_exit(void)asus_led_exit ();acpi_bus_unregister_driver (&asus_hotk_driver); -sysfs_remove_group (&asuspf_device->dev.kobj, &asuspf_attribute_group); -platform_device_unregister (asuspf_device); -platform_driver_unregister (&asuspf_driver); +sysfs_remove_group (&asuspf_device->dev.kobj, &asuspf_attribute_group); +platform_device_unregister (asuspf_device); +platform_driver_unregister (&asuspf_driver);kfree (asus_info); } -static int asus_backlight_init (struct device * dev) +static int asus_backlight_init (struct device *dev) {struct backlight_device *bd; -if (brightness_set_handle && lcd_switch_handle) { - bd =backlight_device_register (ASUS_HOTK_FILE , dev, -NULL , &asusbl_data); -if (IS_ERR (bd)) { +if (brightness_set_handle && lcd_switch_handle) { + bd =backlight_device_register (ASUS_HOTK_FILE , dev, +NULL , &asusbl_data); +if (IS_ERR (bd)) {printk (ASUS_ERR "Could not register asus backlight device\n" ); asus_backlight_device =NULL ;
@@ -1036,11 +1035,11 @@ static int asus_backlight_init(struct device * dev) asus_backlight_device = bd;down (&bd->sem); -if (likely (bd->props)) { +if (likely (bd->props)) { bd->props->brightness =read_brightness (NULL ); bd->props->power =FB_BLANK_UNBLANK ; -if (likely (bd->props->update_status)) - bd->props->update_status (bd); +if (likely (bd->props->update_status)) + bd->props->update_status (bd); }up (&bd->sem); }
@@ -1048,39 +1047,39 @@ static int asus_backlight_init(struct device * dev) }static int asus_led_register (acpi_handle handle, -struct led_classdev * ldev, -struct device * dev) +struct led_classdev *ldev,struct device *dev) { -if (!handle) +if (!handle)return 0 ;return led_classdev_register (dev, ldev); } +#define ASUS_LED_REGISTER (object, device) \ asus_led_register(object##_set_handle, &object##_led, device) -static int asus_led_init (struct device * dev) +static int asus_led_init (struct device *dev) {int rv; rv =ASUS_LED_REGISTER (mled, dev); -if (rv) +if (rv)return rv; rv =ASUS_LED_REGISTER (tled, dev); -if (rv) +if (rv)return rv; rv =ASUS_LED_REGISTER (rled, dev); -if (rv) +if (rv)return rv; rv =ASUS_LED_REGISTER (pled, dev); -if (rv) +if (rv)return rv; led_workqueue =create_singlethread_workqueue ("led_workqueue" ); -if (!led_workqueue) +if (!led_workqueue)return -ENOMEM ;return 0 ;
@@ -1118,51 +1117,51 @@ static int __init asus_laptop_init(void) dev =acpi_get_physical_device (hotk->device->handle); result =asus_backlight_init (dev); -if (result) +if (result) goto fail_backlight; result =asus_led_init (dev); -if (result) +if (result) goto fail_led; -/* Register platform stuff */ +/* Register platform stuff */ result =platform_driver_register (&asuspf_driver); -if (result) - goto fail_platform_driver; +if (result) + goto fail_platform_driver; - asuspf_device =platform_device_alloc (ASUS_HOTK_FILE ,-1 ); -if (!asuspf_device) { - result = -ENOMEM ; - goto fail_platform_device1; - } + asuspf_device =platform_device_alloc (ASUS_HOTK_FILE ,-1 ); +if (!asuspf_device) { + result = -ENOMEM ; + goto fail_platform_device1; + } - result =platform_device_add (asuspf_device); -if (result) - goto fail_platform_device2; + result =platform_device_add (asuspf_device); +if (result) + goto fail_platform_device2; - result =sysfs_create_group (&asuspf_device->dev.kobj, + result =sysfs_create_group (&asuspf_device->dev.kobj, &asuspf_attribute_group); -if (result) - goto fail_sysfs; +if (result) + goto fail_sysfs; -return 0 ; +return 0 ; -fail_sysfs: -platform_device_del (asuspf_device); + fail_sysfs: +platform_device_del (asuspf_device); -fail_platform_device2: + fail_platform_device2:platform_device_put (asuspf_device); -fail_platform_device1: -platform_driver_unregister (&asuspf_driver); + fail_platform_device1: +platform_driver_unregister (&asuspf_driver); -fail_platform_driver: + fail_platform_driver:asus_led_exit (); -fail_led: + fail_led:asus_backlight_exit (); -fail_backlight: + fail_backlight:return result; }
Signature · 1 line
1.5.0.rc3.39.gec804
A message that is not in the archive (sent off-list or not yet received): [email protected]
Len Brown
reviewerPATCH 39/140 ACPI: delete unused acpi_device_get_debug_info()
From: Len Brown <[email protected]>
--- drivers/acpi/scan.c | 45 --------------------------------------------- 1 files changed, 0 insertions(+), 45 deletions(-)
drivers/acpi/scan.c +0 -45
@@ -888,49 +888,6 @@ static int acpi_device_set_context(struct acpi_device *device, int type)return result; } -static void acpi_device_get_debug_info (struct acpi_device *device, -acpi_handle handle,int type) -{ -#ifdef ACPI_DEBUG_OUTPUT -char *type_string =NULL ; -char name[80 ] = {'?' ,'\0' }; -struct acpi_buffer buffer = {sizeof (name), name }; - -switch (type) { -case ACPI_BUS_TYPE_DEVICE : - type_string ="Device" ; -acpi_get_name (handle,ACPI_FULL_PATHNAME , &buffer); -break ; -case ACPI_BUS_TYPE_POWER : - type_string ="Power Resource" ; -acpi_get_name (handle,ACPI_FULL_PATHNAME , &buffer); -break ; -case ACPI_BUS_TYPE_PROCESSOR : - type_string ="Processor" ; -acpi_get_name (handle,ACPI_FULL_PATHNAME , &buffer); -break ; -case ACPI_BUS_TYPE_SYSTEM : - type_string ="System" ; -acpi_get_name (handle,ACPI_FULL_PATHNAME , &buffer); -break ; -case ACPI_BUS_TYPE_THERMAL : - type_string ="Thermal Zone" ; -acpi_get_name (handle,ACPI_FULL_PATHNAME , &buffer); -break ; -case ACPI_BUS_TYPE_POWER_BUTTON : - type_string ="Power Button" ; -sprintf (name,"PWRB" ); -break ; -case ACPI_BUS_TYPE_SLEEP_BUTTON : - type_string ="Sleep Button" ; -sprintf (name,"SLPB" ); -break ; - } - -printk (KERN_DEBUG "Found %s %s [%p]\n" , type_string, name, handle); -#endif /* ACPI_DEBUG_OUTPUT */ -} -static int acpi_bus_remove (struct acpi_device *dev,int rmdevice) {int result =0 ;
@@ -1076,8 +1033,6 @@ acpi_add_single_object(struct acpi_device **child,if ((result =acpi_device_set_context (device, type))) goto end; -acpi_device_get_debug_info (device, handle, type); -acpi_device_register (device, parent);/*
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 40/140 ACPI: correct id for fixed buttons
From: Alexey Starikovskiy <[email protected]>
ACPI_BUTTON_HID_POWERF was changed, but this change was not propogated to button.c, thus breaking detection of fixed power and sleep buttons.
--- drivers/acpi/button.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/button.c +1 -1
@@ -74,7 +74,7 @@ static int acpi_button_state_open_fs(struct inode *inode, struct file *file);static struct acpi_driver acpi_button_driver = { .name =ACPI_BUTTON_DRIVER_NAME , .class =ACPI_BUTTON_CLASS , - .ids ="ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E" , + .ids ="button_power,button_sleep,PNP0C0D,PNP0C0C,PNP0C0E" , .ops = { .add = acpi_button_add, .remove = acpi_button_remove,
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 41/140 ACPI: prevent build failure when CONFIG_X86_NUMAQ=y
From: Len Brown <[email protected]>
...by disabling CONFIG_ACPI when CONFIG_X86_NUMAQ=y
otherwise arch/i386/pci/Makefile forgets
that it needs to build acpi.o
drivers/built-in.o: In function `acpi_pci_root_add':
pci_root.c:(.text+0x45ec4): undefined reference to `pci_acpi_scan_root'
--- drivers/acpi/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/acpi/Kconfig +1 -0
@@ -3,6 +3,7 @@ # menu "ACPI (Advanced Configuration and Power Interface) Support" + depends on !X86_NUMAQ depends on !X86_VISWS depends on !IA64_HP_SIM depends on IA64 || X86
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 42/140 ACPICA: Update function header
From: Bob Moore <[email protected]>
--- drivers/acpi/events/evrgnini.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/acpi/events/evrgnini.c +3 -0
@@ -432,6 +432,9 @@ acpi_ev_default_region_setup(acpi_handle handle,* a PCI address in the scope of the definition. This address is * required to perform an access to PCI config space. * +* MUTEX: Interpreter should be unlocked, because we may run the _REG +* method for this region. +* ******************************************************************************/ acpi_status
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 43/140 ACPICA: Handle mis-matched package length
From: Bob Moore <[email protected]>
Implement support within the AML interpreter for package objects that contain a mismatch between the AML length and package element count. In this case, the lesser of the two is used. Some BIOS code apparently modifies the package length on the fly, and this change supports this. Provides compatibility with the MS AML interpreter.
--- drivers/acpi/dispatcher/dsobject.c | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-)
drivers/acpi/dispatcher/dsobject.c +19 -8
@@ -318,9 +318,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, obj_desc->package.node = parent->common.node; } - obj_desc->package.count = package_length; - -/* Count the number of items in the package list */ +/* Count the *actual* number of items in the package list */ arg = op->common.value.arg; arg = arg->common.next;
@@ -329,11 +327,24 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, }/* -* The package length (number of elements) will be the greater -* of the specified length and the length of the initializer list +* The number of elements in the package will be the lesser of the +* specified element count and the length of the initializer list. +* +* Even though the ASL compilers do not allow this to happen (for the +* fixed length package opcode), some BIOS code modifies the AML on the +* fly to adjust the package length, and this code compensates for that. +* This also provides compatibility with other AML interpreters. */ -if (package_list_length > package_length) { - obj_desc->package.count = package_list_length; + obj_desc->package.count = package_length; + +if (package_list_length != package_length) { +ACPI_DEBUG_PRINT ((ACPI_DB_INFO , +"Package length mismatch, using lesser of %X(Length Arg) and %X(AML Length)\n" , + package_length, package_list_length)); + +if (package_list_length < package_length) { + obj_desc->package.count = package_list_length; + } }/*
@@ -356,7 +367,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,*/ arg = op->common.value.arg; arg = arg->common.next; -for (i =0 ; arg; i++) { +for (i =0 ; i < obj_desc->package.count; i++) {if (arg->common.aml_opcode ==AML_INT_RETURN_VALUE_OP ) {/* Object (package or buffer) is already built */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 44/140 ACPICA: Handle case NumElements > Package length
From: Bob Moore <[email protected]>
Additional update for NumElements fix. Must handle case where NumElements > Package list length, pad package with null elements.
--- drivers/acpi/dispatcher/dsobject.c | 87 +++++++++++++++++------------------- 1 files changed, 41 insertions(+), 46 deletions(-)
drivers/acpi/dispatcher/dsobject.c +41 -46
@@ -260,7 +260,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, } obj_desc->buffer.flags |=AOPOBJ_DATA_VALID ; - op->common.node = (struct acpi_namespace_node *)obj_desc; + op->common.node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_desc);return_ACPI_STATUS (AE_OK ); }
@@ -270,7 +270,8 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,* * PARAMETERS: walk_state - Current walk state * Op - Parser object to be translated -* package_length - Number of elements in the package +* element_count - Number of elements in the package - this is +* the num_elements argument to Package() * obj_desc_ptr - Where the ACPI internal object is returned * * RETURN: Status
@@ -278,18 +279,29 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,* DESCRIPTION: Translate a parser Op package object to the equivalent * namespace object * +* NOTE: The number of elements in the package will be always be the num_elements +* count, regardless of the number of elements in the package list. If +* num_elements is smaller, only that many package list elements are used. +* if num_elements is larger, the Package object is padded out with +* objects of type Uninitialized (as per ACPI spec.) +* +* Even though the ASL compilers do not allow num_elements to be smaller +* than the Package list length (for the fixed length package opcode), some +* BIOS code modifies the AML on the fly to adjust the num_elements, and +* this code compensates for that. This also provides compatibility with +* other AML interpreters. +* ******************************************************************************/ acpi_status acpi_ds_build_internal_package_obj (struct acpi_walk_state *walk_state,union acpi_parse_object *op, -u32 package_length, +u32 element_count,union acpi_operand_object **obj_desc_ptr) {union acpi_parse_object *arg;union acpi_parse_object *parent;union acpi_operand_object *obj_desc =NULL ; -u32 package_list_length;acpi_status status =AE_OK ;acpi_native_uint i;
@@ -318,43 +330,13 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, obj_desc->package.node = parent->common.node; } -/* Count the *actual* number of items in the package list */ - - arg = op->common.value.arg; - arg = arg->common.next; -for (package_list_length =0 ; arg; package_list_length++) { - arg = arg->common.next; - } - -/* -* The number of elements in the package will be the lesser of the -* specified element count and the length of the initializer list. -* -* Even though the ASL compilers do not allow this to happen (for the -* fixed length package opcode), some BIOS code modifies the AML on the -* fly to adjust the package length, and this code compensates for that. -* This also provides compatibility with other AML interpreters. -*/ - obj_desc->package.count = package_length; - -if (package_list_length != package_length) { -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Package length mismatch, using lesser of %X(Length Arg) and %X(AML Length)\n" , - package_length, package_list_length)); - -if (package_list_length < package_length) { - obj_desc->package.count = package_list_length; - } - } -/* -* Allocate the pointer array (array of pointers to the -* individual objects). Add an extra pointer slot so -* that the list is always null terminated. +* Allocate the element array (array of pointers to the individual +* objects) based on the num_elements parameter. Add an extra pointer slot +* so that the list is always null terminated. */ obj_desc->package.elements =ACPI_ALLOCATE_ZEROED (((acpi_size ) - obj_desc->package. - count + + element_count +1 ) *sizeof (void *));if (!obj_desc->package.elements) {
@@ -362,15 +344,20 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,return_ACPI_STATUS (AE_NO_MEMORY ); } + obj_desc->package.count = element_count; +/* -* Initialize all elements of the package +* Initialize the elements of the package, up to the num_elements count. +* Package is automatically padded with uninitialized (NULL) elements +* if num_elements is greater than the package list length. Likewise, +* Package is truncated if num_elements is less than the list length. */ arg = op->common.value.arg; arg = arg->common.next; -for (i =0 ; i < obj_desc->package.count; i++) { +for (i =0 ; arg && (i < element_count); i++) {if (arg->common.aml_opcode ==AML_INT_RETURN_VALUE_OP ) { -/* Object (package or buffer) is already built */ +/* This package element is already built, just get it */ obj_desc->package.elements[i] = ACPI_CAST_PTR(union acpi_operand_object,
@@ -384,8 +371,14 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, arg = arg->common.next; } +if (!arg) { +ACPI_DEBUG_PRINT ((ACPI_DB_INFO , +"Package List length larger than NumElements count (%X), truncated\n" , + element_count)); + } + obj_desc->package.flags |=AOPOBJ_DATA_VALID ; - op->common.node = (struct acpi_namespace_node *)obj_desc; + op->common.node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_desc);return_ACPI_STATUS (status); }
@@ -499,8 +492,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,/* * Defer evaluation of Buffer term_arg operand */ - obj_desc->buffer.node = (struct acpi_namespace_node *) - walk_state->operands[0 ]; + obj_desc->buffer.node = + ACPI_CAST_PTR(struct acpi_namespace_node, + walk_state->operands[0 ]); obj_desc->buffer.aml_start = op->named.data; obj_desc->buffer.aml_length = op->named.length;break ;
@@ -510,8 +504,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,/* * Defer evaluation of Package term_arg operand */ - obj_desc->package.node = (struct acpi_namespace_node *) - walk_state->operands[0 ]; + obj_desc->package.node = + ACPI_CAST_PTR(struct acpi_namespace_node, + walk_state->operands[0 ]); obj_desc->package.aml_start = op->named.data; obj_desc->package.aml_length = op->named.length;break ;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 45/140 ACPICA: Delete recursive feature of ACPI Global Lock
From: Bob Moore <[email protected]>
Completed a new design and implementation for
the ACPI Global Lock support. On the OS side, the global lock is now treated as a standard AML mutex. Previously, multiple OS threads could acquire the global lock simultaneously, but this could cause the BIOS to be starved by the lock in cases such as the Embedded Controller driver, where there is a tight coupling between the OS and the BIOS.
--- drivers/acpi/events/evmisc.c | 113 +++++++++++++++++++------------------ drivers/acpi/executer/exmutex.c | 78 +++++++++++++++----------- drivers/acpi/executer/exsystem.c | 78 +------------------------- drivers/acpi/namespace/nsaccess.c | 36 +++++------- drivers/acpi/utilities/utdelete.c | 14 +++-- drivers/acpi/utilities/utglobal.c | 2 +- include/acpi/acglobal.h | 2 +- include/acpi/acinterp.h | 6 -- include/acpi/aclocal.h | 1 - 9 files changed, 132 insertions(+), 198 deletions(-)
drivers/acpi/events/evmisc.c +59 -54
@@ -298,19 +298,13 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) {acpi_status status; -/* Signal threads that are waiting for the lock */ +/* Signal the thread that is waiting for the lock */ -if (acpi_gbl_global_lock_thread_count) { +/* Send a unit to the semaphore */ -/* Send sufficient units to the semaphore */ - - status = -acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore, - acpi_gbl_global_lock_thread_count); -if (ACPI_FAILURE (status)) { -ACPI_ERROR ((AE_INFO , -"Could not signal Global Lock semaphore" )); - } + status =acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,1 ); +if (ACPI_FAILURE (status)) { +ACPI_ERROR ((AE_INFO ,"Could not signal Global Lock semaphore" )); } }
@@ -333,7 +327,8 @@ static u32 acpi_ev_global_lock_handler(void *context)u8 acquired = FALSE;/* -* Attempt to get the lock +* Attempt to get the lock. +* * If we don't get it now, it will be marked pending and we will * take another interrupt when it becomes free. */
@@ -341,6 +336,7 @@ static u32 acpi_ev_global_lock_handler(void *context)if (acquired) {/* Got the lock, now wake all threads waiting for it */ + acpi_gbl_global_lock_acquired = TRUE;acpi_ev_global_lock_thread (context); }
@@ -399,6 +395,16 @@ acpi_status acpi_ev_init_global_lock_handler(void)* * DESCRIPTION: Attempt to gain ownership of the Global Lock. * +* MUTEX: Interpreter must be locked +* +* Note: The original implementation allowed multiple threads to "acquire" the +* Global Lock, and the OS would hold the lock until the last thread had +* released it. However, this could potentially starve the BIOS out of the +* lock, especially in the case where there is a tight handshake between the +* Embedded Controller driver and the BIOS. Therefore, this implementation +* allows only one thread to acquire the HW Global Lock at a time, and makes +* the global lock appear as a standard mutex on the OS side. +* *****************************************************************************/ acpi_status acpi_ev_acquire_global_lock (u16 timeout)
@@ -408,27 +414,25 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)ACPI_FUNCTION_TRACE (ev_acquire_global_lock); -#ifndef ACPI_APPLICATION -/* Make sure that we actually have a global lock */ - -if (!acpi_gbl_global_lock_present) { -return_ACPI_STATUS (AE_NO_GLOBAL_LOCK ); +/* +* Only one thread can acquire the GL at a time, the global_lock_mutex +* enforces this. This interface releases the interpreter if we must wait. +*/ + status =acpi_ex_system_wait_mutex (acpi_gbl_global_lock_mutex, timeout); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); } -#endif - -/* One more thread wants the global lock */ - - acpi_gbl_global_lock_thread_count++;/* -* If we (OS side vs. BIOS side) have the hardware lock already, -* we are done +* Make sure that a global lock actually exists. If not, just treat +* the lock as a standard mutex. */ -if (acpi_gbl_global_lock_acquired) { +if (!acpi_gbl_global_lock_present) { + acpi_gbl_global_lock_acquired = TRUE;return_ACPI_STATUS (AE_OK ); } -/* We must acquire the actual hardware lock */ +/* Attempt to acquire the actual hardware lock */ ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);if (acquired) {
@@ -436,25 +440,24 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)/* We got the lock */ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC , -"Acquired the HW Global Lock\n" )); +"Acquired hardware Global Lock\n" )); acpi_gbl_global_lock_acquired = TRUE;return_ACPI_STATUS (AE_OK ); }/* -* Did not get the lock. The pending bit was set above, and we must now +* Did not get the lock. The pending bit was set above, and we must now * wait until we get the global lock released interrupt. */ -ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"Waiting for the HW Global Lock\n" )); +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"Waiting for hardware Global Lock\n" ));/* -* Acquire the global lock semaphore first. -* Since this wait will block, we must release the interpreter +* Wait for handshake with the global lock interrupt handler. +* This interface releases the interpreter if we must wait. */ - status = -acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore, - timeout); + status =acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore, +ACPI_WAIT_FOREVER );return_ACPI_STATUS (status); }
@@ -477,38 +480,40 @@ acpi_status acpi_ev_release_global_lock(void)ACPI_FUNCTION_TRACE (ev_release_global_lock); -if (!acpi_gbl_global_lock_thread_count) { +/* Lock must be acquired */ + +if (!acpi_gbl_global_lock_acquired) {ACPI_WARNING ((AE_INFO , -"Cannot release HW Global Lock, it has not been acquired" )); +"Cannot release the ACPI Global Lock, it has not been acquired" ));return_ACPI_STATUS (AE_NOT_ACQUIRED ); } -/* One fewer thread has the global lock */ +if (acpi_gbl_global_lock_present) { - acpi_gbl_global_lock_thread_count--; -if (acpi_gbl_global_lock_thread_count) { +/* Allow any thread to release the lock */ -/* There are still some threads holding the lock, cannot release */ +ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, + pending); -return_ACPI_STATUS (AE_OK ); +/* +* If the pending bit was set, we must write GBL_RLS to the control +* register +*/ +if (pending) { + status = +acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE , +1 ,ACPI_MTX_LOCK ); + } + +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC , +"Released hardware Global Lock\n" )); } -/* -* No more threads holding lock, we can do the actual hardware -* release -*/ -ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending); acpi_gbl_global_lock_acquired = FALSE; -/* -* If the pending bit was set, we must write GBL_RLS to the control -* register -*/ -if (pending) { - status =acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE , -1 ,ACPI_MTX_LOCK ); - } +/* Release the local GL mutex */ +acpi_os_release_mutex (acpi_gbl_global_lock_mutex);return_ACPI_STATUS (status); }
drivers/acpi/executer/exmutex.c +45 -33
163 lines not on this page · raw message
drivers/acpi/executer/exsystem.c +1 -77
90 lines not on this page · raw message
drivers/acpi/namespace/nsaccess.c +16 -20
@@ -195,31 +195,27 @@ acpi_status acpi_ns_root_initialize(void) obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) -1 ); -if (ACPI_STRCMP (init_val->name,"_GL_" ) ==0 ) { - -/* Create a counting semaphore for the global lock */ +/* Create a mutex */ + + status = +acpi_os_create_mutex (&obj_desc->mutex. + os_mutex); +if (ACPI_FAILURE (status)) { +acpi_ut_remove_reference (obj_desc); + goto unlock_and_exit; + } - status = -acpi_os_create_semaphore - (ACPI_NO_UNIT_LIMIT ,1 , - &acpi_gbl_global_lock_semaphore); -if (ACPI_FAILURE (status)) { -acpi_ut_remove_reference - (obj_desc); - goto unlock_and_exit; - } +/* Special case for ACPI Global Lock */ -/* Mark this mutex as very special */ +if (ACPI_STRCMP (init_val->name,"_GL_" ) ==0 ) { + acpi_gbl_global_lock_mutex = + obj_desc->mutex.os_mutex; - obj_desc->mutex.os_mutex = -ACPI_GLOBAL_LOCK ; - }else { -/* Create a mutex */ +/* Create additional counting semaphore for global lock */ status = -acpi_os_create_mutex (&obj_desc-> - mutex. - os_mutex); +acpi_os_create_semaphore (1 ,1 , + &acpi_gbl_global_lock_semaphore);if (ACPI_FAILURE (status)) {acpi_ut_remove_reference (obj_desc);
drivers/acpi/utilities/utdelete.c +9 -5
@@ -158,16 +158,20 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)"***** Mutex %p, OS Mutex %p\n" , object, object->mutex.os_mutex)); -if (object->mutex.os_mutex !=ACPI_GLOBAL_LOCK ) { -acpi_ex_unlink_mutex (object); -acpi_os_delete_mutex (object->mutex.os_mutex); - }else { -/* Global Lock "mutex" is actually a counting semaphore */ +if (object->mutex.os_mutex == acpi_gbl_global_lock_mutex) { + +/* Global Lock has extra semaphore */ (void )acpi_os_delete_semaphore (acpi_gbl_global_lock_semaphore); acpi_gbl_global_lock_semaphore =NULL ; + +acpi_os_delete_mutex (object->mutex.os_mutex); + acpi_gbl_global_lock_mutex =NULL ; + }else { +acpi_ex_unlink_mutex (object); +acpi_os_delete_mutex (object->mutex.os_mutex); }break ;
drivers/acpi/utilities/utglobal.c +1 -1
@@ -795,8 +795,8 @@ void acpi_ut_init_globals(void)/* Global Lock support */ acpi_gbl_global_lock_semaphore =NULL ; + acpi_gbl_global_lock_mutex =NULL ; acpi_gbl_global_lock_acquired = FALSE; - acpi_gbl_global_lock_thread_count =0 ; acpi_gbl_global_lock_handle =0 ;/* Miscellaneous variables */
include/acpi/acglobal.h +1 -1
@@ -197,6 +197,7 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];/* * Global lock semaphore works in conjunction with the actual HW global lock */ +ACPI_EXTERN acpi_mutex acpi_gbl_global_lock_mutex; ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore;/*
@@ -240,7 +241,6 @@ ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;/* Misc */ -ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
include/acpi/acinterp.h +0 -6
@@ -277,12 +277,6 @@ acpi_status acpi_ex_system_do_suspend(acpi_integer time);acpi_status acpi_ex_system_do_stall (u32 time); -acpi_status -acpi_ex_system_acquire_mutex (union acpi_operand_object *time, -union acpi_operand_object *obj_desc); - -acpi_status acpi_ex_system_release_mutex (union acpi_operand_object *obj_desc); -acpi_status acpi_ex_system_signal_event (union acpi_operand_object *obj_desc); acpi_status
include/acpi/aclocal.h +0 -1
@@ -51,7 +51,6 @@#define ACPI_SERIALIZED 0xFFtypedef u32 acpi_mutex_handle ; -#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)/* Total number of aml opcodes defined */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 46/140 ACPICA: Release global lock from interrupt handler
From: Bob Moore <[email protected]>
The ACPI Global Lock interrupt handler no longer queues the execution of a separate thread to signal the global lock semaphore. Instead, the semaphore is signaled directly from the interrupt handler.
--- drivers/acpi/events/evmisc.c | 50 ++++++++++++----------------------------- 1 files changed, 15 insertions(+), 35 deletions(-)
drivers/acpi/events/evmisc.c +15 -35
@@ -67,8 +67,6 @@ static const char *acpi_notify_value_names[] = { static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); -static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context); -static u32 acpi_ev_global_lock_handler (void *context);/*******************************************************************************
@@ -282,43 +280,19 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)/******************************************************************************* * -* FUNCTION: acpi_ev_global_lock_thread -* -* PARAMETERS: Context - From thread interface, not used -* -* RETURN: None -* -* DESCRIPTION: Invoked by SCI interrupt handler upon acquisition of the -* Global Lock. Simply signal all threads that are waiting -* for the lock. -* -******************************************************************************/ - -static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) -{ -acpi_status status; - -/* Signal the thread that is waiting for the lock */ - -/* Send a unit to the semaphore */ - - status =acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,1 ); -if (ACPI_FAILURE (status)) { -ACPI_ERROR ((AE_INFO ,"Could not signal Global Lock semaphore" )); - } -} - -/******************************************************************************* -* * FUNCTION: acpi_ev_global_lock_handler * * PARAMETERS: Context - From thread interface, not used * -* RETURN: ACPI_INTERRUPT_HANDLED or ACPI_INTERRUPT_NOT_HANDLED +* RETURN: ACPI_INTERRUPT_HANDLED * * DESCRIPTION: Invoked directly from the SCI handler when a global lock -* release interrupt occurs. Grab the global lock and queue -* the global lock thread for execution +* release interrupt occurs. Attempt to acquire the global lock, +* if successful, signal the thread waiting for the lock. +* +* NOTE: Assumes that the semaphore can be signaled from interrupt level. If +* this is not possible for some reason, a separate thread will have to be +* scheduled to do this. * ******************************************************************************/
@@ -338,7 +312,13 @@ static u32 acpi_ev_global_lock_handler(void *context)/* Got the lock, now wake all threads waiting for it */ acpi_gbl_global_lock_acquired = TRUE; -acpi_ev_global_lock_thread (context); +/* Send a unit to the semaphore */ + +if (ACPI_FAILURE (acpi_os_signal_semaphore ( + acpi_gbl_global_lock_semaphore,1 ))) { +ACPI_ERROR ((AE_INFO , +"Could not signal Global Lock semaphore" )); + } }return (ACPI_INTERRUPT_HANDLED );
@@ -480,7 +460,7 @@ acpi_status acpi_ev_release_global_lock(void)ACPI_FUNCTION_TRACE (ev_release_global_lock); -/* Lock must be acquired */ +/* Lock must be already acquired */ if (!acpi_gbl_global_lock_acquired) { ACPI_WARNING((AE_INFO,
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 47/140 ACPICA: Cast acpi_thread_id to UINT32 for debug output only
From: Bob Moore <[email protected]>
--- drivers/acpi/utilities/utdebug.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/acpi/utilities/utdebug.c +3 -4
@@ -180,9 +180,8 @@ acpi_ut_debug_print(u32 requested_debug_level,if (thread_id != acpi_gbl_prev_thread_id) {if (ACPI_LV_THREADS & acpi_dbg_level) {acpi_os_printf - ("\n**** Context Switch from TID %lX to TID %lX ****\n\n" , - (unsigned long ) acpi_gbl_prev_thread_id, - (unsigned long ) thread_id); + ("\n**** Context Switch from TID %X to TID %X ****\n\n" , + (unsigned )acpi_gbl_prev_thread_id, (unsigned )thread_id); } acpi_gbl_prev_thread_id = thread_id;
@@ -195,7 +194,7 @@ acpi_ut_debug_print(u32 requested_debug_level,acpi_os_printf ("%8s-%04ld " , module_name, line_number);if (ACPI_LV_THREADS & acpi_dbg_level) { -acpi_os_printf ("[%04lX] " , thread_id); +acpi_os_printf ("[%04X] " , (unsigned )thread_id); } acpi_os_printf("[%02ld] %-22.22s: ",
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 48/140 ACPICA: fix for object premature deletion
From: Fiodor Suietov <[email protected]>
Fix for object premature deletion after CopyObject on Operation Region (BZ 350)
--- drivers/acpi/utilities/utcopy.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/acpi/utilities/utcopy.c +9 -0
@@ -719,6 +719,15 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,acpi_ut_add_reference (source_desc->reference.object);break ; +case ACPI_TYPE_REGION : +/* +* We copied the Region Handler, so we now must add a reference +*/ +if (dest_desc->region.handler) { +acpi_ut_add_reference (dest_desc->region.handler); + } +break ; +default :/* Nothing to do for other simple objects */ break ;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 49/140 ACPICA: Temporary fix for BankValue parameter
From: Bob Moore <[email protected]>
Temporary fix for BankValue parameter of a Bank Field to support all constant values, including Zero and One. Must eventually be converted to a full TermArg evaluation.
--- drivers/acpi/dispatcher/dsfield.c | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-)
drivers/acpi/dispatcher/dsfield.c +28 -2
@@ -133,7 +133,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, } } -/* We could put the returned object (Node) on the object stack for later, +/* +* We could put the returned object (Node) on the object stack for later, * but for now, we will put it in the "op" object that the parser uses, * so we can get it again at the end of this scope */
@@ -514,8 +515,33 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,/* Third arg is the bank_value */ +/* TBD: This arg is a term_arg, not a constant, and must be evaluated */ + arg = arg->common.next; - info.bank_value = (u32 ) arg->common.value.integer; + +/* Currently, only the following constants are supported */ + +switch (arg->common.aml_opcode) { +case AML_ZERO_OP : + info.bank_value =0 ; +break ; + +case AML_ONE_OP : + info.bank_value =1 ; +break ; + +case AML_BYTE_OP : +case AML_WORD_OP : +case AML_DWORD_OP : +case AML_QWORD_OP : + info.bank_value = (u32 ) arg->common.value.integer; +break ; + +default : + info.bank_value =0 ; +ACPI_ERROR ((AE_INFO , +"Non-constant BankValue for BankField is not implemented" )); + }/* Fourth arg is the field flags */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 50/140 ACPICA: Update version to 20060721
From: Bob Moore <[email protected]>
--- include/acpi/acconfig.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060707 +#define ACPI_CA_VERSION 0x20060721/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 51/140 ACPICA: Update debug output
From: Bob Moore <[email protected]>
--- drivers/acpi/events/evgpe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/events/evgpe.c +1 -1
@@ -570,7 +570,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)if (ACPI_FAILURE (status)) {ACPI_EXCEPTION ((AE_INFO , status, -"While evaluating GPE method [%4.4s]" , +"while evaluating GPE method [%4.4s]" ,acpi_ut_get_node_name (local_gpe_event_info.dispatch. method_node)));
Signature · 1 line
1.5.0.rc3.39.gec804
A message that is not in the archive (sent off-list or not yet received): [email protected]
Len Brown
reviewerPATCH 53/140 ACPICA: misc fixes for new Table Manager:
From: Bob Moore <[email protected]>
--- drivers/acpi/tables/tbinstal.c | 35 +-- drivers/acpi/tables/tbutils.c | 544 ++++++++++++++++++++++++-------------- drivers/acpi/tables/tbxface.c | 58 +++-- drivers/acpi/utilities/utmisc.c | 8 +- include/acpi/acconfig.h | 2 +- include/acpi/aclocal.h | 21 +- include/acpi/actables.h | 6 +- include/acpi/actbl.h | 12 +- 8 files changed, 420 insertions(+), 266 deletions(-)
drivers/acpi/tables/tbinstal.c +11 -24
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("tbinstal")*****************************************************************************/ acpi_status acpi_tb_verify_table (struct acpi_table_desc *table_desc) { -u8 checksum; +acpi_status status;ACPI_FUNCTION_TRACE (tb_verify_table);
@@ -84,17 +84,9 @@ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc)/* Always calculate checksum, ignore bad checksum if requested */ - checksum =acpi_tb_checksum (ACPI_CAST_PTR (void, table_desc->pointer), - table_desc->length); - -#if (ACPI_CHECKSUM_ABORT ) - -if (checksum) { -return_ACPI_STATUS (AE_BAD_CHECKSUM ); - } -#endif - -return_ACPI_STATUS (AE_OK ); + status = +acpi_tb_verify_checksum (table_desc->pointer, table_desc->length); +return_ACPI_STATUS (status); }/*******************************************************************************
@@ -188,7 +180,7 @@ acpi_status acpi_tb_resize_root_table_list(void)/* allow_resize flag is a parameter to acpi_initialize_tables */ -if (!(acpi_gbl_root_table_list.flags &ACPI_TABLE_FLAGS_ALLOW_RESIZE )) { +if (!(acpi_gbl_root_table_list.flags &ACPI_ROOT_ALLOW_RESIZE )) {ACPI_ERROR ((AE_INFO ,"Resize of Root Table Array is not allowed" ));return_ACPI_STATUS (AE_SUPPORT );
@@ -212,18 +204,14 @@ acpi_status acpi_tb_resize_root_table_list(void) acpi_gbl_root_table_list.size * sizeof(struct acpi_table_desc)); -if (acpi_gbl_root_table_list.flags &ACPI_TABLE_ORIGIN_MASK == -ACPI_TABLE_ORIGIN_ALLOCATED ) { +if (acpi_gbl_root_table_list.flags &ACPI_ROOT_ORIGIN_ALLOCATED ) {ACPI_FREE (acpi_gbl_root_table_list.tables); } } acpi_gbl_root_table_list.tables = tables; acpi_gbl_root_table_list.size +=ACPI_ROOT_TABLE_SIZE_INCREMENT ; - acpi_gbl_root_table_list.flags = (u8) (ACPI_TABLE_ORIGIN_ALLOCATED | - (acpi_gbl_root_table_list. - flags & - ~ACPI_TABLE_ORIGIN_MASK )); + acpi_gbl_root_table_list.flags |= (u8 )ACPI_ROOT_ORIGIN_ALLOCATED ;return_ACPI_STATUS (AE_OK ); }
@@ -348,8 +336,7 @@ void acpi_tb_terminate(void)* Delete the root table array if allocated locally. Array cannot be * mapped, so we don't need to check for that flag. */ -if ((acpi_gbl_root_table_list.flags &ACPI_TABLE_ORIGIN_MASK ) == -ACPI_TABLE_ORIGIN_ALLOCATED ) { +if (acpi_gbl_root_table_list.flags &ACPI_ROOT_ORIGIN_ALLOCATED ) {ACPI_FREE (acpi_gbl_root_table_list.tables); }
@@ -497,7 +484,7 @@ u8 acpi_tb_is_table_loaded(acpi_native_uint table_index)if (table_index < acpi_gbl_root_table_list.count) { is_loaded = (u8) (acpi_gbl_root_table_list.tables[table_index]. - flags &ACPI_TABLE_FLAGS_LOADED ); + flags &ACPI_TABLE_IS_LOADED ); } (void )acpi_ut_release_mutex (ACPI_MTX_TABLES );
@@ -524,10 +511,10 @@ void acpi_tb_set_table_loaded_flag(acpi_native_uint table_index, u8 is_loaded)if (table_index < acpi_gbl_root_table_list.count) {if (is_loaded) { acpi_gbl_root_table_list.tables[table_index].flags |= -ACPI_TABLE_FLAGS_LOADED ; +ACPI_TABLE_IS_LOADED ; }else { acpi_gbl_root_table_list.tables[table_index].flags &= - ~ACPI_TABLE_FLAGS_LOADED ; + ~ACPI_TABLE_IS_LOADED ; } }
drivers/acpi/tables/tbutils.c +343 -201
725 lines not on this page · raw message
drivers/acpi/tables/tbxface.c +35 -23
128 lines not on this page · raw message
drivers/acpi/utilities/utmisc.c +6 -2
@@ -996,9 +996,13 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) {va_list args; -acpi_os_printf ("ACPI (%s-%04d): " , module_name, line_number); +/* +* Removed module_name, line_number, and acpica version, not needed +* for info output +*/ +acpi_os_printf ("ACPI: " );va_start (args, format);acpi_os_vprintf (format, args); -acpi_os_printf (" [%X]\n" ,ACPI_CA_VERSION ); +acpi_os_printf ("\n" ); }
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060823 +#define ACPI_CA_VERSION 0x20060828/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
include/acpi/aclocal.h +14 -7
@@ -227,6 +227,16 @@ struct acpi_table_desc {u8 flags; }; +/* Flags for above */ + +#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) + +/* One internal RSDT for table management */ +struct acpi_internal_rsdt {struct acpi_table_desc *tables;u32 count;
@@ -234,14 +244,11 @@ struct acpi_internal_rsdt {u8 flags; }; -/* Flags for both structs above */ +/* Flags for above */ -#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_FLAGS_LOADED (4) -#define ACPI_TABLE_FLAGS_ALLOW_RESIZE (8) +#define ACPI_ROOT_ORIGIN_UNKNOWN (0)/* ~ORIGIN_ALLOCATED */ +#define ACPI_ROOT_ORIGIN_ALLOCATED (1) +#define ACPI_ROOT_ALLOW_RESIZE (2)/* Predefined (fixed) table indexes */
include/acpi/actables.h +4 -2
@@ -94,9 +94,11 @@ acpi_tb_print_table_header(acpi_physical_address address,u8 acpi_tb_checksum (u8 * buffer,acpi_native_uint length); -void acpi_tb_convert_fadt (struct acpi_table_fadt *fadt); +acpi_status +acpi_tb_verify_checksum (struct acpi_table_header *table,u32 length); -acpi_status acpi_tb_parse_root_table (struct acpi_table_rsdp *rsdp,u8 flags); +acpi_status +acpi_tb_parse_root_table (acpi_physical_address rsdp_address,u8 flags);void *acpi_tb_map (acpi_physical_address address,u32 length,u32 flags);
include/acpi/actbl.h +6 -6
@@ -199,8 +199,8 @@ struct acpi_table_fadt {u32 pm1b_control_block;/* Port address of Power Mgt 1b Control Reg Blk */ u32 pm2_control_block;/* Port address of Power Mgt 2 Control Reg Blk */ u32 pm_timer_block;/* Port address of Power Mgt Timer Ctrl Reg Blk */ -u32 gpe0_block;/* Port addr of General Purpose acpi_event 0 Reg Blk */ -u32 gpe1_block;/* Port addr of General Purpose acpi_event 1 Reg Blk */ +u32 gpe0_block;/* Port addr of General Purpose Event 0 Reg Blk */ +u32 gpe1_block;/* Port addr of General Purpose Event 1 Reg Blk */ u8 pm1_event_length;/* Byte Length of ports at pm1_x_evt_blk */ u8 pm1_control_length;/* Byte Length of ports at pm1_x_cnt_blk */ u8 pm2_control_length;/* Byte Length of ports at pm2_cnt_blk */
@@ -226,14 +226,14 @@ struct acpi_table_fadt {u8 reserved4[3 ];/* These three bytes must be zero */ u64 Xfacs;/* 64-bit physical address of FACS */ u64 Xdsdt;/* 64-bit physical address of DSDT */ -struct acpi_generic_address xpm1a_event_block;/* Extended Power Mgt 1a acpi_event Reg Blk address */ -struct acpi_generic_address xpm1b_event_block;/* Extended Power Mgt 1b acpi_event Reg Blk address */ +struct acpi_generic_address xpm1a_event_block;/* Extended Power Mgt 1a Event Reg Blk address */ +struct acpi_generic_address xpm1b_event_block;/* Extended Power Mgt 1b Event Reg Blk address */ struct acpi_generic_address xpm1a_control_block;/* Extended Power Mgt 1a Control Reg Blk address */ struct acpi_generic_address xpm1b_control_block;/* Extended Power Mgt 1b Control Reg Blk address */ struct acpi_generic_address xpm2_control_block;/* Extended Power Mgt 2 Control Reg Blk address */ struct acpi_generic_address xpm_timer_block;/* Extended Power Mgt Timer Ctrl Reg Blk address */ -struct acpi_generic_address xgpe0_block;/* Extended General Purpose acpi_event 0 Reg Blk address */ -struct acpi_generic_address xgpe1_block;/* Extended General Purpose acpi_event 1 Reg Blk address */ +struct acpi_generic_address xgpe0_block;/* Extended General Purpose Event 0 Reg Blk address */ +struct acpi_generic_address xgpe1_block;/* Extended General Purpose Event 1 Reg Blk address */ };/* FADT flags */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 54/140 ACPICA: Update comments for individual table fields
From: Bob Moore <[email protected]>
comments only
--- include/acpi/actbl.h | 64 +++++++++++++++++++++++++------------------------- 1 files changed, 32 insertions(+), 32 deletions(-)
include/acpi/actbl.h +32 -32
@@ -56,7 +56,7 @@#define ACPI_SIG_RSDT "RSDT"/* Root System Description Table */ #define ACPI_SIG_XSDT "XSDT"/* Extended System Description Table */ #define ACPI_SIG_SSDT "SSDT"/* Secondary System Description Table */ -#define ACPI_RSDP_NAME "RSDP" +#define ACPI_RSDP_NAME "RSDP"/* Short name for RSDP, not signature */ /* * All tables and structures must be byte-packed to match the ACPI
@@ -185,55 +185,55 @@ struct acpi_table_fadt {struct acpi_table_header header;/* Common ACPI table header */ u32 facs;/* 32-bit physical address of FACS */ u32 dsdt;/* 32-bit physical address of DSDT */ -u8 model;/* System Interrupt Model (ACPI 1.0) not used in ACPI 2.0+ */ +u8 model;/* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */ u8 preferred_profile;/* Conveys preferred power management profile to OSPM. */ u16 sci_interrupt;/* System vector of SCI interrupt */ -u32 smi_command;/* Port address of SMI command port */ +u32 smi_command;/* 32-bit Port address of SMI command port */ u8 acpi_enable;/* Value to write to smi_cmd to enable ACPI */ u8 acpi_disable;/* Value to write to smi_cmd to disable ACPI */ u8 S4bios_request;/* Value to write to SMI CMD to enter S4BIOS state */ u8 pstate_control;/* Processor performance state control */ -u32 pm1a_event_block;/* Port address of Power Mgt 1a Event Reg Blk */ -u32 pm1b_event_block;/* Port address of Power Mgt 1b Event Reg Blk */ -u32 pm1a_control_block;/* Port address of Power Mgt 1a Control Reg Blk */ -u32 pm1b_control_block;/* Port address of Power Mgt 1b Control Reg Blk */ -u32 pm2_control_block;/* Port address of Power Mgt 2 Control Reg Blk */ -u32 pm_timer_block;/* Port address of Power Mgt Timer Ctrl Reg Blk */ -u32 gpe0_block;/* Port addr of General Purpose Event 0 Reg Blk */ -u32 gpe1_block;/* Port addr of General Purpose Event 1 Reg Blk */ -u8 pm1_event_length;/* Byte Length of ports at pm1_x_evt_blk */ -u8 pm1_control_length;/* Byte Length of ports at pm1_x_cnt_blk */ -u8 pm2_control_length;/* Byte Length of ports at pm2_cnt_blk */ -u8 pm_timer_length;/* Byte Length of ports at pm_tmr_blk */ -u8 gpe0_block_length;/* Byte Length of ports at gpe0_blk */ -u8 gpe1_block_length;/* Byte Length of ports at gpe1_blk */ -u8 gpe1_base;/* Offset in gpe model where gpe1 events start */ -u8 cst_control;/* Support for the _CST object and C States change notification. */ +u32 pm1a_event_block;/* 32-bit Port address of Power Mgt 1a Event Reg Blk */ +u32 pm1b_event_block;/* 32-bit Port address of Power Mgt 1b Event Reg Blk */ +u32 pm1a_control_block;/* 32-bit Port address of Power Mgt 1a Control Reg Blk */ +u32 pm1b_control_block;/* 32-bit Port address of Power Mgt 1b Control Reg Blk */ +u32 pm2_control_block;/* 32-bit Port address of Power Mgt 2 Control Reg Blk */ +u32 pm_timer_block;/* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */ +u32 gpe0_block;/* 32-bit Port address of General Purpose Event 0 Reg Blk */ +u32 gpe1_block;/* 32-bit Port address of General Purpose Event 1 Reg Blk */ +u8 pm1_event_length;/* Byte Length of ports at pm1x_event_block */ +u8 pm1_control_length;/* Byte Length of ports at pm1x_control_block */ +u8 pm2_control_length;/* Byte Length of ports at pm2_control_block */ +u8 pm_timer_length;/* Byte Length of ports at pm_timer_block */ +u8 gpe0_block_length;/* Byte Length of ports at gpe0_block */ +u8 gpe1_block_length;/* Byte Length of ports at gpe1_block */ +u8 gpe1_base;/* Offset in GPE number space where GPE1 events start */ +u8 cst_control;/* Support for the _CST object and C States change notification */ u16 C2latency;/* Worst case HW latency to enter/exit C2 state */ u16 C3latency;/* Worst case HW latency to enter/exit C3 state */ u16 flush_size;/* Processor's memory cache line width, in bytes */ u16 flush_stride;/* Number of flush strides that need to be read */ -u8 duty_offset;/* Processor's duty cycle index in processor's P_CNT reg */ -u8 duty_width;/* Processor's duty cycle value bit width in P_CNT register. */ +u8 duty_offset;/* Processor duty cycle index in processor's P_CNT reg */ +u8 duty_width;/* Processor duty cycle value bit width in P_CNT register. */ u8 day_alarm;/* Index to day-of-month alarm in RTC CMOS RAM */ u8 month_alarm;/* Index to month-of-year alarm in RTC CMOS RAM */ u8 century;/* Index to century in RTC CMOS RAM */ u16 boot_flags;/* IA-PC Boot Architecture Flags. See Table 5-10 for description */ u8 reserved;/* Reserved, must be zero */ -u32 flags;/* Miscellaneous flag bits */ -struct acpi_generic_address reset_register;/* Reset register address in GAS format */ +u32 flags;/* Miscellaneous flag bits (see below for individual flags) */ +struct acpi_generic_address reset_register;/* 64-bit address of the Reset register */ u8 reset_value;/* Value to write to the reset_register port to reset the system */ -u8 reserved4[3 ];/* These three bytes must be zero */ +u8 reserved4[3 ];/* Reserved, must be zero */ u64 Xfacs;/* 64-bit physical address of FACS */ u64 Xdsdt;/* 64-bit physical address of DSDT */ -struct acpi_generic_address xpm1a_event_block;/* Extended Power Mgt 1a Event Reg Blk address */ -struct acpi_generic_address xpm1b_event_block;/* Extended Power Mgt 1b Event Reg Blk address */ -struct acpi_generic_address xpm1a_control_block;/* Extended Power Mgt 1a Control Reg Blk address */ -struct acpi_generic_address xpm1b_control_block;/* Extended Power Mgt 1b Control Reg Blk address */ -struct acpi_generic_address xpm2_control_block;/* Extended Power Mgt 2 Control Reg Blk address */ -struct acpi_generic_address xpm_timer_block;/* Extended Power Mgt Timer Ctrl Reg Blk address */ -struct acpi_generic_address xgpe0_block;/* Extended General Purpose Event 0 Reg Blk address */ -struct acpi_generic_address xgpe1_block;/* Extended General Purpose Event 1 Reg Blk address */ +struct acpi_generic_address xpm1a_event_block;/* 64-bit Extended Power Mgt 1a Event Reg Blk address */ +struct acpi_generic_address xpm1b_event_block;/* 64-bit Extended Power Mgt 1b Event Reg Blk address */ +struct acpi_generic_address xpm1a_control_block;/* 64-bit Extended Power Mgt 1a Control Reg Blk address */ +struct acpi_generic_address xpm1b_control_block;/* 64-bit Extended Power Mgt 1b Control Reg Blk address */ +struct acpi_generic_address xpm2_control_block;/* 64-bit Extended Power Mgt 2 Control Reg Blk address */ +struct acpi_generic_address xpm_timer_block;/* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ +struct acpi_generic_address xgpe0_block;/* 64-bit Extended General Purpose Event 0 Reg Blk address */ +struct acpi_generic_address xgpe1_block;/* 64-bit Extended General Purpose Event 1 Reg Blk address */ };/* FADT flags */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 55/140 ACPICA: Fix for FADT conversion in 64-bit mode
From: Bob Moore <[email protected]>
--- drivers/acpi/tables/tbutils.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)
drivers/acpi/tables/tbutils.c +14 -7
@@ -131,6 +131,8 @@ acpi_tb_print_table_header(acpi_physical_address address, ((struct acpi_table_rsdp *)header)->revision, ((struct acpi_table_rsdp *)header)->oem_id)); }else { +/* Standard ACPI table with full common header */ + ACPI_INFO((AE_INFO, "%4.4s @ 0x%p/0x%04X (v%3.3d %6.6s %8.8s 0x%08X %4.4s 0x%08X)", header->signature, ACPI_CAST_PTR(void, address),
@@ -160,7 +162,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, u8 bit_width, u64 address) { -ACPI_STORE_ADDRESS (new_gas_struct->address, address); +ACPI_MOVE_64_TO_64 (&new_gas_struct->address, &address); new_gas_struct->space_id =ACPI_ADR_SPACE_SYSTEM_IO ; new_gas_struct->bit_width = bit_width; new_gas_struct->bit_offset =0 ;
@@ -284,13 +286,15 @@ static void acpi_tb_convert_fadt(void) ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, fadt_conversion_table[i].target); +/* Expand only if the X target is null */ +if (!target->address) {acpi_tb_init_generic_address (target, *ACPI_ADD_PTR (u8, &acpi_gbl_FADT, fadt_conversion_table [i].length), - *ACPI_ADD_PTR (u64, + *ACPI_ADD_PTR (u32, &acpi_gbl_FADT, fadt_conversion_table [i].source));
@@ -301,6 +305,10 @@ static void acpi_tb_convert_fadt(void)* Calculate separate GAS structs for the PM1 Enable registers. * These addresses do not appear (directly) in the FADT, so it is * useful to calculate them once, here. +* +* The PM event blocks are split into two register blocks, first is the +* PM Status Register block, followed immediately by the PM Enable Register +* block. Each is of length (pm1_event_length/2) */ pm1_register_length = (u8 )ACPI_DIV_2 (acpi_gbl_FADT.pm1_event_length);
@@ -308,17 +316,16 @@ static void acpi_tb_convert_fadt(void)acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, pm1_register_length, - (u64) (acpi_gbl_FADT.xpm1a_event_block. - address + pm1_register_length)); + (acpi_gbl_FADT.xpm1a_event_block.address + + pm1_register_length));/* PM1B is optional; leave null if not present */ if (acpi_gbl_FADT.xpm1b_event_block.address) {acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, pm1_register_length, - (u64) (acpi_gbl_FADT. - xpm1b_event_block.address + - pm1_register_length)); + (acpi_gbl_FADT.xpm1b_event_block. + address + pm1_register_length)); }/* Global FADT is the new common V2.0 FADT */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 56/140 ACPICA: Lint changes
From: Bob Moore <[email protected]>
Lint changes
Move RSDT/XSDT pointer extraction to separate function Warning on 32-bit platforms if XSDT pointers use more than 32 bits.
--- drivers/acpi/tables/tbutils.c | 121 ++++++++++++++++++++++++++++------------- drivers/acpi/tables/tbxface.c | 4 +- 2 files changed, 84 insertions(+), 41 deletions(-)
drivers/acpi/tables/tbutils.c +82 -39
@@ -60,6 +60,10 @@ static void inline acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, u8 bit_width, u64 address); +static acpi_physical_address +acpi_tb_get_root_table_entry (u8 * table_entry, +acpi_native_uint table_entry_size); +/* Table used for conversion of FADT to common format */ typedef struct acpi_fadt_conversion {
@@ -126,10 +130,14 @@ acpi_tb_print_table_header(acpi_physical_address address,ACPI_INFO ((AE_INFO ,"RSDP @ 0x%p/0x%04X (v%3.3d %6.6s)" ,ACPI_CAST_PTR (void, address), - (((struct acpi_table_rsdp *)header)->revision >0 ) ? - ((struct acpi_table_rsdp *)header)->length :20 , - ((struct acpi_table_rsdp *)header)->revision, - ((struct acpi_table_rsdp *)header)->oem_id)); + (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> + revision > + 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, + header)->length :20 , + ACPI_CAST_PTR(struct acpi_table_rsdp, + header)->revision, + ACPI_CAST_PTR(struct acpi_table_rsdp, + header)->oem_id)); }else {/* Standard ACPI table with full common header */
@@ -278,8 +286,8 @@ static void acpi_tb_convert_fadt(void) }/* -* Expand the V1.0 addresses to the "X" generic address structs, -* as necessary. +* Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address +* structures as necessary. */ for (i =0 ; i <ACPI_FADT_CONVERSION_ENTRIES ; i++) { target =
@@ -294,10 +302,11 @@ static void acpi_tb_convert_fadt(void) &acpi_gbl_FADT, fadt_conversion_table [i].length), - *ACPI_ADD_PTR (u32, - &acpi_gbl_FADT, - fadt_conversion_table - [i].source)); + (u64) *ACPI_ADD_PTR (u32, + &acpi_gbl_FADT, + fadt_conversion_table + [i]. + source)); } }
@@ -444,7 +453,7 @@ static void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)/* Copy the entire FADT locally */ -ACPI_MEMSET (&acpi_gbl_FADT,sizeof (struct acpi_table_fadt ),0 ); +ACPI_MEMSET (&acpi_gbl_FADT,0 ,sizeof (struct acpi_table_fadt ));ACPI_MEMCPY (&acpi_gbl_FADT, table,ACPI_MIN (length,sizeof (struct acpi_table_fadt )));
@@ -465,6 +474,61 @@ static void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)/******************************************************************************* * +* FUNCTION: acpi_tb_get_root_table_entry +* +* PARAMETERS: table_entry - Pointer to the RSDT/XSDT table entry +* table_entry_size - sizeof 32 or 64 (RSDT or XSDT) +* +* RETURN: Physical address extracted from the root table +* +* DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on +* both 32-bit and 64-bit platforms +* +* NOTE: acpi_physical_address is 32-bit on 32-bit platforms, 64-bit on +* 64-bit platforms. +* +******************************************************************************/ + +static acpi_physical_address +acpi_tb_get_root_table_entry (u8 * table_entry, +acpi_native_uint table_entry_size) +{ +u64 address64; + +/* +* Get the table physical address (32-bit for RSDT, 64-bit for XSDT): +* Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT +*/ +if (table_entry_size ==sizeof (u32)) { +/* +* 32-bit platform, RSDT: Return 32-bit table entry +* 64-bit platform, RSDT: Expand 32-bit to 64-bit and return +*/ +return ((acpi_physical_address) + (*ACPI_CAST_PTR (u32, table_entry))); + }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 +*/ +ACPI_MOVE_64_TO_64 (&address64, table_entry); + +#if ACPI_MACHINE_WIDTH ==32 +if (address64 >ACPI_UINT32_MAX ) { + +/* Will truncate 64-bit address to 32 bits */ + +ACPI_WARNING ((AE_INFO , +"64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating" , +ACPI_FORMAT_UINT64 (address64))); + } +#endif +return ((acpi_physical_address) (address64)); + } +} + +/******************************************************************************* +* * FUNCTION: acpi_tb_parse_root_table * * PARAMETERS: Rsdp - Pointer to the RSDP
@@ -567,8 +631,8 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)/* Calculate the number of tables described in the root table */ table_count = - (table->length - -sizeof (struct acpi_table_header )) / table_entry_size; + (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,
@@ -599,32 +663,11 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) } } -/* -* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) -*/ -if ((table_entry_size ==sizeof (u32)) || - (sizeof (acpi_physical_address) ==sizeof (u32))) { -/* -* 32-bit platform, RSDT: Move 32-bit to 32-bit -* 32-bit platform, XSDT: Truncate 64-bit to 32-bit -* 64-bit platform, RSDT: Expand 32-bit to 64-bit -* -* Note: Addresses are 32-bit aligned in both RSDT and XSDT -*/ - acpi_gbl_root_table_list. - tables[acpi_gbl_root_table_list.count].address = - (acpi_physical_address) (*ACPI_CAST_PTR - (u32, table_entry)); - }else { -/* -* 64-bit platform, XSDT: Move 64-bit to 64-bit -* -* Note: 64-bit addresses are only 32-bit aligned in the XSDT -*/ -ACPI_MOVE_64_TO_64 (&acpi_gbl_root_table_list. - tables[acpi_gbl_root_table_list. - count].address, table_entry); - } +/* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */ + + acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. + address = +acpi_tb_get_root_table_entry (table_entry, table_entry_size); table_entry += table_entry_size; acpi_gbl_root_table_list.count++;
drivers/acpi/tables/tbxface.c +2 -2
@@ -102,9 +102,9 @@ acpi_initialize_tables(struct acpi_table_desc *initial_table_array, }else {/* Root Table Array has been statically allocated by the host */ -ACPI_MEMSET (initial_table_array, +ACPI_MEMSET (initial_table_array,0 , initial_table_count * -sizeof (struct acpi_table_desc ),0 ); +sizeof (struct acpi_table_desc )); acpi_gbl_root_table_list.tables = initial_table_array; acpi_gbl_root_table_list.size = initial_table_count;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 57/140 ACPICA: minimal patch to integrate new tables into Linux
From: Alexey Starikovskiy <[email protected]>
--- arch/i386/kernel/acpi/boot.c | 17 ++---- arch/ia64/kernel/acpi.c | 8 +- arch/ia64/sn/kernel/io_common.c | 17 ++++-- arch/ia64/sn/kernel/iomv.c | 10 ++- arch/x86_64/kernel/time.c | 18 +++--- drivers/acpi/asus_acpi.c | 9 +-- drivers/acpi/blacklist.c | 15 ++-- drivers/acpi/bus.c | 25 ++++---- drivers/acpi/ec.c | 4 +- drivers/acpi/motherboard.c | 40 ++++++------ drivers/acpi/osl.c | 47 ++++++-------- drivers/acpi/processor_core.c | 2 +- drivers/acpi/processor_idle.c | 29 ++++---- drivers/acpi/processor_perflib.c | 27 +++----- drivers/acpi/scan.c | 4 +- drivers/acpi/sleep/proc.c | 36 ++++++----- drivers/acpi/system.c | 15 ++--- drivers/acpi/tables.c | 29 ++++---- drivers/acpi/tables/Makefile | 3 +- drivers/acpi/tables/tbutils.c | 2 +- drivers/acpi/tables/tbxface.c | 8 ++- include/acpi/acglobal.h | 2 + include/acpi/acpi_bus.h | 1 - include/acpi/actbl.h | 7 ++- include/acpi/actbl2.h | 49 -------------- include/acpi/actbl71.h | 134 -------------------------------------- include/asm-i386/acpi.h | 8 +- include/asm-ia64/acpi.h | 8 +- include/asm-ia64/sn/acpi.h | 16 ----- include/asm-x86_64/acpi.h | 8 +- include/linux/acpi.h | 46 ------------- 31 files changed, 191 insertions(+), 453 deletions(-) delete mode 100644 include/acpi/actbl2.h delete mode 100644 include/acpi/actbl71.h delete mode 100644 include/asm-ia64/sn/acpi.h
arch/i386/kernel/acpi/boot.c +5 -12
@@ -716,33 +716,26 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) printk(KERN_WARNING PREFIX "Unable to map FADT\n");return 0 ; } -/* initialize sci_int early for INT_SRC_OVR MADT parsing */ - acpi_fadt.sci_int = fadt->sci_int; - -/* initialize rev and apic_phys_dest_mode for x86_64 genapic */ - acpi_fadt.revision = fadt->revision; - acpi_fadt.force_apic_physical_destination_mode = - fadt->force_apic_physical_destination_mode;#ifdef CONFIG_X86_PM_TIMER /* detect the location of the ACPI PM Timer */ -if (fadt->revision >=FADT2_REVISION_ID ) { +if (fadt->header.revision >=FADT2_REVISION_ID ) {/* FADT rev. 2 */ -if (fadt->xpm_tmr_blk.address_space_id != +if (fadt->xpm_timer_block.space_id !=ACPI_ADR_SPACE_SYSTEM_IO )return 0 ; - pmtmr_ioport = fadt->xpm_tmr_blk.address; + pmtmr_ioport = fadt->xpm_timer_block.address;/* * "X" fields are optional extensions to the original V1.0 * fields, so we must selectively expand V1.0 fields if the * corresponding X field is zero. */ if (!pmtmr_ioport) - pmtmr_ioport = fadt->V1_pm_tmr_blk; + pmtmr_ioport = fadt->pm_timer_block; }else {/* FADT rev. 1 */ - pmtmr_ioport = fadt->V1_pm_tmr_blk; + pmtmr_ioport = fadt->pm_timer_block; }if (pmtmr_ioport) printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
arch/ia64/kernel/acpi.c +4 -4
@@ -76,7 +76,7 @@ const char *acpi_get_sysname(void) {#ifdef CONFIG_IA64_GENERIC unsigned long rsdp_phys; -struct acpi20_table_rsdp *rsdp; +struct acpi_table_rsdp *rsdp;struct acpi_table_xsdt *xsdt;struct acpi_table_header *hdr;
@@ -87,8 +87,8 @@ const char *acpi_get_sysname(void)return "dig" ; } - rsdp = (struct acpi20_table_rsdp *)__va (rsdp_phys); -if (strncmp (rsdp->signature,RSDP_SIG ,sizeof (RSDP_SIG ) -1 )) { + rsdp = (struct acpi_table_rsdp *)__va (rsdp_phys); +if (strncmp (rsdp->signature,ACPI_SIG_RSDP ,sizeof (ACPI_SIG_RSDP ) -1 )) {printk (KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n" );return "dig" ;
@@ -96,7 +96,7 @@ const char *acpi_get_sysname(void) xsdt = (struct acpi_table_xsdt *)__va (rsdp->xsdt_address); hdr = &xsdt->header; -if (strncmp (hdr->signature,XSDT_SIG ,sizeof (XSDT_SIG ) -1 )) { +if (strncmp (hdr->signature,ACPI_SIG_XSDT ,sizeof (ACPI_SIG_XSDT ) -1 )) {printk (KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n" );return "dig" ;
arch/ia64/sn/kernel/io_common.c +12 -5
@@ -25,7 +25,6 @@#include "xtalk/xwidgetdev.h" #include <linux/acpi.h> #include <asm/sn/sn2/sn_hwperf.h> -#include <asm/sn/acpi.h> extern void sn_init_cpei_timer (void );extern void register_sn_procfs (void );
@@ -37,7 +36,6 @@ extern void sn_legacy_pci_window_fixup(struct pci_controller *, u64, u64);extern void sn_io_acpi_init (void );extern void sn_io_init (void ); -static struct list_head sn_sysdata_list;/* sysdata list struct */
@@ -50,6 +48,15 @@ int sn_ioif_inited; /* SN I/O infrastructure initialized? */struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES ];/* indexed by asic type */ +int sn_acpi_base_support () +{ +struct acpi_table_header *header; + (void )acpi_get_table_by_index (ACPI_TABLE_INDEX_DSDT , &header); +if (header && header->oem_revision >=0x20101 ) +return 1 ; +return 0 ; +} +/* * Hooks and struct for unsupported pci providers */
@@ -286,7 +293,7 @@ void sn_pci_fixup_slot(struct pci_dev *dev)list_add_tail (&pcidev_info->pdi_list, &(SN_PLATFORM_DATA (dev->bus)->pcidev_info)); -if (SN_ACPI_BASE_SUPPORT ()) +if (sn_acpi_base_support ())sn_acpi_slot_fixup (dev, pcidev_info);else sn_more_slot_fixup (dev, pcidev_info);
@@ -498,7 +505,7 @@ void __devinit sn_pci_fixup_bus(struct pci_bus *bus) { -if (SN_ACPI_BASE_SUPPORT ()) +if (sn_acpi_base_support ())sn_acpi_bus_fixup (bus);else sn_bus_fixup (bus);
@@ -546,7 +553,7 @@ sn_io_early_init(void)printk (KERN_INFO "ACPI DSDT OEM Rev 0x%x\n" , acpi_gbl_DSDT->oem_revision); -if (SN_ACPI_BASE_SUPPORT ()) +if (sn_acpi_base_support ())sn_io_acpi_init ();else sn_io_init ();
arch/ia64/sn/kernel/iomv.c +6 -4
@@ -1,4 +1,4 @@ -/* +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details.
@@ -16,7 +16,6 @@#include <asm/sn/pda.h> #include <asm/sn/sn_cpuid.h> #include <asm/sn/shub_mmr.h> -#include <asm/sn/acpi.h> #define IS_LEGACY_VGA_IOPORT (p) \ (((p) >= 0x3b0 && (p) <= 0x3bb) || ((p) >= 0x3c0 && (p) <= 0x3df))
@@ -26,9 +25,12 @@* @port: port to convert * * Legacy in/out instructions are converted to ld/st instructions -* on IA64. This routine will convert a port number into a valid +* on IA64. This routine will convert a port number into a valid * SN i/o address. Used by sn_in*() and sn_out*(). */ + +extern int sn_acpi_base_support (); +void *sn_io_addr (unsigned long port) {if (!IS_RUNNING_ON_SIMULATOR ()) {
@@ -37,7 +39,7 @@ void *sn_io_addr(unsigned long port)/* On sn2, legacy I/O ports don't point at anything */ if (port < (64 *1024 ))return NULL ; -if (SN_ACPI_BASE_SUPPORT ()) +if (sn_acpi_base_support ())return (__ia64_mk_io_addr (port));else return ((void *)(port | __IA64_UNCACHED_OFFSET));
arch/x86_64/kernel/time.c +9 -9
@@ -498,7 +498,7 @@ static unsigned long get_cmos_time(void) {unsigned int year, mon, day, hour, min, sec;unsigned long flags; -unsigned extyear =0 ; +unsigned century =0 ;spin_lock_irqsave (&rtc_lock, flags);
@@ -510,9 +510,9 @@ static unsigned long get_cmos_time(void) mon =CMOS_READ (RTC_MONTH ); year =CMOS_READ (RTC_YEAR );#ifdef CONFIG_ACPI -if (acpi_fadt.revision >=FADT2_REVISION_ID && - acpi_fadt.century) - extyear =CMOS_READ (acpi_fadt.century); +if (acpi_gbl_FADT.header.revision >=FADT2_REVISION_ID && + acpi_gbl_FADT.century) + century =CMOS_READ (acpi_gbl_FADT.century);#endif }while (sec !=CMOS_READ (RTC_SECONDS ));
@@ -530,10 +530,10 @@ static unsigned long get_cmos_time(void)BCD_TO_BIN (mon);BCD_TO_BIN (year); -if (extyear) { -BCD_TO_BIN (extyear); - year += extyear; -printk (KERN_INFO "Extended CMOS year: %d\n" , extyear); +if (century) { +BCD_TO_BIN (century); + year += century *100 ; +printk (KERN_INFO "Extended CMOS year: %d\n" , century *100 ); }else {/* * x86-64 systems only exists since 2002.
@@ -954,7 +954,7 @@ __cpuinit int unsynchronized_tsc(void)if (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL ) {#ifdef CONFIG_ACPI /* But TSC doesn't tick in C3 so don't use it there */ -if (acpi_fadt.length >0 && acpi_fadt.plvl3_lat <1000 ) +if (acpi_gbl_FADT.header.length >0 && acpi_gbl_FADT.C3latency <1000 )return 1 ;#endif return 0 ;
drivers/acpi/asus_acpi.c +2 -7
@@ -26,7 +26,7 @@* Pontus Fuchs - Helper functions, cleanup * Johann Wiesner - Small compile fixes * John Belmonte - ACPI code for Toshiba laptop was a good starting point. -* Éric Burghard - LED display support for W1N +* �ic Burghard - LED display support for W1N * */
@@ -1128,7 +1128,6 @@ static int asus_model_match(char *model)static int asus_hotk_get_info (void ) {struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL }; -struct acpi_buffer dsdt = {ACPI_ALLOCATE_BUFFER ,NULL };union acpi_object *model =NULL ;int bsts_result;char *string =NULL ;
@@ -1142,11 +1141,9 @@ static int asus_hotk_get_info(void)* HID), this bit will be moved. A global variable asus_info contains * the DSDT header. */ - status =acpi_get_table (ACPI_TABLE_ID_DSDT ,1 , &dsdt); + status =acpi_get_table (ACPI_SIG_DSDT ,1 , &asus_info);if (ACPI_FAILURE (status))printk (KERN_WARNING " Couldn't get the DSDT table header\n" ); -else - asus_info = dsdt.pointer;/* We have to write 0 on init this far for all ASUS models */ if (!write_acpi_int (hotk->handle,"INIT" ,0 , &buffer)) {
@@ -1358,8 +1355,6 @@ static void __exit asus_acpi_exit(void)acpi_bus_unregister_driver (&asus_hotk_driver);remove_proc_entry (PROC_ASUS , acpi_root_dir); -kfree (asus_info); -return ; }
drivers/acpi/blacklist.c +7 -8
@@ -44,7 +44,7 @@ struct acpi_blacklist_item {char oem_id[7 ];char oem_table_id[9 ];u32 oem_revision; -acpi_table_type table; +char *table;enum acpi_blacklist_predicates oem_revision_predicate;char *reason;u32 is_critical_error;
@@ -56,18 +56,18 @@ struct acpi_blacklist_item {*/ static struct acpi_blacklist_item acpi_blacklist[]__initdata = {/* Compaq Presario 1700 */ - {"PTLTD " ," DSDT " ,0x06040000 ,ACPI_DSDT , less_than_or_equal, + {"PTLTD " ," DSDT " ,0x06040000 ,ACPI_SIG_DSDT , less_than_or_equal,"Multiple problems" ,1 },/* Sony FX120, FX140, FX150? */ - {"SONY " ,"U0 " ,0x20010313 ,ACPI_DSDT , less_than_or_equal, + {"SONY " ,"U0 " ,0x20010313 ,ACPI_SIG_DSDT , less_than_or_equal,"ACPI driver problem" ,1 },/* Compaq Presario 800, Insyde BIOS */ - {"INT440" ,"SYSFexxx" ,0x00001001 ,ACPI_DSDT , less_than_or_equal, + {"INT440" ,"SYSFexxx" ,0x00001001 ,ACPI_SIG_DSDT , less_than_or_equal,"Does not use _REG to protect EC OpRegions" ,1 },/* IBM 600E - _ADR should return 7, but it returns 1 */ - {"IBM " ,"TP600E " ,0x00000105 ,ACPI_DSDT , less_than_or_equal, + {"IBM " ,"TP600E " ,0x00000105 ,ACPI_SIG_DSDT , less_than_or_equal,"Incorrect _ADR" ,1 }, - {"ASUS\0\0" ,"P2B-S " ,0 ,ACPI_DSDT , all_versions, + {"ASUS\0\0" ,"P2B-S " ,0 ,ACPI_SIG_DSDT , all_versions,"Bogus PCI routing" ,1 }, {"" }
@@ -106,8 +106,7 @@ int __init acpi_blacklisted(void)struct acpi_table_header *table_header;while (acpi_blacklist[i].oem_id[0 ] !='\0' ) { -if (acpi_get_table_header_early - (acpi_blacklist[i].table, &table_header)) { +if (acpi_get_table_header (acpi_blacklist[i].table,0 , &table_header)) { i++;continue ; }
drivers/acpi/bus.c +12 -13
@@ -44,9 +44,6 @@ ACPI_MODULE_NAME("acpi_bus")extern void __init acpi_pic_sci_set_trigger (unsigned int irq,u16 trigger);#endif -struct fadt_descriptor acpi_fadt; -EXPORT_SYMBOL (acpi_fadt); -struct acpi_device *acpi_root;struct proc_dir_entry *acpi_root_dir;EXPORT_SYMBOL (acpi_root_dir);
@@ -582,11 +579,12 @@ static int __init acpi_bus_init_irq(void)return 0 ; } +acpi_native_uint acpi_gbl_permanent_mmap; + +void __init acpi_early_init (void ) {acpi_status status =AE_OK ; -struct acpi_buffer buffer = {sizeof (acpi_fadt), &acpi_fadt }; -if (acpi_disabled)return ;
@@ -597,6 +595,15 @@ void __init acpi_early_init(void)if (!acpi_strict) acpi_gbl_enable_interpreter_slack = TRUE; + acpi_gbl_permanent_mmap =1 ; + + status =acpi_reallocate_root_table (); +if (ACPI_FAILURE (status)) { + printk(KERN_ERR PREFIX + "Unable to reallocate ACPI tables\n"); + goto error0; + } + status =acpi_initialize_subsystem ();if (ACPI_FAILURE (status)) { printk(KERN_ERR PREFIX
@@ -611,14 +618,6 @@ void __init acpi_early_init(void) goto error0; } -/* -* Get a separate copy of the FADT for use by other drivers. -*/ - status =acpi_get_table (ACPI_TABLE_ID_FADT ,1 , &buffer); -if (ACPI_FAILURE (status)) { - printk(KERN_ERR PREFIX "Unable to get the FADT\n"); - goto error0; - }#ifdef CONFIG_X86 if (!acpi_ioapic) {extern acpi_interrupt_flags acpi_sci_flags;
drivers/acpi/ec.c +1 -3
@@ -872,9 +872,7 @@ static int __init acpi_ec_get_real_ecdt(void)acpi_status status;struct acpi_table_ecdt *ecdt_ptr; - status =acpi_get_firmware_table ("ECDT" ,1 ,ACPI_LOGICAL_ADDRESSING , - (struct acpi_table_header **) - &ecdt_ptr); + status =acpi_get_table ("ECDT" ,1 , (struct acpi_table_header **)&ecdt_ptr);if (ACPI_FAILURE (status))return -ENODEV ;
drivers/acpi/motherboard.c +20 -20
@@ -134,41 +134,41 @@ static void __init acpi_request_region (struct acpi_generic_address *addr,if (!addr->address || !length)return ; -if (addr->address_space_id ==ACPI_ADR_SPACE_SYSTEM_IO ) +if (addr->space_id ==ACPI_ADR_SPACE_SYSTEM_IO )request_region (addr->address, length, desc); -else if (addr->address_space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) +else if (addr->space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY )request_mem_region (addr->address, length, desc); }static void __init acpi_reserve_resources (void ) { -acpi_request_region (&acpi_gbl_FADT->xpm1a_evt_blk, - acpi_gbl_FADT->pm1_evt_len,"ACPI PM1a_EVT_BLK" ); +acpi_request_region (&acpi_gbl_FADT.xpm1a_event_block, + acpi_gbl_FADT.pm1_event_length,"ACPI PM1a_EVT_BLK" ); -acpi_request_region (&acpi_gbl_FADT->xpm1b_evt_blk, - acpi_gbl_FADT->pm1_evt_len,"ACPI PM1b_EVT_BLK" ); +acpi_request_region (&acpi_gbl_FADT.xpm1b_event_block, + acpi_gbl_FADT.pm1_event_length,"ACPI PM1b_EVT_BLK" ); -acpi_request_region (&acpi_gbl_FADT->xpm1a_cnt_blk, - acpi_gbl_FADT->pm1_cnt_len,"ACPI PM1a_CNT_BLK" ); +acpi_request_region (&acpi_gbl_FADT.xpm1a_control_block, + acpi_gbl_FADT.pm1_control_length,"ACPI PM1a_CNT_BLK" ); -acpi_request_region (&acpi_gbl_FADT->xpm1b_cnt_blk, - acpi_gbl_FADT->pm1_cnt_len,"ACPI PM1b_CNT_BLK" ); +acpi_request_region (&acpi_gbl_FADT.xpm1b_control_block, + acpi_gbl_FADT.pm1_control_length,"ACPI PM1b_CNT_BLK" ); -if (acpi_gbl_FADT->pm_tm_len ==4 ) -acpi_request_region (&acpi_gbl_FADT->xpm_tmr_blk,4 ,"ACPI PM_TMR" ); +if (acpi_gbl_FADT.pm_timer_length ==4 ) +acpi_request_region (&acpi_gbl_FADT.xpm_timer_block,4 ,"ACPI PM_TMR" ); -acpi_request_region (&acpi_gbl_FADT->xpm2_cnt_blk, - acpi_gbl_FADT->pm2_cnt_len,"ACPI PM2_CNT_BLK" ); +acpi_request_region (&acpi_gbl_FADT.xpm2_control_block, + acpi_gbl_FADT.pm2_control_length,"ACPI PM2_CNT_BLK" );/* Length of GPE blocks must be a non-negative multiple of 2 */ -if (!(acpi_gbl_FADT->gpe0_blk_len &0x1 )) -acpi_request_region (&acpi_gbl_FADT->xgpe0_blk, - acpi_gbl_FADT->gpe0_blk_len,"ACPI GPE0_BLK" ); +if (!(acpi_gbl_FADT.gpe0_block_length &0x1 )) +acpi_request_region (&acpi_gbl_FADT.xgpe0_block, + acpi_gbl_FADT.gpe0_block_length,"ACPI GPE0_BLK" ); -if (!(acpi_gbl_FADT->gpe1_blk_len &0x1 )) -acpi_request_region (&acpi_gbl_FADT->xgpe1_blk, - acpi_gbl_FADT->gpe1_blk_len,"ACPI GPE1_BLK" ); +if (!(acpi_gbl_FADT.gpe1_block_length &0x1 )) +acpi_request_region (&acpi_gbl_FADT.xgpe1_block, + acpi_gbl_FADT.gpe1_block_length,"ACPI GPE1_BLK" ); }static int __init acpi_motherboard_init (void )
drivers/acpi/osl.c +19 -28
78 lines not on this page · raw message
drivers/acpi/processor_core.c +1 -1
@@ -431,7 +431,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)* Check to see if we have bus mastering arbitration control. This * is required for proper C3 usage (to maintain cache coherency). */ -if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len) { +if (acpi_fadt.pm2_control_block && acpi_fadt.pm2_control_length) { pr->flags.bm_control =1 ;ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Bus mastering arbitration control present\n" ));
drivers/acpi/processor_idle.c +15 -14
@@ -160,7 +160,7 @@ static inline u32 ticks_elapsed(u32 t1, u32 t2) {if (t2 >= t1)return (t2 - t1); -else if (!acpi_fadt.tmr_val_ext) +else if (!(acpi_fadt.flags &ACPI_FADT_32BIT_TIMER ))return (((0x00FFFFFF - t1) + t2) &0x00FFFFFF );else return ((0xFFFFFFFF - t1) + t2);
@@ -236,7 +236,7 @@ static void acpi_cstate_enter(struct acpi_processor_cx *cstate)/* Dummy wait op - must do something useless after P_LVL2 read because chipsets cannot guarantee that STPCLK# signal gets asserted in time to freeze execution properly. */ - unused =inl (acpi_fadt.xpm_tmr_blk.address); + unused =inl (acpi_fadt.xpm_timer_block.address); } }
@@ -338,7 +338,7 @@ static void acpi_processor_idle(void)* detection phase, to work cleanly with logical CPU hotplug. */ if ((cx->type !=ACPI_STATE_C1 ) && (num_online_cpus () >1 ) && - !pr->flags.has_cst && !acpi_fadt.plvl2_up) + !pr->flags.has_cst && !(acpi_fadt.flags &ACPI_FADT_C2_MP_SUPPORTED )) cx = &pr->power.states[ACPI_STATE_C1 ];#endif
@@ -384,11 +384,11 @@ static void acpi_processor_idle(void)case ACPI_STATE_C2 :/* Get start time (ticks) */ - t1 =inl (acpi_fadt.xpm_tmr_blk.address); + t1 =inl (acpi_fadt.xpm_timer_block.address);/* Invoke C2 */ acpi_cstate_enter (cx);/* Get end time (ticks) */ - t2 =inl (acpi_fadt.xpm_tmr_blk.address); + t2 =inl (acpi_fadt.xpm_timer_block.address);#ifdef CONFIG_GENERIC_TIME /* TSC halts in C2, so notify users */
@@ -420,11 +420,11 @@ static void acpi_processor_idle(void) }/* Get start time (ticks) */ - t1 =inl (acpi_fadt.xpm_tmr_blk.address); + t1 =inl (acpi_fadt.xpm_timer_block.address);/* Invoke C3 */ acpi_cstate_enter (cx);/* Get end time (ticks) */ - t2 =inl (acpi_fadt.xpm_tmr_blk.address); + t2 =inl (acpi_fadt.xpm_timer_block.address);if (pr->flags.bm_check) {/* Enable bus master arbitration */ atomic_dec (&c3_cpu_count);
@@ -457,7 +457,7 @@ static void acpi_processor_idle(void)#ifdef CONFIG_HOTPLUG_CPU /* Don't do promotion/demotion */ if ((cx->type ==ACPI_STATE_C1 ) && (num_online_cpus () >1 ) && - !pr->flags.has_cst && !acpi_fadt.plvl2_up) { + !pr->flags.has_cst && !(acpi_fadt.flags &ACPI_FADT_C2_MP_SUPPORTED )) { next_state = cx; goto end; }
@@ -627,7 +627,8 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)* Check for P_LVL2_UP flag before entering C2 and above on * an SMP system. */ -if ((num_online_cpus () >1 ) && !acpi_fadt.plvl2_up) +if ((num_online_cpus () >1 ) && + !(acpi_fadt.flags &ACPI_FADT_C2_MP_SUPPORTED ))return -ENODEV ;#endif
@@ -636,8 +637,8 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) pr->power.states[ACPI_STATE_C3 ].address = pr->pblk +5 ;/* determine latencies from FADT */ - pr->power.states[ACPI_STATE_C2 ].latency = acpi_fadt.plvl2_lat; - pr->power.states[ACPI_STATE_C3 ].latency = acpi_fadt.plvl3_lat; + pr->power.states[ACPI_STATE_C2 ].latency = acpi_fadt.C2latency; + pr->power.states[ACPI_STATE_C3 ].latency = acpi_fadt.C3latency; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "lvl2[0x%08x] lvl3[0x%08x]\n",
@@ -883,7 +884,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,* WBINVD should be set in fadt, for C3 state to be * supported on when bm_check is not required. */ -if (acpi_fadt.wb_invd !=1 ) { +if (!(acpi_fadt.flags &ACPI_FADT_WBINVD )) {ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Cache invalidation should work properly" " for C3 to be enabled on SMP systems\n" ));
@@ -1164,9 +1165,9 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,if (!pr)return -EINVAL ; -if (acpi_fadt.cst_cnt && !nocst) { +if (acpi_fadt.cst_control && !nocst) { status = -acpi_os_write_port (acpi_fadt.smi_cmd, acpi_fadt.cst_cnt,8 ); +acpi_os_write_port (acpi_fadt.smi_command, acpi_fadt.cst_control,8 );if (ACPI_FAILURE (status)) {ACPI_EXCEPTION ((AE_INFO , status,"Notifying BIOS of _CST ability failed" ));
drivers/acpi/processor_perflib.c +10 -17
@@ -352,31 +352,24 @@ int acpi_processor_notify_smm(struct module *calling_module) is_done = -EIO ; -/* Can't write pstate_cnt to smi_cmd if either value is zero */ -if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { -ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"No SMI port or pstate_cnt\n" )); +/* Can't write pstate_control to smi_command if either value is zero */ +if ((!acpi_fadt.smi_command) || (!acpi_fadt.pstate_control)) { +ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"No SMI port or pstate_control\n" ));module_put (calling_module);return 0 ; }ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n" , - acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); +"Writing pstate_control [0x%x] to smi_command [0x%x]\n" , + acpi_fadt.pstate_control, acpi_fadt.smi_command)); -/* FADT v1 doesn't support pstate_cnt, many BIOS vendors use -* it anyway, so we need to support it... */ -if (acpi_fadt_is_v1) { -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Using v1.0 FADT reserved value for pstate_cnt\n" )); - } - - status =acpi_os_write_port (acpi_fadt.smi_cmd, - (u32 ) acpi_fadt.pstate_cnt,8 ); + status =acpi_os_write_port (acpi_fadt.smi_command, + (u32 ) acpi_fadt.pstate_control,8 );if (ACPI_FAILURE (status)) {ACPI_EXCEPTION ((AE_INFO , status, -"Failed to write pstate_cnt [0x%x] to " -"smi_cmd [0x%x]" , acpi_fadt.pstate_cnt, - acpi_fadt.smi_cmd)); +"Failed to write pstate_control [0x%x] to " +"smi_command [0x%x]" , acpi_fadt.pstate_control, + acpi_fadt.smi_command));module_put (calling_module);return status; }
drivers/acpi/scan.c +2 -2
@@ -1333,7 +1333,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)/* * Enumerate all fixed-feature devices. */ -if (acpi_fadt.pwr_button ==0 ) { +if ((acpi_fadt.flags &ACPI_FADT_POWER_BUTTON ) ==0 ) { result =acpi_add_single_object (&device, acpi_root,NULL ,ACPI_BUS_TYPE_POWER_BUTTON );
@@ -1341,7 +1341,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) result =acpi_start_single_object (device); } -if (acpi_fadt.sleep_button ==0 ) { +if ((acpi_fadt.flags &ACPI_FADT_SLEEP_BUTTON ) ==0 ) { result =acpi_add_single_object (&device, acpi_root,NULL ,ACPI_BUS_TYPE_SLEEP_BUTTON );
drivers/acpi/sleep/proc.c +19 -17
@@ -73,7 +73,7 @@ acpi_system_write_sleep(struct file *file,static int acpi_system_alarm_seq_show (struct seq_file *seq,void *offset) {u32 sec, min, hr; -u32 day, mo, yr; +u32 day, mo, yr, cent =0 ;unsigned char rtc_control =0 ;unsigned long flags;
@@ -87,20 +87,19 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) rtc_control =CMOS_READ (RTC_CONTROL );/* If we ever get an FACP with proper values... */ -if (acpi_gbl_FADT->day_alrm) +if (acpi_gbl_FADT.day_alarm)/* ACPI spec: only low 6 its should be cared */ - day =CMOS_READ (acpi_gbl_FADT->day_alrm) &0x3F ; + day =CMOS_READ (acpi_gbl_FADT.day_alarm) &0x3F ;else day =CMOS_READ (RTC_DAY_OF_MONTH ); -if (acpi_gbl_FADT->mon_alrm) - mo =CMOS_READ (acpi_gbl_FADT->mon_alrm); +if (acpi_gbl_FADT.month_alarm) + mo =CMOS_READ (acpi_gbl_FADT.month_alarm);else mo =CMOS_READ (RTC_MONTH ); -if (acpi_gbl_FADT->century) - yr =CMOS_READ (acpi_gbl_FADT->century) *100 + -CMOS_READ (RTC_YEAR ); -else - yr =CMOS_READ (RTC_YEAR ); +if (acpi_gbl_FADT.century) + cent =CMOS_READ (acpi_gbl_FADT.century); + + yr =CMOS_READ (RTC_YEAR );spin_unlock_irqrestore (&rtc_lock, flags);
@@ -111,10 +110,11 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)BCD_TO_BIN (day);BCD_TO_BIN (mo);BCD_TO_BIN (yr); +BCD_TO_BIN (cent); }/* we're trusting the FADT (see above) */ -if (!acpi_gbl_FADT->century) +if (!acpi_gbl_FADT.century)/* If we're not trusting the FADT, we should at least make it * right for _this_ century... ehm, what is _this_ century? *
@@ -134,6 +134,8 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)* */ yr +=2000 ; + else + yr += cent * 100;seq_printf (seq,"%4.4u-" , yr); (mo >12 ) ?seq_puts (seq,"**-" ) :seq_printf (seq,"%2.2u-" , mo);
@@ -317,12 +319,12 @@ acpi_system_write_alarm(struct file *file,* offsets into the CMOS RAM here -- which for some reason are pointing * to the RTC area of memory. */ -if (acpi_gbl_FADT->day_alrm) -CMOS_WRITE (day, acpi_gbl_FADT->day_alrm); -if (acpi_gbl_FADT->mon_alrm) -CMOS_WRITE (mo, acpi_gbl_FADT->mon_alrm); -if (acpi_gbl_FADT->century) -CMOS_WRITE (yr /100 , acpi_gbl_FADT->century); +if (acpi_gbl_FADT.day_alarm) +CMOS_WRITE (day, acpi_gbl_FADT.day_alarm); +if (acpi_gbl_FADT.month_alarm) +CMOS_WRITE (mo, acpi_gbl_FADT.month_alarm); +if (acpi_gbl_FADT.century) +CMOS_WRITE (yr /100 , acpi_gbl_FADT.century);/* enable the rtc alarm interrupt */ rtc_control |=RTC_AIE ;CMOS_WRITE (rtc_control,RTC_CONTROL );
drivers/acpi/system.c +6 -9
@@ -39,7 +39,6 @@ ACPI_MODULE_NAME("acpi_system")#define ACPI_SYSTEM_FILE_EVENT "event"#define ACPI_SYSTEM_FILE_DSDT "dsdt"#define ACPI_SYSTEM_FILE_FADT "fadt" -extern struct fadt_descriptor acpi_fadt;/* -------------------------------------------------------------------------- FS Interface (/proc)
@@ -76,17 +75,16 @@ acpi_system_read_dsdt(struct file *file, char __user * buffer, size_t count, loff_t * ppos) { acpi_status status = AE_OK; -struct acpi_buffer dsdt = {ACPI_ALLOCATE_BUFFER ,NULL }; +struct acpi_table_header *dsdt =NULL ;ssize_t res; - status =acpi_get_table (ACPI_TABLE_ID_DSDT ,1 , &dsdt); + status =acpi_get_table (ACPI_SIG_DSDT ,1 , &dsdt);if (ACPI_FAILURE (status))return -ENODEV ; res =simple_read_from_buffer (buffer, count, ppos, - dsdt.pointer, dsdt.length); -kfree (dsdt.pointer); + dsdt, dsdt->length);return res; }
@@ -103,17 +101,16 @@ acpi_system_read_fadt(struct file *file, char __user * buffer, size_t count, loff_t * ppos) { acpi_status status = AE_OK; -struct acpi_buffer fadt = {ACPI_ALLOCATE_BUFFER ,NULL }; +struct acpi_table_header *fadt =NULL ;ssize_t res; - status =acpi_get_table (ACPI_TABLE_ID_FADT ,1 , &fadt); + status =acpi_get_table (ACPI_SIG_FADT ,1 , &fadt);if (ACPI_FAILURE (status))return -ENODEV ; res =simple_read_from_buffer (buffer, count, ppos, - fadt.pointer, fadt.length); -kfree (fadt.pointer); + fadt, fadt->length);return res; }
drivers/acpi/tables.c +14 -15
@@ -74,6 +74,7 @@ static unsigned long sdt_pa; /* Physical Address */static unsigned long sdt_count;/* Table count */ static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES ]__initdata ; +static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES ]__initdata ;void acpi_table_print (struct acpi_table_header *header,unsigned long phys_addr) {
@@ -284,12 +285,12 @@ acpi_get_table_header_early(enum acpi_table_id id,struct fadt_descriptor *fadt = (struct fadt_descriptor *)*header; -if (fadt->revision ==3 && fadt->Xdsdt) { +if (fadt->header.revision ==3 && fadt->Xdsdt) { *header = (void *)__acpi_map_table (fadt->Xdsdt,sizeof (struct acpi_table_header )); - }else if (fadt->V1_dsdt) { - *header = (void *)__acpi_map_table (fadt->V1_dsdt, + }else if (fadt->dsdt) { + *header = (void *)__acpi_map_table (fadt->dsdt,sizeof (struct acpi_table_header )); }else
@@ -410,12 +411,11 @@ static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)/* First check XSDT (but only on ACPI 2.0-compatible systems) */ -if ((rsdp->revision >=2 ) && - (((struct acpi20_table_rsdp *)rsdp)->xsdt_address)) { +if ((rsdp->revision >=2 ) && rsdp->xsdt_physical_address) {struct acpi_table_xsdt *mapped_xsdt =NULL ; - sdt_pa = ((struct acpi20_table_rsdp *)rsdp)->xsdt_address; + sdt_pa = rsdp->xsdt_physical_address;/* map in just the header */ header = (struct acpi_table_header *)
@@ -457,16 +457,16 @@ static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp) }for (i =0 ; i < sdt_count; i++) - sdt_entry[i].pa = (unsigned long )mapped_xsdt->entry[i]; + sdt_entry[i].pa = (unsigned long )mapped_xsdt->table_offset_entry[i]; }/* Then check RSDT */ -else if (rsdp->rsdt_address) { +else if (rsdp->rsdt_physical_address) {struct acpi_table_rsdt *mapped_rsdt =NULL ; - sdt_pa = rsdp->rsdt_address; + sdt_pa = rsdp->rsdt_physical_address;/* map in just the header */ header = (struct acpi_table_header *)
@@ -507,7 +507,7 @@ static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp) }for (i =0 ; i < sdt_count; i++) - sdt_entry[i].pa = (unsigned long )mapped_rsdt->entry[i]; + sdt_entry[i].pa = (unsigned long )mapped_rsdt->table_offset_entry[i]; }else {
@@ -599,13 +599,10 @@ int __init acpi_table_init(void)if (rsdp->revision <2 ) result = -acpi_table_compute_checksum (rsdp, -sizeof (struct acpi_table_rsdp )); +acpi_table_compute_checksum (rsdp,ACPI_RSDP_REV0_SIZE );else result = -acpi_table_compute_checksum (rsdp, - ((struct acpi20_table_rsdp *) - rsdp)->length); +acpi_table_compute_checksum (rsdp, rsdp->length);if (result) {printk (KERN_WARNING " >>> ERROR: Invalid checksum\n" );
@@ -617,5 +614,7 @@ int __init acpi_table_init(void)if (acpi_table_get_sdt (rsdp))return -ENODEV ; +acpi_initialize_tables (initial_tables,ACPI_MAX_TABLES ,0 ); +return 0 ; }
drivers/acpi/tables/Makefile +1 -2
@@ -2,7 +2,6 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := tbconvrt.o tbget.o tbrsdt.o tbxface.o \ - tbgetall.o tbinstal.o tbutils.o tbxfroot.o +obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o EXTRA_CFLAGS += $(ACPI_CFLAGS)
drivers/acpi/tables/tbutils.c +1 -1
@@ -545,7 +545,7 @@ acpi_tb_get_root_table_entry(u8 * table_entry,* ******************************************************************************/ -acpi_status +acpi_status __init acpi_tb_parse_root_table (acpi_physical_address rsdp_address,u8 flags) {struct acpi_table_rsdp *rsdp;
drivers/acpi/tables/tbxface.c +5 -3
@@ -78,7 +78,7 @@ static acpi_status acpi_tb_load_namespace(void);* ******************************************************************************/ -acpi_status +acpi_status __init acpi_initialize_tables (struct acpi_table_desc *initial_table_array,u32 initial_table_count,u8 allow_resize) {
@@ -132,8 +132,6 @@ acpi_initialize_tables(struct acpi_table_desc *initial_table_array,return_ACPI_STATUS (status); } -ACPI_EXPORT_SYMBOL (acpi_initialize_tables) -/******************************************************************************* * * FUNCTION: acpi_reallocate_root_table
@@ -365,6 +363,10 @@ acpi_get_table(char *signature, *out_table = acpi_gbl_root_table_list.tables[i].pointer; } +if (!acpi_gbl_permanent_mmap) { + acpi_gbl_root_table_list.tables[i].pointer =0 ; + } +return (status); }
include/acpi/acglobal.h +2 -0
@@ -147,6 +147,8 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);*/ ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list; ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT; +#define acpi_fadt acpi_gbl_FADT +extern acpi_native_uint acpi_gbl_permanent_mmap;/* * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
include/acpi/acpi_bus.h +0 -1
@@ -59,7 +59,6 @@ acpi_evaluate_reference(acpi_handle handle,#define ACPI_BUS_FILE_ROOT "acpi"extern struct proc_dir_entry *acpi_root_dir; -extern struct fadt_descriptor acpi_fadt;enum acpi_bus_removal_type {ACPI_BUS_REMOVAL_NORMAL =0 ,
include/acpi/actbl.h +6 -1
@@ -236,6 +236,9 @@ struct acpi_table_fadt {struct acpi_generic_address xgpe1_block;/* 64-bit Extended General Purpose Event 1 Reg Blk address */ }; +#define fadt_descriptor acpi_table_fadt +#define sci_int sci_interrupt +/* FADT flags */ #define ACPI_FADT_WBINVD (1)/* 00: The wbinvd instruction works properly */
@@ -289,6 +292,8 @@ enum acpi_prefered_pm_profiles {/* * Get the remaining ACPI tables */ +/* +Don't include any new tables definitions for now. #include <acpi/actbl1.h> - +*/ #endif /* __ACTBL_H__ */
include/acpi/actbl2.h deleted +0 -49
49 lines not on this page · raw message
include/acpi/actbl71.h deleted +0 -134
134 lines not on this page · raw message
include/asm-i386/acpi.h +4 -4
@@ -59,11 +59,11 @@int __acpi_acquire_global_lock (unsigned int *lock);int __acpi_release_global_lock (unsigned int *lock); -#define ACPI_ACQUIRE_GLOBAL_LOCK (GLptr, Acq) \ - ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) +#define ACPI_ACQUIRE_GLOBAL_LOCK (facs, Acq) \ + ((Acq) = __acpi_acquire_global_lock(&facs->global_lock)) -#define ACPI_RELEASE_GLOBAL_LOCK (GLptr, Acq) \ - ((Acq) = __acpi_release_global_lock((unsigned int *) GLptr)) +#define ACPI_RELEASE_GLOBAL_LOCK (facs, Acq) \ + ((Acq) = __acpi_release_global_lock(&facs->global_lock))/* * Math helper asm macros
include/asm-ia64/acpi.h +4 -4
@@ -82,11 +82,11 @@ ia64_acpi_release_global_lock (unsigned int *lock)return old &0x1 ; } -#define ACPI_ACQUIRE_GLOBAL_LOCK (GLptr, Acq) \ - ((Acq) = ia64_acpi_acquire_global_lock((unsigned int *) GLptr)) +#define ACPI_ACQUIRE_GLOBAL_LOCK (facs, Acq) \ + ((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock)) -#define ACPI_RELEASE_GLOBAL_LOCK (GLptr, Acq) \ - ((Acq) = ia64_acpi_release_global_lock((unsigned int *) GLptr)) +#define ACPI_RELEASE_GLOBAL_LOCK (facs, Acq) \ + ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))#define acpi_disabled 0/* ACPI always enabled on IA64 */ #define acpi_noirq 0/* ACPI always enabled on IA64 */
include/asm-ia64/sn/acpi.h deleted +0 -16
@@ -1,16 +0,0 @@ -/* -* This file is subject to the terms and conditions of the GNU General Public -* License. See the file "COPYING" in the main directory of this archive -* for more details. -* -* Copyright (C) 2006 Silicon Graphics, Inc. All rights reserved. -*/ - -#ifndef _ASM_IA64_SN_ACPI_H -#define _ASM_IA64_SN_ACPI_H - -#include "acpi/acglobal.h" - -#define SN_ACPI_BASE_SUPPORT () (acpi_gbl_DSDT->oem_revision >= 0x20101) - -#endif /* _ASM_IA64_SN_ACPI_H */
include/asm-x86_64/acpi.h +4 -4
@@ -57,11 +57,11 @@int __acpi_acquire_global_lock (unsigned int *lock);int __acpi_release_global_lock (unsigned int *lock); -#define ACPI_ACQUIRE_GLOBAL_LOCK (GLptr, Acq) \ - ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) +#define ACPI_ACQUIRE_GLOBAL_LOCK (facs, Acq) \ + ((Acq) = __acpi_acquire_global_lock(&facs->global_lock)) -#define ACPI_RELEASE_GLOBAL_LOCK (GLptr, Acq) \ - ((Acq) = __acpi_release_global_lock((unsigned int *) GLptr)) +#define ACPI_RELEASE_GLOBAL_LOCK (facs, Acq) \ + ((Acq) = __acpi_release_global_lock(&facs->global_lock))/* * Math helper asm macros
include/linux/acpi.h +0 -46
57 lines not on this page · raw message
Signature · 5 lines
1.5.0.rc3.39.gec804 - 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
reviewerPATCH 58/140 ACPICA: Add support for DMAR table
From: Bob Moore <[email protected]>
Implement support for ACPI DMAR table (DMA Remapping Table) in header files and disassembler.
--- include/acpi/acdisasm.h | 14 +++++++-- include/acpi/actbl1.h | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 3 deletions(-)
include/acpi/acdisasm.h +11 -3
@@ -97,9 +97,10 @@ typedef const struct acpi_dmtable_info {#define ACPI_DMT_CHKSUM 20#define ACPI_DMT_SPACEID 21#define ACPI_DMT_GAS 22 -#define ACPI_DMT_MADT 23 -#define ACPI_DMT_SRAT 24 -#define ACPI_DMT_EXIT 25 +#define ACPI_DMT_DMAR 23 +#define ACPI_DMT_MADT 24 +#define ACPI_DMT_SRAT 25 +#define ACPI_DMT_EXIT 26typedef void (*ACPI_TABLE_HANDLER ) (struct acpi_table_header * table);
@@ -147,6 +148,11 @@ extern struct acpi_dmtable_info acpi_dm_table_info_boot[];extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar_hdr[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[];extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];extern struct acpi_dmtable_info acpi_dm_table_info_facs[];extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
@@ -201,6 +207,8 @@ void acpi_dm_dump_asf(struct acpi_table_header *table);void acpi_dm_dump_cpep (struct acpi_table_header *table); +void acpi_dm_dump_dmar (struct acpi_table_header *table); +void acpi_dm_dump_fadt (struct acpi_table_header *table);void acpi_dm_dump_srat (struct acpi_table_header *table);
include/acpi/actbl1.h +73 -0
85 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 59/140 ACPICA: Add acpi_gpe_count global to track the number of GPE events
From: Bob Moore <[email protected]>
--- drivers/acpi/events/evgpe.c | 2 ++ drivers/acpi/utilities/utglobal.c | 2 ++ include/acpi/acglobal.h | 4 ++++ 3 files changed, 8 insertions(+), 0 deletions(-)
drivers/acpi/events/evgpe.c +2 -0
@@ -618,6 +618,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)ACPI_FUNCTION_TRACE (ev_gpe_dispatch); + acpi_gpe_count++; +/* * If edge-triggered, clear the GPE status bit now. Note that * level-triggered events are cleared after the GPE is serviced.
drivers/acpi/utilities/utglobal.c +2 -0
@@ -720,6 +720,7 @@ void acpi_ut_init_globals(void)/* GPE support */ + acpi_gpe_count =0 ; acpi_gbl_gpe_xrupt_list_head =NULL ; acpi_gbl_gpe_fadt_blocks[0 ] =NULL ; acpi_gbl_gpe_fadt_blocks[1 ] =NULL ;
@@ -779,3 +780,4 @@ void acpi_ut_init_globals(void) ACPI_EXPORT_SYMBOL(acpi_dbg_level) ACPI_EXPORT_SYMBOL(acpi_dbg_layer) +ACPI_EXPORT_SYMBOL(acpi_gpe_count)
include/acpi/acglobal.h +4 -0
@@ -80,6 +80,10 @@ extern u32 acpi_dbg_layer;extern u32 acpi_gbl_nesting_level; +/* Event counters */ + +ACPI_EXTERN u32 acpi_gpe_count; +/* Support for dynamic control method tracing mechanism */ ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 60/140 ACPICA: Disable all wake GPEs after first one recieved
From: Bob Moore <[email protected]>
Change for GPE support: when a wake GPE is received, now all wake GPEs are immediately disabled to prevent the waking GPE from firing again, and to prevent other wake GPEs from interrupting the wake process.
--- drivers/acpi/events/evgpe.c | 78 +++++++++--------------------------------- include/acpi/acglobal.h | 68 ++++++++++++++++++------------------- include/acpi/actypes.h | 6 +--- 3 files changed, 51 insertions(+), 101 deletions(-)
drivers/acpi/events/evgpe.c +17 -61
@@ -635,20 +635,23 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) } } -/* Save current system state */ - -if (acpi_gbl_system_awake_and_running) { -ACPI_SET_BIT (gpe_event_info->flags,ACPI_GPE_SYSTEM_RUNNING ); - }else { -ACPI_CLEAR_BIT (gpe_event_info->flags,ACPI_GPE_SYSTEM_RUNNING ); +if (!acpi_gbl_system_awake_and_running) { +/* +* We just woke up because of a wake GPE. Disable any further GPEs +* until we are fully up and running (Only wake GPEs should be enabled +* at this time, but we just brute-force disable them all.) +* 1) We must disable this particular wake GPE so it won't fire again +* 2) We want to disable all wake GPEs, since we are now awake +*/ + (void )acpi_hw_disable_all_gpes (); }/* -* Dispatch the GPE to either an installed handler, or the control -* method associated with this GPE (_Lxx or _Exx). -* If a handler exists, we invoke it and do not attempt to run the method. -* If there is neither a handler nor a method, we disable the level to -* prevent further events from coming in here. +* Dispatch the GPE to either an installed handler, or the control method +* associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke +* it and do not attempt to run the method. If there is neither a handler +* nor a method, we disable this GPE to prevent further such pointless +* events from firing. */ switch (gpe_event_info->flags &ACPI_GPE_DISPATCH_MASK ) {case ACPI_GPE_DISPATCH_HANDLER :
@@ -679,8 +682,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)case ACPI_GPE_DISPATCH_METHOD :/* -* Disable GPE, so it doesn't keep firing before the method has a -* chance to run. +* Disable the GPE, so it doesn't keep firing before the method has a +* chance to run (it runs asynchronously with interrupts enabled). */ status =acpi_ev_disable_gpe (gpe_event_info);if (ACPI_FAILURE (status)) {
@@ -713,7 +716,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) gpe_number));/* -* Disable the GPE. The GPE will remain disabled until the ACPI +* Disable the GPE. The GPE will remain disabled until the ACPI * Core Subsystem is restarted, or a handler is installed. */ status =acpi_ev_disable_gpe (gpe_event_info);
@@ -728,50 +731,3 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)return_UINT32 (ACPI_INTERRUPT_HANDLED ); } - -#ifdef ACPI_GPE_NOTIFY_CHECK -/******************************************************************************* -* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED -* -* FUNCTION: acpi_ev_check_for_wake_only_gpe -* -* PARAMETERS: gpe_event_info - info for this GPE -* -* RETURN: Status -* -* DESCRIPTION: Determine if a a GPE is "wake-only". -* -* Called from Notify() code in interpreter when a "DeviceWake" -* Notify comes in. -* -******************************************************************************/ - -acpi_status -acpi_ev_check_for_wake_only_gpe (struct acpi_gpe_event_info *gpe_event_info) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (ev_check_for_wake_only_gpe); - -if ((gpe_event_info) &&/* Only >0 for _Lxx/_Exx */ - ((gpe_event_info->flags &ACPI_GPE_SYSTEM_MASK ) ==ACPI_GPE_SYSTEM_RUNNING )) {/* System state at GPE time */ -/* This must be a wake-only GPE, disable it */ - - status =acpi_ev_disable_gpe (gpe_event_info); - -/* Set GPE to wake-only. Do not change wake disabled/enabled status */ - -acpi_ev_set_gpe_type (gpe_event_info,ACPI_GPE_TYPE_WAKE ); - -ACPI_INFO ((AE_INFO , -"GPE %p was updated from wake/run to wake-only" , - gpe_event_info)); - -/* This was a wake-only GPE */ - -return_ACPI_STATUS (AE_WAKE_ONLY_GPE ); - } - -return_ACPI_STATUS (AE_OK ); -} -#endif
include/acpi/acglobal.h +33 -35
86 lines not on this page · raw message
include/acpi/actypes.h +1 -5
@@ -592,7 +592,7 @@ typedef u32 acpi_event_status;* | | | +--- Type of dispatch -- to method, handler, or none * | | +--- Enabled for runtime? * | +--- Enabled for wake? -* +--- System state when GPE ocurred (running/waking) +* +--- Unused */ #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01
@@ -618,10 +618,6 @@ typedef u32 acpi_event_status;#define ACPI_GPE_ENABLE_MASK (u8) 0x60/* Both run/wake */ -#define ACPI_GPE_SYSTEM_MASK (u8) 0x80 -#define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80 -#define ACPI_GPE_SYSTEM_WAKING (u8) 0x00 -/* * Flags for GPE and Lock interfaces */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 61/140 ACPICA: Fix unalignment in acpi_ut_repair_name
From: Bob Moore <[email protected]>
Update interface to acpi_ut_repair_name() to avoid alignment issues on IA64
--- drivers/acpi/namespace/nsdump.c | 2 +- drivers/acpi/namespace/nssearch.c | 3 ++- drivers/acpi/utilities/utglobal.c | 2 +- drivers/acpi/utilities/utmisc.c | 11 +++++------ include/acpi/acutils.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-)
drivers/acpi/namespace/nsdump.c +1 -1
@@ -205,7 +205,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,if (!acpi_ut_valid_acpi_name (this_node->name.integer)) { this_node->name.integer = -acpi_ut_repair_name (this_node->name.integer); +acpi_ut_repair_name (this_node->name.ascii);ACPI_WARNING ((AE_INFO ,"Invalid ACPI Name %08X" , this_node->name.integer));
drivers/acpi/namespace/nssearch.c +2 -1
@@ -321,7 +321,8 @@ acpi_ns_search_and_enter(u32 target_name,* even though there are a few bad names. */ if (!acpi_ut_valid_acpi_name (target_name)) { - target_name =acpi_ut_repair_name (target_name); + target_name = +acpi_ut_repair_name (ACPI_CAST_PTR (char, &target_name));/* Report warning only if in strict mode or debug mode */
drivers/acpi/utilities/utglobal.c +1 -1
@@ -566,7 +566,7 @@ char *acpi_ut_get_node_name(void *object)/* Name must be a valid ACPI name */ if (!acpi_ut_valid_acpi_name (node->name.integer)) { - node->name.integer =acpi_ut_repair_name (node->name.integer); + node->name.integer =acpi_ut_repair_name (node->name.ascii); }/* Return the name */
drivers/acpi/utilities/utmisc.c +5 -6
@@ -582,26 +582,25 @@ u8 acpi_ut_valid_acpi_name(u32 name)* ******************************************************************************/ -acpi_name acpi_ut_repair_name (acpi_name name) +acpi_name acpi_ut_repair_name (char *name) { -char *name_ptr =ACPI_CAST_PTR (char, &name); -char new_name[ACPI_NAME_SIZE ];acpi_native_uint i; +char new_name[ACPI_NAME_SIZE ];for (i =0 ; i <ACPI_NAME_SIZE ; i++) { - new_name[i] = name_ptr[i]; + new_name[i] = name[i];/* * Replace a bad character with something printable, yet technically * still invalid. This prevents any collisions with existing "good" * names in the namespace. */ -if (!acpi_ut_valid_acpi_char (name_ptr[i], i)) { +if (!acpi_ut_valid_acpi_char (name[i], i)) { new_name[i] ='*' ; } } -return (*ACPI_CAST_PTR (u32, new_name)); +return (*(u32 *) new_name); }/*******************************************************************************
include/acpi/acutils.h +1 -1
@@ -470,7 +470,7 @@ void acpi_ut_print_string(char *string, u8 max_length);u8 acpi_ut_valid_acpi_name (u32 name); -acpi_name acpi_ut_repair_name (acpi_name name); +acpi_name acpi_ut_repair_name (char *name);u8 acpi_ut_valid_acpi_char (char character,acpi_native_uint position);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 62/140 ACPICA: Store GPE number instead of bitmask
From: Alexey Starikovskiy <[email protected]>
Update internal GPE data structure to simplify debug, use gpe_number instead of register bitmask.
--- drivers/acpi/events/evgpe.c | 7 ++++--- drivers/acpi/events/evgpeblk.c | 3 ++- drivers/acpi/hardware/hwgpe.c | 13 +++++++++++-- drivers/acpi/utilities/utglobal.c | 2 -- include/acpi/acglobal.h | 1 - include/acpi/aclocal.h | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-)
drivers/acpi/events/evgpe.c +4 -3
@@ -121,7 +121,9 @@ 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 = gpe_event_info->register_bit; + register_bit = (u8) + (1 << + (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));/* 1) Disable case. Simply clear all enable bits */
@@ -458,8 +460,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)/* Examine one GPE bit */ -if (enabled_status_byte & - acpi_gbl_decode_to8bit[j]) { +if (enabled_status_byte & (1 << j)) {/* * Found an active GPE. Dispatch the event to a handler * or method.
drivers/acpi/events/evgpeblk.c +2 -1
@@ -819,7 +819,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)/* Init the event_info for each GPE within this register */ for (j =0 ; j <ACPI_GPE_REGISTER_WIDTH ; j++) { - this_event->register_bit = acpi_gbl_decode_to8bit[j]; + this_event->gpe_number = + (u8) (this_register->base_gpe_number + j); this_event->register_info = this_register; this_event++; }
drivers/acpi/hardware/hwgpe.c +11 -2
@@ -105,14 +105,20 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)acpi_status acpi_hw_clear_gpe (struct acpi_gpe_event_info * gpe_event_info) {acpi_status status; +u8 register_bit;ACPI_FUNCTION_ENTRY (); + 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 * clear this GPE. */ - status =acpi_hw_low_level_write (8 , gpe_event_info->register_bit, + status =acpi_hw_low_level_write (8 , register_bit, &gpe_event_info->register_info-> status_address);
@@ -155,7 +161,10 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,/* Get the register bitmask for this GPE */ - register_bit = gpe_event_info->register_bit; + 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/utilities/utglobal.c +0 -2
@@ -164,8 +164,6 @@ u32 acpi_gbl_startup_flags = 0;u8 acpi_gbl_shutdown = TRUE; -const u8 acpi_gbl_decode_to8bit[8 ] = {1 ,2 ,4 ,8 ,16 ,32 ,64 ,128 }; -const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT ] = {"\\_S0_" ,"\\_S1_" ,
include/acpi/acglobal.h +0 -1
@@ -240,7 +240,6 @@ ACPI_EXTERN u8 acpi_gbl_system_awake_and_running;extern u8 acpi_gbl_shutdown;extern u32 acpi_gbl_startup_flags; -extern const u8 acpi_gbl_decode_to8bit[8 ];extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT ];extern const char *acpi_gbl_highest_dstate_names[4 ];extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES ];
include/acpi/aclocal.h +1 -1
@@ -367,7 +367,7 @@ struct acpi_gpe_event_info {union acpi_gpe_dispatch_info dispatch;/* Either Method or Handler */ struct acpi_gpe_register_info *register_info;/* Backpointer to register info */ u8 flags;/* Misc info about this GPE */ -u8 register_bit;/* This GPE bit within the register */ +u8 gpe_number;/* This GPE */ };/* Information about a GPE register pair, one per each status/enable pair in an array */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 63/140 ACPICA: Split acpi_format_exception into two parts
From: Bob Moore <[email protected]>
Split acpi_format_exception into two parts. New function is acpi_ut_verify_exception and will be used to verify exception codes returned by user.
--- drivers/acpi/utilities/utglobal.c | 118 +++++++++++------------------------- drivers/acpi/utilities/utmisc.c | 73 +++++++++++++++++++++++ include/acpi/acglobal.h | 8 +++ include/acpi/acutils.h | 2 + 4 files changed, 119 insertions(+), 82 deletions(-)
drivers/acpi/utilities/utglobal.c +36 -82
@@ -52,87 +52,6 @@ ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)/******************************************************************************* * -* FUNCTION: acpi_format_exception -* -* PARAMETERS: Status - The acpi_status code to be formatted -* -* RETURN: A string containing the exception text. A valid pointer is -* always returned. -* -* DESCRIPTION: This function translates an ACPI exception into an ASCII string. -* -******************************************************************************/ -const char *acpi_format_exception (acpi_status status) -{ -acpi_status sub_status; -const char *exception =NULL ; - -ACPI_FUNCTION_ENTRY (); - -/* -* Status is composed of two parts, a "type" and an actual code -*/ - sub_status = (status & ~AE_CODE_MASK ); - -switch (status &AE_CODE_MASK ) { -case AE_CODE_ENVIRONMENTAL : - -if (sub_status <=AE_CODE_ENV_MAX ) { - exception = acpi_gbl_exception_names_env[sub_status]; - } -break ; - -case AE_CODE_PROGRAMMER : - -if (sub_status <=AE_CODE_PGM_MAX ) { - exception = - acpi_gbl_exception_names_pgm[sub_status -1 ]; - } -break ; - -case AE_CODE_ACPI_TABLES : - -if (sub_status <=AE_CODE_TBL_MAX ) { - exception = - acpi_gbl_exception_names_tbl[sub_status -1 ]; - } -break ; - -case AE_CODE_AML : - -if (sub_status <=AE_CODE_AML_MAX ) { - exception = - acpi_gbl_exception_names_aml[sub_status -1 ]; - } -break ; - -case AE_CODE_CONTROL : - -if (sub_status <=AE_CODE_CTRL_MAX ) { - exception = - acpi_gbl_exception_names_ctrl[sub_status -1 ]; - } -break ; - -default : -break ; - } - -if (!exception) { - -/* Exception code was not recognized */ - -ACPI_ERROR ((AE_INFO , -"Unknown exception code: 0x%8.8X" , status)); - - exception ="UNKNOWN_STATUS_CODE" ; - } - - return (ACPI_CAST_PTR(const char, exception)); -} - -/******************************************************************************* -* * Static global variable initialization. * ******************************************************************************/
@@ -182,10 +101,45 @@ const char *acpi_gbl_highest_dstate_names[4] = {/******************************************************************************* * -* Namespace globals +* FUNCTION: acpi_format_exception +* +* PARAMETERS: Status - The acpi_status code to be formatted +* +* RETURN: A string containing the exception text. A valid pointer is +* always returned. +* +* DESCRIPTION: This function translates an ACPI exception into an ASCII string +* It is here instead of utxface.c so it is always present. * ******************************************************************************/ +const char *acpi_format_exception (acpi_status status) +{ +const char *exception =NULL ; + +ACPI_FUNCTION_ENTRY (); + + exception =acpi_ut_validate_exception (status); +if (!exception) { + +/* Exception code was not recognized */ + +ACPI_ERROR ((AE_INFO , +"Unknown exception code: 0x%8.8X" , status)); + + exception ="UNKNOWN_STATUS_CODE" ; + } + + return (ACPI_CAST_PTR(const char, exception)); +} + +ACPI_EXPORT_SYMBOL (acpi_format_exception) + +/******************************************************************************* +* +* Namespace globals +* +******************************************************************************/ /* * Predefined ACPI Names (Built-in to the Interpreter) *
drivers/acpi/utilities/utmisc.c +73 -0
85 lines not on this page · raw message
include/acpi/acglobal.h +8 -0
@@ -245,6 +245,14 @@ extern const char *acpi_gbl_highest_dstate_names[4];extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES ];extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS ]; +/* Exception codes */ + +extern char const *acpi_gbl_exception_names_env[]; +extern char const *acpi_gbl_exception_names_pgm[]; +extern char const *acpi_gbl_exception_names_tbl[]; +extern char const *acpi_gbl_exception_names_aml[]; +extern char const *acpi_gbl_exception_names_ctrl[]; +/***************************************************************************** * * Namespace globals
include/acpi/acutils.h +2 -0
@@ -453,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,/* * utmisc */ +const char *acpi_ut_validate_exception (acpi_status status); +u8 acpi_ut_is_aml_table (struct acpi_table_header *table);acpi_status acpi_ut_allocate_owner_id (acpi_owner_id * owner_id);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 64/140 ACPICA: Update version to 20060831
From: Bob Moore <[email protected]>
--- include/acpi/acconfig.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
include/acpi/acconfig.h +3 -3
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060828 +#define ACPI_CA_VERSION 0x20060831/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -158,8 +158,8 @@/* Sizes for ACPI table headers */ -#define ACPI_OEM_ID_SIZE 6 -#define ACPI_OEM_TABLE_ID_SIZE 8 +#define ACPI_OEM_ID_SIZE 6 +#define ACPI_OEM_TABLE_ID_SIZE 8/* Constants used in searching for the RSDP in low memory */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 65/140 ACPICA: Cleanup of FADT verification function.
From: Bob Moore <[email protected]>
Removed offset display, not needed.
--- drivers/acpi/utilities/utinit.c | 65 ++++++++++++++------------------------- 1 files changed, 23 insertions(+), 42 deletions(-)
drivers/acpi/utilities/utinit.c +23 -42
@@ -50,8 +50,7 @@ACPI_MODULE_NAME ("utinit" ) /* Local prototypes */ -static void -acpi_ut_fadt_register_error (char *register_name,u32 value,u8 offset); +static void acpi_ut_fadt_register_error (char *register_name,u32 value);static void acpi_ut_terminate (void );
@@ -61,21 +60,18 @@ static void acpi_ut_terminate(void);* * PARAMETERS: register_name - Pointer to string identifying register * Value - Actual register contents value -* Offset - Byte offset in the FADT * -* RETURN: AE_BAD_VALUE +* RETURN: None * * DESCRIPTION: Display failure message * ******************************************************************************/ -static void -acpi_ut_fadt_register_error (char *register_name,u32 value,u8 offset) +static void acpi_ut_fadt_register_error (char *register_name,u32 value) { -ACPI_WARNING ((AE_INFO , -"Invalid FADT value %s=%X at offset %X in FADT=%p" , - register_name, value, offset, &acpi_gbl_FADT)); +ACPI_WARNING ((AE_INFO ,"Invalid FADT value %s = %X" , + register_name, value)); }/******************************************************************************
@@ -98,69 +94,54 @@ acpi_status acpi_ut_validate_fadt(void)* but don't abort on any problems, just display error */ if (acpi_gbl_FADT.pm1_event_length <4 ) { -acpi_ut_fadt_register_error ("PM1_EVT_LEN" , +acpi_ut_fadt_register_error ("Pm1EventLength" , (u32 ) acpi_gbl_FADT. - pm1_event_length, -ACPI_FADT_OFFSET (pm1_event_length)); + pm1_event_length); + } + +if (acpi_gbl_FADT.pm_timer_length <4 ) { +acpi_ut_fadt_register_error ("PmTimerLength" , + (u32 ) acpi_gbl_FADT. + pm_timer_length); }if (!acpi_gbl_FADT.pm1_control_length) { -acpi_ut_fadt_register_error ("PM1_CNT_LEN" ,0 , -ACPI_FADT_OFFSET - (pm1_control_length)); +acpi_ut_fadt_register_error ("Pm1ControlLength" ,0 ); }if (!acpi_gbl_FADT.xpm1a_event_block.address) { -acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK" ,0 , -ACPI_FADT_OFFSET (xpm1a_event_block. - address)); +acpi_ut_fadt_register_error ("XPm1aEventBlock.Address" ,0 ); }if (!acpi_gbl_FADT.xpm1a_control_block.address) { -acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK" ,0 , -ACPI_FADT_OFFSET - (xpm1a_control_block.address)); +acpi_ut_fadt_register_error ("XPm1aControlBlock.Address" ,0 ); }if (!acpi_gbl_FADT.xpm_timer_block.address) { -acpi_ut_fadt_register_error ("X_PM_TMR_BLK" ,0 , -ACPI_FADT_OFFSET (xpm_timer_block. - address)); +acpi_ut_fadt_register_error ("XPmTimerBlock.Address" ,0 ); }if ((acpi_gbl_FADT.xpm2_control_block.address && !acpi_gbl_FADT.pm2_control_length)) { -acpi_ut_fadt_register_error ("PM2_CNT_LEN" , +acpi_ut_fadt_register_error ("Pm2ControlLength" , (u32 ) acpi_gbl_FADT. - pm2_control_length, -ACPI_FADT_OFFSET - (pm2_control_length)); - } - -if (acpi_gbl_FADT.pm_timer_length <4 ) { -acpi_ut_fadt_register_error ("PM_TM_LEN" , - (u32 ) acpi_gbl_FADT.pm_timer_length, -ACPI_FADT_OFFSET (pm_timer_length)); + pm2_control_length); }/* Length of GPE blocks must be a multiple of 2 */ if (acpi_gbl_FADT.xgpe0_block.address && (acpi_gbl_FADT.gpe0_block_length &1 )) { -acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN" , +acpi_ut_fadt_register_error ("Gpe0BlockLength" , (u32 ) acpi_gbl_FADT. - gpe0_block_length, -ACPI_FADT_OFFSET - (gpe0_block_length)); + gpe0_block_length); }if (acpi_gbl_FADT.xgpe1_block.address && (acpi_gbl_FADT.gpe1_block_length &1 )) { -acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN" , +acpi_ut_fadt_register_error ("Gpe1BlockLength" , (u32 ) acpi_gbl_FADT. - gpe1_block_length, -ACPI_FADT_OFFSET - (gpe1_block_length)); + gpe1_block_length); }return (AE_OK );
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 66/140 ACPICA: Create tbfadt.c to hold all FADT-related functions
From: Bob Moore <[email protected]>
--- drivers/acpi/tables/Makefile | 2 +- drivers/acpi/tables/tbfadt.c | 380 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 381 insertions(+), 1 deletions(-) create mode 100644 drivers/acpi/tables/tbfadt.c
drivers/acpi/tables/Makefile +1 -1
@@ -2,6 +2,6 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o +obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o EXTRA_CFLAGS += $(ACPI_CFLAGS)
drivers/acpi/tables/tbfadt.c new file +380 -0
380 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 67/140 ACPICA: Re-implement interpreters' "serialized mode"
From: Bob Moore <[email protected]>
Enhanced the implementation of the interpreters' serialized mode (boot with "acpi_serialize" to set acpi_glb_all_methods_serialized flag.)
When this mode is specified, instead of creating a serialization semaphore per control method, the interpreter lock is simply no longer released before a blocking operation during control method execution. This effectively makes the AML Interpreter single-threaded. The overhead of a semaphore per-method is eliminated.
--- drivers/acpi/events/evregion.c | 15 ++---- drivers/acpi/events/evxface.c | 6 +-- drivers/acpi/executer/excreate.c | 5 +-- drivers/acpi/executer/exsystem.c | 30 +++-------- drivers/acpi/executer/exutils.c | 108 +++++++++++++++++++++++++++++------- drivers/acpi/namespace/nseval.c | 11 +--- drivers/acpi/namespace/nsinit.c | 7 +-- drivers/acpi/namespace/nsxfeval.c | 11 ++--- include/acpi/acinterp.h | 6 ++- 9 files changed, 114 insertions(+), 85 deletions(-)
drivers/acpi/events/evregion.c +4 -11
@@ -291,7 +291,6 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, u32 bit_width, acpi_integer * value) { acpi_status status; -acpi_status status2;acpi_adr_space_handler handler;acpi_adr_space_setup region_setup;union acpi_operand_object *handler_desc;
@@ -345,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,* setup will potentially execute control methods * (e.g., _REG method for this region) */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter (); status = region_setup(region_obj, ACPI_REGION_ACTIVATE, handler_desc->address_space.context,
@@ -353,10 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,/* Re-enter the interpreter */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } +acpi_ex_reacquire_interpreter ();/* Check for failure of the Region Setup */
@@ -409,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,* exit the interpreter because the handler *might* block -- we don't * know what it will do, so we can't hold the lock on the intepreter. */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter (); }/* Call the handler */
@@ -430,10 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,* We just returned from a non-default handler, we must re-enter the * interpreter */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } +acpi_ex_reacquire_interpreter (); }return_ACPI_STATUS (status);
drivers/acpi/events/evxface.c +2 -4
@@ -768,11 +768,9 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)return (AE_BAD_PARAMETER ); } - status =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status)) { -return (status); - } +/* Must lock interpreter to prevent race conditions */ +acpi_ex_enter_interpreter (); status =acpi_ev_acquire_global_lock (timeout);acpi_ex_exit_interpreter ();
drivers/acpi/executer/excreate.c +1 -4
@@ -583,10 +583,7 @@ acpi_ex_create_method(u8 * aml_start,* Get the sync_level. If method is serialized, a mutex will be * created for this method when it is parsed. */ -if (acpi_gbl_all_methods_serialized) { - obj_desc->method.sync_level =0 ; - obj_desc->method.method_flags |=AML_METHOD_SERIALIZED ; - }else if (method_flags &AML_METHOD_SERIALIZED ) { +if (method_flags &AML_METHOD_SERIALIZED ) {/* * ACPI 1.0: sync_level = 0 * ACPI 2.0: sync_level = sync_level in method declaration
drivers/acpi/executer/exsystem.c +7 -23
@@ -66,7 +66,6 @@ ACPI_MODULE_NAME("exsystem")acpi_status acpi_ex_system_wait_semaphore (acpi_semaphore semaphore,u16 timeout) {acpi_status status; -acpi_status status2;ACPI_FUNCTION_TRACE (ex_system_wait_semaphore);
@@ -79,7 +78,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)/* We must wait, so unlock the interpreter */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter (); status =acpi_os_wait_semaphore (semaphore,1 , timeout);
@@ -89,13 +88,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)/* Reacquire the interpreter */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status2)) { - -/* Report fatal error, could not acquire interpreter */ - -return_ACPI_STATUS (status2); - } +acpi_ex_reacquire_interpreter (); }return_ACPI_STATUS (status);
@@ -119,7 +112,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)acpi_status acpi_ex_system_wait_mutex (acpi_mutex mutex,u16 timeout) {acpi_status status; -acpi_status status2;ACPI_FUNCTION_TRACE (ex_system_wait_mutex);
@@ -132,7 +124,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)/* We must wait, so unlock the interpreter */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter (); status =acpi_os_acquire_mutex (mutex, timeout);
@@ -142,13 +134,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)/* Reacquire the interpreter */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status2)) { - -/* Report fatal error, could not acquire interpreter */ - -return_ACPI_STATUS (status2); - } +acpi_ex_reacquire_interpreter (); }return_ACPI_STATUS (status);
@@ -209,20 +195,18 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)acpi_status acpi_ex_system_do_suspend (acpi_integer how_long) { -acpi_status status; -ACPI_FUNCTION_ENTRY ();/* Since this thread will sleep, we must release the interpreter */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter ();acpi_os_sleep (how_long);/* And now we must get the interpreter again */ - status =acpi_ex_enter_interpreter (); -return (status); +acpi_ex_reacquire_interpreter (); +return (AE_OK ); }/*******************************************************************************
drivers/acpi/executer/exutils.c +87 -21
148 lines not on this page · raw message
drivers/acpi/namespace/nseval.c +2 -9
@@ -154,11 +154,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)* Execute the method via the interpreter. The interpreter is locked * here before calling into the AML parser */ - status =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } - +acpi_ex_enter_interpreter (); status =acpi_ps_execute_method (info);acpi_ex_exit_interpreter (); }else {
@@ -182,10 +178,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)* resolution, we must lock it because we could access an opregion. * The opregion access code assumes that the interpreter is locked. */ - status =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } +acpi_ex_enter_interpreter ();/* Function has a strange interface */
drivers/acpi/namespace/nsinit.c +2 -5
@@ -213,7 +213,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, u32 level, void *context, void **return_value) { acpi_object_type type; -acpi_status status; +acpi_status status =AE_OK ;struct acpi_init_walk_info *info = (struct acpi_init_walk_info *)context; struct acpi_namespace_node *node =
@@ -267,10 +267,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,/* * Must lock the interpreter before executing AML code */ - status =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status)) { -return (status); - } +acpi_ex_enter_interpreter ();/* * Each of these types can contain executable AML code within the
drivers/acpi/namespace/nsxfeval.c +4 -7
@@ -170,7 +170,6 @@ acpi_evaluate_object(acpi_handle handle, struct acpi_buffer *return_buffer) {acpi_status status; -acpi_status status2;struct acpi_evaluate_info *info;acpi_size buffer_space_needed;u32 i;
@@ -329,14 +328,12 @@ acpi_evaluate_object(acpi_handle handle,* Delete the internal return object. NOTE: Interpreter must be * locked to avoid race condition. */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_SUCCESS (status2)) { +acpi_ex_enter_interpreter (); -/* Remove one reference on the return object (should delete it) */ +/* Remove one reference on the return object (should delete it) */ -acpi_ut_remove_reference (info->return_object); -acpi_ex_exit_interpreter (); - } +acpi_ut_remove_reference (info->return_object); +acpi_ex_exit_interpreter (); } cleanup:
include/acpi/acinterp.h +5 -1
@@ -445,10 +445,14 @@ acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,/* * exutils - interpreter/scanner utilities */ -acpi_status acpi_ex_enter_interpreter (void ); +void acpi_ex_enter_interpreter (void );void acpi_ex_exit_interpreter (void ); +void acpi_ex_reacquire_interpreter (void ); + +void acpi_ex_relinquish_interpreter (void ); +void acpi_ex_truncate_for32bit_table (union acpi_operand_object *obj_desc);u8 acpi_ex_acquire_global_lock (u32 rule);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 68/140 ACPICA: Delete stale FADT functions outside tbfadt.c.
From: Bob Moore <[email protected]>
Moved all FADT-related functions to a new file, tbfadt.c. Eliminated the acpi_hw_initialize function - the FADT registers are now validated when the table is loaded.
--- drivers/acpi/hardware/hwacpi.c | 29 ----- drivers/acpi/tables/tbutils.c | 238 +------------------------------------- drivers/acpi/utilities/utinit.c | 95 --------------- drivers/acpi/utilities/utxface.c | 14 --- include/acpi/achware.h | 2 - include/acpi/actables.h | 9 ++ include/acpi/acutils.h | 2 - 7 files changed, 10 insertions(+), 379 deletions(-)
drivers/acpi/hardware/hwacpi.c +0 -29
@@ -49,34 +49,6 @@ ACPI_MODULE_NAME("hwacpi")/****************************************************************************** * -* FUNCTION: acpi_hw_initialize -* -* PARAMETERS: None -* -* RETURN: Status -* -* DESCRIPTION: Initialize and validate the various ACPI registers defined in -* the FADT. -* -******************************************************************************/ -acpi_status acpi_hw_initialize (void ) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (hw_initialize); - -/* Sanity check the FADT for valid values */ - - status =acpi_ut_validate_fadt (); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } - -return_ACPI_STATUS (AE_OK ); -} - -/****************************************************************************** -* * FUNCTION: acpi_hw_set_mode * * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY
@@ -86,7 +58,6 @@ acpi_status acpi_hw_initialize(void)* DESCRIPTION: Transitions the system into the requested mode. * ******************************************************************************/ -acpi_status acpi_hw_set_mode (u32 mode) {
drivers/acpi/tables/tbutils.c +1 -237
272 lines not on this page · raw message
drivers/acpi/utilities/utinit.c +0 -95
103 lines not on this page · raw message
drivers/acpi/utilities/utxface.c +0 -14
@@ -127,20 +127,6 @@ acpi_status acpi_enable_subsystem(u32 flags)ACPI_FUNCTION_TRACE (acpi_enable_subsystem); -/* -* We must initialize the hardware before we can enable ACPI. -* The values from the FADT are validated here. -*/ -if (!(flags &ACPI_NO_HARDWARE_INIT )) { -ACPI_DEBUG_PRINT ((ACPI_DB_EXEC , -"[Init] Initializing ACPI hardware\n" )); - - status =acpi_hw_initialize (); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } - } -/* Enable ACPI mode */ if (!(flags &ACPI_NO_ACPI_ENABLE )) {
include/acpi/achware.h +0 -2
@@ -61,8 +61,6 @@/* * hwacpi - high level functions */ -acpi_status acpi_hw_initialize (void ); -acpi_status acpi_hw_set_mode (u32 mode);u32 acpi_hw_get_mode (void );
include/acpi/actables.h +9 -0
@@ -45,6 +45,11 @@#define __ACTABLES_H__/* +* tbfadt - FADT parse/convert/validate +*/ +void acpi_tb_parse_fadt (acpi_native_uint table_index,u8 flags); + +/* * tbfind - find ACPI table */ acpi_status
@@ -97,6 +102,10 @@ u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length);acpi_status acpi_tb_verify_checksum (struct acpi_table_header *table,u32 length); +void +acpi_tb_install_table (acpi_physical_address address, +u8 flags,char *signature,acpi_native_uint table_index); +acpi_status acpi_tb_parse_root_table (acpi_physical_address rsdp_address,u8 flags);
include/acpi/acutils.h +0 -2
@@ -141,8 +141,6 @@ acpi_status acpi_ut_hardware_initialize(void);void acpi_ut_subsystem_shutdown (void ); -acpi_status acpi_ut_validate_fadt (void ); -/* * utclib - Local implementations of C library functions */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 69/140 ACPICA: Update comments in tbfadt.c
From: Bob Moore <[email protected]>
--- drivers/acpi/tables/tbfadt.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-)
drivers/acpi/tables/tbfadt.c +6 -5
@@ -195,8 +195,8 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)* * DESCRIPTION: Converts all versions of the FADT to a common internal format. * -* NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), and must contain -* a copy of the actual FADT. +* 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. *
@@ -292,9 +292,10 @@ static void acpi_tb_convert_fadt(void)* * PARAMETERS: None * -* RETURN: Status +* RETURN: None * -* DESCRIPTION: Validate various ACPI registers in the FADT +* DESCRIPTION: Validate various ACPI registers in the FADT. For problems, +* issue a message, but no status is returned. * ******************************************************************************/
@@ -375,6 +376,6 @@ static void acpi_tb_validate_fadt(void)static void acpi_tb_fadt_register_error (char *register_name,u32 value) { -ACPI_WARNING ((AE_INFO ,"Invalid FADT value \"%s\" = %X" , +ACPI_WARNING ((AE_INFO ,"Invalid FADT value in field \"%s\" = %X" , register_name, value)); }
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 70/140 ACPICA: add ASF comment
From: Bob Moore <[email protected]>
--- include/acpi/actbl1.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/acpi/actbl1.h +2 -0
@@ -97,6 +97,8 @@ struct acpi_subtable_header {* * ASF - Alert Standard Format table (Signature "ASF!") * +* Conforms to the Alert Standard Format Specification V2.0, 23 April 2003 +* ******************************************************************************/ struct acpi_table_asf {
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 71/140 ACPICA: re-factor table init routines for benefit of iASL
From: Bob Moore <[email protected]>
Required new table init interface since iASL does not use RSDP/XSDT.
--- drivers/acpi/tables/tbxface.c | 30 +++++++++++++++++++++++++----- include/acpi/actables.h | 2 ++ 2 files changed, 27 insertions(+), 5 deletions(-)
drivers/acpi/tables/tbxface.c +25 -5
@@ -54,6 +54,29 @@ static acpi_status acpi_tb_load_namespace(void);/******************************************************************************* * +* FUNCTION: acpi_allocate_root_table +* +* PARAMETERS: initial_table_count - Size of initial_table_array, in number of +* struct acpi_table_desc structures +* +* RETURN: Status +* +* DESCRIPTION: Allocate a root table array. Used by i_aSL compiler and +* acpi_initialize_tables. +* +******************************************************************************/ + +acpi_status acpi_allocate_root_table (u32 initial_table_count) +{ + + acpi_gbl_root_table_list.size = initial_table_count; + acpi_gbl_root_table_list.flags =ACPI_ROOT_ALLOW_RESIZE ; + +return (acpi_tb_resize_root_table_list ()); +} + +/******************************************************************************* +* * FUNCTION: acpi_initialize_tables * * PARAMETERS: initial_table_array - Pointer to an array of pre-allocated
@@ -79,7 +102,7 @@ static acpi_status acpi_tb_load_namespace(void);******************************************************************************/ acpi_status __init -acpi_initialize_tables (struct acpi_table_desc *initial_table_array, +acpi_initialize_tables (struct acpi_table_desc * initial_table_array,u32 initial_table_count,u8 allow_resize) {acpi_physical_address rsdp_address;
@@ -92,10 +115,7 @@ acpi_initialize_tables(struct acpi_table_desc *initial_table_array,* Allocate the table array if requested */ if (!initial_table_array) { - acpi_gbl_root_table_list.size = initial_table_count; - acpi_gbl_root_table_list.flags =ACPI_ROOT_ALLOW_RESIZE ; - - status =acpi_tb_resize_root_table_list (); + status =acpi_allocate_root_table (initial_table_count);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
include/acpi/actables.h +2 -0
@@ -44,6 +44,8 @@#ifndef __ACTABLES_H__#define __ACTABLES_H__ +acpi_status acpi_allocate_root_table (u32 initial_table_count); +/* * tbfadt - FADT parse/convert/validate */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 72/140 ACPICA: Allow type ANY to be the target of the Scope operator.
From: Bob Moore <[email protected]>
Useful during disassembly where the target may be in a different table and thus the type is unknown.
--- drivers/acpi/dispatcher/dswload.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/acpi/dispatcher/dswload.c +2 -0
@@ -196,6 +196,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,* one of the opcodes that actually opens a scope */ switch (node->type) { +case ACPI_TYPE_ANY :case ACPI_TYPE_LOCAL_SCOPE :/* Scope */ case ACPI_TYPE_DEVICE :case ACPI_TYPE_POWER :
@@ -669,6 +670,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,* one of the opcodes that actually opens a scope */ switch (node->type) { +case ACPI_TYPE_ANY :case ACPI_TYPE_LOCAL_SCOPE :/* Scope */ case ACPI_TYPE_DEVICE :case ACPI_TYPE_POWER :
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 73/140 ACPICA: IsResourceTemplate now returns ACPI_STATUS
From: Bob Moore <[email protected]>
to differentiate the failure modes.
--- include/acpi/acdisasm.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
include/acpi/acdisasm.h +3 -1
@@ -140,7 +140,9 @@ extern const char *acpi_gbl_match_ops[];extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];extern struct acpi_dmtable_info acpi_dm_table_info_asf1[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf1a[];extern struct acpi_dmtable_info acpi_dm_table_info_asf2[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf2a[];extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
@@ -322,7 +324,7 @@ acpi_dm_resource_template(struct acpi_op_walk_info *info,union acpi_parse_object *op, u8 * byte_data, u32 byte_count); -u8 acpi_dm_is_resource_template (union acpi_parse_object *op); +acpi_status acpi_dm_is_resource_template (union acpi_parse_object *op);void acpi_dm_indent (u32 level);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 74/140 ACPICA: Add declarations for ASF! sub-tables
From: Bob Moore <[email protected]>
--- include/acpi/actbl1.h | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-)
include/acpi/actbl1.h +22 -3
@@ -148,7 +148,21 @@ struct acpi_asf_alert {u8 deassert_mask;u8 alerts;u8 data_length; -u8 array[1 ]; +}; + +struct acpi_asf_alert_data { +u8 address; +u8 command; +u8 mask; +u8 value; +u8 sensor_type; +u8 type; +u8 offset; +u8 source_type; +u8 severity; +u8 sensor_number; +u8 entity; +u8 instance; };/* 2: ASF Remote Control */
@@ -158,7 +172,13 @@ struct acpi_asf_remote {u8 controls;u8 data_length;u16 reserved2; -u8 array[1 ]; +}; + +struct acpi_asf_control_data { +u8 function; +u8 address; +u8 command; +u8 value; };/* 3: ASF RMCP Boot Options */
@@ -180,7 +200,6 @@ struct acpi_asf_address {struct acpi_asf_header header;u8 eprom_address;u8 devices; -u8 smbus_addresses[1 ]; };/*******************************************************************************
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 75/140 ACPICA: FADT verification is now table driven.
From: Bob Moore <[email protected]>
Disassembler now verifies an input
--- drivers/acpi/tables/tbfadt.c | 289 ++++++++++++++++++++++------------------- drivers/acpi/tables/tbutils.c | 2 +- include/acpi/actables.h | 4 + 3 files changed, 158 insertions(+), 137 deletions(-)
drivers/acpi/tables/tbfadt.c +153 -136
@@ -49,74 +49,92 @@ ACPI_MODULE_NAME("tbfadt")/* Local prototypes */ static void inline -acpi_tb_init_generic_address (struct acpi_generic_address *new_gas_struct, +acpi_tb_init_generic_address (struct acpi_generic_address *generic_address,u8 bit_width,u64 address); -static void acpi_tb_fadt_register_error (char *register_name,u32 value); +/* Table for conversion of FADT to common internal format and FADT validation */ -static void acpi_tb_convert_fadt (void ); - -static void acpi_tb_validate_fadt (void ); - -/* Table used for conversion of FADT to common format */ - -typedef struct acpi_fadt_conversion { +typedef struct acpi_fadt_info { +char *name;u8 target;u8 source;u8 length; +u8 type; -}acpi_fadt_conversion ; +}acpi_fadt_info ; -static struct acpi_fadt_conversion fadt_conversion_table[] = { - {ACPI_FADT_OFFSET (xpm1a_event_block), +#define ACPI_FADT_REQUIRED 1 +#define ACPI_FADT_SEPARATE_LENGTH 2 + +static struct acpi_fadt_info fadt_info_table[] = { + {"Pm1aEventBlock" ,ACPI_FADT_OFFSET (xpm1a_event_block),ACPI_FADT_OFFSET (pm1a_event_block), -ACPI_FADT_OFFSET (pm1_event_length)}, - {ACPI_FADT_OFFSET (xpm1b_event_block), +ACPI_FADT_OFFSET (pm1_event_length),ACPI_FADT_REQUIRED }, + + {"Pm1bEventBlock" ,ACPI_FADT_OFFSET (xpm1b_event_block),ACPI_FADT_OFFSET (pm1b_event_block), -ACPI_FADT_OFFSET (pm1_event_length)}, - {ACPI_FADT_OFFSET (xpm1a_control_block), +ACPI_FADT_OFFSET (pm1_event_length),0 }, + + {"Pm1aControlBlock" ,ACPI_FADT_OFFSET (xpm1a_control_block),ACPI_FADT_OFFSET (pm1a_control_block), -ACPI_FADT_OFFSET (pm1_control_length)}, - {ACPI_FADT_OFFSET (xpm1b_control_block), +ACPI_FADT_OFFSET (pm1_control_length),ACPI_FADT_REQUIRED }, + + {"Pm1bControlBlock" ,ACPI_FADT_OFFSET (xpm1b_control_block),ACPI_FADT_OFFSET (pm1b_control_block), -ACPI_FADT_OFFSET (pm1_control_length)}, - {ACPI_FADT_OFFSET (xpm2_control_block), +ACPI_FADT_OFFSET (pm1_control_length),0 }, + + {"Pm2ControlBlock" ,ACPI_FADT_OFFSET (xpm2_control_block),ACPI_FADT_OFFSET (pm2_control_block), -ACPI_FADT_OFFSET (pm2_control_length)}, - {ACPI_FADT_OFFSET (xpm_timer_block),ACPI_FADT_OFFSET (pm_timer_block), -ACPI_FADT_OFFSET (pm_timer_length)}, - {ACPI_FADT_OFFSET (xgpe0_block),ACPI_FADT_OFFSET (gpe0_block), -ACPI_FADT_OFFSET (gpe0_block_length)}, - {ACPI_FADT_OFFSET (xgpe1_block),ACPI_FADT_OFFSET (gpe1_block), -ACPI_FADT_OFFSET (gpe1_block_length)} +ACPI_FADT_OFFSET (pm2_control_length),ACPI_FADT_SEPARATE_LENGTH }, + + {"PmTimerBlock" ,ACPI_FADT_OFFSET (xpm_timer_block), +ACPI_FADT_OFFSET (pm_timer_block), +ACPI_FADT_OFFSET (pm_timer_length),ACPI_FADT_REQUIRED }, + + {"Gpe0Block" ,ACPI_FADT_OFFSET (xgpe0_block), +ACPI_FADT_OFFSET (gpe0_block), +ACPI_FADT_OFFSET (gpe0_block_length),ACPI_FADT_SEPARATE_LENGTH }, + + {"Gpe1Block" ,ACPI_FADT_OFFSET (xgpe1_block), +ACPI_FADT_OFFSET (gpe1_block), +ACPI_FADT_OFFSET (gpe1_block_length),ACPI_FADT_SEPARATE_LENGTH } }; -#define ACPI_FADT_CONVERSION_ENTRIES (sizeof (fadt_conversion_table) / sizeof (struct acpi_fadt_conversion)) +#define ACPI_FADT_INFO_ENTRIES (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info))/******************************************************************************* * * FUNCTION: acpi_tb_init_generic_address * -* PARAMETERS: new_gas_struct - GAS struct to be initialized +* PARAMETERS: generic_address - GAS struct to be initialized * bit_width - Width of this register * Address - Address of the register * * RETURN: None * -* DESCRIPTION: Initialize a GAS structure. +* DESCRIPTION: Initialize a Generic Address Structure (GAS) +* See the ACPI specification for a full description and +* definition of this structure. * ******************************************************************************/ static void inline -acpi_tb_init_generic_address (struct acpi_generic_address *new_gas_struct, +acpi_tb_init_generic_address (struct acpi_generic_address *generic_address,u8 bit_width,u64 address) { -ACPI_MOVE_64_TO_64 (&new_gas_struct->address, &address); - new_gas_struct->space_id =ACPI_ADR_SPACE_SYSTEM_IO ; - new_gas_struct->bit_width = bit_width; - new_gas_struct->bit_offset =0 ; - new_gas_struct->access_width =0 ; +/* +* The 64-bit Address field is non-aligned in the byte packed +* GAS struct. +*/ +ACPI_MOVE_64_TO_64 (&generic_address->address, &address); + +/* All other fields are byte-wide */ + + generic_address->space_id =ACPI_ADR_SPACE_SYSTEM_IO ; + generic_address->bit_width = bit_width; + generic_address->bit_offset =0 ; + generic_address->access_width =0 ; }/*******************************************************************************
@@ -139,8 +157,8 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)struct acpi_table_header *table;/* -* Special case for the FADT because of multiple versions and the fact -* that it contains pointers to both the DSDT and FACS tables. +* The FADT has multiple versions with different lengths, +* and it contains pointers to both the DSDT and FACS tables. * * Get a local copy of the FADT and convert it to a common format * Map entire FADT, assumed to be smaller than one page.
@@ -160,29 +178,41 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)*/ (void )acpi_tb_verify_checksum (table, length); -/* Copy the entire FADT locally */ +/* +* If the FADT is larger than what we know about, we have a problem. +* Truncate the table, but make some noise. +*/ +if (length >sizeof (struct acpi_table_fadt )) { +ACPI_WARNING ((AE_INFO , +"FADT (revision %u) is too large, truncating length 0x%X to 0x%X" , + table->revision, length, +sizeof (struct acpi_table_fadt ))); + } -ACPI_MEMSET (&acpi_gbl_FADT,0 ,sizeof (struct acpi_table_fadt )); +/* Copy the entire FADT locally. Zero first for tb_convert_fadt */ +ACPI_MEMSET (&acpi_gbl_FADT,0 ,sizeof (struct acpi_table_fadt ));ACPI_MEMCPY (&acpi_gbl_FADT, table,ACPI_MIN (length,sizeof (struct acpi_table_fadt ))); -acpi_os_unmap_memory (table, length); -/* Convert local FADT to the common internal format */ +/* All done with the real FADT, unmap it */ + +acpi_os_unmap_memory (table, length); +/* +* 1) Convert the local copy of the FADT to the common internal format +* 2) Validate some of the important values within the FADT +*/ acpi_tb_convert_fadt (); +acpi_tb_validate_fadt (&acpi_gbl_FADT); -/* Extract the DSDT and FACS tables from the FADT */ +/* 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_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xfacs, flags,ACPI_SIG_FACS ,ACPI_TABLE_INDEX_FACS ); - -/* Validate important FADT values */ - -acpi_tb_validate_fadt (); }/*******************************************************************************
@@ -194,6 +224,7 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)* RETURN: None * * DESCRIPTION: Converts all versions of the FADT to a common internal format. +* -> Expand all 32-bit addresses to 64-bit. * * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), * and must contain a copy of the actual FADT.
@@ -213,13 +244,17 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)* ******************************************************************************/ -static void acpi_tb_convert_fadt (void ) +void acpi_tb_convert_fadt (void ) {u8 pm1_register_length;struct acpi_generic_address *target;acpi_native_uint i; -/* Expand the FACS and DSDT addresses as necessary */ +/* Update the local FADT table header length */ + + acpi_gbl_FADT.header.length =sizeof (struct acpi_table_fadt ); + +/* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */ if (!acpi_gbl_FADT.Xfacs) { acpi_gbl_FADT.Xfacs = (u64 ) acpi_gbl_FADT.facs;
@@ -233,10 +268,10 @@ static void acpi_tb_convert_fadt(void)* Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address * structures as necessary. */ -for (i =0 ; i <ACPI_FADT_CONVERSION_ENTRIES ; i++) { +for (i =0 ; i <ACPI_FADT_INFO_ENTRIES ; i++) { target = ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, - fadt_conversion_table[i].target); + fadt_info_table[i].target);/* Expand only if the X target is null */
@@ -244,11 +279,11 @@ static void acpi_tb_convert_fadt(void)acpi_tb_init_generic_address (target, *ACPI_ADD_PTR (u8, &acpi_gbl_FADT, - fadt_conversion_table + fadt_info_table [i].length), (u64) *ACPI_ADD_PTR (u32, &acpi_gbl_FADT, - fadt_conversion_table + fadt_info_table [i]. source)); }
@@ -265,14 +300,14 @@ static void acpi_tb_convert_fadt(void)*/ pm1_register_length = (u8 )ACPI_DIV_2 (acpi_gbl_FADT.pm1_event_length); -/* PM1A is required */ +/* The PM1A register block is required */ acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, pm1_register_length, (acpi_gbl_FADT.xpm1a_event_block.address + pm1_register_length)); -/* PM1B is optional; leave null if not present */ +/* The PM1B register block is optional, ignore if not present */ if (acpi_gbl_FADT.xpm1b_event_block.address) { acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
@@ -280,102 +315,84 @@ static void acpi_tb_convert_fadt(void) (acpi_gbl_FADT.xpm1b_event_block. address + pm1_register_length)); } - -/* Global FADT is the new common V2.0 FADT */ - - acpi_gbl_FADT.header.length =sizeof (struct acpi_table_fadt ); }/****************************************************************************** * * FUNCTION: acpi_tb_validate_fadt * -* PARAMETERS: None +* PARAMETERS: Table - Pointer to the FADT to be validated * * RETURN: None * -* DESCRIPTION: Validate various ACPI registers in the FADT. For problems, -* issue a message, but no status is returned. +* DESCRIPTION: Validate various important fields within the FADT. If a problem +* is found, issue a message, but no status is returned. +* Used by both the table manager and the disassembler. +* +* Possible additional checks: +* (acpi_gbl_FADT.pm1_event_length >= 4) +* (acpi_gbl_FADT.pm1_control_length >= 2) +* (acpi_gbl_FADT.pm_timer_length >= 4) +* Gpe block lengths must be multiple of 2 * ******************************************************************************/ -static void acpi_tb_validate_fadt (void ) +void acpi_tb_validate_fadt (struct acpi_table_fadt *table) { +u32 *address32; +struct acpi_generic_address *address64; +u8 length; +acpi_native_uint i; -/* These length fields have a minimum value */ - -if (acpi_gbl_FADT.pm1_event_length <4 ) { -acpi_tb_fadt_register_error ("Pm1EventLength" , - (u32 ) acpi_gbl_FADT. - pm1_event_length); - } - -if (acpi_gbl_FADT.pm_timer_length <4 ) { -acpi_tb_fadt_register_error ("PmTimerLength" , - (u32 ) acpi_gbl_FADT. - pm_timer_length); - } - -/* These length and address fields must be non-zero */ - -if (!acpi_gbl_FADT.pm1_control_length) { -acpi_tb_fadt_register_error ("Pm1ControlLength" ,0 ); - } - -if (!acpi_gbl_FADT.xpm1a_event_block.address) { -acpi_tb_fadt_register_error ("XPm1aEventBlock.Address" ,0 ); - } - -if (!acpi_gbl_FADT.xpm1a_control_block.address) { -acpi_tb_fadt_register_error ("XPm1aControlBlock.Address" ,0 ); - } - -if (!acpi_gbl_FADT.xpm_timer_block.address) { -acpi_tb_fadt_register_error ("XPmTimerBlock.Address" ,0 ); - } - -/* If PM2 block is present, must have non-zero length */ - -if ((acpi_gbl_FADT.xpm2_control_block.address && - !acpi_gbl_FADT.pm2_control_length)) { -acpi_tb_fadt_register_error ("Pm2ControlLength" , - (u32 ) acpi_gbl_FADT. - pm2_control_length); - } - -/* Length of any valid GPE blocks must be a multiple of 2 */ +/* Examine all of the 64-bit extended address fields (X fields) */ + +for (i =0 ; i <ACPI_FADT_INFO_ENTRIES ; i++) { + +/* Generate pointers to the 32-bit and 64-bit addresses and get the length */ + + address64 = + ACPI_ADD_PTR(struct acpi_generic_address, table, + fadt_info_table[i].target); + address32 =ACPI_ADD_PTR (u32, table, fadt_info_table[i].source); + length = *ACPI_ADD_PTR (u8, table, fadt_info_table[i].length); + +if (fadt_info_table[i].type &ACPI_FADT_REQUIRED ) { +/* +* Field is required (Pm1a_event, Pm1a_control, pm_timer). +* Both the address and length must be non-zero. +*/ +if (!address64->address || !length) { +ACPI_ERROR ((AE_INFO , +"Required field \"%s\" has zero address and/or length: %8.8X%8.8X/%X" , + fadt_info_table[i].name, +ACPI_FORMAT_UINT64 (address64-> + address), + length)); + } + }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. +*/ +if ((address64->address && !length) + || (!address64->address && length)) { +ACPI_WARNING ((AE_INFO , +"Optional field \"%s\" has zero address or length: %8.8X%8.8X/%X" , + fadt_info_table[i].name, +ACPI_FORMAT_UINT64 (address64-> + address), + length)); + } + } -if (acpi_gbl_FADT.xgpe0_block.address && - (acpi_gbl_FADT.gpe0_block_length &1 )) { -acpi_tb_fadt_register_error ("Gpe0BlockLength" , - (u32 ) acpi_gbl_FADT. - gpe0_block_length); - } +/* If both 32- and 64-bit addresses are valid (non-zero), they must match */ -if (acpi_gbl_FADT.xgpe1_block.address && - (acpi_gbl_FADT.gpe1_block_length &1 )) { -acpi_tb_fadt_register_error ("Gpe1BlockLength" , - (u32 ) acpi_gbl_FADT. - gpe1_block_length); +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" , + fadt_info_table[i].name, *address32, +ACPI_FORMAT_UINT64 (address64->address))); + } } } - -/******************************************************************************* -* -* FUNCTION: acpi_tb_fadt_register_error -* -* PARAMETERS: register_name - Pointer to string identifying register -* Value - Actual register contents value -* -* RETURN: None -* -* DESCRIPTION: Display FADT warning message -* -******************************************************************************/ - -static void acpi_tb_fadt_register_error (char *register_name,u32 value) -{ - -ACPI_WARNING ((AE_INFO ,"Invalid FADT value in field \"%s\" = %X" , - register_name, value)); -}
drivers/acpi/tables/tbutils.c +1 -1
@@ -280,7 +280,7 @@ acpi_tb_get_root_table_entry(u8 * table_entry,#if ACPI_MACHINE_WIDTH ==32 if (address64 >ACPI_UINT32_MAX ) { -/* Will truncate 64-bit address to 32 bits */ +/* 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",
include/acpi/actables.h +4 -0
@@ -51,6 +51,10 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count);*/ void acpi_tb_parse_fadt (acpi_native_uint table_index,u8 flags); +void acpi_tb_convert_fadt (void ); + +void acpi_tb_validate_fadt (struct acpi_table_fadt *table); +/* * tbfind - find ACPI table */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 76/140 ACPICA: Report error if method creates 2 objects with the same name
From: Bob Moore <[email protected]>
Fixed a regression where an error was no
longer emitted if a control method attempts to create 2 objects of the same name. This previously and now returns AE_ALREADY_EXISTS. When this exception occurs, it invokes the mechanism that will dynamically serialize the control method to possible prevent future errors. (BZ 440)
--- drivers/acpi/dispatcher/dswload.c | 15 ++++++++++++--- drivers/acpi/parser/psparse.c | 5 +++++ 2 files changed, 17 insertions(+), 3 deletions(-)
drivers/acpi/dispatcher/dswload.c +12 -3
@@ -547,6 +547,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,acpi_status status;acpi_object_type object_type;char *buffer_ptr; +u32 flags;ACPI_FUNCTION_TRACE (ds_load2_begin_op);
@@ -752,12 +753,20 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,break ; } -/* Add new entry into namespace */ + flags =ACPI_NS_NO_UPSEARCH ; +if (walk_state->pass_number ==3 ) { + +/* Execution mode, node cannot already exist */ + + flags |=ACPI_NS_ERROR_IF_FOUND ; + } + +/* Add new entry or lookup existing entry */ status =acpi_ns_lookup (walk_state->scope_info, buffer_ptr, - object_type,ACPI_IMODE_LOAD_PASS2 , -ACPI_NS_NO_UPSEARCH , walk_state, &(node)); + object_type,ACPI_IMODE_LOAD_PASS2 , flags, + walk_state, &node);break ; }
drivers/acpi/parser/psparse.c +5 -0
@@ -540,6 +540,11 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)if ((status ==AE_ALREADY_EXISTS ) && (!walk_state->method_desc->method.mutex)) { +ACPI_INFO ((AE_INFO , +"Marking method %4.4s as Serialized" , + walk_state->method_node->name. + ascii)); +/* * Method tried to create an object twice. The probable cause is * that the method cannot handle reentrancy.
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 77/140 ACPICA: New common routine for creating and verifying a local FADT.
From: Bob Moore <[email protected]>
--- drivers/acpi/tables/tbfadt.c | 71 ++++++++++++++++++++++++++++++------------ include/acpi/actables.h | 4 +-- 2 files changed, 52 insertions(+), 23 deletions(-)
drivers/acpi/tables/tbfadt.c +51 -20
@@ -52,6 +52,10 @@ static void inline acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, u8 bit_width, u64 address); +static void acpi_tb_convert_fadt (void ); + +static void acpi_tb_validate_fadt (void ); +/* Table for conversion of FADT to common internal format and FADT validation */ typedef struct acpi_fadt_info {
@@ -178,13 +182,47 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)*/ (void )acpi_tb_verify_checksum (table, length); +/* Obtain a local copy of the FADT in common ACPI 2.0+ format */ + +acpi_tb_create_local_fadt (table, length); + +/* All done with the real FADT, unmap it */ + +acpi_os_unmap_memory (table, length); + +/* 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_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xfacs, + flags,ACPI_SIG_FACS ,ACPI_TABLE_INDEX_FACS ); +} + +/******************************************************************************* +* +* FUNCTION: acpi_tb_create_local_fadt +* +* PARAMETERS: Table - Pointer to BIOS FADT +* Length - Length of the table +* +* RETURN: None +* +* DESCRIPTION: Get a local copy of the FADT and convert it to a common format. +* Performs validation on some important FADT fields. +* +******************************************************************************/ + +void acpi_tb_create_local_fadt (struct acpi_table_header *table,u32 length) +{ +/* -* If the FADT is larger than what we know about, we have a problem. +* Check if the FADT is larger than what we know about (ACPI 2.0 version). * Truncate the table, but make some noise. */ if (length >sizeof (struct acpi_table_fadt )) {ACPI_WARNING ((AE_INFO , -"FADT (revision %u) is too large, truncating length 0x%X to 0x%X" , +"FADT (revision %u) is longer than ACPI 2.0 version, truncating length 0x%X to 0x%X" , table->revision, length,sizeof (struct acpi_table_fadt ))); }
@@ -192,27 +230,16 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)/* Copy the entire FADT locally. Zero first for tb_convert_fadt */ ACPI_MEMSET (&acpi_gbl_FADT,0 ,sizeof (struct acpi_table_fadt )); +ACPI_MEMCPY (&acpi_gbl_FADT, table,ACPI_MIN (length,sizeof (struct acpi_table_fadt ))); -/* All done with the real FADT, unmap it */ - -acpi_os_unmap_memory (table, length); -/* * 1) Convert the local copy of the FADT to the common internal format * 2) Validate some of the important values within the FADT */ acpi_tb_convert_fadt (); -acpi_tb_validate_fadt (&acpi_gbl_FADT); - -/* 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_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xfacs, - flags,ACPI_SIG_FACS ,ACPI_TABLE_INDEX_FACS ); +acpi_tb_validate_fadt (); }/*******************************************************************************
@@ -244,7 +271,7 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)* ******************************************************************************/ -void acpi_tb_convert_fadt (void ) +static void acpi_tb_convert_fadt (void ) {u8 pm1_register_length;struct acpi_generic_address *target;
@@ -337,7 +364,7 @@ void acpi_tb_convert_fadt(void)* ******************************************************************************/ -void acpi_tb_validate_fadt (struct acpi_table_fadt *table) +static void acpi_tb_validate_fadt (void ) {u32 *address32;struct acpi_generic_address *address64;
@@ -351,10 +378,14 @@ void acpi_tb_validate_fadt(struct acpi_table_fadt *table)/* Generate pointers to the 32-bit and 64-bit addresses and get the length */ address64 = - ACPI_ADD_PTR(struct acpi_generic_address, table, + ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, fadt_info_table[i].target); - address32 =ACPI_ADD_PTR (u32, table, fadt_info_table[i].source); - length = *ACPI_ADD_PTR (u8, table, fadt_info_table[i].length); + address32 = +ACPI_ADD_PTR (u32, &acpi_gbl_FADT, + fadt_info_table[i].source); + length = + *ACPI_ADD_PTR (u8, &acpi_gbl_FADT, + fadt_info_table[i].length);if (fadt_info_table[i].type &ACPI_FADT_REQUIRED ) {/*
include/acpi/actables.h +1 -3
@@ -51,9 +51,7 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count);*/ void acpi_tb_parse_fadt (acpi_native_uint table_index,u8 flags); -void acpi_tb_convert_fadt (void ); - -void acpi_tb_validate_fadt (struct acpi_table_fadt *table); +void acpi_tb_create_local_fadt (struct acpi_table_header *table,u32 length);/* * tbfind - find ACPI table
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 78/140 ACPICA: Fix memory leak in table load error path
From: Bob Moore <[email protected]>
--- drivers/acpi/executer/exconfig.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/executer/exconfig.c +1 -1
@@ -413,7 +413,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,*/ status =acpi_tb_add_table (table_ptr, &table_index);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto cleanup; } status =
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 79/140 ACPICA: Fix trace output name and whitespace
From: Bob Moore <[email protected]>
--- drivers/acpi/executer/exutils.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/acpi/executer/exutils.c +1 -3
@@ -88,7 +88,7 @@ void acpi_ex_enter_interpreter(void) {acpi_status status; -ACPI_FUNCTION_TRACE (ex_reacquire_interpreter); +ACPI_FUNCTION_TRACE (ex_enter_interpreter); status =acpi_ut_acquire_mutex (ACPI_MTX_INTERPRETER );if (ACPI_FAILURE (status)) {
@@ -116,7 +116,6 @@ void acpi_ex_enter_interpreter(void)void acpi_ex_reacquire_interpreter (void ) { -ACPI_FUNCTION_TRACE (ex_reacquire_interpreter);/*
@@ -185,7 +184,6 @@ void acpi_ex_exit_interpreter(void)void acpi_ex_relinquish_interpreter (void ) { -ACPI_FUNCTION_TRACE (ex_relinquish_interpreter);/*
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 80/140 ACPICA: Update version to 20060912
From: Bob Moore <[email protected]>
--- include/acpi/acconfig.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060831 +#define ACPI_CA_VERSION 0x20060912/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 81/140 ACPICA: Add full table name to disassembler output
From: Bob Moore <[email protected]>
--- include/acpi/acdisasm.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/acpi/acdisasm.h +2 -0
@@ -101,6 +101,7 @@ typedef const struct acpi_dmtable_info {#define ACPI_DMT_MADT 24#define ACPI_DMT_SRAT 25#define ACPI_DMT_EXIT 26 +#define ACPI_DMT_SIG 27typedef void (*ACPI_TABLE_HANDLER ) (struct acpi_table_header * table);
@@ -109,6 +110,7 @@ struct acpi_dmtable_data {char *signature;struct acpi_dmtable_info *table_info;ACPI_TABLE_HANDLER table_handler; +char *name; };struct acpi_op_walk_info {
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 82/140 ACPICA: Fix for Global Lock semaphore.
From: Bob Moore <[email protected]>
Fixed a problem with the Global Lock where the lock could appear to be obtained before it is actually obtained, semaphore created with one unit.
--- drivers/acpi/namespace/nsaccess.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/namespace/nsaccess.c +1 -1
@@ -214,7 +214,7 @@ acpi_status acpi_ns_root_initialize(void)/* Create additional counting semaphore for global lock */ status = -acpi_os_create_semaphore (1 ,1 , +acpi_os_create_semaphore (1 ,0 , &acpi_gbl_global_lock_semaphore);if (ACPI_FAILURE (status)) { acpi_ut_remove_reference
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 83/140 ACPICA: Remove obsolete Flags parameter.
From: Bob Moore <[email protected]>
Remove flags parameter for acpi_{get,set}_register(). It is no longer necessary now that these functions use a spinlock for mutual exclusion.
--- drivers/acpi/events/evevent.c | 8 +++----- drivers/acpi/events/evmisc.c | 2 +- drivers/acpi/events/evxfevnt.c | 12 ++++++------ drivers/acpi/hardware/hwacpi.c | 3 +-- drivers/acpi/hardware/hwregs.c | 18 +++++------------- drivers/acpi/hardware/hwsleep.c | 22 ++++++++-------------- drivers/acpi/pci_link.c | 2 +- drivers/acpi/processor_idle.c | 21 +++++++-------------- include/acpi/achware.h | 2 +- include/acpi/acpixf.h | 4 ++-- 10 files changed, 35 insertions(+), 59 deletions(-)
drivers/acpi/events/evevent.c +3 -5
@@ -204,8 +204,7 @@ 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_MTX_LOCK ); + enable_register_id,0 );if (ACPI_FAILURE (status)) {return (status); }
@@ -291,7 +290,7 @@ 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 ,ACPI_MTX_DO_NOT_LOCK ); + status_register_id,1 );/* * Make sure we've got a handler. If not, report an error.
@@ -299,8 +298,7 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)*/ if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { (void )acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,0 , -ACPI_MTX_DO_NOT_LOCK ); + enable_register_id,0 ); ACPI_ERROR((AE_INFO, "No installed handler for fixed event [%08X]",
drivers/acpi/events/evmisc.c +1 -1
@@ -493,7 +493,7 @@ acpi_status acpi_ev_release_global_lock(void)if (pending) { status =acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE , -1 ,ACPI_MTX_LOCK ); +1 ); } ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
drivers/acpi/events/evxfevnt.c +6 -6
@@ -157,7 +157,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags)*/ status =acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,1 ,ACPI_MTX_LOCK ); + enable_register_id,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -166,7 +166,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags) status =acpi_get_register (acpi_gbl_fixed_event_info[event]. - enable_register_id, &value,ACPI_MTX_LOCK ); + enable_register_id, &value);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -356,14 +356,14 @@ acpi_status acpi_disable_event(u32 event, u32 flags)*/ status =acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,0 ,ACPI_MTX_LOCK ); + 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_MTX_LOCK ); + enable_register_id, &value);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -409,7 +409,7 @@ acpi_status acpi_clear_event(u32 event)*/ status =acpi_set_register (acpi_gbl_fixed_event_info[event]. - status_register_id,1 ,ACPI_MTX_LOCK ); + status_register_id,1 );return_ACPI_STATUS (status); }
@@ -498,7 +498,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) status =acpi_get_register (acpi_gbl_fixed_event_info[event]. - status_register_id, event_status,ACPI_MTX_LOCK ); + status_register_id, event_status);return_ACPI_STATUS (status); }
drivers/acpi/hardware/hwacpi.c +1 -2
@@ -171,8 +171,7 @@ u32 acpi_hw_get_mode(void)return_UINT32 (ACPI_SYS_MODE_ACPI ); } - status = -acpi_get_register (ACPI_BITREG_SCI_ENABLE , &value,ACPI_MTX_LOCK ); + status =acpi_get_register (ACPI_BITREG_SCI_ENABLE , &value);if (ACPI_FAILURE (status)) {return_UINT32 (ACPI_SYS_MODE_LEGACY ); }
drivers/acpi/hardware/hwregs.c +5 -13
@@ -54,17 +54,15 @@ ACPI_MODULE_NAME("hwregs")* * FUNCTION: acpi_hw_clear_acpi_status * -* PARAMETERS: Flags - Lock the hardware or not +* PARAMETERS: None * -* RETURN: none +* RETURN: None * * DESCRIPTION: Clears all fixed and general purpose status bits * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * -* NOTE: TBD: Flags parameter is obsolete, to be removed -* ******************************************************************************/ -acpi_status acpi_hw_clear_acpi_status (u32 flags) +acpi_status acpi_hw_clear_acpi_status (void ) {acpi_status status;acpi_cpu_flags lock_flags =0 ;
@@ -253,18 +251,15 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)* * PARAMETERS: register_id - ID of ACPI bit_register to access * return_value - Value that was read from the register -* Flags - Lock the hardware or not * * RETURN: Status and the value read from specified Register. Value * returned is normalized to bit0 (is shifted all the way right) * * DESCRIPTION: ACPI bit_register read function. * -* NOTE: TBD: Flags parameter is obsolete, to be removed -* ******************************************************************************/ -acpi_status acpi_get_register (u32 register_id,u32 * return_value,u32 flags) +acpi_status acpi_get_register (u32 register_id,u32 * return_value) {u32 register_value =0 ;struct acpi_bit_register_info *bit_reg_info;
@@ -312,16 +307,13 @@ ACPI_EXPORT_SYMBOL(acpi_get_register)* PARAMETERS: register_id - ID of ACPI bit_register to access * Value - (only used on write) value to write to the * Register, NOT pre-normalized to the bit pos -* Flags - Lock the hardware or not * * RETURN: Status * * DESCRIPTION: ACPI Bit Register write function. * -* NOTE: TBD: Flags parameter is obsolete, to be removed -* ******************************************************************************/ -acpi_status acpi_set_register (u32 register_id,u32 value,u32 flags) +acpi_status acpi_set_register (u32 register_id,u32 value) {u32 register_value =0 ;struct acpi_bit_register_info *bit_reg_info;
drivers/acpi/hardware/hwsleep.c +8 -14
@@ -277,15 +277,14 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)/* Clear wake status */ - status = -acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 ,ACPI_MTX_DO_NOT_LOCK ); + status =acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }/* Clear all fixed and general purpose status bits */ - status =acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK ); + status =acpi_hw_clear_acpi_status ();if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -398,8 +397,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, &in_value, - ACPI_MTX_DO_NOT_LOCK); + status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }
@@ -432,13 +430,12 @@ 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 ,ACPI_MTX_DO_NOT_LOCK ); + status =acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); } - status =acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK ); + status =acpi_hw_clear_acpi_status ();if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -465,8 +462,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) do { acpi_os_stall(1000); - status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value, - ACPI_MTX_DO_NOT_LOCK); + status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }
@@ -599,13 +595,11 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) (void )acpi_set_register (acpi_gbl_fixed_event_info - [ACPI_EVENT_POWER_BUTTON ].enable_register_id,1 , -ACPI_MTX_DO_NOT_LOCK ); + [ACPI_EVENT_POWER_BUTTON ].enable_register_id,1 ); (void )acpi_set_register (acpi_gbl_fixed_event_info - [ACPI_EVENT_POWER_BUTTON ].status_register_id,1 , -ACPI_MTX_DO_NOT_LOCK ); + [ACPI_EVENT_POWER_BUTTON ].status_register_id,1 ); arg.integer.value =ACPI_SST_WORKING ; status =acpi_evaluate_object (NULL ,METHOD_NAME__SST , &arg_list,NULL );
drivers/acpi/pci_link.c +1 -1
@@ -785,7 +785,7 @@ static int irqrouter_resume(struct sys_device *dev)/* Make sure SCI is enabled again (Apple firmware bug?) */ -acpi_set_register (ACPI_BITREG_SCI_ENABLE ,1 ,ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_SCI_ENABLE ,1 );list_for_each (node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node);
drivers/acpi/processor_idle.c +7 -14
@@ -187,8 +187,7 @@ acpi_processor_power_activate(struct acpi_processor *pr,case ACPI_STATE_C3 :/* Disable bus master reload */ if (new->type !=ACPI_STATE_C3 && pr->flags.bm_check) -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 );break ; } }
@@ -198,8 +197,7 @@ acpi_processor_power_activate(struct acpi_processor *pr,case ACPI_STATE_C3 :/* Enable bus master reload */ if (old->type !=ACPI_STATE_C3 && pr->flags.bm_check) -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,1 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,1 );break ; }
@@ -291,12 +289,10 @@ static void acpi_processor_idle(void) pr->power.bm_activity <<= diff; -acpi_get_register (ACPI_BITREG_BUS_MASTER_STATUS , - &bm_status,ACPI_MTX_DO_NOT_LOCK ); +acpi_get_register (ACPI_BITREG_BUS_MASTER_STATUS , &bm_status);if (bm_status) { pr->power.bm_activity |=0x1 ; -acpi_set_register (ACPI_BITREG_BUS_MASTER_STATUS , -1 ,ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_STATUS ,1 ); }/* * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect
@@ -411,8 +407,7 @@ static void acpi_processor_idle(void)* All CPUs are trying to go to C3 * Disable bus master arbitration */ -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,1 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_ARB_DISABLE ,1 ); } }else {/* SMP with no shared cache... Invalidate cache */
@@ -428,8 +423,7 @@ static void acpi_processor_idle(void)if (pr->flags.bm_check) {/* Enable bus master arbitration */ atomic_dec (&c3_cpu_count); -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 ); }#ifdef CONFIG_GENERIC_TIME
@@ -890,8 +884,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, " for C3 to be enabled on SMP systems\n"));return ; } -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD , -0 ,ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 ); }/*
include/acpi/achware.h +1 -1
@@ -82,7 +82,7 @@ acpi_hw_low_level_read(u32 width,acpi_status acpi_hw_low_level_write (u32 width,u32 value,struct acpi_generic_address *reg); -acpi_status acpi_hw_clear_acpi_status (u32 flags); +acpi_status acpi_hw_clear_acpi_status (void );/* * hwgpe - GPE support
include/acpi/acpixf.h +2 -2
@@ -312,9 +312,9 @@ acpi_resource_to_address64(struct acpi_resource *resource,/* * Hardware (ACPI device) interfaces */ -acpi_status acpi_get_register (u32 register_id,u32 * return_value,u32 flags); +acpi_status acpi_get_register (u32 register_id,u32 * return_value); -acpi_status acpi_set_register (u32 register_id,u32 value,u32 flags); +acpi_status acpi_set_register (u32 register_id,u32 value);acpi_status acpi_set_firmware_waking_vector (acpi_physical_address physical_address);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 84/140 ACPICA: Use faster ByIndex interface to get FACS
From: Bob Moore <[email protected]>
--- drivers/acpi/events/evmisc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/events/evmisc.c +2 -2
@@ -347,8 +347,8 @@ acpi_status acpi_ev_init_global_lock_handler(void)ACPI_FUNCTION_TRACE (ev_init_global_lock_handler); status = -acpi_get_table (ACPI_SIG_FACS ,0 , - (struct acpi_table_header **)&facs); +acpi_get_table_by_index (ACPI_TABLE_INDEX_FACS , + (struct acpi_table_header **)&facs);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 85/140 ACPICA: On AML mutex force-release, set depth to zero (was 1).
From: Bob Moore <[email protected]>
--- drivers/acpi/executer/exmutex.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/acpi/executer/exmutex.c +7 -1
@@ -329,6 +329,12 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,* * DESCRIPTION: Release all mutexes held by this thread * +* NOTE: This function is called as the thread is exiting the interpreter. +* Mutexes are not released when an individual control method is exited, but +* only when the parent thread actually exits the interpreter. This allows one +* method to acquire a mutex, and a different method to release it, as long as +* this is performed underneath a single parent control method. +* ******************************************************************************/ void acpi_ex_release_all_mutexes (struct acpi_thread_state *thread)
@@ -346,7 +352,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) obj_desc->mutex.prev =NULL ; obj_desc->mutex.next =NULL ; - obj_desc->mutex.acquisition_depth =1 ; + obj_desc->mutex.acquisition_depth =0 ;/* Release the mutex, special case for Global Lock */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 86/140 ACPICA: Update interpreter error paths to always report the error
From: Bob Moore <[email protected]>
--- drivers/acpi/dispatcher/dswexec.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/acpi/dispatcher/dswexec.c +7 -3
@@ -219,7 +219,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,if (!op) { status =acpi_ds_load2_begin_op (walk_state, out_op);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto error_exit; } op = *out_op;
@@ -238,7 +238,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, status =acpi_ds_scope_stack_pop (walk_state);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto error_exit; } } }
@@ -287,7 +287,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, status =acpi_ds_result_stack_push (walk_state);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto error_exit; } status =acpi_ds_exec_begin_control_op (walk_state, op);
@@ -328,6 +328,10 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,/* Nothing to do here during method execution */ return_ACPI_STATUS (status); + + error_exit: + status =acpi_ds_method_error (status, walk_state); +return_ACPI_STATUS (status); }/*****************************************************************************
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 87/140 ACPICA: Fix for possible memory leak and fault.
From: Fiodor Suietov <[email protected]>
Fixed a possible memory leak and fault in acpi_ex_resolve_object_to_value() during a read from a buffer or region field. (BZ 458)
--- drivers/acpi/executer/exresolv.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/acpi/executer/exresolv.c +5 -3
@@ -141,7 +141,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,acpi_status status =AE_OK ;union acpi_operand_object *stack_desc;void *temp_node; -union acpi_operand_object *obj_desc; +union acpi_operand_object *obj_desc =NULL ;u16 opcode;ACPI_FUNCTION_TRACE (ex_resolve_object_to_value);
@@ -299,8 +299,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, status =acpi_ds_get_package_arguments (stack_desc);break ; -/* These cases may never happen here, but just in case.. */ -case ACPI_TYPE_BUFFER_FIELD :case ACPI_TYPE_LOCAL_REGION_FIELD :case ACPI_TYPE_LOCAL_BANK_FIELD :
@@ -314,6 +312,10 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, status =acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc); + +/* Remove a reference to the original operand, then override */ + +acpi_ut_remove_reference (*stack_ptr); *stack_ptr = (void *)obj_desc;break ;
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 88/140 ACPICA: Add new subsystem state bit that is set after SubsystemInitialize is called
From: Bob Moore <[email protected]>
--- drivers/acpi/utilities/utxface.c | 1 + include/acpi/actypes.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/acpi/utilities/utxface.c +1 -0
@@ -67,6 +67,7 @@ acpi_status acpi_initialize_subsystem(void)ACPI_FUNCTION_TRACE (acpi_initialize_subsystem); + acpi_gbl_startup_flags =ACPI_SUBSYSTEM_INITIALIZE ;ACPI_DEBUG_EXEC (acpi_ut_init_stack_ptr_trace ());/* Initialize the OS-Dependent layer */
include/acpi/actypes.h +2 -1
@@ -412,7 +412,8 @@ typedef u64 acpi_integer;/* * Initialization state */ -#define ACPI_INITIALIZED_OK 0x01 +#define ACPI_SUBSYSTEM_INITIALIZE 0x01 +#define ACPI_INITIALIZED_OK 0x02/* * Power state values
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 89/140 ACPICA: Update version to 20060927
From: Bob Moore <[email protected]>
--- include/acpi/acconfig.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060912 +#define ACPI_CA_VERSION 0x20060927/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 90/140 ACPICA: Restructured module into multiple functions.
From: Mikhail Kouzmich <[email protected]>
Restructured the AML ParseLoop function, breaking it into several subfunctions in order to reduce CPU stack use and improve maintainability
--- drivers/acpi/parser/psloop.c | 1406 +++++++++++++++++++++++------------------- include/acpi/acexcep.h | 8 +- 2 files changed, 789 insertions(+), 625 deletions(-)
drivers/acpi/parser/psloop.c +783 -623
@@ -42,12 +42,11 @@*/ /* -* Parse the AML and build an operation tree as most interpreters, -* like Perl, do. Parsing is done by hand rather than with a YACC -* generated parser to tightly constrain stack and dynamic memory -* usage. At the same time, parsing is kept flexible and the code -* fairly compact by parsing based on a list of AML opcode -* templates in aml_op_info[] +* Parse the AML and build an operation tree as most interpreters, (such as +* Perl) do. Parsing is done by hand rather than with a YACC generated parser +* to tightly constrain stack and dynamic memory usage. Parsing is kept +* flexible and the code fairly compact by parsing based on a list of AML +* opcode templates in aml_op_info[]. */ #include <acpi/acpi.h>
@@ -60,766 +59,679 @@ ACPI_MODULE_NAME("psloop")static u32 acpi_gbl_depth =0 ; +/* Local prototypes */ + +static acpi_status acpi_ps_get_aml_opcode (struct acpi_walk_state *walk_state); + +static acpi_status +acpi_ps_build_named_op (struct acpi_walk_state *walk_state, +u8 * aml_op_start, +union acpi_parse_object *unnamed_op, +union acpi_parse_object **op); + +static acpi_status +acpi_ps_create_op (struct acpi_walk_state *walk_state, +u8 * aml_op_start,union acpi_parse_object **new_op); + +static acpi_status +acpi_ps_get_arguments (struct acpi_walk_state *walk_state, +u8 * aml_op_start,union acpi_parse_object *op); + +static acpi_status +acpi_ps_complete_op (struct acpi_walk_state *walk_state, +union acpi_parse_object **op,acpi_status status); + +static acpi_status +acpi_ps_complete_final_op (struct acpi_walk_state *walk_state, +union acpi_parse_object *op,acpi_status status); +/******************************************************************************* * -* FUNCTION: acpi_ps_parse_loop +* FUNCTION: acpi_ps_get_aml_opcode * * PARAMETERS: walk_state - Current state * * RETURN: Status * -* DESCRIPTION: Parse AML (pointed to by the current parser state) and return -* a tree of ops. +* DESCRIPTION: Extract the next AML opcode from the input stream. * ******************************************************************************/ -acpi_status acpi_ps_parse_loop (struct acpi_walk_state *walk_state) +static acpi_status acpi_ps_get_aml_opcode (struct acpi_walk_state *walk_state) { -acpi_status status =AE_OK ; -acpi_status status2; -union acpi_parse_object *op =NULL ;/* current op */ -union acpi_parse_object *arg =NULL ; -union acpi_parse_object *pre_op =NULL ; -struct acpi_parse_state *parser_state; -u8 *aml_op_start =NULL ; -ACPI_FUNCTION_TRACE_PTR (ps_parse_loop, walk_state); +ACPI_FUNCTION_TRACE_PTR (ps_get_aml_opcode, walk_state); -if (walk_state->descending_callback ==NULL ) { -return_ACPI_STATUS (AE_BAD_PARAMETER ); - } + walk_state->aml_offset = + (u32 )ACPI_PTR_DIFF (walk_state->parser_state.aml, + walk_state->parser_state.aml_start); + walk_state->opcode =acpi_ps_peek_opcode (&(walk_state->parser_state)); - parser_state = &walk_state->parser_state; - walk_state->arg_types =0 ; +/* +* First cut to determine what we have found: +* 1) A valid AML opcode +* 2) A name string +* 3) An unknown/invalid opcode +*/ + walk_state->op_info =acpi_ps_get_opcode_info (walk_state->opcode); -#if (!defined (ACPI_NO_METHOD_EXECUTION ) && !defined (ACPI_CONSTANT_EVAL_ONLY )) +switch (walk_state->op_info->class) { +case AML_CLASS_ASCII : +case AML_CLASS_PREFIX : +/* +* Starts with a valid prefix or ASCII char, this is a name +* string. Convert the bare name string to a namepath. +*/ + walk_state->opcode =AML_INT_NAMEPATH_OP ; + walk_state->arg_types =ARGP_NAMESTRING ; +break ; -if (walk_state->walk_type &ACPI_WALK_METHOD_RESTART ) { +case AML_CLASS_UNKNOWN : -/* We are restarting a preempted control method */ +/* The opcode is unrecognized. Just skip unknown opcodes */ -if (acpi_ps_has_completed_scope (parser_state)) { -/* -* We must check if a predicate to an IF or WHILE statement -* was just completed -*/ -if ((parser_state->scope->parse_scope.op) && - ((parser_state->scope->parse_scope.op->common. - aml_opcode ==AML_IF_OP ) - || (parser_state->scope->parse_scope.op->common. - aml_opcode ==AML_WHILE_OP )) - && (walk_state->control_state) - && (walk_state->control_state->common.state == -ACPI_CONTROL_PREDICATE_EXECUTING )) { -/* -* A predicate was just completed, get the value of the -* predicate and branch based on that value -*/ - walk_state->op =NULL ; - status = -acpi_ds_get_predicate_value (walk_state, -ACPI_TO_POINTER - (TRUE)); -if (ACPI_FAILURE (status) - && ((status &AE_CODE_MASK ) != -AE_CODE_CONTROL )) { -if (status ==AE_AML_NO_RETURN_VALUE ) { -ACPI_EXCEPTION ((AE_INFO , status, -"Invoked method did not return a value" )); +ACPI_ERROR ((AE_INFO , +"Found unknown opcode %X at AML address %p offset %X, ignoring" , + walk_state->opcode, walk_state->parser_state.aml, + walk_state->aml_offset)); - } -ACPI_EXCEPTION ((AE_INFO , status, -"GetPredicate Failed" )); -return_ACPI_STATUS (status); - } +ACPI_DUMP_BUFFER (walk_state->parser_state.aml,128 ); - status = -acpi_ps_next_parse_state (walk_state, op, - status); - } +/* Assume one-byte bad opcode */ -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Popped scope, Op=%p\n" , op)); - }else if (walk_state->prev_op) { + walk_state->parser_state.aml++; +return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); -/* We were in the middle of an op */ +default : - op = walk_state->prev_op; - walk_state->arg_types = walk_state->prev_arg_types; - } +/* Found opcode info, this is a normal opcode */ + + walk_state->parser_state.aml += +acpi_ps_get_opcode_size (walk_state->opcode); + walk_state->arg_types = walk_state->op_info->parse_args; +break ; } -#endif -/* Iterative parsing loop, while there is more AML to process: */ +return_ACPI_STATUS (AE_OK ); +} -while ((parser_state->aml < parser_state->aml_end) || (op)) { - aml_op_start = parser_state->aml; -if (!op) { +/******************************************************************************* +* +* FUNCTION: acpi_ps_build_named_op +* +* PARAMETERS: walk_state - Current state +* aml_op_start - Begin of named Op in AML +* unnamed_op - Early Op (not a named Op) +* Op - Returned Op +* +* RETURN: Status +* +* DESCRIPTION: Parse a named Op +* +******************************************************************************/ -/* Get the next opcode from the AML stream */ +static acpi_status +acpi_ps_build_named_op (struct acpi_walk_state *walk_state, +u8 * aml_op_start, +union acpi_parse_object *unnamed_op, +union acpi_parse_object **op) +{ +acpi_status status =AE_OK ; +union acpi_parse_object *arg =NULL ; - walk_state->aml_offset = - (u32 )ACPI_PTR_DIFF (parser_state->aml, - parser_state->aml_start); - walk_state->opcode =acpi_ps_peek_opcode (parser_state); +ACPI_FUNCTION_TRACE_PTR (ps_build_named_op, walk_state); -/* -* First cut to determine what we have found: -* 1) A valid AML opcode -* 2) A name string -* 3) An unknown/invalid opcode -*/ - walk_state->op_info = -acpi_ps_get_opcode_info (walk_state->opcode); -switch (walk_state->op_info->class) { -case AML_CLASS_ASCII : -case AML_CLASS_PREFIX : -/* -* Starts with a valid prefix or ASCII char, this is a name -* string. Convert the bare name string to a namepath. -*/ - walk_state->opcode =AML_INT_NAMEPATH_OP ; - walk_state->arg_types =ARGP_NAMESTRING ; -break ; + unnamed_op->common.value.arg =NULL ; + unnamed_op->common.aml_opcode = walk_state->opcode; -case AML_CLASS_UNKNOWN : +/* +* Get and append arguments until we find the node that contains +* the name (the type ARGP_NAME). +*/ +while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && + (GET_CURRENT_ARG_TYPE (walk_state->arg_types) !=ARGP_NAME )) { + status = +acpi_ps_get_next_arg (walk_state, + &(walk_state->parser_state), +GET_CURRENT_ARG_TYPE (walk_state-> + arg_types), &arg); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } -/* The opcode is unrecognized. Just skip unknown opcodes */ +acpi_ps_append_arg (unnamed_op, arg); +INCREMENT_ARG_LIST (walk_state->arg_types); + } -ACPI_ERROR ((AE_INFO , -"Found unknown opcode %X at AML address %p offset %X, ignoring" , - walk_state->opcode, - parser_state->aml, - walk_state->aml_offset)); +/* +* Make sure that we found a NAME and didn't run out of arguments +*/ +if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { +return_ACPI_STATUS (AE_AML_NO_OPERAND ); + } -ACPI_DUMP_BUFFER (parser_state->aml,128 ); +/* We know that this arg is a name, move to next arg */ -/* Assume one-byte bad opcode */ +INCREMENT_ARG_LIST (walk_state->arg_types); - parser_state->aml++; -continue ; +/* +* Find the object. This will either insert the object into +* the namespace or simply look it up +*/ + walk_state->op =NULL ; -default : + status = walk_state->descending_callback (walk_state, op); +if (ACPI_FAILURE (status)) { +ACPI_EXCEPTION ((AE_INFO , status,"During name lookup/catalog" )); +return_ACPI_STATUS (status); + } -/* Found opcode info, this is a normal opcode */ +if (!op) { +return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); + } - parser_state->aml += -acpi_ps_get_opcode_size (walk_state->opcode); - walk_state->arg_types = - walk_state->op_info->parse_args; -break ; - } + status =acpi_ps_next_parse_state (walk_state, *op, status); +if (ACPI_FAILURE (status)) { +if (status ==AE_CTRL_PENDING ) { +return_ACPI_STATUS (AE_CTRL_PARSE_PENDING ); + } +return_ACPI_STATUS (status); + } -/* Create Op structure and append to parent's argument list */ +acpi_ps_append_arg (*op, unnamed_op->common.value.arg); + acpi_gbl_depth++; -if (walk_state->op_info->flags &AML_NAMED ) { +if ((*op)->common.aml_opcode ==AML_REGION_OP ) { +/* +* Defer final parsing of an operation_region body, because we don't +* have enough info in the first pass to parse it correctly (i.e., +* there may be method calls within the term_arg elements of the body.) +* +* However, we must continue parsing because the opregion is not a +* standalone package -- we don't know where the end is at this point. +* +* (Length is unknown until parse of the body complete) +*/ + (*op)->named.data = aml_op_start; + (*op)->named.length =0 ; + } -/* Allocate a new pre_op if necessary */ +return_ACPI_STATUS (AE_OK ); +} -if (!pre_op) { - pre_op = -acpi_ps_alloc_op (walk_state-> - opcode); -if (!pre_op) { - status =AE_NO_MEMORY ; - goto close_this_op; - } - } +/******************************************************************************* +* +* FUNCTION: acpi_ps_create_op +* +* PARAMETERS: walk_state - Current state +* aml_op_start - Op start in AML +* new_op - Returned Op +* +* RETURN: Status +* +* DESCRIPTION: Get Op from AML +* +******************************************************************************/ - pre_op->common.value.arg =NULL ; - pre_op->common.aml_opcode = walk_state->opcode; +static acpi_status +acpi_ps_create_op (struct acpi_walk_state *walk_state, +u8 * aml_op_start,union acpi_parse_object **new_op) +{ +acpi_status status =AE_OK ; +union acpi_parse_object *op; +union acpi_parse_object *named_op =NULL ; -/* -* Get and append arguments until we find the node that contains -* the name (the type ARGP_NAME). -*/ -while (GET_CURRENT_ARG_TYPE - (walk_state->arg_types) - && - (GET_CURRENT_ARG_TYPE - (walk_state->arg_types) !=ARGP_NAME )) { - status = -acpi_ps_get_next_arg (walk_state, - parser_state, -GET_CURRENT_ARG_TYPE - (walk_state-> - arg_types), - &arg); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } +ACPI_FUNCTION_TRACE_PTR (ps_create_op, walk_state); -acpi_ps_append_arg (pre_op, arg); -INCREMENT_ARG_LIST (walk_state-> - arg_types); - } + status =acpi_ps_get_aml_opcode (walk_state); +if (status ==AE_CTRL_PARSE_CONTINUE ) { +return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); + } -/* -* Make sure that we found a NAME and didn't run out of -* arguments -*/ -if (!GET_CURRENT_ARG_TYPE - (walk_state->arg_types)) { - status =AE_AML_NO_OPERAND ; - goto close_this_op; - } +/* Create Op structure and append to parent's argument list */ -/* We know that this arg is a name, move to next arg */ + walk_state->op_info =acpi_ps_get_opcode_info (walk_state->opcode); + op =acpi_ps_alloc_op (walk_state->opcode); +if (!op) { +return_ACPI_STATUS (AE_NO_MEMORY ); + } -INCREMENT_ARG_LIST (walk_state->arg_types); +if (walk_state->op_info->flags &AML_NAMED ) { + status = +acpi_ps_build_named_op (walk_state, aml_op_start, op, + &named_op); +acpi_ps_free_op (op); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } -/* -* Find the object. This will either insert the object into -* the namespace or simply look it up -*/ - walk_state->op =NULL ; + *new_op = named_op; +return_ACPI_STATUS (AE_OK ); + } - status = - walk_state->descending_callback (walk_state, - &op); -if (ACPI_FAILURE (status)) { -ACPI_EXCEPTION ((AE_INFO , status, -"During name lookup/catalog" )); - goto close_this_op; - } +/* Not a named opcode, just allocate Op and append to parent */ -if (!op) { -continue ; - } +if (walk_state->op_info->flags &AML_CREATE ) { +/* +* Backup to beginning of create_xXXfield declaration +* body_length is unknown until we parse the body +*/ + op->named.data = aml_op_start; + op->named.length =0 ; + } - status = -acpi_ps_next_parse_state (walk_state, op, - status); -if (status ==AE_CTRL_PENDING ) { - status =AE_OK ; - goto close_this_op; - } +acpi_ps_append_arg (acpi_ps_get_parent_scope + (&(walk_state->parser_state)), op); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } +if (walk_state->descending_callback !=NULL ) { +/* +* Find the object. This will either insert the object into +* the namespace or simply look it up +*/ + walk_state->op = *new_op = op; -acpi_ps_append_arg (op, - pre_op->common.value.arg); - acpi_gbl_depth++; - -if (op->common.aml_opcode ==AML_REGION_OP ) { -/* -* Defer final parsing of an operation_region body, -* because we don't have enough info in the first pass -* to parse it correctly (i.e., there may be method -* calls within the term_arg elements of the body.) -* -* However, we must continue parsing because -* the opregion is not a standalone package -- -* we don't know where the end is at this point. -* -* (Length is unknown until parse of the body complete) -*/ - op->named.data = aml_op_start; - op->named.length =0 ; - } - }else { -/* Not a named opcode, just allocate Op and append to parent */ + status = walk_state->descending_callback (walk_state, &op); + status =acpi_ps_next_parse_state (walk_state, op, status); +if (status ==AE_CTRL_PENDING ) { + status =AE_CTRL_PARSE_PENDING ; + } + } - walk_state->op_info = -acpi_ps_get_opcode_info (walk_state->opcode); - op =acpi_ps_alloc_op (walk_state->opcode); -if (!op) { - status =AE_NO_MEMORY ; - goto close_this_op; - } +return_ACPI_STATUS (status); +} -if (walk_state->op_info->flags &AML_CREATE ) { -/* -* Backup to beginning of create_xXXfield declaration -* body_length is unknown until we parse the body -*/ - op->named.data = aml_op_start; - op->named.length =0 ; - } +/******************************************************************************* +* +* FUNCTION: acpi_ps_get_arguments +* +* PARAMETERS: walk_state - Current state +* aml_op_start - Op start in AML +* Op - Current Op +* +* RETURN: Status +* +* DESCRIPTION: Get arguments for passed Op. +* +******************************************************************************/ -acpi_ps_append_arg (acpi_ps_get_parent_scope - (parser_state), op); +static acpi_status +acpi_ps_get_arguments (struct acpi_walk_state *walk_state, +u8 * aml_op_start,union acpi_parse_object *op) +{ +acpi_status status =AE_OK ; +union acpi_parse_object *arg =NULL ; -if ((walk_state->descending_callback !=NULL )) { -/* -* Find the object. This will either insert the object into -* the namespace or simply look it up -*/ - walk_state->op = op; +ACPI_FUNCTION_TRACE_PTR (ps_get_arguments, walk_state); - status = - walk_state-> -descending_callback (walk_state, - &op); - status = -acpi_ps_next_parse_state (walk_state, - op, - status); -if (status ==AE_CTRL_PENDING ) { - status =AE_OK ; - goto close_this_op; - } +switch (op->common.aml_opcode) { +case AML_BYTE_OP :/* AML_BYTEDATA_ARG */ +case AML_WORD_OP :/* AML_WORDDATA_ARG */ +case AML_DWORD_OP :/* AML_DWORDATA_ARG */ +case AML_QWORD_OP :/* AML_QWORDATA_ARG */ +case AML_STRING_OP :/* AML_ASCIICHARLIST_ARG */ -if (ACPI_FAILURE (status)) { - goto close_this_op; - } - } - } +/* Fill in constant or string argument directly */ - op->common.aml_offset = walk_state->aml_offset; +acpi_ps_get_next_simple_arg (&(walk_state->parser_state), +GET_CURRENT_ARG_TYPE (walk_state-> + arg_types), + op); +break ; -if (walk_state->op_info) { -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n" , - (u32 ) op->common.aml_opcode, - walk_state->op_info->name, op, - parser_state->aml, - op->common.aml_offset)); - } +case AML_INT_NAMEPATH_OP :/* AML_NAMESTRING_ARG */ + + status = +acpi_ps_get_next_namepath (walk_state, + &(walk_state->parser_state), op, +1 ); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); } + walk_state->arg_types =0 ; +break ; + +default :/* -* Start arg_count at zero because we don't know if there are -* any args yet +* Op is not a constant or string, append each argument to the Op */ - walk_state->arg_count =0 ; - -/* Are there any arguments that must be processed? */ - -if (walk_state->arg_types) { - -/* Get arguments */ - -switch (op->common.aml_opcode) { -case AML_BYTE_OP :/* AML_BYTEDATA_ARG */ -case AML_WORD_OP :/* AML_WORDDATA_ARG */ -case AML_DWORD_OP :/* AML_DWORDATA_ARG */ -case AML_QWORD_OP :/* AML_QWORDATA_ARG */ -case AML_STRING_OP :/* AML_ASCIICHARLIST_ARG */ - -/* Fill in constant or string argument directly */ - -acpi_ps_get_next_simple_arg (parser_state, -GET_CURRENT_ARG_TYPE - (walk_state-> - arg_types), op); -break ; - -case AML_INT_NAMEPATH_OP :/* AML_NAMESTRING_ARG */ - - status = -acpi_ps_get_next_namepath (walk_state, - parser_state, op, -1 ); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } - - walk_state->arg_types =0 ; -break ; +while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) + && !walk_state->arg_count) { + walk_state->aml_offset = + (u32 )ACPI_PTR_DIFF (walk_state->parser_state.aml, + walk_state->parser_state. + aml_start); -default : -/* -* Op is not a constant or string, append each argument -* to the Op -*/ -while (GET_CURRENT_ARG_TYPE - (walk_state->arg_types) - && !walk_state->arg_count) { - walk_state->aml_offset = (u32 ) -ACPI_PTR_DIFF (parser_state->aml, - parser_state-> - aml_start); + status = +acpi_ps_get_next_arg (walk_state, + &(walk_state->parser_state), +GET_CURRENT_ARG_TYPE + (walk_state->arg_types), &arg); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } - status = -acpi_ps_get_next_arg (walk_state, - parser_state, -GET_CURRENT_ARG_TYPE - (walk_state-> - arg_types), - &arg); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } +if (arg) { + arg->common.aml_offset = walk_state->aml_offset; +acpi_ps_append_arg (op, arg); + } -if (arg) { - arg->common.aml_offset = - walk_state->aml_offset; -acpi_ps_append_arg (op, arg); - } -INCREMENT_ARG_LIST (walk_state-> - arg_types); - } +INCREMENT_ARG_LIST (walk_state->arg_types); + } -/* Special processing for certain opcodes */ +/* Special processing for certain opcodes */ -/* TBD (remove): Temporary mechanism to disable this code if needed */ +/* TBD (remove): Temporary mechanism to disable this code if needed */ #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE -if ((walk_state->pass_number <= -ACPI_IMODE_LOAD_PASS1 ) - && - ((walk_state-> - parse_flags &ACPI_PARSE_DISASSEMBLE ) == -0 )) { -/* -* We want to skip If/Else/While constructs during Pass1 -* because we want to actually conditionally execute the -* code during Pass2. -* -* Except for disassembly, where we always want to -* walk the If/Else/While packages -*/ -switch (op->common.aml_opcode) { -case AML_IF_OP : -case AML_ELSE_OP : -case AML_WHILE_OP : - -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Pass1: Skipping an If/Else/While body\n" )); - -/* Skip body of if/else/while in pass 1 */ - - parser_state->aml = - parser_state->pkg_end; - walk_state->arg_count =0 ; -break ; - -default : -break ; - } - } -#endif -switch (op->common.aml_opcode) { -case AML_METHOD_OP : - -/* -* Skip parsing of control method -* because we don't have enough info in the first pass -* to parse it correctly. -* -* Save the length and address of the body -*/ - op->named.data = parser_state->aml; - op->named.length = - (u32) (parser_state->pkg_end - - parser_state->aml); - -/* Skip body of method */ - - parser_state->aml = - parser_state->pkg_end; - walk_state->arg_count =0 ; -break ; - -case AML_BUFFER_OP : -case AML_PACKAGE_OP : -case AML_VAR_PACKAGE_OP : - -if ((op->common.parent) && - (op->common.parent->common. - aml_opcode ==AML_NAME_OP ) - && (walk_state->pass_number <= -ACPI_IMODE_LOAD_PASS2 )) { -/* -* Skip parsing of Buffers and Packages -* because we don't have enough info in the first pass -* to parse them correctly. -*/ - op->named.data = aml_op_start; - op->named.length = - (u32) (parser_state-> - pkg_end - - aml_op_start); - -/* Skip body */ - - parser_state->aml = - parser_state->pkg_end; - walk_state->arg_count =0 ; - } -break ; +if ((walk_state->pass_number <=ACPI_IMODE_LOAD_PASS1 ) && + ((walk_state->parse_flags &ACPI_PARSE_DISASSEMBLE ) ==0 )) { +/* +* We want to skip If/Else/While constructs during Pass1 because we +* want to actually conditionally execute the code during Pass2. +* +* Except for disassembly, where we always want to walk the +* If/Else/While packages +*/ +switch (op->common.aml_opcode) { +case AML_IF_OP : +case AML_ELSE_OP : +case AML_WHILE_OP : -case AML_WHILE_OP : +ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , +"Pass1: Skipping an If/Else/While body\n" )); -if (walk_state->control_state) { - walk_state->control_state-> - control.package_end = - parser_state->pkg_end; - } -break ; +/* Skip body of if/else/while in pass 1 */ -default : + walk_state->parser_state.aml = + walk_state->parser_state.pkg_end; + walk_state->arg_count =0 ; +break ; -/* No action for all other opcodes */ -break ; - } +default :break ; } } +#endif -/* Check for arguments that need to be processed */ - -if (walk_state->arg_count) { +switch (op->common.aml_opcode) { +case AML_METHOD_OP :/* -* There are arguments (complex ones), push Op and -* prepare for argument +* Skip parsing of control method because we don't have enough +* info in the first pass to parse it correctly. +* +* Save the length and address of the body */ - status =acpi_ps_push_scope (parser_state, op, - walk_state->arg_types, - walk_state->arg_count); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } - op =NULL ; -continue ; - } + op->named.data = walk_state->parser_state.aml; + op->named.length = (u32) + (walk_state->parser_state.pkg_end - + walk_state->parser_state.aml); -/* -* All arguments have been processed -- Op is complete, -* prepare for next -*/ - walk_state->op_info = -acpi_ps_get_opcode_info (op->common.aml_opcode); -if (walk_state->op_info->flags &AML_NAMED ) { -if (acpi_gbl_depth) { - acpi_gbl_depth--; - } +/* Skip body of method */ -if (op->common.aml_opcode ==AML_REGION_OP ) { + walk_state->parser_state.aml = + walk_state->parser_state.pkg_end; + walk_state->arg_count =0 ; +break ; + +case AML_BUFFER_OP : +case AML_PACKAGE_OP : +case AML_VAR_PACKAGE_OP : + +if ((op->common.parent) && + (op->common.parent->common.aml_opcode == +AML_NAME_OP ) + && (walk_state->pass_number <= +ACPI_IMODE_LOAD_PASS2 )) {/* -* Skip parsing of control method or opregion body, -* because we don't have enough info in the first pass -* to parse them correctly. -* -* Completed parsing an op_region declaration, we now -* know the length. +* Skip parsing of Buffers and Packages because we don't have +* enough info in the first pass to parse them correctly. */ - op->named.length = - (u32) (parser_state->aml - op->named.data); - } - } + op->named.data = aml_op_start; + op->named.length = (u32) + (walk_state->parser_state.pkg_end - + aml_op_start); -if (walk_state->op_info->flags &AML_CREATE ) { -/* -* Backup to beginning of create_xXXfield declaration (1 for -* Opcode) -* -* body_length is unknown until we parse the body -*/ - op->named.length = - (u32) (parser_state->aml - op->named.data); - } +/* Skip body */ -/* This op complete, notify the dispatcher */ + walk_state->parser_state.aml = + walk_state->parser_state.pkg_end; + walk_state->arg_count =0 ; + } +break ; -if (walk_state->ascending_callback !=NULL ) { - walk_state->op = op; - walk_state->opcode = op->common.aml_opcode; +case AML_WHILE_OP : - status = walk_state->ascending_callback (walk_state); - status = -acpi_ps_next_parse_state (walk_state, op, status); -if (status ==AE_CTRL_PENDING ) { - status =AE_OK ; - goto close_this_op; +if (walk_state->control_state) { + walk_state->control_state->control.package_end = + walk_state->parser_state.pkg_end; } - } - - close_this_op: -/* -* Finished one argument of the containing scope -*/ - parser_state->scope->parse_scope.arg_count--; +break ; -/* Finished with pre_op */ +default : -if (pre_op) { -acpi_ps_free_op (pre_op); - pre_op =NULL ; +/* No action for all other opcodes */ +break ; } -/* Close this Op (will result in parse subtree deletion) */ +break ; + } - status2 =acpi_ps_complete_this_op (walk_state, op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } - op =NULL ; +return_ACPI_STATUS (AE_OK ); +} -switch (status) { -case AE_OK : -break ; +/******************************************************************************* +* +* FUNCTION: acpi_ps_complete_op +* +* PARAMETERS: walk_state - Current state +* Op - Returned Op +* Status - Parse status before complete Op +* +* RETURN: Status +* +* DESCRIPTION: Complete Op +* +******************************************************************************/ -case AE_CTRL_TRANSFER : +static acpi_status +acpi_ps_complete_op (struct acpi_walk_state *walk_state, +union acpi_parse_object **op,acpi_status status) +{ +acpi_status status2; -/* We are about to transfer to a called method. */ +ACPI_FUNCTION_TRACE_PTR (ps_complete_op, walk_state); - walk_state->prev_op = op; - walk_state->prev_arg_types = walk_state->arg_types; -return_ACPI_STATUS (status); +/* +* Finished one argument of the containing scope +*/ + walk_state->parser_state.scope->parse_scope.arg_count--; -case AE_CTRL_END : +/* Close this Op (will result in parse subtree deletion) */ -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); + status2 =acpi_ps_complete_this_op (walk_state, *op); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); + } -if (op) { - walk_state->op = op; - walk_state->op_info = -acpi_ps_get_opcode_info (op->common. - aml_opcode); - walk_state->opcode = op->common.aml_opcode; + *op =NULL ; - status = - walk_state->ascending_callback (walk_state); - status = -acpi_ps_next_parse_state (walk_state, op, - status); +switch (status) { +case AE_OK : +break ; - status2 = -acpi_ps_complete_this_op (walk_state, op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } - op =NULL ; - } - status =AE_OK ; -break ; +case AE_CTRL_TRANSFER : -case AE_CTRL_BREAK : -case AE_CTRL_CONTINUE : +/* We are about to transfer to a called method */ -/* Pop off scopes until we find the While */ + walk_state->prev_op =NULL ; + walk_state->prev_arg_types = walk_state->arg_types; +return_ACPI_STATUS (status); -while (!op || (op->common.aml_opcode !=AML_WHILE_OP )) { -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); +case AE_CTRL_END : -if (op->common.aml_opcode !=AML_WHILE_OP ) { - status2 = -acpi_ds_result_stack_pop - (walk_state); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } - } - } - -/* Close this iteration of the While loop */ +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); - walk_state->op = op; +if (*op) { + walk_state->op = *op; walk_state->op_info = -acpi_ps_get_opcode_info (op->common.aml_opcode); - walk_state->opcode = op->common.aml_opcode; +acpi_ps_get_opcode_info ((*op)->common.aml_opcode); + walk_state->opcode = (*op)->common.aml_opcode; status = walk_state->ascending_callback (walk_state); status = -acpi_ps_next_parse_state (walk_state, op, status); +acpi_ps_next_parse_state (walk_state, *op, status); - status2 =acpi_ps_complete_this_op (walk_state, op); + status2 =acpi_ps_complete_this_op (walk_state, *op);if (ACPI_FAILURE (status2)) {return_ACPI_STATUS (status2); } - op =NULL ; - - status =AE_OK ; -break ; + } -case AE_CTRL_TERMINATE : + status =AE_OK ; +break ; - status =AE_OK ; +case AE_CTRL_BREAK : +case AE_CTRL_CONTINUE : -/* Clean up */ -do { -if (op) { - status2 = -acpi_ps_complete_this_op (walk_state, - op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } +/* Pop off scopes until we find the While */ - status2 = -acpi_ds_result_stack_pop - (walk_state); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } +while (!(*op) || ((*op)->common.aml_opcode !=AML_WHILE_OP )) { +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); -acpi_ut_delete_generic_state - (acpi_ut_pop_generic_state - (&walk_state->control_state)); +if ((*op)->common.aml_opcode !=AML_WHILE_OP ) { + status2 =acpi_ds_result_stack_pop (walk_state); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); } + } + } -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); +/* Close this iteration of the While loop */ - }while (op); + walk_state->op = *op; + walk_state->op_info = +acpi_ps_get_opcode_info ((*op)->common.aml_opcode); + walk_state->opcode = (*op)->common.aml_opcode; -return_ACPI_STATUS (status); + status = walk_state->ascending_callback (walk_state); + status =acpi_ps_next_parse_state (walk_state, *op, status); -default :/* All other non-AE_OK status */ + status2 =acpi_ps_complete_this_op (walk_state, *op); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); + } -do { -if (op) { - status2 = -acpi_ps_complete_this_op (walk_state, - op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } + status =AE_OK ; +break ; + +case AE_CTRL_TERMINATE : + +/* Clean up */ +do { +if (*op) { + status2 = +acpi_ps_complete_this_op (walk_state, *op); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); + } + status2 =acpi_ds_result_stack_pop (walk_state); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); } -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); +acpi_ut_delete_generic_state + (acpi_ut_pop_generic_state + (&walk_state->control_state)); + } - }while (op); +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); -/* -* TBD: Cleanup parse ops on error -*/ -#if 0 -if (op ==NULL ) { -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); + }while (*op); + +return_ACPI_STATUS (AE_OK ); + +default :/* All other non-AE_OK status */ + +do { +if (*op) { + status2 = +acpi_ps_complete_this_op (walk_state, *op); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); + } } -#endif - walk_state->prev_op = op; - walk_state->prev_arg_types = walk_state->arg_types; -return_ACPI_STATUS (status); - } -/* This scope complete? */ +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); -if (acpi_ps_has_completed_scope (parser_state)) { -acpi_ps_pop_scope (parser_state, &op, + }while (*op); + +#if 0 +/* +* TBD: Cleanup parse ops on error +*/ +if (*op ==NULL ) { +acpi_ps_pop_scope (parser_state, op, &walk_state->arg_types, &walk_state->arg_count); -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Popped scope, Op=%p\n" , op)); - }else { - op =NULL ; } +#endif + walk_state->prev_op =NULL ; + walk_state->prev_arg_types = walk_state->arg_types; +return_ACPI_STATUS (status); + } - }/* while parser_state->Aml */ +/* This scope complete? */ + +if (acpi_ps_has_completed_scope (&(walk_state->parser_state))) { +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); +ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"Popped scope, Op=%p\n" , *op)); + }else { + *op =NULL ; + } + +return_ACPI_STATUS (AE_OK ); +} + +/******************************************************************************* +* +* FUNCTION: acpi_ps_complete_final_op +* +* PARAMETERS: walk_state - Current state +* Op - Current Op +* Status - Current parse status before complete last +* Op +* +* RETURN: Status +* +* DESCRIPTION: Complete last Op. +* +******************************************************************************/ + +static acpi_status +acpi_ps_complete_final_op (struct acpi_walk_state *walk_state, +union acpi_parse_object *op,acpi_status status) +{ +acpi_status status2; + +ACPI_FUNCTION_TRACE_PTR (ps_complete_final_op, walk_state);/* * Complete the last Op (if not completed), and clear the scope stack. * It is easily possible to end an AML "package" with an unbounded number * of open scopes (such as when several ASL blocks are closed with -* sequential closing braces). We want to terminate each one cleanly. +* sequential closing braces). We want to terminate each one cleanly. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"AML package complete at Op %p\n" , op));
@@ -838,8 +750,12 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)acpi_ps_next_parse_state (walk_state, op, status);if (status ==AE_CTRL_PENDING ) { - status =AE_OK ; - goto close_this_op; + status = +acpi_ps_complete_op (walk_state, &op, +AE_OK ); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } }if (status ==AE_CTRL_TERMINATE ) {
@@ -858,7 +774,9 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) } } - acpi_ps_pop_scope(parser_state, + acpi_ps_pop_scope(& + (walk_state-> + parser_state), &op, &walk_state-> arg_types,
@@ -887,10 +805,252 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) } } -acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, +acpi_ps_pop_scope (&(walk_state->parser_state), &op, + &walk_state->arg_types, &walk_state->arg_count); }while (op);return_ACPI_STATUS (status); } + +/******************************************************************************* +* +* FUNCTION: acpi_ps_parse_loop +* +* PARAMETERS: walk_state - Current state +* +* RETURN: Status +* +* DESCRIPTION: Parse AML (pointed to by the current parser state) and return +* a tree of ops. +* +******************************************************************************/ + +acpi_status acpi_ps_parse_loop (struct acpi_walk_state *walk_state) +{ +acpi_status status =AE_OK ; +union acpi_parse_object *op =NULL ;/* current op */ +struct acpi_parse_state *parser_state; +u8 *aml_op_start =NULL ; + +ACPI_FUNCTION_TRACE_PTR (ps_parse_loop, walk_state); + +if (walk_state->descending_callback ==NULL ) { +return_ACPI_STATUS (AE_BAD_PARAMETER ); + } + + parser_state = &walk_state->parser_state; + walk_state->arg_types =0 ; + +#if (!defined (ACPI_NO_METHOD_EXECUTION ) && !defined (ACPI_CONSTANT_EVAL_ONLY )) + +if (walk_state->walk_type &ACPI_WALK_METHOD_RESTART ) { + +/* We are restarting a preempted control method */ + +if (acpi_ps_has_completed_scope (parser_state)) { +/* +* We must check if a predicate to an IF or WHILE statement +* was just completed +*/ +if ((parser_state->scope->parse_scope.op) && + ((parser_state->scope->parse_scope.op->common. + aml_opcode ==AML_IF_OP ) + || (parser_state->scope->parse_scope.op->common. + aml_opcode ==AML_WHILE_OP )) + && (walk_state->control_state) + && (walk_state->control_state->common.state == +ACPI_CONTROL_PREDICATE_EXECUTING )) { +/* +* A predicate was just completed, get the value of the +* predicate and branch based on that value +*/ + walk_state->op =NULL ; + status = +acpi_ds_get_predicate_value (walk_state, +ACPI_TO_POINTER + (TRUE)); +if (ACPI_FAILURE (status) + && ((status &AE_CODE_MASK ) != +AE_CODE_CONTROL )) { +if (status ==AE_AML_NO_RETURN_VALUE ) { +ACPI_EXCEPTION ((AE_INFO , status, +"Invoked method did not return a value" )); + + } + +ACPI_EXCEPTION ((AE_INFO , status, +"GetPredicate Failed" )); +return_ACPI_STATUS (status); + } + + status = +acpi_ps_next_parse_state (walk_state, op, + status); + } + +acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); +ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , +"Popped scope, Op=%p\n" , op)); + }else if (walk_state->prev_op) { + +/* We were in the middle of an op */ + + op = walk_state->prev_op; + walk_state->arg_types = walk_state->prev_arg_types; + } + } +#endif + +/* Iterative parsing loop, while there is more AML to process: */ + +while ((parser_state->aml < parser_state->aml_end) || (op)) { + aml_op_start = parser_state->aml; +if (!op) { + status = +acpi_ps_create_op (walk_state, aml_op_start, &op); +if (ACPI_FAILURE (status)) { +if (status ==AE_CTRL_PARSE_CONTINUE ) { +continue ; + } + +if (status ==AE_CTRL_PARSE_PENDING ) { + status =AE_OK ; + } + + status = +acpi_ps_complete_op (walk_state, &op, + status); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +continue ; + } + + op->common.aml_offset = walk_state->aml_offset; + +if (walk_state->op_info) { +ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , +"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n" , + (u32 ) op->common.aml_opcode, + walk_state->op_info->name, op, + parser_state->aml, + op->common.aml_offset)); + } + } + +/* +* Start arg_count at zero because we don't know if there are +* any args yet +*/ + walk_state->arg_count =0 ; + +/* Are there any arguments that must be processed? */ + +if (walk_state->arg_types) { + +/* Get arguments */ + + status = +acpi_ps_get_arguments (walk_state, aml_op_start, op); +if (ACPI_FAILURE (status)) { + status = +acpi_ps_complete_op (walk_state, &op, + status); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +continue ; + } + } + +/* Check for arguments that need to be processed */ + +if (walk_state->arg_count) { +/* +* There are arguments (complex ones), push Op and +* prepare for argument +*/ + status =acpi_ps_push_scope (parser_state, op, + walk_state->arg_types, + walk_state->arg_count); +if (ACPI_FAILURE (status)) { + status = +acpi_ps_complete_op (walk_state, &op, + status); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +continue ; + } + + op =NULL ; +continue ; + } + +/* +* All arguments have been processed -- Op is complete, +* prepare for next +*/ + walk_state->op_info = +acpi_ps_get_opcode_info (op->common.aml_opcode); +if (walk_state->op_info->flags &AML_NAMED ) { +if (acpi_gbl_depth) { + acpi_gbl_depth--; + } + +if (op->common.aml_opcode ==AML_REGION_OP ) { +/* +* Skip parsing of control method or opregion body, +* because we don't have enough info in the first pass +* to parse them correctly. +* +* Completed parsing an op_region declaration, we now +* know the length. +*/ + op->named.length = + (u32) (parser_state->aml - op->named.data); + } + } + +if (walk_state->op_info->flags &AML_CREATE ) { +/* +* Backup to beginning of create_xXXfield declaration (1 for +* Opcode) +* +* body_length is unknown until we parse the body +*/ + op->named.length = + (u32) (parser_state->aml - op->named.data); + } + +/* This op complete, notify the dispatcher */ + +if (walk_state->ascending_callback !=NULL ) { + walk_state->op = op; + walk_state->opcode = op->common.aml_opcode; + + status = walk_state->ascending_callback (walk_state); + status = +acpi_ps_next_parse_state (walk_state, op, status); +if (status ==AE_CTRL_PENDING ) { + status =AE_OK ; + } + } + + status =acpi_ps_complete_op (walk_state, &op, status); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + + }/* while parser_state->Aml */ + + status =acpi_ps_complete_final_op (walk_state, op, status); +return_ACPI_STATUS (status); +}
include/acpi/acexcep.h +6 -2
@@ -178,8 +178,10 @@#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL)#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL)#define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL) +#define AE_CTRL_PARSE_CONTINUE (acpi_status) (0x000C | AE_CODE_CONTROL) +#define AE_CTRL_PARSE_PENDING (acpi_status) (0x000D | AE_CODE_CONTROL) -#define AE_CODE_CTRL_MAX 0x000B +#define AE_CODE_CTRL_MAX 0x000D#ifdef DEFINE_ACPI_GLOBALS
@@ -291,7 +293,9 @@ char const *acpi_gbl_exception_names_ctrl[] = {"AE_CTRL_TRANSFER" ,"AE_CTRL_BREAK" ,"AE_CTRL_CONTINUE" , -"AE_CTRL_SKIP" +"AE_CTRL_SKIP" , +"AE_CTRL_PARSE_CONTINUE" , +"AE_CTRL_PARSE_PENDING" };#endif /* ACPI GLOBALS */
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 91/140 ACPICA: Eliminate control method 2-pass parse/execute.
From: Valery Podrezov <[email protected]>
Completed an AML interpreter performance enhancement for control method execution. Previously a 2-pass parse/execution, control methods are now completely parsed and executed in single pass. This improves overall interpreter performance by ~25%, reduces code size, and reduces CPU stack use.
--- drivers/acpi/dispatcher/dsmethod.c | 50 +-------------- drivers/acpi/parser/psloop.c | 2 +- drivers/acpi/parser/psxface.c | 114 ++++++++++++------------------------ 3 files changed, 42 insertions(+), 124 deletions(-)
drivers/acpi/dispatcher/dsmethod.c +4 -46
@@ -327,7 +327,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,ACPI_FUNCTION_TRACE_PTR (ds_call_control_method, this_walk_state);ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH , -"Execute method %p, currentstate=%p\n" , +"Calling method %p, currentstate=%p\n" , this_walk_state->prev_op, this_walk_state));/*
@@ -351,49 +351,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,return_ACPI_STATUS (status); } -/* -* 1) Parse the method. All "normal" methods are parsed for each execution. -* Internal methods (_OSI, etc.) do not require parsing. -*/ -if (!(obj_desc->method.method_flags &AML_METHOD_INTERNAL_ONLY )) { - -/* Create a new walk state for the parse */ - - next_walk_state = -acpi_ds_create_walk_state (obj_desc->method.owner_id, op, - obj_desc,NULL ); -if (!next_walk_state) { - status =AE_NO_MEMORY ; - goto cleanup; - } - -/* Create and init a parse tree root */ - - op =acpi_ps_create_scope_op (); -if (!op) { - status =AE_NO_MEMORY ; - goto cleanup; - } - - status =acpi_ds_init_aml_walk (next_walk_state, op, method_node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, -NULL ,1 ); -if (ACPI_FAILURE (status)) { -acpi_ps_delete_parse_tree (op); - goto cleanup; - } - -/* Begin AML parse (deletes next_walk_state) */ - - status =acpi_ps_parse_aml (next_walk_state); -acpi_ps_delete_parse_tree (op); -if (ACPI_FAILURE (status)) { - goto cleanup; - } - } - -/* 2) Begin method execution. Create a new walk state */ +/* Begin method parse/execution. Create a new walk state */ next_walk_state =acpi_ds_create_walk_state (obj_desc->method.owner_id,NULL , obj_desc, thread);
@@ -445,8 +403,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, this_walk_state->num_operands =0 ;ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH , -"Starting nested execution, newstate=%p\n" , - next_walk_state)); +"**** Begin nested execution of [%4.4s] **** WalkState=%p\n" , + method_node->name.ascii, next_walk_state));/* Invoke an internal method if necessary */
drivers/acpi/parser/psloop.c +1 -1
@@ -226,7 +226,7 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state,return_ACPI_STATUS (status); } -if (!op) { +if (!*op) {return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); }
drivers/acpi/parser/psxface.c +37 -77
151 lines not on this page · raw message
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 92/140 ACPICA: Fix race condition with AcpiWalkNamespace.
From: Bob Moore <[email protected]>
Fixed a problem with a possible race condition between threads executing AcpiWalkNamespace and the AML interpreter. This condition was removed by modifying AcpiWalkNamespace to (by default) ignore all temporary namespace entries created during any concurrent control method execution
--- drivers/acpi/dispatcher/dswload.c | 4 ++-- drivers/acpi/namespace/nsdump.c | 9 ++++++++- drivers/acpi/namespace/nssearch.c | 4 ++++ drivers/acpi/namespace/nswalk.c | 13 ++++++++----- include/acpi/aclocal.h | 2 +- include/acpi/acnamesp.h | 10 +++++++--- 6 files changed, 30 insertions(+), 12 deletions(-)
drivers/acpi/dispatcher/dswload.c +2 -2
@@ -756,9 +756,9 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, flags =ACPI_NS_NO_UPSEARCH ;if (walk_state->pass_number ==3 ) { -/* Execution mode, node cannot already exist */ +/* Execution mode, node cannot already exist, node is temporary */ - flags |=ACPI_NS_ERROR_IF_FOUND ; + flags |= (ACPI_NS_ERROR_IF_FOUND |ACPI_NS_TEMPORARY ); }/* Add new entry or lookup existing entry */
drivers/acpi/namespace/nsdump.c +8 -1
@@ -226,6 +226,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, obj_desc =acpi_ns_get_attached_object (this_node); acpi_dbg_level = dbg_level; +/* Temp nodes are those nodes created by a control method */ + +if (this_node->flags &ANOBJ_TEMPORARY ) { +acpi_os_printf ("(T) " ); + } +switch (info->display_type &ACPI_DISPLAY_MASK ) {case ACPI_DISPLAY_SUMMARY :
@@ -623,7 +629,8 @@ acpi_ns_dump_objects(acpi_object_type type, info.display_type = display_type; (void )acpi_ns_walk_namespace (type, start_handle, max_depth, -ACPI_NS_WALK_NO_UNLOCK , +ACPI_NS_WALK_NO_UNLOCK | +ACPI_NS_WALK_TEMP_NODES , acpi_ns_dump_one_object, (void *)&info,NULL ); }
drivers/acpi/namespace/nssearch.c +4 -0
@@ -402,6 +402,10 @@ acpi_ns_search_and_enter(u32 target_name, }#endif +if (flags &ACPI_NS_TEMPORARY ) { + new_node->flags |=ANOBJ_TEMPORARY ; + } +/* Install the new object into the parent's list of children */ acpi_ns_install_node (walk_state, node, new_node, type);
drivers/acpi/namespace/nswalk.c +8 -5
@@ -126,7 +126,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,* PARAMETERS: Type - acpi_object_type to search for * start_node - Handle in namespace where search begins * max_depth - Depth to which search is to reach -* unlock_before_callback- Whether to unlock the NS before invoking +* Flags - Whether to unlock the NS before invoking * the callback routine * user_function - Called when an object of "Type" is found * Context - Passed to user function
@@ -153,7 +153,7 @@ acpi_status acpi_ns_walk_namespace(acpi_object_type type, acpi_handle start_node, u32 max_depth, - u8 unlock_before_callback, + u32 flags, acpi_walk_callback user_function, void *context, void **return_value) {
@@ -201,12 +201,15 @@ acpi_ns_walk_namespace(acpi_object_type type, child_type = child_node->type; } -if (child_type == type) { +if ((child_type == type) && + (!(child_node->flags &ANOBJ_TEMPORARY ) || + (child_node->flags &ANOBJ_TEMPORARY ) + && (flags &ACPI_NS_WALK_TEMP_NODES ))) {/* * Found a matching node, invoke the user * callback function */ -if (unlock_before_callback) { +if (flags &ACPI_NS_WALK_UNLOCK ) { mutex_status =acpi_ut_release_mutex (ACPI_MTX_NAMESPACE );
@@ -219,7 +222,7 @@ acpi_ns_walk_namespace(acpi_object_type type, status =user_function (child_node, level, context, return_value); -if (unlock_before_callback) { +if (flags &ACPI_NS_WALK_UNLOCK ) { mutex_status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE );
include/acpi/aclocal.h +1 -1
@@ -204,7 +204,7 @@ struct acpi_namespace_node {/* Namespace Node flags */ #define ANOBJ_END_OF_PEER_LIST 0x01/* End-of-list, Peer field points to parent */ -#define ANOBJ_RESERVED 0x02/* Available for future use */ +#define ANOBJ_TEMPORARY 0x02/* Node is create by a method and is temporary */ #define ANOBJ_METHOD_ARG 0x04/* Node is a method argument */ #define ANOBJ_METHOD_LOCAL 0x08/* Node is a method local */ #define ANOBJ_SUBTREE_HAS_INI 0x10/* Used to optimize device initialization */
include/acpi/acnamesp.h +7 -3
@@ -65,9 +65,13 @@#define ACPI_NS_ERROR_IF_FOUND 0x08#define ACPI_NS_PREFIX_IS_SCOPE 0x10#define ACPI_NS_EXTERNAL 0x20 +#define ACPI_NS_TEMPORARY 0x40 -#define ACPI_NS_WALK_UNLOCK TRUE -#define ACPI_NS_WALK_NO_UNLOCK FALSE +/* Flags for acpi_ns_walk_namespace */ + +#define ACPI_NS_WALK_NO_UNLOCK 0 +#define ACPI_NS_WALK_UNLOCK 0x01 +#define ACPI_NS_WALK_TEMP_NODES 0x02/* * nsinit - Namespace initialization
@@ -92,7 +96,7 @@ acpi_status acpi_ns_walk_namespace(acpi_object_type type, acpi_handle start_object, u32 max_depth, - u8 unlock_before_callback, + u32 flags, acpi_walk_callback user_function, void *context, void **return_value);
Signature · 1 line
1.5.0.rc3.39.gec804
Len Brown
reviewerPATCH 93/140 ACPICA: _CID support for PCI Root Bridge detection.
From: Bob Moore <[email protected]>
Implemented _CID support for PCI Root Bridge detection. If the _HID does not match the predefined root bridge IDs, the _CID list (if present)
is now obtained and also checked for an ID match
--- drivers/acpi/events/evrgnini.c | 163 ++++++++++++++++++++++++++++++--------- 1 files changed, 125 insertions(+), 38 deletions(-)
drivers/acpi/events/evrgnini.c +125 -38
@@ -48,6 +48,11 @@#define _COMPONENT ACPI_EVENTSACPI_MODULE_NAME ("evrgnini" ) +/* Local prototypes */ +static u8 acpi_ev_match_pci_root_bridge (char *id); + +static u8 acpi_ev_is_pci_root_bridge (struct acpi_namespace_node *node); +/******************************************************************************* * * FUNCTION: acpi_ev_system_memory_region_setup
@@ -62,6 +67,7 @@ ACPI_MODULE_NAME("evrgnini")* DESCRIPTION: Setup a system_memory operation region * ******************************************************************************/ + acpi_status acpi_ev_system_memory_region_setup(acpi_handle handle, u32 function,
@@ -168,9 +174,9 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,union acpi_operand_object *handler_obj;struct acpi_namespace_node *parent_node;struct acpi_namespace_node *pci_root_node; +struct acpi_namespace_node *pci_device_node;union acpi_operand_object *region_obj = (union acpi_operand_object *)handle; -struct acpi_device_id object_hID;ACPI_FUNCTION_TRACE (ev_pci_config_region_setup);
@@ -215,45 +221,30 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, pci_root_node = parent_node;while (pci_root_node != acpi_gbl_root_node) { - status = -acpi_ut_execute_HID (pci_root_node, &object_hID); -if (ACPI_SUCCESS (status)) { -/* -* Got a valid _HID string, check if this is a PCI root. -* New for ACPI 3.0: check for a PCI Express root also. -*/ -if (! - (ACPI_STRNCMP - (object_hID.value,PCI_ROOT_HID_STRING , -sizeof (PCI_ROOT_HID_STRING ))) - || - !(ACPI_STRNCMP - (object_hID.value, -PCI_EXPRESS_ROOT_HID_STRING , -sizeof (PCI_EXPRESS_ROOT_HID_STRING )))) { - -/* Install a handler for this PCI root bridge */ - status = -acpi_install_address_space_handler ((acpi_handle ) pci_root_node,ACPI_ADR_SPACE_PCI_CONFIG ,ACPI_DEFAULT_HANDLER ,NULL ,NULL ); -if (ACPI_FAILURE (status)) { -if (status ==AE_SAME_HANDLER ) { -/* -* It is OK if the handler is already installed on the root -* bridge. Still need to return a context object for the -* new PCI_Config operation region, however. -*/ - status =AE_OK ; - }else { -ACPI_EXCEPTION ((AE_INFO , - status, -"Could not install PciConfig handler for Root Bridge %4.4s" , -acpi_ut_get_node_name - (pci_root_node))); - } +/* Get the _HID/_CID in order to detect a root_bridge */ + +if (acpi_ev_is_pci_root_bridge (pci_root_node)) { + +/* Install a handler for this PCI root bridge */ + + status =acpi_install_address_space_handler ((acpi_handle ) pci_root_node,ACPI_ADR_SPACE_PCI_CONFIG ,ACPI_DEFAULT_HANDLER ,NULL ,NULL ); +if (ACPI_FAILURE (status)) { +if (status ==AE_SAME_HANDLER ) { +/* +* It is OK if the handler is already installed on the root +* bridge. Still need to return a context object for the +* new PCI_Config operation region, however. +*/ + status =AE_OK ; + }else { +ACPI_EXCEPTION ((AE_INFO , status, +"Could not install PciConfig handler for Root Bridge %4.4s" , +acpi_ut_get_node_name + (pci_root_node))); } -break ; } +break ; } pci_root_node =acpi_ns_get_parent_node (pci_root_node);
@@ -282,14 +273,25 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,/* * For PCI_Config space access, we need the segment, bus, * device and function numbers. Acquire them here. +* +* Find the parent device object. (This allows the operation region to be +* within a subscope under the device, such as a control method.) */ + pci_device_node = region_obj->region.node; +while (pci_device_node && (pci_device_node->type !=ACPI_TYPE_DEVICE )) { + pci_device_node =acpi_ns_get_parent_node (pci_device_node); + } + +if (!pci_device_node) { +return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); + }/* * 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 , parent_node, +acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR , pci_device_node, &pci_value);/*
@@ -329,6 +331,91 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,/******************************************************************************* * +* FUNCTION: acpi_ev_match_pci_root_bridge +* +* PARAMETERS: Id - The HID/CID in string format +* +* RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge +* +* DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. +* +******************************************************************************/ + +static u8 acpi_ev_match_pci_root_bridge (char *id) +{ + +/* +* Check if this is a PCI root. +* ACPI 3.0+: check for a PCI Express root also. +*/ +if (!(ACPI_STRNCMP (id, +PCI_ROOT_HID_STRING , +sizeof (PCI_ROOT_HID_STRING ))) || + !(ACPI_STRNCMP (id, +PCI_EXPRESS_ROOT_HID_STRING , +sizeof (PCI_EXPRESS_ROOT_HID_STRING )))) { +return (TRUE); + } + +return (FALSE); +} + +/******************************************************************************* +* +* FUNCTION: acpi_ev_is_pci_root_bridge +* +* PARAMETERS: Node - Device node being examined +* +* RETURN: TRUE if device is a PCI/PCI-Express Root Bridge +* +* DESCRIPTION: Determine if the input device represents a PCI Root Bridge by +* examining the _HID and _CID for the device. +* +******************************************************************************/ + +static u8 acpi_ev_is_pci_root_bridge (struct acpi_namespace_node *node) +{ +acpi_status status; +struct acpi_device_id hid; +struct acpi_compatible_id_list *cid; +acpi_native_uint i; + +/* +* Get the _HID and check for a PCI Root Bridge +*/ + status =acpi_ut_execute_HID (node, &hid); +if (ACPI_FAILURE (status)) { +return (FALSE); + } + +if (acpi_ev_match_pci_root_bridge (hid.value)) { +return (TRUE); + } + +/* +* The _HID did not match. +* Get the _CID and check for a PCI Root Bridge +*/ + status =acpi_ut_execute_CID (node, &cid); +if (ACPI_FAILURE (status)) { +return (FALSE); + } + +/* Check all _CIDs in the returned list */ + +for (i =0 ; i < cid->count; i++) { +if (acpi_ev_match_pci_root_bridge (cid->id[i].value)) { +ACPI_FREE (cid); +return (TRUE); + } + } + +ACPI_FREE (cid); +return (FALSE); +} + +/******************************************************************************* +* * FUNCTION: acpi_ev_pci_bar_region_setup * * PARAMETERS: Handle - Region we are interested in
Signature · 1 line
1.5.0.rc3.39.gec804