以echo 5 > /proc/acpi/sleep除錯為例
在drivers/acpi/hardware/hwsleep.c中入紅色字的內容:
#include asm/io.h
acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state){
....
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1B_CONTROL,
PM1Bcontrol);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
//Jeff Liao add the 80 port debug msg.
outb((unsigned char)0xff, 0x80);
outb((unsigned char)0xff, 0x80);
acpi_os_stall(100000000);
/* Insert SLP_ENABLE bit */
PM1Acontrol |= sleep_enable_reg_info->access_bit_mask;
PM1Bcontrol |= sleep_enable_reg_info->access_bit_mask;
......
}
其中acpi_os_stall實做如下,該function可以stall kernel執行us (ms),當us=10 000 000 是代表10 秒
#include linux/nmi.h
void acpi_os_stall(u32 us)
{
while (us) {
u32 delay = 1000;
if (delay > us)
delay = us;
udelay(delay);
touch_nmi_watchdog();
us -= delay;
}
沒有留言:
張貼留言