Skip to content

Commit

Permalink
Merge branches 'acpi-iomem', 'acpi-pm' and 'acpi-sci' into acpi-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael J. Wysocki committed Feb 24, 2011
4 parents 981858b + bb45e39 + aad83b1 + 23fe363 commit dd87cc5
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 134 deletions.
6 changes: 3 additions & 3 deletions arch/ia64/include/asm/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ static inline const char *acpi_get_sysname (void)
int acpi_request_vector (u32 int_type);
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);

/* routines for saving/restoring kernel state */
extern int acpi_save_state_mem(void);
extern void acpi_restore_state_mem(void);
/* Low-level suspend routine. */
extern int acpi_suspend_lowlevel(void);

extern unsigned long acpi_wakeup_address;

/*
Expand Down
14 changes: 2 additions & 12 deletions arch/ia64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,18 +1034,8 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
EXPORT_SYMBOL(acpi_unregister_ioapic);

/*
* acpi_save_state_mem() - save kernel state
* acpi_suspend_lowlevel() - save kernel state and suspend.
*
* TBD when when IA64 starts to support suspend...
*/
int acpi_save_state_mem(void) { return 0; }

/*
* acpi_restore_state()
*/
void acpi_restore_state_mem(void) {}

/*
* do_suspend_lowlevel()
*/
void do_suspend_lowlevel(void) {}
int acpi_suspend_lowlevel(void) { return 0; }
5 changes: 2 additions & 3 deletions arch/x86/include/asm/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ static inline void acpi_disable_pci(void)
acpi_noirq_set();
}

/* routines for saving/restoring kernel state */
extern int acpi_save_state_mem(void);
extern void acpi_restore_state_mem(void);
/* Low-level suspend routine. */
extern int acpi_suspend_lowlevel(void);

extern unsigned long acpi_wakeup_address;

Expand Down
13 changes: 3 additions & 10 deletions arch/x86/kernel/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ static char temp_stack[4096];
#endif

/**
* acpi_save_state_mem - save kernel state
* acpi_suspend_lowlevel - save kernel state
*
* Create an identity mapped page table and copy the wakeup routine to
* low memory.
*
* Note that this is too late to change acpi_wakeup_address.
*/
int acpi_save_state_mem(void)
int acpi_suspend_lowlevel(void)
{
struct wakeup_header *header;

Expand Down Expand Up @@ -107,17 +107,10 @@ int acpi_save_state_mem(void)
saved_magic = 0x123456789abcdef0L;
#endif /* CONFIG_64BIT */

do_suspend_lowlevel();
return 0;
}

/*
* acpi_restore_state - undo effects of acpi_save_state_mem
*/
void acpi_restore_state_mem(void)
{
}


/**
* acpi_reserve_wakeup_memory - do _very_ early ACPI initialisation
*
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/kernel/acpi/sleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ extern char swsusp_pg_dir[PAGE_SIZE];

extern unsigned long acpi_copy_wakeup_routine(unsigned long);
extern void wakeup_long64(void);

extern void do_suspend_lowlevel(void);
11 changes: 7 additions & 4 deletions drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ struct acpi_button {
struct input_dev *input;
char phys[32]; /* for input device */
unsigned long pushed;
bool wakeup_enabled;
};

static const struct file_operations acpi_button_info_fops = {
Expand Down Expand Up @@ -430,8 +431,10 @@ static int acpi_button_add(struct acpi_device *device)
/* Button's GPE is run-wake GPE */
acpi_enable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number);
device->wakeup.run_wake_count++;
device_set_wakeup_enable(&device->dev, true);
if (!device_may_wakeup(&device->dev)) {
device_set_wakeup_enable(&device->dev, true);
button->wakeup_enabled = true;
}
}

printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
Expand All @@ -453,8 +456,8 @@ static int acpi_button_remove(struct acpi_device *device, int type)
if (device->wakeup.flags.valid) {
acpi_disable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number);
device->wakeup.run_wake_count--;
device_set_wakeup_enable(&device->dev, false);
if (button->wakeup_enabled)
device_set_wakeup_enable(&device->dev, false);
}

acpi_button_remove_fs(device);
Expand Down
22 changes: 19 additions & 3 deletions drivers/acpi/nvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct nvs_page {
unsigned int size;
void *kaddr;
void *data;
bool unmap;
struct list_head node;
};

Expand All @@ -44,6 +45,9 @@ int suspend_nvs_register(unsigned long start, unsigned long size)
{
struct nvs_page *entry, *next;

pr_info("PM: Registering ACPI NVS region at %lx (%ld bytes)\n",
start, size);

while (size > 0) {
unsigned int nr_bytes;

Expand Down Expand Up @@ -81,7 +85,13 @@ void suspend_nvs_free(void)
free_page((unsigned long)entry->data);
entry->data = NULL;
if (entry->kaddr) {
iounmap(entry->kaddr);
if (entry->unmap) {
iounmap(entry->kaddr);
entry->unmap = false;
} else {
acpi_os_unmap_memory(entry->kaddr,
entry->size);
}
entry->kaddr = NULL;
}
}
Expand Down Expand Up @@ -115,8 +125,14 @@ int suspend_nvs_save(void)

list_for_each_entry(entry, &nvs_list, node)
if (entry->data) {
entry->kaddr = acpi_os_ioremap(entry->phys_start,
entry->size);
unsigned long phys = entry->phys_start;
unsigned int size = entry->size;

entry->kaddr = acpi_os_get_iomem(phys, size);
if (!entry->kaddr) {
entry->kaddr = acpi_os_ioremap(phys, size);
entry->unmap = !!entry->kaddr;
}
if (!entry->kaddr) {
suspend_nvs_free();
return -ENOMEM;
Expand Down
Loading

0 comments on commit dd87cc5

Please sign in to comment.