本文整理汇总了C++中enable_nonboot_cpus函数的典型用法代码示例。如果您正苦于以下问题:C++ enable_nonboot_cpus函数的具体用法?C++ enable_nonboot_cpus怎么用?C++ enable_nonboot_cpus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enable_nonboot_cpus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: suspend_enter
/**
* suspend_enter - Make the system enter the given sleep state.
* @state: System sleep state to enter.
* @wakeup: Returns information that the sleep state should not be re-entered.
*
* This function should be called after devices have been suspended.
*/
static int suspend_enter(suspend_state_t state, bool *wakeup)
{
int error;
if (suspend_ops->prepare) {
error = suspend_ops->prepare();
if (error)
goto Platform_finish;
}
error = dpm_suspend_end(PMSG_SUSPEND);
if (error) {
printk(KERN_ERR "PM: Some devices failed to power down\n");
goto Platform_finish;
}
if (suspend_ops->prepare_late) {
error = suspend_ops->prepare_late();
if (error)
goto Platform_wake;
}
if (suspend_test(TEST_PLATFORM))
goto Platform_wake;
error = disable_nonboot_cpus();
if (error || suspend_test(TEST_CPUS))
goto Enable_cpus;
arch_suspend_disable_irqs();
BUG_ON(!irqs_disabled());
error = syscore_suspend();
if (!error) {
*wakeup = pm_wakeup_pending();
if (!(suspend_test(TEST_CORE) || *wakeup)) {
error = suspend_ops->enter(state);
events_check_enabled = false;
}
syscore_resume();
}
arch_suspend_enable_irqs();
BUG_ON(irqs_disabled());
Enable_cpus:
enable_nonboot_cpus();
Platform_wake:
if (suspend_ops->wake)
suspend_ops->wake();
dpm_resume_start(PMSG_RESUME);
Platform_finish:
if (suspend_ops->finish)
suspend_ops->finish();
return error;
}
示例2: prepare_processes
static int prepare_processes(void)
{
int error = 0;
pm_prepare_console();
error = disable_nonboot_cpus();
if (error)
goto enable_cpus;
if (freeze_processes()) {
error = -EBUSY;
goto thaw;
}
if (pm_disk_mode == PM_DISK_TESTPROC) {
printk("swsusp debug: Waiting for 5 seconds.\n");
mdelay(5000);
goto thaw;
}
/* Free memory before shutting down devices. */
if (!(error = swsusp_shrink_memory()))
return 0;
thaw:
thaw_processes();
enable_cpus:
enable_nonboot_cpus();
pm_restore_console();
return error;
}
示例3: unprepare_processes
static void unprepare_processes(void)
{
platform_finish();
thaw_processes();
enable_nonboot_cpus();
pm_restore_console();
}
示例4: suspend_devices_and_enter
/**
* suspend_devices_and_enter - suspend devices and enter the desired system sleep
* state.
* @state: state to enter
*/
int suspend_devices_and_enter(suspend_state_t state)
{
int error;
if (!pm_ops)
return -ENOSYS;
if (pm_ops->set_target) {
error = pm_ops->set_target(state);
if (error)
return error;
}
suspend_console();
error = device_suspend(PMSG_SUSPEND);
if (error) {
printk(KERN_ERR "Some devices failed to suspend\n");
goto Resume_console;
}
if (pm_ops->prepare) {
error = pm_ops->prepare(state);
if (error)
goto Resume_devices;
}
error = disable_nonboot_cpus();
if (!error)
suspend_enter(state);
enable_nonboot_cpus();
pm_finish(state);
Resume_devices:
device_resume();
Resume_console:
resume_console();
return error;
}
示例5: finish
static void finish(void)
{
device_resume();
platform_finish();
enable_nonboot_cpus();
thaw_processes();
pm_restore_console();
}
示例6: suspend_finish
static void suspend_finish(suspend_state_t state)
{
enable_nonboot_cpus();
pm_finish(state);
device_resume();
resume_console();
thaw_processes();
pm_restore_console();
}
示例7: suspend_devices_and_enter
/**
* suspend_devices_and_enter - suspend devices and enter the desired system
* sleep state.
* @state: state to enter
*/
int suspend_devices_and_enter(suspend_state_t state)
{
int error, ftrace_save;
if (!suspend_ops)
return -ENOSYS;
if (suspend_ops->begin) {
error = suspend_ops->begin(state);
if (error)
goto Close;
}
suspend_console();
ftrace_save = __ftrace_enabled_save();
suspend_test_start();
error = device_suspend(PMSG_SUSPEND);
if (error) {
printk(KERN_ERR "PM: Some devices failed to suspend\n");
goto Recover_platform;
}
suspend_test_finish("suspend devices");
if (suspend_test(TEST_DEVICES))
goto Recover_platform;
if (suspend_ops->prepare) {
error = suspend_ops->prepare();
if (error)
goto Resume_devices;
}
if (suspend_test(TEST_PLATFORM))
goto Finish;
error = disable_nonboot_cpus();
if (!error && !suspend_test(TEST_CPUS))
suspend_enter(state);
enable_nonboot_cpus();
Finish:
if (suspend_ops->finish)
suspend_ops->finish();
Resume_devices:
suspend_test_start();
device_resume(PMSG_RESUME);
suspend_test_finish("resume devices");
__ftrace_enabled_restore(ftrace_save);
resume_console();
Close:
if (suspend_ops->end)
suspend_ops->end();
return error;
Recover_platform:
if (suspend_ops->recover)
suspend_ops->recover();
goto Resume_devices;
}
示例8: suspend_finish
static void suspend_finish(suspend_state_t state)
{
device_resume();
thaw_processes();
enable_nonboot_cpus();
if (pm_ops && pm_ops->finish)
pm_ops->finish(state);
pm_restore_console();
}
示例9: ambench_apbread
static void ambench_apbread(void)
{
u64 raw_counter = 0;
u64 amba_counter = 0;
unsigned long flags;
disable_nonboot_cpus();
local_irq_save(flags);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
amba_writel(TIMER1_STATUS_REG, APBREAD_RELOAD_NUM);
amba_writel(TIMER1_RELOAD_REG, 0x0);
amba_writel(TIMER1_MATCH1_REG, 0x0);
amba_writel(TIMER1_MATCH2_REG, 0x0);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_OF1);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_CSL1);
amba_setbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
do {
raw_counter++;
} while(__raw_readl((const volatile void *)TIMER1_STATUS_REG));
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
amba_writel(TIMER1_STATUS_REG, APBREAD_RELOAD_NUM);
amba_writel(TIMER1_RELOAD_REG, 0x0);
amba_writel(TIMER1_MATCH1_REG, 0x0);
amba_writel(TIMER1_MATCH2_REG, 0x0);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_OF1);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_CSL1);
amba_setbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
do {
amba_counter++;
} while(amba_readl(TIMER1_STATUS_REG));
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
local_irq_restore(flags);
enable_nonboot_cpus();
#if defined(CONFIG_PLAT_AMBARELLA_SUPPORT_HAL)
raw_counter *= get_apb_bus_freq_hz();
#else
raw_counter *= clk_get_rate(clk_get(NULL, "gclk_apb"));
#endif
do_div(raw_counter, APBREAD_RELOAD_NUM);
#if defined(CONFIG_PLAT_AMBARELLA_SUPPORT_HAL)
amba_counter *= get_apb_bus_freq_hz();
#else
amba_counter *= clk_get_rate(clk_get(NULL, "gclk_apb"));
#endif
do_div(amba_counter, APBREAD_RELOAD_NUM);
pr_info("CPU[0x%x] APBRead: raw speed %llu/s!\n",
cpu_architecture(), raw_counter);
pr_info("CPU[0x%x] APBRead: amba speed %llu/s!\n",
cpu_architecture(), amba_counter);
}
示例10: plug_secondary_cpus
static int plug_secondary_cpus(void *data)
{
if (!(suspend_test(TEST_FREEZER) ||
suspend_test(TEST_DEVICES) ||
suspend_test(TEST_PLATFORM)))
enable_nonboot_cpus();
complete(&second_cpu_complete);
return 0;
}
示例11: suspend_prepare
static int suspend_prepare(suspend_state_t state)
{
int error = 0;
unsigned int free_pages;
if (!pm_ops || !pm_ops->enter)
return -EPERM;
pm_prepare_console();
disable_nonboot_cpus();
if (num_online_cpus() != 1) {
error = -EPERM;
goto Enable_cpu;
}
if (freeze_processes()) {
error = -EAGAIN;
goto Thaw;
}
if ((free_pages = nr_free_pages()) < FREE_PAGE_NUMBER) {
pr_debug("PM: free some memory\n");
shrink_all_memory(FREE_PAGE_NUMBER - free_pages);
if (nr_free_pages() < FREE_PAGE_NUMBER) {
error = -ENOMEM;
printk(KERN_ERR "PM: No enough memory\n");
goto Thaw;
}
}
if (pm_ops->prepare) {
if ((error = pm_ops->prepare(state)))
goto Thaw;
}
if ((error = device_suspend(PMSG_SUSPEND))) {
printk(KERN_ERR "Some devices failed to suspend\n");
goto Finish;
}
return 0;
Finish:
if (pm_ops->finish)
pm_ops->finish(state);
Thaw:
thaw_processes();
Enable_cpu:
enable_nonboot_cpus();
pm_restore_console();
return error;
}
示例12: hibernation_snapshot
int hibernation_snapshot(int platform_mode)
{
int error;
/* Free memory before shutting down devices. */
error = swsusp_shrink_memory();
if (error)
return error;
error = platform_begin(platform_mode);
if (error)
goto Close;
suspend_console();
error = device_suspend(PMSG_FREEZE);
if (error)
goto Recover_platform;
if (hibernation_test(TEST_DEVICES))
goto Recover_platform;
error = platform_pre_snapshot(platform_mode);
if (error || hibernation_test(TEST_PLATFORM))
goto Finish;
error = disable_nonboot_cpus();
if (!error) {
if (hibernation_test(TEST_CPUS))
goto Enable_cpus;
if (hibernation_testmode(HIBERNATION_TEST))
goto Enable_cpus;
error = create_image(platform_mode);
/* Control returns here after successful restore */
}
Enable_cpus:
enable_nonboot_cpus();
Finish:
platform_finish(platform_mode);
Resume_devices:
device_resume(in_suspend ?
(error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
resume_console();
Close:
platform_end(platform_mode);
return error;
Recover_platform:
platform_recover(platform_mode);
goto Resume_devices;
}
示例13: suspend_prepare
static int suspend_prepare(suspend_state_t state)
{
int error;
unsigned int free_pages;
if (!pm_ops || !pm_ops->enter)
return -EPERM;
pm_prepare_console();
if (freeze_processes()) {
error = -EAGAIN;
goto Thaw;
}
if ((free_pages = global_page_state(NR_FREE_PAGES))
< FREE_PAGE_NUMBER) {
pr_debug("PM: free some memory\n");
shrink_all_memory(FREE_PAGE_NUMBER - free_pages);
if (nr_free_pages() < FREE_PAGE_NUMBER) {
error = -ENOMEM;
printk(KERN_ERR "PM: No enough memory\n");
goto Thaw;
}
}
if (pm_ops->prepare) {
if ((error = pm_ops->prepare(state)))
goto Thaw;
}
suspend_console();
error = device_suspend(PMSG_SUSPEND);
if (error) {
printk(KERN_ERR "Some devices failed to suspend\n");
goto Resume_devices;
}
error = disable_nonboot_cpus();
if (!error)
return 0;
enable_nonboot_cpus();
Resume_devices:
pm_finish(state);
device_resume();
resume_console();
Thaw:
thaw_processes();
pm_restore_console();
return error;
}
示例14: ambench_apbread
static void ambench_apbread(void)
{
u64 raw_counter = 0;
u64 amba_counter = 0;
unsigned long flags;
disable_nonboot_cpus();
local_irq_save(flags);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
amba_writel(TIMER1_STATUS_REG, APBREAD_RELOAD_NUM);
amba_writel(TIMER1_RELOAD_REG, 0x0);
amba_writel(TIMER1_MATCH1_REG, 0x0);
amba_writel(TIMER1_MATCH2_REG, 0x0);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_OF1);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_CSL1);
amba_setbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
do {
raw_counter++;
} while(__raw_readl(TIMER1_STATUS_REG));
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
amba_writel(TIMER1_STATUS_REG, APBREAD_RELOAD_NUM);
amba_writel(TIMER1_RELOAD_REG, 0x0);
amba_writel(TIMER1_MATCH1_REG, 0x0);
amba_writel(TIMER1_MATCH2_REG, 0x0);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_OF1);
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_CSL1);
amba_setbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
do {
amba_counter++;
} while(amba_readl(TIMER1_STATUS_REG));
amba_clrbitsl(TIMER_CTR_REG, TIMER_CTR_EN1);
local_irq_restore(flags);
enable_nonboot_cpus();
raw_counter *= get_apb_bus_freq_hz();
do_div(raw_counter, APBREAD_RELOAD_NUM);
amba_counter *= get_apb_bus_freq_hz();
do_div(amba_counter, APBREAD_RELOAD_NUM);
pr_info("CPU[0x%x] APBRead: raw speed %llu/s!\n",
cpu_architecture(), raw_counter);
pr_info("CPU[0x%x] APBRead: amba speed %llu/s!\n",
cpu_architecture(), amba_counter);
}
示例15: snapshot_release
static int snapshot_release(struct inode *inode, struct file *filp)
{
struct snapshot_data *data;
swsusp_free();
data = filp->private_data;
free_all_swap_pages(data->swap, data->bitmap);
free_bitmap(data->bitmap);
if (data->frozen) {
down(&pm_sem);
thaw_processes();
enable_nonboot_cpus();
up(&pm_sem);
}
atomic_inc(&device_available);
return 0;
}