mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
+260
-270
File diff suppressed because it is too large
Load Diff
@@ -8,44 +8,44 @@
|
||||
#include <asm/pci-direct.h>
|
||||
#include <asm/acpi.h>
|
||||
|
||||
static int __init check_bridge(int vendor, int device)
|
||||
static int __init check_bridge(int vendor, int device)
|
||||
{
|
||||
/* According to Nvidia all timer overrides are bogus. Just ignore
|
||||
them all. */
|
||||
if (vendor == PCI_VENDOR_ID_NVIDIA) {
|
||||
acpi_skip_timer_override = 1;
|
||||
if (vendor == PCI_VENDOR_ID_NVIDIA) {
|
||||
acpi_skip_timer_override = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __init check_acpi_pci(void)
|
||||
{
|
||||
int num,slot,func;
|
||||
|
||||
void __init check_acpi_pci(void)
|
||||
{
|
||||
int num, slot, func;
|
||||
|
||||
/* Assume the machine supports type 1. If not it will
|
||||
always read ffffffff and should not have any side effect. */
|
||||
|
||||
/* Poor man's PCI discovery */
|
||||
for (num = 0; num < 32; num++) {
|
||||
for (slot = 0; slot < 32; slot++) {
|
||||
for (func = 0; func < 8; func++) {
|
||||
for (num = 0; num < 32; num++) {
|
||||
for (slot = 0; slot < 32; slot++) {
|
||||
for (func = 0; func < 8; func++) {
|
||||
u32 class;
|
||||
u32 vendor;
|
||||
class = read_pci_config(num,slot,func,
|
||||
class = read_pci_config(num, slot, func,
|
||||
PCI_CLASS_REVISION);
|
||||
if (class == 0xffffffff)
|
||||
break;
|
||||
break;
|
||||
|
||||
if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
|
||||
continue;
|
||||
|
||||
vendor = read_pci_config(num, slot, func,
|
||||
continue;
|
||||
|
||||
vendor = read_pci_config(num, slot, func,
|
||||
PCI_VENDOR_ID);
|
||||
|
||||
if (check_bridge(vendor&0xffff, vendor >> 16))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (check_bridge(vendor & 0xffff, vendor >> 16))
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,13 @@ extern void zap_low_mappings(void);
|
||||
|
||||
extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
|
||||
|
||||
static void init_low_mapping(pgd_t *pgd, int pgd_limit)
|
||||
static void init_low_mapping(pgd_t * pgd, int pgd_limit)
|
||||
{
|
||||
int pgd_ofs = 0;
|
||||
|
||||
while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
|
||||
set_pgd(pgd, *(pgd+USER_PTRS_PER_PGD));
|
||||
while ((pgd_ofs < pgd_limit)
|
||||
&& (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
|
||||
set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
|
||||
pgd_ofs++, pgd++;
|
||||
}
|
||||
flush_tlb_all();
|
||||
@@ -37,12 +38,13 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit)
|
||||
* Create an identity mapped page table and copy the wakeup routine to
|
||||
* low memory.
|
||||
*/
|
||||
int acpi_save_state_mem (void)
|
||||
int acpi_save_state_mem(void)
|
||||
{
|
||||
if (!acpi_wakeup_address)
|
||||
return 1;
|
||||
init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
|
||||
memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
|
||||
memcpy((void *)acpi_wakeup_address, &wakeup_start,
|
||||
&wakeup_end - &wakeup_start);
|
||||
acpi_copy_wakeup_routine(acpi_wakeup_address);
|
||||
|
||||
return 0;
|
||||
@@ -51,7 +53,7 @@ int acpi_save_state_mem (void)
|
||||
/*
|
||||
* acpi_restore_state - undo effects of acpi_save_state_mem
|
||||
*/
|
||||
void acpi_restore_state_mem (void)
|
||||
void acpi_restore_state_mem(void)
|
||||
{
|
||||
zap_low_mappings();
|
||||
}
|
||||
@@ -67,7 +69,8 @@ void acpi_restore_state_mem (void)
|
||||
void __init acpi_reserve_bootmem(void)
|
||||
{
|
||||
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) {
|
||||
printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n");
|
||||
printk(KERN_ERR
|
||||
"ACPI: Wakeup code way too big, S3 disabled.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
__setup("acpi_sleep=", acpi_sleep_setup);
|
||||
|
||||
|
||||
static __init int reset_videomode_after_s3(struct dmi_system_id *d)
|
||||
{
|
||||
acpi_video_flags |= 2;
|
||||
@@ -101,14 +102,14 @@ static __init int reset_videomode_after_s3(struct dmi_system_id *d)
|
||||
}
|
||||
|
||||
static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
|
||||
{ /* Reset video mode after returning from ACPI S3 sleep */
|
||||
.callback = reset_videomode_after_s3,
|
||||
.ident = "Toshiba Satellite 4030cdt",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
|
||||
},
|
||||
},
|
||||
{ }
|
||||
{ /* Reset video mode after returning from ACPI S3 sleep */
|
||||
.callback = reset_videomode_after_s3,
|
||||
.ident = "Toshiba Satellite 4030cdt",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
|
||||
},
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
static int __init acpisleep_dmi_init(void)
|
||||
|
||||
+21
-16
@@ -17,20 +17,20 @@
|
||||
#include <asm/acpi-ext.h>
|
||||
|
||||
struct acpi_vendor_descriptor {
|
||||
u8 guid_id;
|
||||
efi_guid_t guid;
|
||||
u8 guid_id;
|
||||
efi_guid_t guid;
|
||||
};
|
||||
|
||||
struct acpi_vendor_info {
|
||||
struct acpi_vendor_descriptor *descriptor;
|
||||
u8 *data;
|
||||
u32 length;
|
||||
struct acpi_vendor_descriptor *descriptor;
|
||||
u8 *data;
|
||||
u32 length;
|
||||
};
|
||||
|
||||
acpi_status
|
||||
acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
|
||||
{
|
||||
struct acpi_vendor_info *info = (struct acpi_vendor_info *) context;
|
||||
struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
|
||||
struct acpi_resource_vendor *vendor;
|
||||
struct acpi_vendor_descriptor *descriptor;
|
||||
u32 length;
|
||||
@@ -38,8 +38,8 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
|
||||
if (resource->id != ACPI_RSTYPE_VENDOR)
|
||||
return AE_OK;
|
||||
|
||||
vendor = (struct acpi_resource_vendor *) &resource->data;
|
||||
descriptor = (struct acpi_vendor_descriptor *) vendor->reserved;
|
||||
vendor = (struct acpi_resource_vendor *)&resource->data;
|
||||
descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
|
||||
if (vendor->length <= sizeof(*info->descriptor) ||
|
||||
descriptor->guid_id != info->descriptor->guid_id ||
|
||||
efi_guidcmp(descriptor->guid, info->descriptor->guid))
|
||||
@@ -50,21 +50,24 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
|
||||
if (!info->data)
|
||||
return AE_NO_MEMORY;
|
||||
|
||||
memcpy(info->data, vendor->reserved + sizeof(struct acpi_vendor_descriptor), length);
|
||||
memcpy(info->data,
|
||||
vendor->reserved + sizeof(struct acpi_vendor_descriptor),
|
||||
length);
|
||||
info->length = length;
|
||||
return AE_CTRL_TERMINATE;
|
||||
}
|
||||
|
||||
acpi_status
|
||||
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
|
||||
u8 **data, u32 *length)
|
||||
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
|
||||
u8 ** data, u32 * length)
|
||||
{
|
||||
struct acpi_vendor_info info;
|
||||
|
||||
info.descriptor = id;
|
||||
info.data = NULL;
|
||||
|
||||
acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info);
|
||||
acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match,
|
||||
&info);
|
||||
if (!info.data)
|
||||
return AE_NOT_FOUND;
|
||||
|
||||
@@ -75,17 +78,19 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
|
||||
|
||||
struct acpi_vendor_descriptor hp_ccsr_descriptor = {
|
||||
.guid_id = 2,
|
||||
.guid = EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad)
|
||||
.guid =
|
||||
EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01,
|
||||
0x37, 0x0e, 0xad)
|
||||
};
|
||||
|
||||
acpi_status
|
||||
hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
|
||||
acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length)
|
||||
{
|
||||
acpi_status status;
|
||||
u8 *data;
|
||||
u32 length;
|
||||
|
||||
status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
|
||||
status =
|
||||
acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
|
||||
|
||||
if (ACPI_FAILURE(status) || length != 16)
|
||||
return AE_NOT_FOUND;
|
||||
|
||||
+168
-158
File diff suppressed because it is too large
Load Diff
@@ -47,7 +47,6 @@
|
||||
#include <asm/proto.h>
|
||||
#include <asm/tlbflush.h>
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Low-Level Sleep Support
|
||||
-------------------------------------------------------------------------- */
|
||||
@@ -77,11 +76,12 @@ static void init_low_mapping(void)
|
||||
* Create an identity mapped page table and copy the wakeup routine to
|
||||
* low memory.
|
||||
*/
|
||||
int acpi_save_state_mem (void)
|
||||
int acpi_save_state_mem(void)
|
||||
{
|
||||
init_low_mapping();
|
||||
|
||||
memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
|
||||
memcpy((void *)acpi_wakeup_address, &wakeup_start,
|
||||
&wakeup_end - &wakeup_start);
|
||||
acpi_copy_wakeup_routine(acpi_wakeup_address);
|
||||
|
||||
return 0;
|
||||
@@ -90,7 +90,7 @@ int acpi_save_state_mem (void)
|
||||
/*
|
||||
* acpi_restore_state
|
||||
*/
|
||||
void acpi_restore_state_mem (void)
|
||||
void acpi_restore_state_mem(void)
|
||||
{
|
||||
set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
|
||||
flush_tlb_all();
|
||||
@@ -108,7 +108,8 @@ void __init acpi_reserve_bootmem(void)
|
||||
{
|
||||
acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
|
||||
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
|
||||
printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
|
||||
printk(KERN_CRIT
|
||||
"ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
|
||||
}
|
||||
|
||||
static int __init acpi_sleep_setup(char *str)
|
||||
@@ -127,6 +128,8 @@ static int __init acpi_sleep_setup(char *str)
|
||||
|
||||
__setup("acpi_sleep=", acpi_sleep_setup);
|
||||
|
||||
#endif /*CONFIG_ACPI_SLEEP*/
|
||||
#endif /*CONFIG_ACPI_SLEEP */
|
||||
|
||||
void acpi_pci_link_exit(void) {}
|
||||
void acpi_pci_link_exit(void)
|
||||
{
|
||||
}
|
||||
|
||||
+56
-82
@@ -32,7 +32,6 @@
|
||||
#include <acpi/acpi_bus.h>
|
||||
#include <acpi/acpi_drivers.h>
|
||||
|
||||
|
||||
#define ACPI_AC_COMPONENT 0x00020000
|
||||
#define ACPI_AC_CLASS "ac_adapter"
|
||||
#define ACPI_AC_HID "ACPI0003"
|
||||
@@ -45,47 +44,45 @@
|
||||
#define ACPI_AC_STATUS_UNKNOWN 0xFF
|
||||
|
||||
#define _COMPONENT ACPI_AC_COMPONENT
|
||||
ACPI_MODULE_NAME ("acpi_ac")
|
||||
ACPI_MODULE_NAME("acpi_ac")
|
||||
|
||||
MODULE_AUTHOR("Paul Diefenbaugh");
|
||||
MODULE_AUTHOR("Paul Diefenbaugh");
|
||||
MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int acpi_ac_add (struct acpi_device *device);
|
||||
static int acpi_ac_remove (struct acpi_device *device, int type);
|
||||
static int acpi_ac_add(struct acpi_device *device);
|
||||
static int acpi_ac_remove(struct acpi_device *device, int type);
|
||||
static int acpi_ac_open_fs(struct inode *inode, struct file *file);
|
||||
|
||||
static struct acpi_driver acpi_ac_driver = {
|
||||
.name = ACPI_AC_DRIVER_NAME,
|
||||
.class = ACPI_AC_CLASS,
|
||||
.ids = ACPI_AC_HID,
|
||||
.ops = {
|
||||
.add = acpi_ac_add,
|
||||
.remove = acpi_ac_remove,
|
||||
},
|
||||
.name = ACPI_AC_DRIVER_NAME,
|
||||
.class = ACPI_AC_CLASS,
|
||||
.ids = ACPI_AC_HID,
|
||||
.ops = {
|
||||
.add = acpi_ac_add,
|
||||
.remove = acpi_ac_remove,
|
||||
},
|
||||
};
|
||||
|
||||
struct acpi_ac {
|
||||
acpi_handle handle;
|
||||
unsigned long state;
|
||||
acpi_handle handle;
|
||||
unsigned long state;
|
||||
};
|
||||
|
||||
static struct file_operations acpi_ac_fops = {
|
||||
.open = acpi_ac_open_fs,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.open = acpi_ac_open_fs,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
AC Adapter Management
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
acpi_ac_get_state (
|
||||
struct acpi_ac *ac)
|
||||
static int acpi_ac_get_state(struct acpi_ac *ac)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_get_state");
|
||||
|
||||
@@ -95,24 +92,23 @@ acpi_ac_get_state (
|
||||
status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error reading AC Adapter state\n"));
|
||||
"Error reading AC Adapter state\n"));
|
||||
ac->state = ACPI_AC_STATUS_UNKNOWN;
|
||||
return_VALUE(-ENODEV);
|
||||
}
|
||||
|
||||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
static struct proc_dir_entry *acpi_ac_dir;
|
||||
static struct proc_dir_entry *acpi_ac_dir;
|
||||
|
||||
static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
|
||||
{
|
||||
struct acpi_ac *ac = (struct acpi_ac *) seq->private;
|
||||
struct acpi_ac *ac = (struct acpi_ac *)seq->private;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
|
||||
|
||||
@@ -139,23 +135,21 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
|
||||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static int acpi_ac_open_fs(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_ac_add_fs (
|
||||
struct acpi_device *device)
|
||||
static int acpi_ac_add_fs(struct acpi_device *device)
|
||||
{
|
||||
struct proc_dir_entry *entry = NULL;
|
||||
struct proc_dir_entry *entry = NULL;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
|
||||
|
||||
if (!acpi_device_dir(device)) {
|
||||
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
||||
acpi_ac_dir);
|
||||
acpi_ac_dir);
|
||||
if (!acpi_device_dir(device))
|
||||
return_VALUE(-ENODEV);
|
||||
acpi_device_dir(device)->owner = THIS_MODULE;
|
||||
@@ -163,11 +157,11 @@ acpi_ac_add_fs (
|
||||
|
||||
/* 'state' [R] */
|
||||
entry = create_proc_entry(ACPI_AC_FILE_STATE,
|
||||
S_IRUGO, acpi_device_dir(device));
|
||||
S_IRUGO, acpi_device_dir(device));
|
||||
if (!entry)
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Unable to create '%s' fs entry\n",
|
||||
ACPI_AC_FILE_STATE));
|
||||
"Unable to create '%s' fs entry\n",
|
||||
ACPI_AC_FILE_STATE));
|
||||
else {
|
||||
entry->proc_fops = &acpi_ac_fops;
|
||||
entry->data = acpi_driver_data(device);
|
||||
@@ -177,16 +171,12 @@ acpi_ac_add_fs (
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
acpi_ac_remove_fs (
|
||||
struct acpi_device *device)
|
||||
static int acpi_ac_remove_fs(struct acpi_device *device)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
|
||||
|
||||
if (acpi_device_dir(device)) {
|
||||
remove_proc_entry(ACPI_AC_FILE_STATE,
|
||||
acpi_device_dir(device));
|
||||
remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
|
||||
|
||||
remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
|
||||
acpi_device_dir(device) = NULL;
|
||||
@@ -195,19 +185,14 @@ acpi_ac_remove_fs (
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Driver Model
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
acpi_ac_notify (
|
||||
acpi_handle handle,
|
||||
u32 event,
|
||||
void *data)
|
||||
static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
|
||||
{
|
||||
struct acpi_ac *ac = (struct acpi_ac *) data;
|
||||
struct acpi_device *device = NULL;
|
||||
struct acpi_ac *ac = (struct acpi_ac *)data;
|
||||
struct acpi_device *device = NULL;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_notify");
|
||||
|
||||
@@ -224,21 +209,18 @@ acpi_ac_notify (
|
||||
break;
|
||||
default:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Unsupported event [0x%x]\n", event));
|
||||
"Unsupported event [0x%x]\n", event));
|
||||
break;
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
acpi_ac_add (
|
||||
struct acpi_device *device)
|
||||
static int acpi_ac_add(struct acpi_device *device)
|
||||
{
|
||||
int result = 0;
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_ac *ac = NULL;
|
||||
int result = 0;
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_ac *ac = NULL;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_add");
|
||||
|
||||
@@ -264,19 +246,20 @@ acpi_ac_add (
|
||||
goto end;
|
||||
|
||||
status = acpi_install_notify_handler(ac->handle,
|
||||
ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac);
|
||||
ACPI_DEVICE_NOTIFY, acpi_ac_notify,
|
||||
ac);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error installing notify handler\n"));
|
||||
"Error installing notify handler\n"));
|
||||
result = -ENODEV;
|
||||
goto end;
|
||||
}
|
||||
|
||||
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
|
||||
acpi_device_name(device), acpi_device_bid(device),
|
||||
ac->state?"on-line":"off-line");
|
||||
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
|
||||
acpi_device_name(device), acpi_device_bid(device),
|
||||
ac->state ? "on-line" : "off-line");
|
||||
|
||||
end:
|
||||
end:
|
||||
if (result) {
|
||||
acpi_ac_remove_fs(device);
|
||||
kfree(ac);
|
||||
@@ -285,27 +268,23 @@ end:
|
||||
return_VALUE(result);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
acpi_ac_remove (
|
||||
struct acpi_device *device,
|
||||
int type)
|
||||
static int acpi_ac_remove(struct acpi_device *device, int type)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_ac *ac = NULL;
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_ac *ac = NULL;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_remove");
|
||||
|
||||
if (!device || !acpi_driver_data(device))
|
||||
return_VALUE(-EINVAL);
|
||||
|
||||
ac = (struct acpi_ac *) acpi_driver_data(device);
|
||||
ac = (struct acpi_ac *)acpi_driver_data(device);
|
||||
|
||||
status = acpi_remove_notify_handler(ac->handle,
|
||||
ACPI_DEVICE_NOTIFY, acpi_ac_notify);
|
||||
ACPI_DEVICE_NOTIFY, acpi_ac_notify);
|
||||
if (ACPI_FAILURE(status))
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error removing notify handler\n"));
|
||||
"Error removing notify handler\n"));
|
||||
|
||||
acpi_ac_remove_fs(device);
|
||||
|
||||
@@ -314,11 +293,9 @@ acpi_ac_remove (
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
acpi_ac_init (void)
|
||||
static int __init acpi_ac_init(void)
|
||||
{
|
||||
int result = 0;
|
||||
int result = 0;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_init");
|
||||
|
||||
@@ -336,9 +313,7 @@ acpi_ac_init (void)
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static void __exit
|
||||
acpi_ac_exit (void)
|
||||
static void __exit acpi_ac_exit(void)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE("acpi_ac_exit");
|
||||
|
||||
@@ -349,6 +324,5 @@ acpi_ac_exit (void)
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
module_init(acpi_ac_init);
|
||||
module_exit(acpi_ac_exit);
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <linux/memory_hotplug.h>
|
||||
#include <acpi/acpi_drivers.h>
|
||||
|
||||
|
||||
#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL
|
||||
#define ACPI_MEMORY_DEVICE_CLASS "memory"
|
||||
#define ACPI_MEMORY_DEVICE_HID "PNP0C80"
|
||||
@@ -41,8 +40,8 @@
|
||||
|
||||
#define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT
|
||||
|
||||
ACPI_MODULE_NAME ("acpi_memory")
|
||||
MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
|
||||
ACPI_MODULE_NAME("acpi_memory")
|
||||
MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
|
||||
MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -56,34 +55,33 @@ MODULE_LICENSE("GPL");
|
||||
#define MEMORY_POWER_ON_STATE 1
|
||||
#define MEMORY_POWER_OFF_STATE 2
|
||||
|
||||
static int acpi_memory_device_add (struct acpi_device *device);
|
||||
static int acpi_memory_device_remove (struct acpi_device *device, int type);
|
||||
static int acpi_memory_device_add(struct acpi_device *device);
|
||||
static int acpi_memory_device_remove(struct acpi_device *device, int type);
|
||||
|
||||
static struct acpi_driver acpi_memory_device_driver = {
|
||||
.name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
|
||||
.class = ACPI_MEMORY_DEVICE_CLASS,
|
||||
.ids = ACPI_MEMORY_DEVICE_HID,
|
||||
.ops = {
|
||||
.add = acpi_memory_device_add,
|
||||
.remove = acpi_memory_device_remove,
|
||||
},
|
||||
.name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
|
||||
.class = ACPI_MEMORY_DEVICE_CLASS,
|
||||
.ids = ACPI_MEMORY_DEVICE_HID,
|
||||
.ops = {
|
||||
.add = acpi_memory_device_add,
|
||||
.remove = acpi_memory_device_remove,
|
||||
},
|
||||
};
|
||||
|
||||
struct acpi_memory_device {
|
||||
acpi_handle handle;
|
||||
unsigned int state; /* State of the memory device */
|
||||
unsigned int state; /* State of the memory device */
|
||||
unsigned short cache_attribute; /* memory cache attribute */
|
||||
unsigned short read_write_attribute;/* memory read/write attribute */
|
||||
u64 start_addr; /* Memory Range start physical addr */
|
||||
u64 end_addr; /* Memory Range end physical addr */
|
||||
unsigned short read_write_attribute; /* memory read/write attribute */
|
||||
u64 start_addr; /* Memory Range start physical addr */
|
||||
u64 end_addr; /* Memory Range end physical addr */
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
struct acpi_resource *resource = NULL;
|
||||
struct acpi_resource_address64 address64;
|
||||
|
||||
@@ -94,15 +92,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
||||
if (ACPI_FAILURE(status))
|
||||
return_VALUE(-EINVAL);
|
||||
|
||||
resource = (struct acpi_resource *) buffer.pointer;
|
||||
resource = (struct acpi_resource *)buffer.pointer;
|
||||
status = acpi_resource_to_address64(resource, &address64);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
if (address64.resource_type == ACPI_MEMORY_RANGE) {
|
||||
/* Populate the structure */
|
||||
mem_device->cache_attribute =
|
||||
address64.attribute.memory.cache_attribute;
|
||||
address64.attribute.memory.cache_attribute;
|
||||
mem_device->read_write_attribute =
|
||||
address64.attribute.memory.read_write_attribute;
|
||||
address64.attribute.memory.read_write_attribute;
|
||||
mem_device->start_addr = address64.min_address_range;
|
||||
mem_device->end_addr = address64.max_address_range;
|
||||
}
|
||||
@@ -114,7 +112,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
||||
|
||||
static int
|
||||
acpi_memory_get_device(acpi_handle handle,
|
||||
struct acpi_memory_device **mem_device)
|
||||
struct acpi_memory_device **mem_device)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_handle phandle;
|
||||
@@ -128,8 +126,7 @@ acpi_memory_get_device(acpi_handle handle,
|
||||
|
||||
status = acpi_get_parent(handle, &phandle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error in acpi_get_parent\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
|
||||
return_VALUE(-EINVAL);
|
||||
}
|
||||
|
||||
@@ -137,7 +134,7 @@ acpi_memory_get_device(acpi_handle handle,
|
||||
status = acpi_bus_get_device(phandle, &pdevice);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error in acpi_bus_get_device\n"));
|
||||
"Error in acpi_bus_get_device\n"));
|
||||
return_VALUE(-EINVAL);
|
||||
}
|
||||
|
||||
@@ -147,23 +144,21 @@ acpi_memory_get_device(acpi_handle handle,
|
||||
*/
|
||||
status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error in acpi_bus_add\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
|
||||
return_VALUE(-EINVAL);
|
||||
}
|
||||
|
||||
end:
|
||||
end:
|
||||
*mem_device = acpi_driver_data(device);
|
||||
if (!(*mem_device)) {
|
||||
printk(KERN_ERR "\n driver data not found" );
|
||||
printk(KERN_ERR "\n driver data not found");
|
||||
return_VALUE(-ENODEV);
|
||||
}
|
||||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_memory_check_device(struct acpi_memory_device *mem_device)
|
||||
static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
|
||||
{
|
||||
unsigned long current_status;
|
||||
|
||||
@@ -171,22 +166,21 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device)
|
||||
|
||||
/* Get device present/absent information from the _STA */
|
||||
if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
|
||||
NULL, ¤t_status)))
|
||||
NULL, ¤t_status)))
|
||||
return_VALUE(-ENODEV);
|
||||
/*
|
||||
* Check for device status. Device should be
|
||||
* present/enabled/functioning.
|
||||
*/
|
||||
if (!((current_status & ACPI_MEMORY_STA_PRESENT)
|
||||
&& (current_status & ACPI_MEMORY_STA_ENABLED)
|
||||
&& (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
|
||||
&& (current_status & ACPI_MEMORY_STA_ENABLED)
|
||||
&& (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
|
||||
return_VALUE(-ENODEV);
|
||||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||
static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -196,7 +190,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||
result = acpi_memory_get_device_resources(mem_device);
|
||||
if (result) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"\nget_device_resources failed\n"));
|
||||
"\nget_device_resources failed\n"));
|
||||
mem_device->state = MEMORY_INVALID_STATE;
|
||||
return result;
|
||||
}
|
||||
@@ -206,11 +200,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||
* Note: Assume that this function returns zero on success
|
||||
*/
|
||||
result = add_memory(mem_device->start_addr,
|
||||
(mem_device->end_addr - mem_device->start_addr) + 1,
|
||||
mem_device->read_write_attribute);
|
||||
(mem_device->end_addr - mem_device->start_addr) + 1,
|
||||
mem_device->read_write_attribute);
|
||||
if (result) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"\nadd_memory failed\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
|
||||
mem_device->state = MEMORY_INVALID_STATE;
|
||||
return result;
|
||||
}
|
||||
@@ -218,11 +211,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
||||
static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_object_list arg_list;
|
||||
struct acpi_object_list arg_list;
|
||||
union acpi_object arg;
|
||||
unsigned long current_status;
|
||||
|
||||
@@ -234,16 +226,16 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
||||
arg.type = ACPI_TYPE_INTEGER;
|
||||
arg.integer.value = 1;
|
||||
status = acpi_evaluate_object(mem_device->handle,
|
||||
"_EJ0", &arg_list, NULL);
|
||||
"_EJ0", &arg_list, NULL);
|
||||
/* Return on _EJ0 failure */
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"_EJ0 failed.\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n"));
|
||||
return_VALUE(-ENODEV);
|
||||
}
|
||||
|
||||
/* Evalute _STA to check if the device is disabled */
|
||||
status = acpi_evaluate_integer(mem_device->handle, "_STA",
|
||||
NULL, ¤t_status);
|
||||
NULL, ¤t_status);
|
||||
if (ACPI_FAILURE(status))
|
||||
return_VALUE(-ENODEV);
|
||||
|
||||
@@ -254,8 +246,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
||||
static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
||||
{
|
||||
int result;
|
||||
u64 start = mem_device->start_addr;
|
||||
@@ -278,7 +269,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
||||
result = acpi_memory_powerdown_device(mem_device);
|
||||
if (result) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Device Power Down failed.\n"));
|
||||
"Device Power Down failed.\n"));
|
||||
/* Set the status of the device to invalid */
|
||||
mem_device->state = MEMORY_INVALID_STATE;
|
||||
return result;
|
||||
@@ -288,8 +279,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||
static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||
{
|
||||
struct acpi_memory_device *mem_device;
|
||||
struct acpi_device *device;
|
||||
@@ -299,37 +289,37 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||
switch (event) {
|
||||
case ACPI_NOTIFY_BUS_CHECK:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"\nReceived BUS CHECK notification for device\n"));
|
||||
"\nReceived BUS CHECK notification for device\n"));
|
||||
/* Fall Through */
|
||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
||||
if (event == ACPI_NOTIFY_DEVICE_CHECK)
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"\nReceived DEVICE CHECK notification for device\n"));
|
||||
"\nReceived DEVICE CHECK notification for device\n"));
|
||||
if (acpi_memory_get_device(handle, &mem_device)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error in finding driver data\n"));
|
||||
"Error in finding driver data\n"));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
if (!acpi_memory_check_device(mem_device)) {
|
||||
if (acpi_memory_enable_device(mem_device))
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error in acpi_memory_enable_device\n"));
|
||||
"Error in acpi_memory_enable_device\n"));
|
||||
}
|
||||
break;
|
||||
case ACPI_NOTIFY_EJECT_REQUEST:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"\nReceived EJECT REQUEST notification for device\n"));
|
||||
"\nReceived EJECT REQUEST notification for device\n"));
|
||||
|
||||
if (acpi_bus_get_device(handle, &device)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Device doesn't exist\n"));
|
||||
"Device doesn't exist\n"));
|
||||
break;
|
||||
}
|
||||
mem_device = acpi_driver_data(device);
|
||||
if (!mem_device) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Driver Data is NULL\n"));
|
||||
"Driver Data is NULL\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -337,26 +327,25 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||
* Currently disabling memory device from kernel mode
|
||||
* TBD: Can also be disabled from user mode scripts
|
||||
* TBD: Can also be disabled by Callback registration
|
||||
* with generic sysfs driver
|
||||
* with generic sysfs driver
|
||||
*/
|
||||
if (acpi_memory_disable_device(mem_device))
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error in acpi_memory_disable_device\n"));
|
||||
"Error in acpi_memory_disable_device\n"));
|
||||
/*
|
||||
* TBD: Invoke acpi_bus_remove to cleanup data structures
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Unsupported event [0x%x]\n", event));
|
||||
"Unsupported event [0x%x]\n", event));
|
||||
break;
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_memory_device_add(struct acpi_device *device)
|
||||
static int acpi_memory_device_add(struct acpi_device *device)
|
||||
{
|
||||
int result;
|
||||
struct acpi_memory_device *mem_device = NULL;
|
||||
@@ -391,8 +380,7 @@ acpi_memory_device_add(struct acpi_device *device)
|
||||
return_VALUE(result);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_memory_device_remove (struct acpi_device *device, int type)
|
||||
static int acpi_memory_device_remove(struct acpi_device *device, int type)
|
||||
{
|
||||
struct acpi_memory_device *mem_device = NULL;
|
||||
|
||||
@@ -401,7 +389,7 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
|
||||
if (!device || !acpi_driver_data(device))
|
||||
return_VALUE(-EINVAL);
|
||||
|
||||
mem_device = (struct acpi_memory_device *) acpi_driver_data(device);
|
||||
mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
|
||||
kfree(mem_device);
|
||||
|
||||
return_VALUE(0);
|
||||
@@ -410,12 +398,11 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
|
||||
/*
|
||||
* Helper function to check for memory device
|
||||
*/
|
||||
static acpi_status
|
||||
is_memory_device(acpi_handle handle)
|
||||
static acpi_status is_memory_device(acpi_handle handle)
|
||||
{
|
||||
char *hardware_id;
|
||||
acpi_status status;
|
||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
struct acpi_device_info *info;
|
||||
|
||||
ACPI_FUNCTION_TRACE("is_memory_device");
|
||||
@@ -432,7 +419,7 @@ is_memory_device(acpi_handle handle)
|
||||
|
||||
hardware_id = info->hardware_id.value;
|
||||
if ((hardware_id == NULL) ||
|
||||
(strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
|
||||
(strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
|
||||
status = AE_ERROR;
|
||||
|
||||
acpi_os_free(buffer.pointer);
|
||||
@@ -440,8 +427,8 @@ is_memory_device(acpi_handle handle)
|
||||
}
|
||||
|
||||
static acpi_status
|
||||
acpi_memory_register_notify_handler (acpi_handle handle,
|
||||
u32 level, void *ctxt, void **retv)
|
||||
acpi_memory_register_notify_handler(acpi_handle handle,
|
||||
u32 level, void *ctxt, void **retv)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
@@ -452,10 +439,10 @@ acpi_memory_register_notify_handler (acpi_handle handle,
|
||||
return_ACPI_STATUS(AE_OK); /* continue */
|
||||
|
||||
status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
|
||||
acpi_memory_device_notify, NULL);
|
||||
acpi_memory_device_notify, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error installing notify handler\n"));
|
||||
"Error installing notify handler\n"));
|
||||
return_ACPI_STATUS(AE_OK); /* continue */
|
||||
}
|
||||
|
||||
@@ -463,8 +450,8 @@ acpi_memory_register_notify_handler (acpi_handle handle,
|
||||
}
|
||||
|
||||
static acpi_status
|
||||
acpi_memory_deregister_notify_handler (acpi_handle handle,
|
||||
u32 level, void *ctxt, void **retv)
|
||||
acpi_memory_deregister_notify_handler(acpi_handle handle,
|
||||
u32 level, void *ctxt, void **retv)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
@@ -475,18 +462,18 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
|
||||
return_ACPI_STATUS(AE_OK); /* continue */
|
||||
|
||||
status = acpi_remove_notify_handler(handle,
|
||||
ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify);
|
||||
ACPI_SYSTEM_NOTIFY,
|
||||
acpi_memory_device_notify);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Error removing notify handler\n"));
|
||||
"Error removing notify handler\n"));
|
||||
return_ACPI_STATUS(AE_OK); /* continue */
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
static int __init
|
||||
acpi_memory_device_init (void)
|
||||
static int __init acpi_memory_device_init(void)
|
||||
{
|
||||
int result;
|
||||
acpi_status status;
|
||||
@@ -499,21 +486,20 @@ acpi_memory_device_init (void)
|
||||
return_VALUE(-ENODEV);
|
||||
|
||||
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
acpi_memory_register_notify_handler,
|
||||
NULL, NULL);
|
||||
ACPI_UINT32_MAX,
|
||||
acpi_memory_register_notify_handler,
|
||||
NULL, NULL);
|
||||
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
|
||||
acpi_bus_unregister_driver(&acpi_memory_device_driver);
|
||||
return_VALUE(-ENODEV);
|
||||
}
|
||||
}
|
||||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
static void __exit
|
||||
acpi_memory_device_exit (void)
|
||||
static void __exit acpi_memory_device_exit(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
@@ -524,12 +510,12 @@ acpi_memory_device_exit (void)
|
||||
* handles.
|
||||
*/
|
||||
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
acpi_memory_deregister_notify_handler,
|
||||
NULL, NULL);
|
||||
ACPI_UINT32_MAX,
|
||||
acpi_memory_deregister_notify_handler,
|
||||
NULL, NULL);
|
||||
|
||||
if (ACPI_FAILURE (status))
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
|
||||
if (ACPI_FAILURE(status))
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
|
||||
|
||||
acpi_bus_unregister_driver(&acpi_memory_device_driver);
|
||||
|
||||
@@ -538,5 +524,3 @@ acpi_memory_device_exit (void)
|
||||
|
||||
module_init(acpi_memory_device_init);
|
||||
module_exit(acpi_memory_device_exit);
|
||||
|
||||
|
||||
|
||||
+344
-346
File diff suppressed because it is too large
Load Diff
+186
-220
File diff suppressed because it is too large
Load Diff
+64
-54
@@ -26,7 +26,6 @@
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
@@ -34,49 +33,49 @@
|
||||
#include <acpi/acpi_bus.h>
|
||||
#include <linux/dmi.h>
|
||||
|
||||
enum acpi_blacklist_predicates
|
||||
{
|
||||
all_versions,
|
||||
less_than_or_equal,
|
||||
equal,
|
||||
greater_than_or_equal,
|
||||
enum acpi_blacklist_predicates {
|
||||
all_versions,
|
||||
less_than_or_equal,
|
||||
equal,
|
||||
greater_than_or_equal,
|
||||
};
|
||||
|
||||
struct acpi_blacklist_item
|
||||
{
|
||||
char oem_id[7];
|
||||
char oem_table_id[9];
|
||||
u32 oem_revision;
|
||||
acpi_table_type table;
|
||||
enum acpi_blacklist_predicates oem_revision_predicate;
|
||||
char *reason;
|
||||
u32 is_critical_error;
|
||||
struct acpi_blacklist_item {
|
||||
char oem_id[7];
|
||||
char oem_table_id[9];
|
||||
u32 oem_revision;
|
||||
acpi_table_type table;
|
||||
enum acpi_blacklist_predicates oem_revision_predicate;
|
||||
char *reason;
|
||||
u32 is_critical_error;
|
||||
};
|
||||
|
||||
/*
|
||||
* POLICY: If *anything* doesn't work, put it on the blacklist.
|
||||
* If they are critical errors, mark it critical, and abort driver load.
|
||||
*/
|
||||
static struct acpi_blacklist_item acpi_blacklist[] __initdata =
|
||||
{
|
||||
static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
|
||||
/* Compaq Presario 1700 */
|
||||
{"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal, "Multiple problems", 1},
|
||||
{"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal,
|
||||
"Multiple problems", 1},
|
||||
/* Sony FX120, FX140, FX150? */
|
||||
{"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal, "ACPI driver problem", 1},
|
||||
{"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal,
|
||||
"ACPI driver problem", 1},
|
||||
/* Compaq Presario 800, Insyde BIOS */
|
||||
{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, "Does not use _REG to protect EC OpRegions", 1},
|
||||
{"INT440", "SYSFexxx", 0x00001001, ACPI_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, "Incorrect _ADR", 1},
|
||||
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
|
||||
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal,
|
||||
"Incorrect _ADR", 1},
|
||||
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions,
|
||||
"Bogus PCI routing", 1},
|
||||
|
||||
{""}
|
||||
};
|
||||
|
||||
|
||||
#if CONFIG_ACPI_BLACKLIST_YEAR
|
||||
|
||||
static int __init
|
||||
blacklist_by_year(void)
|
||||
static int __init blacklist_by_year(void)
|
||||
{
|
||||
int year;
|
||||
char *s = dmi_get_system_info(DMI_BIOS_DATE);
|
||||
@@ -92,36 +91,38 @@ blacklist_by_year(void)
|
||||
|
||||
s += 1;
|
||||
|
||||
year = simple_strtoul(s,NULL,0);
|
||||
year = simple_strtoul(s, NULL, 0);
|
||||
|
||||
if (year < 100) { /* 2-digit year */
|
||||
if (year < 100) { /* 2-digit year */
|
||||
year += 1900;
|
||||
if (year < 1996) /* no dates < spec 1.0 */
|
||||
year += 100;
|
||||
}
|
||||
|
||||
if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
|
||||
printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
|
||||
"acpi=force is required to enable ACPI\n",
|
||||
year, CONFIG_ACPI_BLACKLIST_YEAR);
|
||||
printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
|
||||
"acpi=force is required to enable ACPI\n",
|
||||
year, CONFIG_ACPI_BLACKLIST_YEAR);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static inline int blacklist_by_year(void) { return 0; }
|
||||
static inline int blacklist_by_year(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int __init
|
||||
acpi_blacklisted(void)
|
||||
int __init acpi_blacklisted(void)
|
||||
{
|
||||
int i = 0;
|
||||
int blacklisted = 0;
|
||||
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)) {
|
||||
while (acpi_blacklist[i].oem_id[0] != '\0') {
|
||||
if (acpi_get_table_header_early
|
||||
(acpi_blacklist[i].table, &table_header)) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
@@ -131,33 +132,43 @@ acpi_blacklisted(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp(acpi_blacklist[i].oem_table_id, table_header->oem_table_id, 8)) {
|
||||
if (strncmp
|
||||
(acpi_blacklist[i].oem_table_id, table_header->oem_table_id,
|
||||
8)) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
|
||||
|| (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
|
||||
&& table_header->oem_revision <= acpi_blacklist[i].oem_revision)
|
||||
|| (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
|
||||
&& table_header->oem_revision >= acpi_blacklist[i].oem_revision)
|
||||
|| (acpi_blacklist[i].oem_revision_predicate ==
|
||||
less_than_or_equal
|
||||
&& table_header->oem_revision <=
|
||||
acpi_blacklist[i].oem_revision)
|
||||
|| (acpi_blacklist[i].oem_revision_predicate ==
|
||||
greater_than_or_equal
|
||||
&& table_header->oem_revision >=
|
||||
acpi_blacklist[i].oem_revision)
|
||||
|| (acpi_blacklist[i].oem_revision_predicate == equal
|
||||
&& table_header->oem_revision == acpi_blacklist[i].oem_revision)) {
|
||||
&& table_header->oem_revision ==
|
||||
acpi_blacklist[i].oem_revision)) {
|
||||
|
||||
printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" "
|
||||
"Revision 0x%x has a known ACPI BIOS problem.\n",
|
||||
acpi_blacklist[i].oem_id,
|
||||
acpi_blacklist[i].oem_table_id,
|
||||
acpi_blacklist[i].oem_revision);
|
||||
printk(KERN_ERR PREFIX
|
||||
"Vendor \"%6.6s\" System \"%8.8s\" "
|
||||
"Revision 0x%x has a known ACPI BIOS problem.\n",
|
||||
acpi_blacklist[i].oem_id,
|
||||
acpi_blacklist[i].oem_table_id,
|
||||
acpi_blacklist[i].oem_revision);
|
||||
|
||||
printk(KERN_ERR PREFIX "Reason: %s. This is a %s error\n",
|
||||
acpi_blacklist[i].reason,
|
||||
(acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable"));
|
||||
printk(KERN_ERR PREFIX
|
||||
"Reason: %s. This is a %s error\n",
|
||||
acpi_blacklist[i].reason,
|
||||
(acpi_blacklist[i].
|
||||
is_critical_error ? "non-recoverable" :
|
||||
"recoverable"));
|
||||
|
||||
blacklisted = acpi_blacklist[i].is_critical_error;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -166,4 +177,3 @@ acpi_blacklisted(void)
|
||||
|
||||
return blacklisted;
|
||||
}
|
||||
|
||||
|
||||
+151
-159
File diff suppressed because it is too large
Load Diff
+123
-151
File diff suppressed because it is too large
Load Diff
+56
-72
@@ -44,9 +44,9 @@
|
||||
|
||||
#define ACPI_CONTAINER_COMPONENT 0x01000000
|
||||
#define _COMPONENT ACPI_CONTAINER_COMPONENT
|
||||
ACPI_MODULE_NAME ("acpi_container")
|
||||
ACPI_MODULE_NAME("acpi_container")
|
||||
|
||||
MODULE_AUTHOR("Anil S Keshavamurthy");
|
||||
MODULE_AUTHOR("Anil S Keshavamurthy");
|
||||
MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -56,41 +56,38 @@ static int acpi_container_add(struct acpi_device *device);
|
||||
static int acpi_container_remove(struct acpi_device *device, int type);
|
||||
|
||||
static struct acpi_driver acpi_container_driver = {
|
||||
.name = ACPI_CONTAINER_DRIVER_NAME,
|
||||
.class = ACPI_CONTAINER_CLASS,
|
||||
.ids = "ACPI0004,PNP0A05,PNP0A06",
|
||||
.ops = {
|
||||
.add = acpi_container_add,
|
||||
.remove = acpi_container_remove,
|
||||
},
|
||||
.name = ACPI_CONTAINER_DRIVER_NAME,
|
||||
.class = ACPI_CONTAINER_CLASS,
|
||||
.ids = "ACPI0004,PNP0A05,PNP0A06",
|
||||
.ops = {
|
||||
.add = acpi_container_add,
|
||||
.remove = acpi_container_remove,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
static int
|
||||
is_device_present(acpi_handle handle)
|
||||
static int is_device_present(acpi_handle handle)
|
||||
{
|
||||
acpi_handle temp;
|
||||
acpi_status status;
|
||||
unsigned long sta;
|
||||
acpi_handle temp;
|
||||
acpi_status status;
|
||||
unsigned long sta;
|
||||
|
||||
ACPI_FUNCTION_TRACE("is_device_present");
|
||||
|
||||
status = acpi_get_handle(handle, "_STA", &temp);
|
||||
if (ACPI_FAILURE(status))
|
||||
return_VALUE(1); /* _STA not found, assmue device present */
|
||||
return_VALUE(1); /* _STA not found, assmue device present */
|
||||
|
||||
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
|
||||
if (ACPI_FAILURE(status))
|
||||
return_VALUE(0); /* Firmware error */
|
||||
return_VALUE(0); /* Firmware error */
|
||||
|
||||
return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
|
||||
}
|
||||
|
||||
/*******************************************************************/
|
||||
static int
|
||||
acpi_container_add(struct acpi_device *device)
|
||||
static int acpi_container_add(struct acpi_device *device)
|
||||
{
|
||||
struct acpi_container *container;
|
||||
|
||||
@@ -102,28 +99,26 @@ acpi_container_add(struct acpi_device *device)
|
||||
}
|
||||
|
||||
container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
|
||||
if(!container)
|
||||
if (!container)
|
||||
return_VALUE(-ENOMEM);
|
||||
|
||||
|
||||
memset(container, 0, sizeof(struct acpi_container));
|
||||
container->handle = device->handle;
|
||||
strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME);
|
||||
strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
|
||||
acpi_driver_data(device) = container;
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", \
|
||||
acpi_device_name(device), acpi_device_bid(device)));
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
|
||||
acpi_device_name(device), acpi_device_bid(device)));
|
||||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_container_remove(struct acpi_device *device, int type)
|
||||
static int acpi_container_remove(struct acpi_device *device, int type)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_container *pc = NULL;
|
||||
pc = (struct acpi_container*) acpi_driver_data(device);
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_container *pc = NULL;
|
||||
pc = (struct acpi_container *)acpi_driver_data(device);
|
||||
|
||||
if (pc)
|
||||
kfree(pc);
|
||||
@@ -131,9 +126,7 @@ acpi_container_remove(struct acpi_device *device, int type)
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
container_device_add(struct acpi_device **device, acpi_handle handle)
|
||||
static int container_device_add(struct acpi_device **device, acpi_handle handle)
|
||||
{
|
||||
acpi_handle phandle;
|
||||
struct acpi_device *pdev;
|
||||
@@ -158,10 +151,9 @@ container_device_add(struct acpi_device **device, acpi_handle handle)
|
||||
return_VALUE(result);
|
||||
}
|
||||
|
||||
static void
|
||||
container_notify_cb(acpi_handle handle, u32 type, void *context)
|
||||
static void container_notify_cb(acpi_handle handle, u32 type, void *context)
|
||||
{
|
||||
struct acpi_device *device = NULL;
|
||||
struct acpi_device *device = NULL;
|
||||
int result;
|
||||
int present;
|
||||
acpi_status status;
|
||||
@@ -169,14 +161,14 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
|
||||
ACPI_FUNCTION_TRACE("container_notify_cb");
|
||||
|
||||
present = is_device_present(handle);
|
||||
|
||||
|
||||
switch (type) {
|
||||
case ACPI_NOTIFY_BUS_CHECK:
|
||||
/* Fall through */
|
||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
||||
printk("Container driver received %s event\n",
|
||||
(type == ACPI_NOTIFY_BUS_CHECK)?
|
||||
"ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK");
|
||||
(type == ACPI_NOTIFY_BUS_CHECK) ?
|
||||
"ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
|
||||
status = acpi_bus_get_device(handle, &device);
|
||||
if (present) {
|
||||
if (ACPI_FAILURE(status) || !device) {
|
||||
@@ -207,15 +199,13 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
|
||||
|
||||
static acpi_status
|
||||
container_walk_namespace_cb(acpi_handle handle,
|
||||
u32 lvl,
|
||||
void *context,
|
||||
void **rv)
|
||||
u32 lvl, void *context, void **rv)
|
||||
{
|
||||
char *hid = NULL;
|
||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
||||
struct acpi_device_info *info;
|
||||
acpi_status status;
|
||||
int *action = context;
|
||||
char *hid = NULL;
|
||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
struct acpi_device_info *info;
|
||||
acpi_status status;
|
||||
int *action = context;
|
||||
|
||||
ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
|
||||
|
||||
@@ -233,66 +223,60 @@ container_walk_namespace_cb(acpi_handle handle,
|
||||
}
|
||||
|
||||
if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") &&
|
||||
strcmp(hid, "PNP0A06")) {
|
||||
strcmp(hid, "PNP0A06")) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
switch(*action) {
|
||||
switch (*action) {
|
||||
case INSTALL_NOTIFY_HANDLER:
|
||||
acpi_install_notify_handler(handle,
|
||||
ACPI_SYSTEM_NOTIFY,
|
||||
container_notify_cb,
|
||||
NULL);
|
||||
ACPI_SYSTEM_NOTIFY,
|
||||
container_notify_cb, NULL);
|
||||
break;
|
||||
case UNINSTALL_NOTIFY_HANDLER:
|
||||
acpi_remove_notify_handler(handle,
|
||||
ACPI_SYSTEM_NOTIFY,
|
||||
container_notify_cb);
|
||||
ACPI_SYSTEM_NOTIFY,
|
||||
container_notify_cb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
end:
|
||||
end:
|
||||
acpi_os_free(buffer.pointer);
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
acpi_container_init(void)
|
||||
static int __init acpi_container_init(void)
|
||||
{
|
||||
int result = 0;
|
||||
int action = INSTALL_NOTIFY_HANDLER;
|
||||
int result = 0;
|
||||
int action = INSTALL_NOTIFY_HANDLER;
|
||||
|
||||
result = acpi_bus_register_driver(&acpi_container_driver);
|
||||
if (result < 0) {
|
||||
return(result);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* register notify handler to every container device */
|
||||
acpi_walk_namespace(ACPI_TYPE_DEVICE,
|
||||
ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
container_walk_namespace_cb,
|
||||
&action, NULL);
|
||||
ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
container_walk_namespace_cb, &action, NULL);
|
||||
|
||||
return(0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void __exit
|
||||
acpi_container_exit(void)
|
||||
static void __exit acpi_container_exit(void)
|
||||
{
|
||||
int action = UNINSTALL_NOTIFY_HANDLER;
|
||||
int action = UNINSTALL_NOTIFY_HANDLER;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_container_exit");
|
||||
|
||||
acpi_walk_namespace(ACPI_TYPE_DEVICE,
|
||||
ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
container_walk_namespace_cb,
|
||||
&action, NULL);
|
||||
ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
container_walk_namespace_cb, &action, NULL);
|
||||
|
||||
acpi_bus_unregister_driver(&acpi_container_driver);
|
||||
|
||||
|
||||
+55
-60
@@ -12,17 +12,14 @@
|
||||
#include <acpi/acglobal.h>
|
||||
|
||||
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
||||
ACPI_MODULE_NAME ("debug")
|
||||
|
||||
ACPI_MODULE_NAME("debug")
|
||||
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
|
||||
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
|
||||
|
||||
#ifdef MODULE_PARAM_PREFIX
|
||||
#undef MODULE_PARAM_PREFIX
|
||||
#endif
|
||||
|
||||
#define MODULE_PARAM_PREFIX
|
||||
module_param(acpi_dbg_layer, uint, 0400);
|
||||
module_param(acpi_dbg_layer, uint, 0400);
|
||||
module_param(acpi_dbg_level, uint, 0400);
|
||||
|
||||
struct acpi_dlayer {
|
||||
@@ -35,8 +32,7 @@ struct acpi_dlevel {
|
||||
};
|
||||
#define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
|
||||
|
||||
static const struct acpi_dlayer acpi_debug_layers[] =
|
||||
{
|
||||
static const struct acpi_dlayer acpi_debug_layers[] = {
|
||||
ACPI_DEBUG_INIT(ACPI_UTILITIES),
|
||||
ACPI_DEBUG_INIT(ACPI_HARDWARE),
|
||||
ACPI_DEBUG_INIT(ACPI_EVENTS),
|
||||
@@ -53,8 +49,7 @@ static const struct acpi_dlayer acpi_debug_layers[] =
|
||||
ACPI_DEBUG_INIT(ACPI_TOOLS),
|
||||
};
|
||||
|
||||
static const struct acpi_dlevel acpi_debug_levels[] =
|
||||
{
|
||||
static const struct acpi_dlevel acpi_debug_levels[] = {
|
||||
ACPI_DEBUG_INIT(ACPI_LV_ERROR),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_WARN),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_INIT),
|
||||
@@ -88,81 +83,77 @@ static const struct acpi_dlevel acpi_debug_levels[] =
|
||||
ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
|
||||
};
|
||||
|
||||
static int
|
||||
acpi_system_read_debug (
|
||||
char *page,
|
||||
char **start,
|
||||
off_t off,
|
||||
int count,
|
||||
int *eof,
|
||||
void *data)
|
||||
acpi_system_read_debug(char *page,
|
||||
char **start, off_t off, int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
int size = 0;
|
||||
unsigned int i;
|
||||
char *p = page;
|
||||
int size = 0;
|
||||
unsigned int i;
|
||||
|
||||
if (off != 0)
|
||||
goto end;
|
||||
|
||||
p += sprintf(p, "%-25s\tHex SET\n", "Description");
|
||||
|
||||
switch ((unsigned long) data) {
|
||||
switch ((unsigned long)data) {
|
||||
case 0:
|
||||
for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
|
||||
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
|
||||
acpi_debug_layers[i].name,
|
||||
acpi_debug_layers[i].value,
|
||||
(acpi_dbg_layer & acpi_debug_layers[i].value) ?
|
||||
'*' : ' ');
|
||||
acpi_debug_layers[i].name,
|
||||
acpi_debug_layers[i].value,
|
||||
(acpi_dbg_layer & acpi_debug_layers[i].
|
||||
value) ? '*' : ' ');
|
||||
}
|
||||
p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
|
||||
ACPI_ALL_DRIVERS,
|
||||
(acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS?
|
||||
'*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ?
|
||||
' ' : '-');
|
||||
ACPI_ALL_DRIVERS,
|
||||
(acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
|
||||
ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
|
||||
ACPI_ALL_DRIVERS) ==
|
||||
0 ? ' ' : '-');
|
||||
p += sprintf(p,
|
||||
"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
|
||||
acpi_dbg_layer);
|
||||
"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
|
||||
acpi_dbg_layer);
|
||||
break;
|
||||
case 1:
|
||||
for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
|
||||
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
|
||||
acpi_debug_levels[i].name,
|
||||
acpi_debug_levels[i].value,
|
||||
(acpi_dbg_level & acpi_debug_levels[i].value) ?
|
||||
'*' : ' ');
|
||||
acpi_debug_levels[i].name,
|
||||
acpi_debug_levels[i].value,
|
||||
(acpi_dbg_level & acpi_debug_levels[i].
|
||||
value) ? '*' : ' ');
|
||||
}
|
||||
p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
|
||||
acpi_dbg_level);
|
||||
acpi_dbg_level);
|
||||
break;
|
||||
default:
|
||||
p += sprintf(p, "Invalid debug option\n");
|
||||
break;
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
end:
|
||||
size = (p - page);
|
||||
if (size <= off+count) *eof = 1;
|
||||
if (size <= off + count)
|
||||
*eof = 1;
|
||||
*start = page + off;
|
||||
size -= off;
|
||||
if (size>count) size = count;
|
||||
if (size<0) size = 0;
|
||||
if (size > count)
|
||||
size = count;
|
||||
if (size < 0)
|
||||
size = 0;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
acpi_system_write_debug (
|
||||
struct file *file,
|
||||
const char __user *buffer,
|
||||
unsigned long count,
|
||||
void *data)
|
||||
acpi_system_write_debug(struct file *file,
|
||||
const char __user * buffer,
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
char debug_string[12] = {'\0'};
|
||||
char debug_string[12] = { '\0' };
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_system_write_debug");
|
||||
|
||||
@@ -174,7 +165,7 @@ acpi_system_write_debug (
|
||||
|
||||
debug_string[count] = '\0';
|
||||
|
||||
switch ((unsigned long) data) {
|
||||
switch ((unsigned long)data) {
|
||||
case 0:
|
||||
acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
|
||||
break;
|
||||
@@ -190,9 +181,9 @@ acpi_system_write_debug (
|
||||
|
||||
static int __init acpi_debug_init(void)
|
||||
{
|
||||
struct proc_dir_entry *entry;
|
||||
struct proc_dir_entry *entry;
|
||||
int error = 0;
|
||||
char * name;
|
||||
char *name;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_debug_init");
|
||||
|
||||
@@ -201,8 +192,10 @@ static int __init acpi_debug_init(void)
|
||||
|
||||
/* 'debug_layer' [R/W] */
|
||||
name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
|
||||
entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
|
||||
acpi_system_read_debug,(void *)0);
|
||||
entry =
|
||||
create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
|
||||
acpi_root_dir, acpi_system_read_debug,
|
||||
(void *)0);
|
||||
if (entry)
|
||||
entry->write_proc = acpi_system_write_debug;
|
||||
else
|
||||
@@ -210,19 +203,21 @@ static int __init acpi_debug_init(void)
|
||||
|
||||
/* 'debug_level' [R/W] */
|
||||
name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
|
||||
entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
|
||||
acpi_system_read_debug, (void *)1);
|
||||
if (entry)
|
||||
entry =
|
||||
create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
|
||||
acpi_root_dir, acpi_system_read_debug,
|
||||
(void *)1);
|
||||
if (entry)
|
||||
entry->write_proc = acpi_system_write_debug;
|
||||
else
|
||||
goto Error;
|
||||
|
||||
Done:
|
||||
Done:
|
||||
return_VALUE(error);
|
||||
|
||||
Error:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Unable to create '%s' proc fs entry\n", name));
|
||||
Error:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Unable to create '%s' proc fs entry\n", name));
|
||||
|
||||
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
|
||||
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);
|
||||
|
||||
+161
-185
File diff suppressed because it is too large
Load Diff
@@ -41,23 +41,17 @@
|
||||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acdispat.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
ACPI_MODULE_NAME ("dsinit")
|
||||
ACPI_MODULE_NAME("dsinit")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_init_one_object (
|
||||
acpi_handle obj_handle,
|
||||
u32 level,
|
||||
void *context,
|
||||
void **return_value);
|
||||
|
||||
acpi_ds_init_one_object(acpi_handle obj_handle,
|
||||
u32 level, void *context, void **return_value);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@@ -80,20 +74,17 @@ acpi_ds_init_one_object (
|
||||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_init_one_object (
|
||||
acpi_handle obj_handle,
|
||||
u32 level,
|
||||
void *context,
|
||||
void **return_value)
|
||||
acpi_ds_init_one_object(acpi_handle obj_handle,
|
||||
u32 level, void *context, void **return_value)
|
||||
{
|
||||
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
|
||||
struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
|
||||
acpi_object_type type;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("ds_init_one_object");
|
||||
struct acpi_init_walk_info *info =
|
||||
(struct acpi_init_walk_info *)context;
|
||||
struct acpi_namespace_node *node =
|
||||
(struct acpi_namespace_node *)obj_handle;
|
||||
acpi_object_type type;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_NAME("ds_init_one_object");
|
||||
|
||||
/*
|
||||
* We are only interested in NS nodes owned by the table that
|
||||
@@ -107,23 +98,23 @@ acpi_ds_init_one_object (
|
||||
|
||||
/* And even then, we are only interested in a few object types */
|
||||
|
||||
type = acpi_ns_get_type (obj_handle);
|
||||
type = acpi_ns_get_type(obj_handle);
|
||||
|
||||
switch (type) {
|
||||
case ACPI_TYPE_REGION:
|
||||
|
||||
status = acpi_ds_initialize_region (obj_handle);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Region %p [%4.4s] - Init failure, %s\n",
|
||||
obj_handle, acpi_ut_get_node_name (obj_handle),
|
||||
acpi_format_exception (status)));
|
||||
status = acpi_ds_initialize_region(obj_handle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Region %p [%4.4s] - Init failure, %s\n",
|
||||
obj_handle,
|
||||
acpi_ut_get_node_name(obj_handle),
|
||||
acpi_format_exception(status)));
|
||||
}
|
||||
|
||||
info->op_region_count++;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_METHOD:
|
||||
|
||||
/*
|
||||
@@ -131,7 +122,7 @@ acpi_ds_init_one_object (
|
||||
* the entire pathname
|
||||
*/
|
||||
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -148,12 +139,13 @@ acpi_ds_init_one_object (
|
||||
* Always parse methods to detect errors, we will delete
|
||||
* the parse tree below
|
||||
*/
|
||||
status = acpi_ds_parse_method (obj_handle);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"\n+Method %p [%4.4s] - parse failure, %s\n",
|
||||
obj_handle, acpi_ut_get_node_name (obj_handle),
|
||||
acpi_format_exception (status)));
|
||||
status = acpi_ds_parse_method(obj_handle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"\n+Method %p [%4.4s] - parse failure, %s\n",
|
||||
obj_handle,
|
||||
acpi_ut_get_node_name(obj_handle),
|
||||
acpi_format_exception(status)));
|
||||
|
||||
/* This parse failed, but we will continue parsing more methods */
|
||||
}
|
||||
@@ -161,13 +153,11 @@ acpi_ds_init_one_object (
|
||||
info->method_count++;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_DEVICE:
|
||||
|
||||
info->device_count++;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -179,7 +169,6 @@ acpi_ds_init_one_object (
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_initialize_objects
|
||||
@@ -195,45 +184,43 @@ acpi_ds_init_one_object (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_initialize_objects (
|
||||
struct acpi_table_desc *table_desc,
|
||||
struct acpi_namespace_node *start_node)
|
||||
acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
|
||||
struct acpi_namespace_node * start_node)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_init_walk_info info;
|
||||
acpi_status status;
|
||||
struct acpi_init_walk_info info;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ds_initialize_objects");
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ds_initialize_objects");
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"**** Starting initialization of namespace objects ****\n"));
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:"));
|
||||
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"**** Starting initialization of namespace objects ****\n"));
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
|
||||
|
||||
info.method_count = 0;
|
||||
info.method_count = 0;
|
||||
info.op_region_count = 0;
|
||||
info.object_count = 0;
|
||||
info.device_count = 0;
|
||||
info.table_desc = table_desc;
|
||||
info.object_count = 0;
|
||||
info.device_count = 0;
|
||||
info.table_desc = table_desc;
|
||||
|
||||
/* Walk entire namespace from the supplied root */
|
||||
|
||||
status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
|
||||
acpi_ds_init_one_object, &info, NULL);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
|
||||
acpi_ds_init_one_object, &info, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
|
||||
acpi_format_exception(status)));
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
|
||||
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
|
||||
table_desc->pointer->signature, table_desc->owner_id, info.object_count,
|
||||
info.device_count, info.method_count, info.op_region_count));
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
||||
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
|
||||
table_desc->pointer->signature,
|
||||
table_desc->owner_id, info.object_count,
|
||||
info.device_count, info.method_count,
|
||||
info.op_region_count));
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"%hd Methods, %hd Regions\n", info.method_count, info.op_region_count));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"%hd Methods, %hd Regions\n", info.method_count,
|
||||
info.op_region_count));
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+170
-182
File diff suppressed because it is too large
Load Diff
+194
-219
File diff suppressed because it is too large
Load Diff
+156
-171
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user