aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/hrtimer.c3
-rw-r--r--kernel/kernel_sec_debug.c706
-rw-r--r--kernel/module.c6
-rw-r--r--kernel/power/Kconfig17
-rw-r--r--kernel/power/earlysuspend.c21
-rw-r--r--kernel/power/hibernate.c66
-rw-r--r--kernel/power/main.c24
-rw-r--r--kernel/power/power.h1
-rw-r--r--kernel/power/swap.c29
-rw-r--r--kernel/power/wakelock.c29
-rw-r--r--kernel/printk.c88
-rw-r--r--kernel/sys.c4
12 files changed, 895 insertions, 99 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 2043c08..3b00c36 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -49,6 +49,7 @@
#include <asm/uaccess.h>
#include <trace/events/timer.h>
+#include <mach/sec_debug.h>
/*
* The timer bases:
@@ -1215,7 +1216,9 @@ static void __run_hrtimer(struct hrtimer *timer, ktime_t *now)
*/
raw_spin_unlock(&cpu_base->lock);
trace_hrtimer_expire_entry(timer, now);
+ sec_debug_hrtimer_log(timer, fn, 1);
restart = fn(timer);
+ sec_debug_hrtimer_log(timer, fn, 2);
trace_hrtimer_expire_exit(timer);
raw_spin_lock(&cpu_base->lock);
diff --git a/kernel/kernel_sec_debug.c b/kernel/kernel_sec_debug.c
new file mode 100644
index 0000000..6ff0793
--- /dev/null
+++ b/kernel/kernel_sec_debug.c
@@ -0,0 +1,706 @@
+/* kernel_sec_debug.c
+ *
+ * Exception handling in kernel by SEC
+ *
+ * Copyright (c) 2010 Samsung Electronics
+ * http://www.samsung.com/
+ *
+ */
+
+#ifdef CONFIG_SEC_DEBUG
+
+#include <linux/kernel_sec_common.h>
+#include <asm/cacheflush.h> /* cacheflush*/
+#include <linux/errno.h>
+#include <linux/ctype.h>
+#include <linux/vmalloc.h>
+#include <linux/proc_fs.h>
+#include <linux/uaccess.h>
+
+#include <linux/file.h>
+#include <mach/hardware.h>
+
+#ifndef CONFIG_S5PV310_RAFFAELLO
+#define CONFIG_S5PV310_RAFFAELLO
+#endif
+
+/*
+ * Variable
+ */
+
+const char *gkernel_sec_build_info_date_time[] = {
+ __DATE__,
+ __TIME__
+};
+
+#define DEBUG_LEVEL_FILE_NAME "/mnt/.lfs/debug_level.inf"
+#define DEBUG_LEVEL_RD 0
+#define DEBUG_LEVEL_WR 1
+static int debuglevel;
+
+/* klaatu*/
+/*sched_log_t gExcpTaskLog[SCHED_LOG_MAX];*/
+unsigned int gExcpTaskLogIdx = 0;
+
+typedef enum {
+ __SERIAL_SPEED,
+ __LOAD_RAMDISK,
+ __BOOT_DELAY,
+ __LCD_LEVEL,
+ __SWITCH_SEL,
+ __PHONE_DEBUG_ON,
+ __LCD_DIM_LEVEL,
+ __MELODY_MODE,
+ __REBOOT_MODE,
+ __NATION_SEL,
+ __SET_DEFAULT_PARAM,
+ __PARAM_INT_11,
+ __PARAM_INT_12,
+ __PARAM_INT_13,
+ __PARAM_INT_14,
+ __VERSION,
+ __CMDLINE,
+ __PARAM_STR_2,
+ __PARAM_STR_3,
+ __PARAM_STR_4
+} param_idx;
+
+char gkernel_sec_build_info[100];
+unsigned int HWREV = 1;
+unsigned char kernel_sec_cause_str[KERNEL_SEC_DEBUG_CAUSE_STR_LEN];
+
+/*
+ * Function
+ */
+
+void __iomem *kernel_sec_viraddr_wdt_reset_reg;
+__used t_kernel_sec_arm_core_regsiters kernel_sec_core_reg_dump;
+__used t_kernel_sec_mmu_info kernel_sec_mmu_reg_dump;
+__used kernel_sec_upload_cause_type gkernel_sec_upload_cause;
+
+#if defined(CONFIG_S5PV310_RAFFAELLO) /* dpram*/
+static volatile void __iomem *idpram_base; /* Base of internal DPRAM*/
+
+static volatile void __iomem *onedram_base = NULL; /* Base of OneDRAM*/
+static volatile unsigned int *onedram_sem;
+static volatile unsigned int *onedram_mailboxAB; /*received mail*/
+static volatile unsigned int *onedram_mailboxBA; /*send mail*/
+#else
+volatile void __iomem *dpram_base = 0;
+volatile unsigned int *onedram_sem;
+volatile unsigned int *onedram_mailboxAB; /*received mail*/
+volatile unsigned int *onedram_mailboxBA; /*send mail*/
+#endif
+unsigned int received_cp_ack = 0;
+
+extern void (*sec_set_param_value)(int idx, void *value);
+extern void (*sec_get_param_value)(int idx, void *value);
+
+#if defined(CONFIG_S5PV310_RAFFAELLO) /* dpram*/
+
+/*
+ * assigned 16K internal dpram buf for debugging
+ */
+
+#define DPRAM_BUF_SIZE 0x4000
+struct _idpram_buf {
+ unsigned int dpram_start_key1;
+ unsigned int dpram_start_key2;
+ unsigned char dpram_buf[DPRAM_BUF_SIZE];
+ unsigned int dpram_end_key;
+} g_cdma_dpram_buf = {
+ .dpram_start_key1 = 'R',
+ .dpram_start_key2 = 'A',
+ .dpram_buf[0] = 'N',
+ .dpram_buf[1] = 'O',
+ .dpram_buf[2] = 'N',
+ .dpram_buf[3] = 'E',
+ .dpram_end_key = 'D'
+};
+
+void kernel_sec_cdma_dpram_dump(void)
+{
+ printk(KERN_EMERG "Backup CDMA dpram to RAM refore upload\n");
+ memcpy(g_cdma_dpram_buf.dpram_buf, (void *)idpram_base, DPRAM_BUF_SIZE);
+ printk(KERN_EMERG "buf address (0x%x), dpram (0x%x)\n", \
+ (unsigned int)g_cdma_dpram_buf.dpram_buf, (unsigned int) idpram_base);
+}
+EXPORT_SYMBOL(kernel_sec_cdma_dpram_dump);
+#endif
+
+void kernel_sec_set_cp_upload(void)
+{
+ unsigned int send_mail, wait_count;
+
+#if defined(CONFIG_S5PV310_RAFFAELLO) /* dpram*/
+ static volatile u16 *cp_dpram_mbx_BA; /*send mail box*/
+ static volatile u16 *cp_dpram_mbx_AB; /*receive mail box*/
+ u16 cp_irq_mask;
+
+ *((unsigned short *)idpram_base) = 0x554C;
+
+ cp_dpram_mbx_BA = (volatile u16 *)(idpram_base + 0x3FFC);
+ cp_dpram_mbx_AB = (volatile u16 *)(idpram_base + 0x3FFE);
+ cp_irq_mask = 0xCF; /*0x80|0x40|0x0F;*/
+
+#ifdef CDMA_IPC_C210_IDPRAM
+ iowrite16(cp_irq_mask, (void *)cp_dpram_mbx_BA);
+#else
+ *cp_dpram_mbx_BA = cp_irq_mask;
+#endif
+ printk(KERN_EMERG"[kernel_sec_dump_set_cp_upload]" \
+ "set cp upload mode, MailboxBA 0x%8x\n", cp_irq_mask);
+ wait_count = 0;
+ while (1) {
+ cp_irq_mask = ioread16((void *)cp_dpram_mbx_AB);
+ if (cp_irq_mask == 0xCF) {
+ printk(KERN_EMERG" - Done. cp_irq_mask: 0x%04X\n", \
+ cp_irq_mask);
+ break;
+ }
+ mdelay(10);
+ if (++wait_count > 500) {
+ printk(KERN_EMERG"- Fail to set CP uploadmode." /
+ "cp_irq_mask: 0x%04X\n", cp_irq_mask);
+ break;
+ }
+ }
+ printk(KERN_EMERG"modem_wait_count : %d\n", wait_count);
+
+#else
+ send_mail = KERNEL_SEC_DUMP_AP_DEAD_INDICATOR;
+
+ *onedram_sem = 0x0;
+ *onedram_mailboxBA = send_mail;
+ printk(KERN_EMERG"[kernel_sec_dump_set_cp_upload]" \
+ "set cp upload mode, MailboxBA 0x%8x\n", send_mail);
+ wait_count = 0;
+ received_cp_ack = 0;
+ while (1) {
+ if (received_cp_ack == 1) {
+ printk(KERN_EMERG" - Done.\n");
+ break;
+ }
+ mdelay(10);
+ if (++wait_count > 500) {
+ printk(KERN_EMERG" - Fail to set CP uploadmode.\n");
+ break;
+ }
+ }
+ printk(KERN_EMERG"modem_wait_count : %d\n", wait_count);
+#endif
+
+#if defined(CONFIG_S5PV310_RAFFAELLO) /* dpram*/
+ /*
+ * QSC6085 marking the QSC upload mode
+ */
+ *((unsigned int *)idpram_base) = 0xdeaddead;
+ printk(KERN_EMERG"QSC upload magic key write\n");
+ kernel_sec_cdma_dpram_dump();
+#endif
+}
+EXPORT_SYMBOL(kernel_sec_set_cp_upload);
+
+
+void kernel_sec_set_cp_ack(void) /*is set by dpram - dpram_irq_handler*/
+{
+ received_cp_ack = 1;
+}
+EXPORT_SYMBOL(kernel_sec_set_cp_ack);
+
+
+
+void kernel_sec_set_upload_magic_number(void)
+{
+ int *magic_virt_addr = (int *) LOKE_BOOT_USB_DWNLD_V_ADDR;
+
+ if ((KERNEL_SEC_DEBUG_LEVEL_MID == kernel_sec_get_debug_level()) ||
+ (KERNEL_SEC_DEBUG_LEVEL_HIGH == kernel_sec_get_debug_level())) {
+ *magic_virt_addr = LOKE_BOOT_USB_DWNLDMAGIC_NO; /* SET*/
+ printk(KERN_EMERG"KERNEL:magic_number=0x%x" \
+ "SET_UPLOAD_MAGIC_NUMBER\n", *magic_virt_addr);
+ } else {
+ *magic_virt_addr = 0;
+ printk(KERN_EMERG"KERNEL:" \
+ "magic_number=0x%x DEBUG LEVEL low!!\n", \
+ *magic_virt_addr);
+ }
+}
+EXPORT_SYMBOL(kernel_sec_set_upload_magic_number);
+
+
+void kernel_sec_get_debug_level_from_boot(void)
+{
+ unsigned int temp;
+ temp = __raw_readl(S5P_INFORM6);
+ temp &= KERNEL_SEC_DEBUG_LEVEL_MASK;
+ temp = temp >> KERNEL_SEC_DEBUG_LEVEL_BIT;
+
+ if (temp == 0x0) /*low*/
+ debuglevel = KERNEL_SEC_DEBUG_LEVEL_LOW;
+ else if (temp == 0x1) /*mid*/
+ debuglevel = KERNEL_SEC_DEBUG_LEVEL_MID;
+ else if (temp == 0x2) /*high*/
+ debuglevel = KERNEL_SEC_DEBUG_LEVEL_HIGH;
+ else {
+ printk(KERN_EMERG"KERNEL:kernel_sec_get_debug_level_from_boot" \
+ "(reg value is incorrect.)\n");
+ /*debuglevel = KERNEL_SEC_DEBUG_LEVEL_LOW;*/
+ debuglevel = KERNEL_SEC_DEBUG_LEVEL_MID;
+ }
+
+ printk(KERN_EMERG"KERNEL:" \
+ "kernel_sec_get_debug_level_from_boot=0x%x\n", debuglevel);
+}
+
+
+void kernel_sec_clear_upload_magic_number(void)
+{
+ int *magic_virt_addr = (int *) LOKE_BOOT_USB_DWNLD_V_ADDR;
+
+ *magic_virt_addr = 0; /* CLEAR*/
+ printk(KERN_EMERG"KERNEL:magic_number=%x " \
+ "CLEAR_UPLOAD_MAGIC_NUMBER\n", *magic_virt_addr);
+}
+EXPORT_SYMBOL(kernel_sec_clear_upload_magic_number);
+
+void kernel_sec_map_wdog_reg(void)
+{
+ /* Virtual Mapping of Watchdog register */
+ kernel_sec_viraddr_wdt_reset_reg = ioremap_nocache(S3C_PA_WDT, 0x400);
+
+ if (kernel_sec_viraddr_wdt_reset_reg == NULL) {
+ printk(KERN_EMERG"Failed to ioremap()" \
+ "region in forced upload keystring\n");
+ }
+}
+EXPORT_SYMBOL(kernel_sec_map_wdog_reg);
+
+void kernel_sec_set_upload_cause(kernel_sec_upload_cause_type uploadType)
+{
+ unsigned int temp;
+ gkernel_sec_upload_cause = uploadType;
+
+
+ temp = __raw_readl(S5P_INFORM6);
+ /*KERNEL_SEC_UPLOAD_CAUSE_MASK 0x000000FF*/
+ temp |= uploadType;
+ __raw_writel(temp , S5P_INFORM6);
+ printk(KERN_EMERG"(kernel_sec_set_upload_cause)" \
+ ": upload_cause set %x\n", uploadType);
+}
+EXPORT_SYMBOL(kernel_sec_set_upload_cause);
+
+void kernel_sec_set_cause_strptr(unsigned char *str_ptr, int size)
+{
+ unsigned int temp;
+
+ memset((void *)kernel_sec_cause_str, 0, sizeof(kernel_sec_cause_str));
+ memcpy(kernel_sec_cause_str, str_ptr, size);
+
+ temp = virt_to_phys(kernel_sec_cause_str);
+ /*loke read this ptr, display_aries_upload_image*/
+ __raw_writel(temp, LOKE_BOOT_USB_DWNLD_V_ADDR+4);
+}
+EXPORT_SYMBOL(kernel_sec_set_cause_strptr);
+
+
+void kernel_sec_set_autotest(void)
+{
+ unsigned int temp;
+
+ temp = __raw_readl(S5P_INFORM6);
+ temp |= 1<<KERNEL_SEC_UPLOAD_AUTOTEST_BIT;
+ __raw_writel(temp , S5P_INFORM6);
+}
+EXPORT_SYMBOL(kernel_sec_set_autotest);
+
+void kernel_sec_set_build_info(void)
+{
+ char *p = gkernel_sec_build_info;
+ sprintf(p, "ARIES_BUILD_INFO: HWREV: %x", HWREV);
+ strcat(p, " Date:");
+ strcat(p, gkernel_sec_build_info_date_time[0]);
+ strcat(p, " Time:");
+ strcat(p, gkernel_sec_build_info_date_time[1]);
+}
+EXPORT_SYMBOL(kernel_sec_set_build_info);
+
+void kernel_sec_init(void)
+{
+ /*set the dpram mailbox virtual address*/
+#if defined(CONFIG_S5PV310_RAFFAELLO) /*dpram*/
+
+ idpram_base = (volatile void *) \
+ ioremap_nocache(IDPRAM_PHYSICAL_ADDR, 0x4000);
+ if (idpram_base == NULL)
+ printk(KERN_EMERG "failed ioremap g_idpram_region\n");
+#endif
+ kernel_sec_get_debug_level_from_boot();
+ kernel_sec_set_upload_magic_number();
+ kernel_sec_set_upload_cause(UPLOAD_CAUSE_INIT);
+ kernel_sec_map_wdog_reg();
+}
+EXPORT_SYMBOL(kernel_sec_init);
+
+/* core reg dump function*/
+void kernel_sec_get_core_reg_dump(t_kernel_sec_arm_core_regsiters *regs)
+{
+ asm(
+ /* we will be in SVC mode when we enter this function.
+ Collect SVC registers along with cmn registers.*/
+ "str r0, [%0,#0]\n\t" /*R0*/
+ "str r1, [%0,#4]\n\t" /*R1*/
+ "str r2, [%0,#8]\n\t" /*R2*/
+ "str r3, [%0,#12]\n\t" /*R3*/
+ "str r4, [%0,#16]\n\t" /*R4*/
+ "str r5, [%0,#20]\n\t" /*R5*/
+ "str r6, [%0,#24]\n\t" /*R6*/
+ "str r7, [%0,#28]\n\t" /*R7*/
+ "str r8, [%0,#32]\n\t" /*R8*/
+ "str r9, [%0,#36]\n\t" /*R9*/
+ "str r10, [%0,#40]\n\t" /*R10*/
+ "str r11, [%0,#44]\n\t" /*R11*/
+ "str r12, [%0,#48]\n\t" /*R12*/
+
+ /* SVC */
+ "str r13, [%0,#52]\n\t" /*R13_SVC*/
+ "str r14, [%0,#56]\n\t" /*R14_SVC*/
+ "mrs r1, spsr\n\t" /*SPSR_SVC*/
+ "str r1, [%0,#60]\n\t"
+
+ /* PC and CPSR */
+ "sub r1, r15, #0x4\n\t" /*PC*/
+ "str r1, [%0,#64]\n\t"
+ "mrs r1, cpsr\n\t" /*CPSR*/
+ "str r1, [%0,#68]\n\t"
+
+ /* SYS/USR */
+ "mrs r1, cpsr\n\t" /*switch to SYS mode*/
+ "and r1, r1, #0xFFFFFFE0\n\t"
+ "orr r1, r1, #0x1f\n\t"
+ "msr cpsr,r1\n\t"
+ "str r13, [%0,#72]\n\t" /*R13_USR*/
+ "str r14, [%0,#76]\n\t" /*R13_USR*/
+
+ /*FIQ*/
+ "mrs r1, cpsr\n\t" /*switch to FIQ mode*/
+ "and r1,r1,#0xFFFFFFE0\n\t"
+ "orr r1,r1,#0x11\n\t"
+ "msr cpsr,r1\n\t"
+ "str r8, [%0,#80]\n\t" /*R8_FIQ*/
+ "str r9, [%0,#84]\n\t" /*R9_FIQ*/
+ "str r10, [%0,#88]\n\t" /*R10_FIQ*/
+ "str r11, [%0,#92]\n\t" /*R11_FIQ*/
+ "str r12, [%0,#96]\n\t" /*R12_FIQ*/
+ "str r13, [%0,#100]\n\t" /*R13_FIQ*/
+ "str r14, [%0,#104]\n\t" /*R14_FIQ*/
+ "mrs r1, spsr\n\t" /*SPSR_FIQ*/
+ "str r1, [%0,#108]\n\t"
+
+ /*IRQ*/
+ "mrs r1, cpsr\n\t" /*switch to IRQ mode*/
+ "and r1, r1, #0xFFFFFFE0\n\t"
+ "orr r1, r1, #0x12\n\t"
+ "msr cpsr,r1\n\t"
+ "str r13, [%0,#112]\n\t" /*R13_IRQ*/
+ "str r14, [%0,#116]\n\t" /*R14_IRQ*/
+ "mrs r1, spsr\n\t" /* SPSR_IRQ*/
+ "str r1, [%0,#120]\n\t"
+
+ /*MON*/
+ "mrs r1, cpsr\n\t" /*switch to monitor mode*/
+ "and r1, r1, #0xFFFFFFE0\n\t"
+ "orr r1, r1, #0x16\n\t"
+ "msr cpsr,r1\n\t"
+
+ "str r13, [%0,#124]\n\t" /*R13_MON*/
+ "str r14, [%0,#128]\n\t" /*R14_MON*/
+ "mrs r1, spsr\n\t" /*SPSR_MON*/
+ "str r1, [%0,#132]\n\t"
+
+ /*ABT*/
+ "mrs r1, cpsr\n\t" /* switch to Abort mode*/
+ "and r1, r1, #0xFFFFFFE0\n\t"
+ "orr r1, r1, #0x17\n\t"
+ "msr cpsr,r1\n\t"
+
+ "str r13, [%0,#136]\n\t" /*R13_ABT*/
+ "str r14, [%0,#140]\n\t" /* R14_ABT*/
+ "mrs r1, spsr\n\t" /* SPSR_ABT*/
+ "str r1, [%0,#144]\n\t"
+
+ /*UND*/
+ "mrs r1, cpsr\n\t" /* switch to undef mode*/
+ "and r1, r1, #0xFFFFFFE0\n\t"
+ "orr r1, r1, #0x1B\n\t"
+ "msr cpsr,r1\n\t"
+ "str r13, [%0,#148]\n\t" /* R13_UND*/
+ "str r14, [%0,#152]\n\t" /*R14_UND*/
+ "mrs r1, spsr\n\t" /*SPSR_UND*/
+ "str r1, [%0,#156]\n\t"
+
+ /* restore to SVC mode */
+ "mrs r1, cpsr\n\t" /* switch to undef mode*/
+ "and r1, r1, #0xFFFFFFE0\n\t"
+ "orr r1, r1, #0x13\n\t"
+ "msr cpsr,r1\n\t"
+ : /* output */
+ : "r"(regs) /* input */
+ : "%r1" /* clobbered register */
+ );
+ return;
+}
+EXPORT_SYMBOL(kernel_sec_get_core_reg_dump);
+
+int kernel_sec_get_mmu_reg_dump(t_kernel_sec_mmu_info *mmu_info)
+{
+ asm("mrc p15, 0, r1, c1, c0, 0\n\t" /*SCTLR*/
+ "str r1, [%0]\n\t"
+ "mrc p15, 0, r1, c2, c0, 0\n\t" /*TTBR0*/
+ "str r1, [%0,#4]\n\t"
+ "mrc p15, 0, r1, c2, c0,1\n\t" /*TTBR1*/
+ "str r1, [%0,#8]\n\t"
+ "mrc p15, 0, r1, c2, c0,2\n\t" /*TTBCR*/
+ "str r1, [%0,#12]\n\t"
+ "mrc p15, 0, r1, c3, c0,0\n\t" /*DACR*/
+ "str r1, [%0,#16]\n\t"
+ "mrc p15, 0, r1, c5, c0,0\n\t" /*DFSR*/
+ "str r1, [%0,#20]\n\t"
+ "mrc p15, 0, r1, c6, c0,0\n\t" /*DFAR*/
+ "str r1, [%0,#24]\n\t"
+ "mrc p15, 0, r1, c5, c0,1\n\t" /*IFSR*/
+ "str r1, [%0,#28]\n\t"
+ "mrc p15, 0, r1, c6, c0,2\n\t" /*IFAR*/
+ "str r1, [%0,#32]\n\t"
+ /*Dont populate DAFSR and RAFSR*/
+ "mrc p15, 0, r1, c10, c2,0\n\t" /*PMRRR*/
+ "str r1, [%0,#44]\n\t"
+ "mrc p15, 0, r1, c10, c2,1\n\t" /*NMRRR*/
+ "str r1, [%0,#48]\n\t"
+ "mrc p15, 0, r1, c13, c0,0\n\t" /*FCSEPID*/
+ "str r1, [%0,#52]\n\t"
+ "mrc p15, 0, r1, c13, c0,1\n\t" /*CONTEXT*/
+ "str r1, [%0,#56]\n\t"
+ "mrc p15, 0, r1, c13, c0,2\n\t" /*URWTPID*/
+ "str r1, [%0,#60]\n\t"
+ "mrc p15, 0, r1, c13, c0,3\n\t" /*UROTPID*/
+ "str r1, [%0,#64]\n\t"
+ "mrc p15, 0, r1, c13, c0,4\n\t" /*POTPIDR*/
+ "str r1, [%0,#68]\n\t"
+ : /* output */
+ : "r"(mmu_info) /* input */
+ : "%r1", "memory" /* clobbered register */
+ );
+ return 0;
+}
+EXPORT_SYMBOL(kernel_sec_get_mmu_reg_dump);
+
+void kernel_sec_save_final_context(void)
+{
+ if (kernel_sec_get_mmu_reg_dump(&kernel_sec_mmu_reg_dump) < 0)
+ printk(KERN_EMERG"(kernel_sec_save_final_context) kernel_sec_get_mmu_reg_dump faile.\n");
+ kernel_sec_get_core_reg_dump(&kernel_sec_core_reg_dump);
+
+ printk(KERN_EMERG "(kernel_sec_save_final_context) Final context was saved before the system reset.\n");
+}
+EXPORT_SYMBOL(kernel_sec_save_final_context);
+
+
+/*
+ * bSilentReset
+ * TRUE : Silent reset - clear the magic code.
+ * FALSE : Reset to upload mode - not clear the magic code.
+ *
+ * TODO : DebugLevel consideration should be added.
+ */
+/*extern void Ap_Cp_Switch_Config(u16 ap_cp_mode);*/
+void kernel_sec_hw_reset(bool bSilentReset)
+{
+/*Ap_Cp_Switch_Config(0);*/
+
+ if (bSilentReset || (KERNEL_SEC_DEBUG_LEVEL_LOW == \
+ kernel_sec_get_debug_level())) {
+ kernel_sec_clear_upload_magic_number();
+ printk(KERN_EMERG "(kernel_sec_hw_reset)" \
+ "Upload Magic Code is cleared for silet reset.\n");
+ }
+
+ printk(KERN_EMERG "(kernel_sec_hw_reset) %s\n", gkernel_sec_build_info);
+
+ printk(KERN_EMERG "(kernel_sec_hw_reset) The forced reset was called." \
+ "The system will be reset !!\n");
+
+ /* flush cache back to ram */
+ flush_cache_all();
+
+ __raw_writel(0x8000, kernel_sec_viraddr_wdt_reset_reg + 0x4);
+ __raw_writel(0x1, kernel_sec_viraddr_wdt_reset_reg + 0x4);
+ __raw_writel(0x8, kernel_sec_viraddr_wdt_reset_reg + 0x8);
+ __raw_writel(0x8021, kernel_sec_viraddr_wdt_reset_reg);
+
+ /* Never happened because the reset will occur before this. */
+ while (1);
+}
+EXPORT_SYMBOL(kernel_sec_hw_reset);
+
+
+bool kernel_set_debug_level(int level)
+{
+ /*if (sec_set_param_value)
+ {
+ if( (level == KERNEL_SEC_DEBUG_LEVEL_LOW) ||
+ ( level == KERNEL_SEC_DEBUG_LEVEL_MID ) )
+ {
+ sec_set_param_value(__PHONE_DEBUG_ON, (void*)&level);
+ printk(KERN_NOTICE "(kernel_set_debug_level)
+ The debug value is %x !!\n", level);
+ return 1;
+ }
+ else
+ {
+ printk(KERN_NOTICE "(kernel_set_debug_level)
+ The debug value is invalid (%x) !!\n", level);
+ return 0;
+ }
+ }
+ else
+ {*/
+ printk(KERN_NOTICE "(kernel_set_debug_level)" /
+ " sec_set_param_value is not intialized !!\n");
+ return 0;
+ /*}*/
+}
+EXPORT_SYMBOL(kernel_set_debug_level);
+
+int kernel_get_debug_level()
+{
+ int debug_level = -1;
+
+/* if (sec_get_param_value)
+ {
+ sec_get_param_value(__PHONE_DEBUG_ON, &debug_level);
+ }
+*/
+ if ((debug_level == KERNEL_SEC_DEBUG_LEVEL_LOW) ||
+ (debug_level == KERNEL_SEC_DEBUG_LEVEL_MID)) {
+ printk(KERN_NOTICE "(kernel_get_debug_level) kernel" \
+ "debug level is %x !!\n", debug_level);
+ return debug_level;
+ }
+ printk(KERN_NOTICE "(kernel_get_debug_level) kernel" \
+ "debug level is invalid (%x) !!\n", debug_level);
+ return debug_level;
+}
+EXPORT_SYMBOL(kernel_get_debug_level);
+
+int kernel_sec_lfs_debug_level_op(int dir, int flags)
+{
+ struct file *filp;
+ mm_segment_t fs;
+
+ int ret;
+
+ filp = filp_open(DEBUG_LEVEL_FILE_NAME, flags, 0);
+
+ if (IS_ERR(filp)) {
+ pr_err("%s: filp_open failed. (%ld)\n", __func__,
+ PTR_ERR(filp));
+
+ return -1;
+ }
+
+ fs = get_fs();
+ set_fs(get_ds());
+
+ if (dir == DEBUG_LEVEL_RD)
+ ret = filp->f_op->read(filp, (char __user *)&debuglevel,
+ sizeof(int), &filp->f_pos);
+ else
+ ret = filp->f_op->write(filp, (char __user *)&debuglevel,
+ sizeof(int), &filp->f_pos);
+
+ set_fs(fs);
+ filp_close(filp, NULL);
+
+ return ret;
+}
+
+bool kernel_sec_set_debug_level(int level)
+{
+ int ret;
+
+ if ((level == KERNEL_SEC_DEBUG_LEVEL_LOW) ||
+ (level == KERNEL_SEC_DEBUG_LEVEL_MID) ||
+ (level == KERNEL_SEC_DEBUG_LEVEL_HIGH)) {
+ debuglevel = level;
+ /* write to param.lfs */
+ ret = kernel_sec_lfs_debug_level_op(DEBUG_LEVEL_WR, \
+ O_RDWR|O_SYNC);
+
+ if (ret == sizeof(debuglevel))
+ pr_info("%s: debuglevel.inf" \
+ "write successfully.\n", \
+ __func__);
+ /* write to regiter (magic code) */
+ kernel_sec_set_upload_magic_number();
+
+ printk(KERN_NOTICE \
+ "(kernel_sec_set_debug_level)" \
+ "The debug value is 0x%x !!\n", level);
+ return 1;
+ } else {
+ printk(KERN_NOTICE "(kernel_sec_set_debug_level)" \
+ "The debug value is" \
+ "invalid(0x%x)!! Set default level(LOW)\n", level);
+ debuglevel = KERNEL_SEC_DEBUG_LEVEL_LOW;
+ return 0;
+ }
+ }
+EXPORT_SYMBOL(kernel_sec_set_debug_level);
+
+
+
+int kernel_sec_get_debug_level_from_param()
+{
+ int ret;
+
+ /* read from param.lfs*/
+ ret = kernel_sec_lfs_debug_level_op(DEBUG_LEVEL_RD, O_RDONLY);
+
+ if (ret == sizeof(debuglevel))
+ pr_info("%s: debuglevel.inf read successfully.\n", __func__);
+ if ((debuglevel == KERNEL_SEC_DEBUG_LEVEL_LOW) ||
+ (debuglevel == KERNEL_SEC_DEBUG_LEVEL_MID) ||
+ (debuglevel == KERNEL_SEC_DEBUG_LEVEL_HIGH)) {
+ /* return debug level */
+ printk(KERN_NOTICE "(kernel_sec_get_debug_level_from_param)" \
+ "kernel debug level is 0x%x !!\n", debuglevel);
+ return debuglevel;
+ } else {
+ /*In case of invalid debug level, default (debug level low)*/
+ printk(KERN_NOTICE "(kernel_sec_get_debug_level_from_param)" \
+ "The debug value is invalid(0x%x)!!" \
+ "Set default level(LOW)\n", debuglevel);
+ /*debuglevel = KERNEL_SEC_DEBUG_LEVEL_LOW;*/
+ debuglevel = KERNEL_SEC_DEBUG_LEVEL_MID;
+ }
+ return debuglevel;
+}
+EXPORT_SYMBOL(kernel_sec_get_debug_level_from_param);
+
+int kernel_sec_get_debug_level()
+{
+ return debuglevel;
+}
+EXPORT_SYMBOL(kernel_sec_get_debug_level);
+
+int kernel_sec_check_debug_level_high(void)
+{
+ if (KERNEL_SEC_DEBUG_LEVEL_HIGH == kernel_sec_get_debug_level())
+ return 1;
+ return 0;
+}
+EXPORT_SYMBOL(kernel_sec_check_debug_level_high);
+
+#endif /* CONFIG_KERNEL_DEBUG_SEC*/
diff --git a/kernel/module.c b/kernel/module.c
index b9d0667..0fb6425 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -570,6 +570,7 @@ MODINFO_ATTR(version);
MODINFO_ATTR(srcversion);
static char last_unloaded_module[MODULE_NAME_LEN+1];
+static unsigned int last_unloaded_module_addr;
#ifdef CONFIG_MODULE_UNLOAD
@@ -841,7 +842,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
/* Store the name of the last unloaded module for diagnostic purposes */
strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
-
+ last_unloaded_module_addr = (unsigned int)&mod->module_core;
free_module(mod);
return 0;
out:
@@ -3404,7 +3405,8 @@ void print_modules(void)
printk(" %s%s", mod->name, module_flags(mod, buf));
preempt_enable();
if (last_unloaded_module[0])
- printk(" [last unloaded: %s]", last_unloaded_module);
+ printk(" [last unloaded: %s](%x)", last_unloaded_module,
+ last_unloaded_module_addr);
printk("\n");
}
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 56afb61..9fda331 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -26,6 +26,15 @@ config PM_WATCHDOG_TIMEOUT
Enable PM watchdog timer to catch lockup during early_suspend,
late_resume and suspend_finish.
+config FAST_BOOT
+ bool "Force suspend and show fake turn off which is same with suspend"
+ depends on SUSPEND
+ default n
+ ---help---
+ This allows you go to suspend instead to turn off. If this is
+ done, it goes to wake up instead to turn on. This works with power
+ source.
+
config HAS_WAKELOCK
bool
@@ -152,6 +161,14 @@ config FULL_PAGE_RECLAIM
dramatically decreased and small size of hibernation snapshot image
has benefit for fast booting.
+config FAST_RESUME
+ bool "Using fast resume during Suspend-to-Disk"
+ depends on HIBERNATION
+ ---help---
+ software_resume() function which triggers hibernation restore is
+ called faster on booting time by introducing new initcalls. This has
+ benefit for fast booting on hibernation
+
config PM_STD_PARTITION
string "Default resume partition"
depends on HIBERNATION
diff --git a/kernel/power/earlysuspend.c b/kernel/power/earlysuspend.c
index 1c293ce..e6303fd 100644
--- a/kernel/power/earlysuspend.c
+++ b/kernel/power/earlysuspend.c
@@ -20,6 +20,9 @@
#include <linux/syscalls.h> /* sys_sync */
#include <linux/wakelock.h>
#include <linux/workqueue.h>
+#ifdef CONFIG_ZRAM_FOR_ANDROID
+#include <asm/atomic.h>
+#endif /* CONFIG_ZRAM_FOR_ANDROID */
#include "power.h"
@@ -29,6 +32,11 @@ enum {
DEBUG_VERBOSE = 1U << 3,
};
static int debug_mask = DEBUG_USER_STATE;
+#ifdef CONFIG_ZRAM_FOR_ANDROID
+atomic_t optimize_comp_on = ATOMIC_INIT(0);
+EXPORT_SYMBOL(optimize_comp_on);
+#endif /* CONFIG_ZRAM_FOR_ANDROID */
+
module_param_named(debug_mask, debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP);
static DEFINE_MUTEX(early_suspend_lock);
@@ -94,6 +102,9 @@ static void early_suspend(struct work_struct *work)
mutex_lock(&early_suspend_lock);
spin_lock_irqsave(&state_lock, irqflags);
+#ifdef CONFIG_ZRAM_FOR_ANDROID
+ atomic_set(&optimize_comp_on, 1);
+#endif /* CONFIG_ZRAM_FOR_ANDROID */
if (state == SUSPEND_REQUESTED)
state |= SUSPENDED;
else
@@ -145,6 +156,9 @@ static void late_resume(struct work_struct *work)
mutex_lock(&early_suspend_lock);
spin_lock_irqsave(&state_lock, irqflags);
+#ifdef CONFIG_ZRAM_FOR_ANDROID
+ atomic_set(&optimize_comp_on, 0);
+#endif /* CONFIG_ZRAM_FOR_ANDROID */
if (state == SUSPENDED)
state &= ~SUSPENDED;
else
@@ -174,6 +188,9 @@ abort:
pm_wd_del_timer(&timer);
}
+#ifdef CONFIG_FAST_BOOT
+extern bool fake_shut_down;
+#endif
void request_suspend_state(suspend_state_t new_state)
{
unsigned long irqflags;
@@ -198,6 +215,10 @@ void request_suspend_state(suspend_state_t new_state)
state |= SUSPEND_REQUESTED;
queue_work(suspend_work_queue, &early_suspend_work);
} else if (old_sleep && new_state == PM_SUSPEND_ON) {
+#ifdef CONFIG_FAST_BOOT
+ if (fake_shut_down)
+ fake_shut_down = false;
+#endif
state &= ~SUSPEND_REQUESTED;
wake_lock(&main_wake_lock);
queue_work(suspend_work_queue, &late_resume_work);
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 8884c27..c260280 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -14,6 +14,7 @@
#include <linux/reboot.h>
#include <linux/string.h>
#include <linux/device.h>
+#include <linux/async.h>
#include <linux/kmod.h>
#include <linux/delay.h>
#include <linux/fs.h>
@@ -24,13 +25,16 @@
#include <linux/freezer.h>
#include <linux/gfp.h>
#include <linux/syscore_ops.h>
+#include <linux/ctype.h>
+#include <linux/genhd.h>
#include <scsi/scsi_scan.h>
#include "power.h"
static int nocompress = 0;
-static int noresume = 0;
+int noresume;
+static int resume_wait = 0;
static char resume_file[256] = CONFIG_PM_STD_PARTITION;
dev_t swsusp_resume_device;
sector_t swsusp_resume_block;
@@ -727,12 +731,30 @@ static int software_resume(void)
/* Check if the device is there */
swsusp_resume_device = name_to_dev_t(resume_file);
+
+ /*
+ * name_to_dev_t is ineffective to verify parition if resume_file is in
+ * integer format. (e.g. major:minor)
+ */
+ if (isdigit(resume_file[0]) && resume_wait) {
+ int partno;
+ while (!get_gendisk(swsusp_resume_device, &partno))
+ msleep(10);
+ }
+
if (!swsusp_resume_device) {
/*
* Some device discovery might still be in progress; we need
* to wait for this to finish.
*/
wait_for_device_probe();
+
+ if (resume_wait) {
+ while ((swsusp_resume_device = name_to_dev_t(resume_file)) == 0)
+ msleep(10);
+ async_synchronize_full();
+ }
+
/*
* We can't depend on SCSI devices being available after loading
* one of their modules until scsi_complete_async_scans() is
@@ -810,7 +832,11 @@ close_finish:
goto Finish;
}
+#ifdef CONFIG_FAST_RESUME
+resume_initcall(software_resume);
+#else
late_initcall(software_resume);
+#endif
static const char * const hibernation_modes[] = {
@@ -1002,11 +1028,42 @@ static ssize_t reserved_size_store(struct kobject *kobj,
power_attr(reserved_size);
+#ifdef CONFIG_FAST_RESUME
+static ssize_t noresume_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%d\n", noresume);
+}
+
+static ssize_t noresume_store(struct kobject *kobj,
+ struct kobj_attribute *attr, const char *buf, size_t n)
+{
+ if (sscanf(buf, "%d", &noresume) == 1) {
+ noresume = !!noresume;
+ if (noresume) {
+ if (!swsusp_resume_device)
+ swsusp_resume_device =
+ name_to_dev_t(resume_file);
+ swsusp_check();
+ swsusp_close(FMODE_READ);
+ }
+ return n;
+ }
+
+ return -EINVAL;
+}
+
+power_attr(noresume);
+#endif
+
static struct attribute * g[] = {
&disk_attr.attr,
&resume_attr.attr,
&image_size_attr.attr,
&reserved_size_attr.attr,
+#ifdef CONFIG_FAST_RESUME
+ &noresume_attr.attr,
+#endif
NULL,
};
@@ -1061,7 +1118,14 @@ static int __init noresume_setup(char *str)
return 1;
}
+static int __init resumewait_setup(char *str)
+{
+ resume_wait = 1;
+ return 1;
+}
+
__setup("noresume", noresume_setup);
__setup("resume_offset=", resume_offset_setup);
__setup("resume=", resume_setup);
__setup("hibernate=", hibernate_setup);
+__setup("resumewait=", resumewait_setup);
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 7f6987f..9c54ff7 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -190,6 +190,12 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
#endif
return (s - buf);
}
+#ifdef CONFIG_FAST_BOOT
+bool fake_shut_down = false;
+EXPORT_SYMBOL(fake_shut_down);
+
+extern void wakelock_force_suspend(void);
+#endif
static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t n)
@@ -220,15 +226,29 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
break;
}
- if (state < PM_SUSPEND_MAX && *s)
+
+#ifdef CONFIG_FAST_BOOT
+ if (len == 4 && !strncmp(buf, "dmem", len)) {
+ pr_info("%s: fake shut down!!!\n", __func__);
+ fake_shut_down = true;
+ state = PM_SUSPEND_MEM;
+ }
+#endif
+
+ if (state < PM_SUSPEND_MAX && *s) {
#ifdef CONFIG_EARLYSUSPEND
if (state == PM_SUSPEND_ON || valid_state(state)) {
error = 0;
request_suspend_state(state);
}
+#ifdef CONFIG_FAST_BOOT
+ if (fake_shut_down)
+ wakelock_force_suspend();
+#endif
#else
error = enter_state(state);
#endif
+ }
#endif
Exit:
@@ -683,7 +703,7 @@ static ssize_t mali_lock_store(struct kobject *kobj,
mali_lock_cnt = mali_dvfs_bottom_lock_pop();
if (mali_lock_cnt == 0)
mali_lock_val = 0;
- } else if (val > 0 && val < 4) { /* lock with level */
+ } else if (val > 0 && val < 5) { /* lock with level */
mali_lock_cnt = mali_dvfs_bottom_lock_push(val);
if (mali_lock_val < val)
mali_lock_val = val;
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 474d75b..fac1ce8 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -72,6 +72,7 @@ static struct kobj_attribute _name##_attr = { \
.store = _name##_store, \
}
+extern int noresume;
/* Preferred image size in bytes (default 500 MB) */
extern unsigned long image_size;
/* Size of memory reserved for drivers (default SPARE_PAGES x PAGE_SIZE) */
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 7c97c3a..2a2dc30 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -372,6 +372,15 @@ static int swap_writer_finish(struct swap_map_handle *handle,
LZO_HEADER, PAGE_SIZE)
#define LZO_CMP_SIZE (LZO_CMP_PAGES * PAGE_SIZE)
+/*
+ * lzo experimental compression ratio.
+ * When compression is used for hibernation, swap size is not required for worst
+ * case. So we use an experimental compression ratio. If the swap size is not
+ * enough, then alloc_swapdev_block() return fails and hibernation codes handle
+ * the error well.
+ */
+#define LZO_RATIO(x) ((x) / 2)
+
/**
* save_image - save the suspend image data
*/
@@ -437,7 +446,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
struct bio *bio;
struct timeval start;
struct timeval stop;
- size_t off, unc_len, cmp_len;
+ size_t off, unc_len, cmp_len, total;
unsigned char *unc, *cmp, *wrk, *page;
page = (void *)__get_free_page(__GFP_WAIT | __GFP_HIGH);
@@ -477,6 +486,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
if (!m)
m = 1;
nr_pages = 0;
+ total = 0;
bio = NULL;
do_gettimeofday(&start);
for (;;) {
@@ -529,6 +539,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
if (ret)
goto out_finish;
}
+ total += DIV_ROUND_UP(LZO_HEADER + cmp_len, PAGE_SIZE);
}
out_finish:
@@ -541,6 +552,11 @@ out_finish:
else
printk(KERN_CONT "\n");
swsusp_show_speed(&start, &stop, nr_to_write, "Wrote");
+ pr_info("PM: %lu->%lu kbytes, %d%% compressed\n",
+ nr_to_write * PAGE_SIZE / 1024,
+ total * PAGE_SIZE / 1024,
+ 100 - ((total * 100) / nr_to_write));
+ image_size = total * PAGE_SIZE;
vfree(cmp);
vfree(unc);
@@ -564,8 +580,8 @@ static int enough_swap(unsigned int nr_pages, unsigned int flags)
pr_debug("PM: Free swap pages: %u\n", free_swap);
- required = PAGES_FOR_IO + ((flags & SF_NOCOMPRESS_MODE) ?
- nr_pages : (nr_pages * LZO_CMP_PAGES) / LZO_UNC_PAGES + 1);
+ required = PAGES_FOR_IO + ((flags & SF_NOCOMPRESS_MODE) ? nr_pages :
+ LZO_RATIO((nr_pages * LZO_CMP_PAGES) / LZO_UNC_PAGES + 1));
return free_swap > required;
}
@@ -943,8 +959,11 @@ int swsusp_check(void)
if (!memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) {
memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
/* Reset swap signature now */
- error = hib_bio_write_page(swsusp_resume_block,
- swsusp_header, NULL);
+#if defined(CONFIG_FAST_RESUME) && defined(CONFIG_SLP)
+ if (noresume)
+#endif
+ error = hib_bio_write_page(swsusp_resume_block,
+ swsusp_header, NULL);
} else {
error = -EINVAL;
}
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c
index b2e149a..104f6dc 100644
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -22,6 +22,9 @@
#ifdef CONFIG_WAKELOCK_STAT
#include <linux/proc_fs.h>
#endif
+#ifdef CONFIG_FAST_BOOT
+#include <linux/delay.h>
+#endif
#include "power.h"
enum {
@@ -250,11 +253,18 @@ static long has_wake_lock_locked(int type)
}
return max_timeout;
}
+#ifdef CONFIG_FAST_BOOT
+extern bool fake_shut_down;
+#endif
long has_wake_lock(int type)
{
long ret;
unsigned long irqflags;
+#ifdef CONFIG_FAST_BOOT
+ if (fake_shut_down)
+ return 0;
+#endif
spin_lock_irqsave(&list_lock, irqflags);
ret = has_wake_lock_locked(type);
if (ret && (debug_mask & DEBUG_WAKEUP) && type == WAKE_LOCK_SUSPEND)
@@ -558,6 +568,25 @@ int wake_lock_active(struct wake_lock *lock)
}
EXPORT_SYMBOL(wake_lock_active);
+#ifdef CONFIG_FAST_BOOT
+void wakelock_force_suspend(void)
+{
+ static int cnt;
+
+ if (cnt > 0) {
+ pr_info("%s: duplicated\n", __func__);
+ return;
+ }
+ cnt++;
+
+ msleep(3000);
+ pr_info("%s: fake shut down\n", __func__);
+ queue_work(suspend_work_queue, &suspend_work);
+
+ cnt = 0;
+}
+#endif
+
static int wakelock_stats_open(struct inode *inode, struct file *file)
{
return single_open(file, wakelock_stats_show, NULL);
diff --git a/kernel/printk.c b/kernel/printk.c
index 95eddd6..17b0c7a 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -216,15 +216,7 @@ void __init setup_log_buf(int early)
new_log_buf_len);
return;
}
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
spin_lock_irqsave(&logbuf_lock, flags);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
log_buf_len = new_log_buf_len;
log_buf = new_log_buf;
new_log_buf_len = 0;
@@ -327,15 +319,7 @@ int log_buf_copy(char *dest, int idx, int len)
bool took_lock = false;
if (!oops_in_progress) {
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irq logbuf_lock", __func__);
-#endif
spin_lock_irq(&logbuf_lock);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irq logbuf_lock", __func__);
-#endif
took_lock = true;
}
@@ -432,15 +416,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
if (error)
goto out;
i = 0;
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irq logbuf_lock", __func__);
-#endif
spin_lock_irq(&logbuf_lock);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irq logbuf_lock", __func__);
-#endif
while (!error && (log_start != log_end) && i < len) {
c = LOG_BUF(log_start);
log_start++;
@@ -449,15 +425,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
buf++;
i++;
cond_resched();
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irq logbuf_lock", __func__);
-#endif
spin_lock_irq(&logbuf_lock);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irq logbuf_lock", __func__);
-#endif
}
spin_unlock_irq(&logbuf_lock);
if (!error)
@@ -482,15 +450,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
count = len;
if (count > log_buf_len)
count = log_buf_len;
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irq logbuf_lock", __func__);
-#endif
spin_lock_irq(&logbuf_lock);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irq logbuf_lock", __func__);
-#endif
if (count > logged_chars)
count = logged_chars;
if (do_clear)
@@ -510,15 +470,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
spin_unlock_irq(&logbuf_lock);
error = __put_user(c,&buf[count-1-i]);
cond_resched();
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irq logbuf_lock", __func__);
-#endif
spin_lock_irq(&logbuf_lock);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irq logbuf_lock", __func__);
-#endif
}
spin_unlock_irq(&logbuf_lock);
if (error)
@@ -768,15 +720,7 @@ void register_log_char_hook(void (*f) (char c))
unsigned start;
unsigned long flags;
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
spin_lock_irqsave(&logbuf_lock, flags);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
start = min(con_start, log_start);
while (start != log_end)
@@ -1010,15 +954,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
}
lockdep_off();
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock logbuf_lock", __func__);
-#endif
spin_lock(&logbuf_lock);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock logbuf_lock", __func__);
-#endif
printk_cpu = this_cpu;
if (recursion_bug) {
@@ -1443,15 +1379,7 @@ void console_unlock(void)
console_may_schedule = 0;
for ( ; ; ) {
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
spin_lock_irqsave(&logbuf_lock, flags);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
wake_klogd |= log_start - log_end;
if (con_start == log_end)
break; /* Nothing to print */
@@ -1701,15 +1629,7 @@ void register_console(struct console *newcon)
* console_unlock(); will print out the buffered messages
* for us.
*/
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
spin_lock_irqsave(&logbuf_lock, flags);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
con_start = log_start;
spin_unlock_irqrestore(&logbuf_lock, flags);
/*
@@ -1918,15 +1838,7 @@ void kmsg_dump(enum kmsg_dump_reason reason)
/* Theoretically, the log could move on after we do this, but
there's not a lot we can do about that. The new messages
will overwrite the start of what we dump. */
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "+ %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
spin_lock_irqsave(&logbuf_lock, flags);
-#ifdef CONFIG_MACH_PX
- sec_debug_aux_log(SEC_DEBUG_AUXLOG_LOGBUF_LOCK_CHANGE,
- "- %s: spin_lock_irqsave logbuf_lock", __func__);
-#endif
end = log_end & LOG_BUF_MASK;
chars = logged_chars;
spin_unlock_irqrestore(&logbuf_lock, flags);
diff --git a/kernel/sys.c b/kernel/sys.c
index 2c9169c..5e1d582 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -340,8 +340,10 @@ void kernel_restart(char *cmd)
syscore_shutdown();
if (!cmd)
printk(KERN_EMERG "Restarting system.\n");
- else
+ else{
printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
+ printk(KERN_EMERG "pid = %d name:%s\n", task_tgid_vnr(current), current->comm);
+ }
kmsg_dump(KMSG_DUMP_RESTART);
machine_restart(cmd);
}