Skip to content
Browse files

strip out Samsung's debug crap

Change-Id: I9158727170060668dc8635a6b984300a7acafe02
  • Loading branch information...
1 parent 32f286b commit 04a3c643d7a1cba886acdd46d04c469528a25602 @jt1134 jt1134 committed Mar 17, 2012
View
13 arch/arm/Kconfig
@@ -1104,19 +1104,6 @@ source "drivers/pcmcia/Kconfig"
endmenu
-menu "Samsung Kernel Debug Features"
-
-choice
- prompt "Enable Samsung Kernel Debug Features"
- default KERNEL_DEBUG_SEC
-
-config KERNEL_DEBUG_SEC
- bool "KERNEL_DEBUG_SEC"
-
-endchoice
-
-endmenu
-
menu "Kernel Features"
source "kernel/time/Kconfig"
View
6 arch/arm/configs/p1_defconfig
@@ -383,11 +383,6 @@ CONFIG_PL330=y
# CONFIG_PCCARD is not set
#
-# Samsung Kernel Debug Features
-#
-CONFIG_KERNEL_DEBUG_SEC=y
-
-#
# Kernel Features
#
CONFIG_TICK_ONESHOT=y
@@ -1017,7 +1012,6 @@ CONFIG_MHL_SII9234=y
# CONFIG_SAMSUNG_MODEMCTL is not set
# CONFIG_SAMSUNG_DPRAM is not set
CONFIG_VIBTONZ=m
-CONFIG_LEVEL=y
CONFIG_STORAGE_DGS=m
CONFIG_GENERIC_BLN=y
CONFIG_SAMSUNG_PARAM=y
View
7 arch/arm/kernel/process.c
@@ -37,10 +37,6 @@
#include <asm/mach/time.h>
#include <mach/regs-clock.h>
-#ifdef CONFIG_KERNEL_DEBUG_SEC
-#include <linux/kernel_sec_common.h>
-#endif
-
static const char *processor_modes[] = {
"USER_26", "FIQ_26" , "IRQ_26" , "SVC_26" , "UK4_26" , "UK5_26" , "UK6_26" , "UK7_26" ,
"UK8_26" , "UK9_26" , "UK10_26", "UK11_26", "UK12_26", "UK13_26", "UK14_26", "UK15_26",
@@ -101,9 +97,6 @@ void arm_machine_restart(char mode, const char *cmd)
*/
setup_mm_for_reboot(mode);
-#ifdef CONFIG_KERNEL_DEBUG_SEC
- kernel_sec_clear_upload_magic_number(); // Clear the magic number because it's normal reboot.
-#endif
writel(0x12345678, S5P_INFORM5); //Reset
View
83 drivers/input/keyboard/gpio_keys.c
@@ -76,43 +76,6 @@ struct gpio_keys_drvdata {
*/
#if defined(CONFIG_MACH_P1)
-#ifdef CONFIG_KERNEL_DEBUG_SEC
-#include <linux/kernel_sec_common.h>
-struct timer_list debug_timer;
-struct gpio_keys_platform_data *g_pdata;
-
-void enter_upload_mode(unsigned long val)
-{
- bool uploadmode = true;
- int i;
-
- // not to enter forced upload mode in boot PARAM_LOW
- if( KERNEL_SEC_DEBUG_LEVEL_LOW == kernel_sec_get_debug_level() )
- return;
-
- for (i = 0; i < g_pdata->nbuttons; i++)
- {
- struct gpio_keys_button *button = &g_pdata->buttons[i];
- if(gpio_get_value(button->gpio))
- {
- uploadmode = false;
- break;
- }
- }
-
- if(uploadmode)
- {
- if (kernel_sec_viraddr_wdt_reset_reg)
- {
- kernel_sec_set_cp_upload();
- kernel_sec_save_final_context(); // Save theh final context.
- kernel_sec_set_upload_cause(UPLOAD_CAUSE_FORCED_UPLOAD);
- kernel_sec_hw_reset(false); // Reboot.
- }
- }
-}
-#endif
-
/* For checking H/W faulty. */
static ssize_t keyshort_test(struct device *dev, struct device_attribute *attr, char *buf)
{
@@ -392,47 +355,6 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata)
int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low;
#if defined(CONFIG_MACH_P1)
-#ifdef CONFIG_KERNEL_DEBUG_SEC
- static bool first=false;
- static bool second=false;
-
- if(state)
- {
- if(button->code == KEY_VOLUMEUP)
- {
- first = true;
- }
-
- if(button->code == KEY_VOLUMEDOWN)
- {
- second = true;
- }
-
- /* Entering the forced upload mode should be pressed both volume keys
- before pressing the power key */
- if(first&&second)
- {
- if(button->code == KEY_POWER)
- {
- mod_timer(&debug_timer, jiffies + HZ*2);
- printk(KERN_WARNING "[Key] Waiting for upload mode for 2 seconds.\n");
- }
- }
- }
- else
- {
- if(button->code == KEY_VOLUMEUP)
- {
- first = false;
- }
-
- if(button->code == KEY_VOLUMEDOWN)
- {
- second = false;
- }
- }
-#endif // CONFIG_KERNEL_DEBUG_SEC
-
if(state)
{
button->pressed = true;
@@ -629,11 +551,6 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
{
pr_err("Failed to create device file(%s)!\n", dev_attr_key_pressed.attr.name);
}
-#ifdef CONFIG_KERNEL_DEBUG_SEC
- g_pdata = pdata;
- init_timer(&debug_timer);
- debug_timer.function = enter_upload_mode;
-#endif
#endif
return 0;
View
6 drivers/misc/Kconfig
@@ -477,12 +477,6 @@ config VIBTONZ
help
Say Y to enable Vibetonz support.
-config LEVEL
- tristate "level_debug"
- default y
- help
- Say Y to enable debug level I/F support.
-
config STORAGE_DGS
tristate "readable dgs"
default m
View
1 drivers/misc/Makefile
@@ -40,7 +40,6 @@ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
obj-$(CONFIG_SAMSUNG_MODEMCTL) += samsung_modemctl/
obj-$(CONFIG_SAMSUNG_DPRAM) += dpram/
obj-$(CONFIG_VIBTONZ) += vibtonz/
-obj-$(CONFIG_LEVEL) += level/
obj-$(CONFIG_30PIN_CONN) += 30pin_con.o
obj-$(CONFIG_MHL_SII9234) += sii9234.o
obj-$(CONFIG_GENERIC_BLN) += bln.o
View
2 drivers/misc/level/Makefile
@@ -1,2 +0,0 @@
-obj-y += level.o
-
View
197 drivers/misc/level/level.c
@@ -1,197 +0,0 @@
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/device.h>
-#include <linux/miscdevice.h>
-#include <linux/kernel.h>
-#include <linux/fs.h>
-#include <linux/errno.h>
-#include <linux/types.h>
-#include <linux/fcntl.h>
-#include <linux/kernel_sec_common.h>
-
-#include <asm/uaccess.h>
-
-#define LEVEL_DEV_NAME "level"
-
-#define LEVEL_DEV_IOCTL_CMD 0xee
-
-#define LEVEL_DEV_UNSET_UPLOAD _IO(LEVEL_DEV_IOCTL_CMD, 0x1)
-#define LEVEL_DEV_SET_AUTOTEST _IO(LEVEL_DEV_IOCTL_CMD, 0x2)
-#define LEVEL_DEV_SET_DEBUGLEVEL _IO(LEVEL_DEV_IOCTL_CMD, 0x3)
-#define LEVEL_DEV_GET_DEBUGLEVEL _IO(LEVEL_DEV_IOCTL_CMD, 0x4)
-
-static void set_debug_level(void);
-static unsigned int get_debug_level(void);
-
-static ssize_t show_control(struct device *d,
- struct device_attribute *attr, char *buf);
-static ssize_t store_control(struct device *d,
- struct device_attribute *attr, const char *buf, size_t count);
-
-static DEVICE_ATTR(control, 0664, show_control, store_control);
-
-static struct attribute *levelctl_attributes[] = {
- &dev_attr_control.attr,
- NULL
-};
-
-static const struct attribute_group levelctl_group = {
- .attrs = levelctl_attributes,
-};
-
-static ssize_t show_control(struct device *d,
- struct device_attribute *attr, char *buf)
-{
- char *p = buf;
- unsigned int val;
-
- val = get_debug_level();
-
- p += sprintf(p, "0x%4x\n",val);
-
- return p - buf;
-}
-
-static ssize_t store_control(struct device *d,
- struct device_attribute *attr, const char *buf, size_t count)
-{
-
- if(!strncmp(buf, "clear", 5)) {
- // clear upload magic number
- kernel_sec_clear_upload_magic_number();
- return count;
- }
-
- if(!strncmp(buf, "autotest", 8)) {
- // set auto test
- kernel_sec_set_autotest();
- return count;
- }
-
- if(!strncmp(buf, "set", 3)) {
- // set debug level
- set_debug_level();
- return count;
- }
-
-return count;
-}
-
-static int level_open(struct inode *inode, struct file *filp)
-{
- printk("level Device open\n");
-
- return 0;
-}
-
-static int level_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
-{
- unsigned int val;
-
- switch (cmd) {
- case LEVEL_DEV_UNSET_UPLOAD:
- kernel_sec_clear_upload_magic_number();
- return 0;
-
- case LEVEL_DEV_SET_AUTOTEST:
- kernel_sec_set_autotest();
- return 0;
-
- case LEVEL_DEV_SET_DEBUGLEVEL:
- set_debug_level();
- return 0;
-
- case LEVEL_DEV_GET_DEBUGLEVEL:
- {
- val = get_debug_level();
- return copy_to_user((unsigned int *)arg, &val, sizeof(val));
- }
- default:
- printk("Unknown Cmd: %x\n", cmd);
- break;
- }
- return -ENOTSUPP;
-}
-
-static void set_debug_level()
-{
- switch(kernel_sec_get_debug_level_from_param())
- {
- case KERNEL_SEC_DEBUG_LEVEL_LOW:
- kernel_sec_set_debug_level(KERNEL_SEC_DEBUG_LEVEL_MID);
- break;
- case KERNEL_SEC_DEBUG_LEVEL_MID:
- kernel_sec_set_debug_level(KERNEL_SEC_DEBUG_LEVEL_HIGH);
- break;
- case KERNEL_SEC_DEBUG_LEVEL_HIGH:
- kernel_sec_set_debug_level(KERNEL_SEC_DEBUG_LEVEL_LOW);
- break;
- default:
- break;
- }
-}
-
-static unsigned int get_debug_level()
-{
- unsigned int val = 0;
-
- switch(kernel_sec_get_debug_level_from_param())
- {
- case KERNEL_SEC_DEBUG_LEVEL_LOW:
- val = 0xA0A0;
- break;
- case KERNEL_SEC_DEBUG_LEVEL_MID:
- val = 0xB0B0;
- break;
- case KERNEL_SEC_DEBUG_LEVEL_HIGH:
- val = 0xC0C0;
- break;
- default:
- val = 0xFFFF;
- break;
- }
-
- return val;
-}
-
-static struct file_operations level_fops =
-{
- .owner = THIS_MODULE,
- .open = level_open,
- .ioctl = level_ioctl,
-};
-
-static struct miscdevice level_device = {
- .minor = MISC_DYNAMIC_MINOR,
- .name = LEVEL_DEV_NAME,
- .fops = &level_fops,
-};
-
-/* init & cleanup. */
-static int __init level_init(void)
-{
- int result;
-
- printk("level device init\n");
-
- result = misc_register(&level_device);
- if (result <0)
- return result;
-
- result = sysfs_create_group(&level_device.this_device->kobj, &levelctl_group);
- if (result < 0) {
- printk("failed to create sysfs files\n");
- }
-
- return 0;
-}
-
-static void __exit level_exit(void)
-{
- printk("level device exit\n");
- misc_deregister(&level_device);
-}
-
-module_init(level_init);
-module_exit(level_exit);
-
View
4 drivers/staging/android/logger.c
@@ -33,10 +33,6 @@
static char klog_buf[256];
//}} pass platform log to kernel - 1/3
-#ifdef CONFIG_KERNEL_DEBUG_SEC
-#include <linux/kernel_sec_common.h>
-#endif
-
/*
* Mark for GetLog (tkhwang)
*/
View
191 include/linux/kernel_sec_common.h
@@ -1,191 +0,0 @@
-#ifndef _KERNEL_SEC_COMMON_H_
-#define _KERNEL_SEC_COMMON_H_
-
-#include <asm/io.h>
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <mach/map.h>
-#include <mach/regs-clock.h>
-#include <linux/sched.h>
-
-// MAGIC_CODE in LOKE
-// you have to use this vitrual address with consideration
-#define LOKE_BOOT_USB_DWNLD_V_ADDR 0xD1000000
-#define LOKE_BOOT_USB_DWNLDMAGIC_NO 0x66262564
-
-#define KERNEL_SEC_DUMP_AP_DEAD_INDICATOR 0xABCD00C9 // AP -> CP : AP Crash Ind
-#define KERNEL_SEC_DUMP_AP_DEAD_ACK 0xCACAEDED // CP -> AP : CP ready for uplaod mode.
-
-#define KERNEL_SEC_DEBUG_CAUSE_STR_LEN 65 //it's longer than DPRAM_ERR_MSG_LEN, in dpram.h
-#define KERNEL_SEC_DEBUG_LEVEL_LOW (0x574F4C44)
-#define KERNEL_SEC_DEBUG_LEVEL_MID (0x44494D44)
-#define KERNEL_SEC_DEBUG_LEVEL_HIGH (0x47494844)
-
-// INFORMATION REGISTER
-// #define S5P_INFORM0 S5P_CLKREG(0xF000)
-// #define S5P_INFORM1 S5P_CLKREG(0xF004)
-// #define S5P_INFORM2 S5P_CLKREG(0xF008)
-// #define S5P_INFORM3 S5P_CLKREG(0xF00C)
-// #define S5P_INFORM4 S5P_CLKREG(0xF010)
-// #define S5P_INFORM5 S5P_CLKREG(0xF014)
-#define S5P_INFORM6 S5P_CLKREG(0xF018) // Magic code for upload cause.
-// #define S5P_INFORM7 S5P_CLKREG(0xF01C)
-
-//WDOG register
-//#define S3C_PA_WDT 0xE2700000
-
-// klaatu - schedule log
-#define SCHED_LOG_MAX 2000
-
-typedef struct {
- void * dummy;
- void * fn;
-}irq_log_t;
-
-typedef union {
- char task[TASK_COMM_LEN];
- irq_log_t irq;
-}task_log_t;
-
-typedef struct {
- unsigned long long time;
- task_log_t log;
-}sched_log_t;
-
-extern sched_log_t gExcpTaskLog[SCHED_LOG_MAX];
-extern unsigned int gExcpTaskLogIdx;
-
-typedef struct tag_mmu_info
-{
- int SCTLR;
- int TTBR0;
- int TTBR1;
- int TTBCR;
- int DACR;
- int DFSR;
- int DFAR;
- int IFSR;
- int IFAR;
- int DAFSR;
- int IAFSR;
- int PMRRR;
- int NMRRR;
- int FCSEPID;
- int CONTEXT;
- int URWTPID;
- int UROTPID;
- int POTPIDR;
-}t_kernel_sec_mmu_info;
-
-/*ARM CORE regs mapping structure*/
-typedef struct
-{
- /* COMMON */
- unsigned int r0;
- unsigned int r1;
- unsigned int r2;
- unsigned int r3;
- unsigned int r4;
- unsigned int r5;
- unsigned int r6;
- unsigned int r7;
- unsigned int r8;
- unsigned int r9;
- unsigned int r10;
- unsigned int r11;
- unsigned int r12;
-
- /* SVC */
- unsigned int r13_svc;
- unsigned int r14_svc;
- unsigned int spsr_svc;
-
- /* PC & CPSR */
- unsigned int pc;
- unsigned int cpsr;
-
- /* USR/SYS */
- unsigned int r13_usr;
- unsigned int r14_usr;
-
- /* FIQ */
- unsigned int r8_fiq;
- unsigned int r9_fiq;
- unsigned int r10_fiq;
- unsigned int r11_fiq;
- unsigned int r12_fiq;
- unsigned int r13_fiq;
- unsigned int r14_fiq;
- unsigned int spsr_fiq;
-
- /* IRQ */
- unsigned int r13_irq;
- unsigned int r14_irq;
- unsigned int spsr_irq;
-
- /* MON */
- unsigned int r13_mon;
- unsigned int r14_mon;
- unsigned int spsr_mon;
-
- /* ABT */
- unsigned int r13_abt;
- unsigned int r14_abt;
- unsigned int spsr_abt;
-
- /* UNDEF */
- unsigned int r13_und;
- unsigned int r14_und;
- unsigned int spsr_und;
-
-}t_kernel_sec_arm_core_regsiters;
-
-typedef enum
-{
- UPLOAD_CAUSE_INIT = 0x00000000,
- UPLOAD_CAUSE_KERNEL_PANIC = 0x000000C8,
- UPLOAD_CAUSE_FORCED_UPLOAD = 0x00000022,
- UPLOAD_CAUSE_CP_ERROR_FATAL = 0x000000CC,
- UPLOAD_CAUSE_USER_FAULT = 0x0000002F,
-}kernel_sec_upload_cause_type;
-
-#define KERNEL_SEC_UPLOAD_CAUSE_MASK 0x000000FF
-#define KERNEL_SEC_UPLOAD_AUTOTEST_BIT 31
-#define KERNEL_SEC_UPLOAD_AUTOTEST_MASK (1<<KERNEL_SEC_UPLOAD_AUTOTEST_BIT)
-
-#define KERNEL_SEC_DEBUG_LEVEL_BIT 29
-#define KERNEL_SEC_DEBUG_LEVEL_MASK (3<<KERNEL_SEC_DEBUG_LEVEL_BIT)
-
-extern void __iomem * kernel_sec_viraddr_wdt_reset_reg;
-extern void kernel_sec_map_wdog_reg(void);
-
-extern void kernel_sec_set_cp_upload(void);
-extern void kernel_sec_set_cp_ack(void);
-extern void kernel_sec_set_upload_magic_number(void);
-extern void kernel_sec_set_upload_cause(kernel_sec_upload_cause_type uploadType);
-extern void kernel_sec_set_cause_strptr(unsigned char* str_ptr, int size);
-extern void kernel_sec_set_autotest(void);
-extern void kernel_sec_clear_upload_magic_number(void);
-extern void kernel_sec_set_build_info(void);
-
-extern void kernel_sec_hw_reset(bool bSilentReset);
-extern void kernel_sec_init(void);
-
-extern void kernel_sec_get_core_reg_dump(t_kernel_sec_arm_core_regsiters* regs);
-extern int kernel_sec_get_mmu_reg_dump(t_kernel_sec_mmu_info *mmu_info);
-extern void kernel_sec_save_final_context(void);
-
-extern bool kernel_set_debug_level(int level);
-extern int kernel_get_debug_level(void);
-extern int kernel_get_debug_state(void);
-
-extern bool kernel_sec_set_debug_level(int level);
-extern int kernel_sec_get_debug_level_from_param(void);
-extern int kernel_sec_get_debug_level(void);
-
-extern void dump_debug_info_forced_ramd_dump(void);
-
-#define KERNEL_SEC_LEN_BUILD_TIME 16
-#define KERNEL_SEC_LEN_BUILD_DATE 16
-
-#endif /* _KERNEL_SEC_COMMON_H_ */
View
12 init/main.c
@@ -82,10 +82,6 @@
#include <asm/smp.h>
#endif
-#ifdef CONFIG_KERNEL_DEBUG_SEC
-#include <linux/kernel_sec_common.h>
-#endif
-
static int kernel_init(void *);
extern void init_IRQ(void);
@@ -710,10 +706,6 @@ asmlinkage void __init start_kernel(void)
ftrace_init();
-#ifdef CONFIG_KERNEL_DEBUG_SEC
- kernel_sec_init();
-#endif
-
/* Do the rest non-__init'ed, we're now alive */
rest_init();
}
@@ -928,10 +920,6 @@ static int __init kernel_init(void * unused)
prepare_namespace();
}
-#ifdef CONFIG_KERNEL_DEBUG_SEC
- kernel_sec_set_build_info();
-#endif
-
/*
* Ok, we have completed the initial bootup, and
* we're essentially up and running. Get rid of the
View
1 kernel/Makefile
@@ -105,7 +105,6 @@ obj-$(CONFIG_PERF_EVENTS) += perf_event.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o
obj-$(CONFIG_PADATA) += padata.o
-obj-$(CONFIG_KERNEL_DEBUG_SEC) += kernel_sec_debug.o
ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
# According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
View
641 kernel/kernel_sec_debug.c
@@ -1,641 +0,0 @@
-/* kernel_sec_debug.c
- *
- * Exception handling in kernel by SEC
- *
- * Copyright (c) 2010 Samsung Electronics
- * http://www.samsung.com/
- *
- */
-
-#ifdef CONFIG_KERNEL_DEBUG_SEC
-
-#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>
-
-/*
- * 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];
-extern unsigned int HWREV;
-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;
-
-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
-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);
-
-void kernel_sec_set_cp_upload(void)
-{
- unsigned int send_mail, wait_count;
-
- 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);
-}
-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;
-
- switch (uploadType){
- case UPLOAD_CAUSE_INIT:
- printk(KERN_EMERG"[DBG] upload cause : UPLOAD_CAUSE_INIT\n");
- break;
- case UPLOAD_CAUSE_KERNEL_PANIC:
- printk(KERN_EMERG"[DBG] upload cause : UPLOAD_CAUSE_KERNEL_PANIC\n");
- break;
- case UPLOAD_CAUSE_FORCED_UPLOAD:
- printk(KERN_EMERG"[DBG] upload cause : UPLOAD_CAUSE_FORCED_UPLOAD\n");
- break;
- case UPLOAD_CAUSE_CP_ERROR_FATAL:
- printk(KERN_EMERG"[DBG] upload cause : UPLOAD_CAUSE_CP_ERROR_FATAL\n");
- break;
- case UPLOAD_CAUSE_USER_FAULT:
- printk(KERN_EMERG"[DBG] upload cause : UPLOAD_CAUSE_USER_FAULT\n");
- break;
- default:
- printk(KERN_EMERG"[DBG] upload cause : UNKNOWN \n");
- }
-
- printk(KERN_EMERG"(kernel_sec_set_upload_cause) : upload_cause set %x\n",uploadType);
- temp = __raw_readl(S5P_INFORM6);
- temp |= uploadType; // KERNEL_SEC_UPLOAD_CAUSE_MASK 0x000000FF
- __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);
- __raw_writel(temp, LOKE_BOOT_USB_DWNLD_V_ADDR+4); //loke read this ptr, display_aries_upload_image
-}
-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 onedram mailbox virtual address
- dpram_base = ioremap_nocache(0x30000000 + 0x05000000 + 0xFFF800, 0x60); //DPRAM_START_ADDRESS_PHYS + DPRAM_SHARED_BANK + DPRAM_SMP
-
- if (dpram_base == NULL) {
- printk(KERN_EMERG"failed ioremap\n");
- }
- onedram_sem = dpram_base ;
- onedram_mailboxAB = dpram_base + 0x20;
- onedram_mailboxBA = dpram_base + 0x40;
-
- 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)
-{
-// CR DAC TTBR0 TTBR1 TTBCR
- 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", __FUNCTION__,
- 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", __FUNCTION__);
- }
- /* 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", __FUNCTION__);
- }
-
- 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
View
20 kernel/panic.c
@@ -23,9 +23,6 @@
#include <linux/init.h>
#include <linux/nmi.h>
#include <linux/dmi.h>
-#ifdef CONFIG_KERNEL_DEBUG_SEC
-#include <linux/kernel_sec_common.h>
-#endif
int panic_on_oops;
static unsigned long tainted_mask;
@@ -130,17 +127,11 @@ NORET_TYPE void panic(const char * fmt, ...)
*/
printk(KERN_EMERG "Rebooting in %d seconds..", panic_timeout);
-#ifndef CONFIG_KERNEL_DEBUG_SEC
for (i = 0; i < panic_timeout; i++) {
touch_nmi_watchdog();
panic_blink_one_second();
}
-#else
- kernel_sec_set_cp_upload();
- kernel_sec_save_final_context();
- kernel_sec_set_upload_cause(UPLOAD_CAUSE_KERNEL_PANIC);
- kernel_sec_hw_reset(false);
-#endif
+
/*
* This will not be a clean reboot, with everything
* shutting down. But if there is a chance of
@@ -164,18 +155,13 @@ NORET_TYPE void panic(const char * fmt, ...)
disabled_wait(caller);
}
#endif
-#ifndef CONFIG_KERNEL_DEBUG_SEC
+
local_irq_enable();
while (1) {
touch_softlockup_watchdog();
panic_blink_one_second();
}
-#else
- kernel_sec_set_cp_upload();
- kernel_sec_save_final_context();
- kernel_sec_set_upload_cause(UPLOAD_CAUSE_KERNEL_PANIC);
- kernel_sec_hw_reset(false);
-#endif
+
}
EXPORT_SYMBOL(panic);

0 comments on commit 04a3c64

Please sign in to comment.
Something went wrong with that request. Please try again.