本文整理汇总了C++中pr_emerg函数的典型用法代码示例。如果您正苦于以下问题:C++ pr_emerg函数的具体用法?C++ pr_emerg怎么用?C++ pr_emerg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pr_emerg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dump_page_badflags
void dump_page_badflags(struct page *page, const char *reason,
unsigned long badflags)
{
pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx\n",
page, atomic_read(&page->_count), page_mapcount(page),
page->mapping, page->index);
BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS);
dump_flags(page->flags, pageflag_names, ARRAY_SIZE(pageflag_names));
if (reason)
pr_alert("page dumped because: %s\n", reason);
if (page->flags & badflags) {
pr_alert("bad because of flags:\n");
dump_flags(page->flags & badflags,
pageflag_names, ARRAY_SIZE(pageflag_names));
}
#ifdef CONFIG_MEMCG
if (page->mem_cgroup)
pr_alert("page->mem_cgroup:%p\n", page->mem_cgroup);
#endif
}
开发者ID:cl-nus,项目名称:linux,代码行数:20,代码来源:debug.c
示例2: arch_restart_cpu
void arch_restart_cpu(u32 cpu)
{
u32 timeout, val;
val = readl(DBG_DSCR(cpu));
val &= ~((0x1 << 14) | (0x1 << 13));
writel(val, DBG_DSCR(cpu));
/* Restart dest cpu */
writel(0x2, DBG_DRCR(cpu));
timeout = 10000;
do {
val = readl(DBG_DSCR(cpu));
if (val & (0x1 << 1))
break;
} while (--timeout);
if (!timeout)
pr_emerg("Cannot restart cpu%d\n", cpu);
}
开发者ID:Fnoeoe,项目名称:android_kernel_samsung_grandprimevelte,代码行数:21,代码来源:coresight-v7.c
示例3: mx_reboot_internal
static void mx_reboot_internal(const char *cmd)
{
local_irq_disable();
if(cmd) {
if (!strcmp(cmd, "charge"))
__raw_writel(REBOOT_MODE_CHARGE, S5P_INFORM4);
else if (!strcmp(cmd, "wipe"))
__raw_writel(REBOOT_MODE_WIPE, S5P_INFORM4);
else if (!strcmp(cmd, "upgrade"))
__raw_writel(REBOOT_MODE_UPGRADE, S5P_INFORM4);
}
flush_cache_all();
outer_flush_all();
arch_reset(0, 0);
pr_emerg("%s: waiting for reboot\n", __func__);
while (1) arch_reset(0, 0);
}
开发者ID:Goodzila,项目名称:m040,代码行数:21,代码来源:mx_reboot.c
示例4: kvmppc_emulate_mmio
int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
{
enum emulation_result er;
int r;
er = kvmppc_emulate_loadstore(vcpu);
switch (er) {
case EMULATE_DONE:
/* Future optimization: only reload non-volatiles if they were
* actually modified. */
r = RESUME_GUEST_NV;
break;
case EMULATE_AGAIN:
r = RESUME_GUEST;
break;
case EMULATE_DO_MMIO:
run->exit_reason = KVM_EXIT_MMIO;
/* We must reload nonvolatiles because "update" load/store
* instructions modify register state. */
/* Future optimization: only reload non-volatiles if they were
* actually modified. */
r = RESUME_HOST_NV;
break;
case EMULATE_FAIL:
{
u32 last_inst;
kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
/* XXX Deliver Program interrupt to guest. */
pr_emerg("%s: emulation failed (%08x)\n", __func__, last_inst);
r = RESUME_HOST;
break;
}
default:
WARN_ON(1);
r = RESUME_GUEST;
}
return r;
}
开发者ID:pandazheng,项目名称:linux-4.0.5-parrot,代码行数:40,代码来源:powerpc.c
示例5: arch_restart_cpu
void arch_restart_cpu(u32 cpu)
{
u32 timeout, val;
void __iomem *p_dbg_base = DBG_BASE(cpu);
void __iomem *p_cti_base = CTI_BASE(cpu);
/* Disable Halt Debug Mode */
val = readl(p_dbg_base + EDSCR);
val &= ~(0x1 << 14);
writel(val, p_dbg_base + EDSCR);
/* Enable CTI access */
cti_enable_access(cpu);
/* Enable CTI */
writel(0x1, p_cti_base + CTI_CTRL);
/* ACK the outut event */
writel(0x1, p_cti_base + CTI_INTACK);
/* Set output channel1 */
val = readl(p_cti_base + CTI_OUT1EN) | 0x2;
writel(val, p_cti_base + CTI_OUT1EN);
/* Trigger pulse event */
writel(0x2, p_cti_base + CTI_APP_PULSE);
/* Wait the cpu become running */
timeout = 10000;
do {
val = readl(p_dbg_base + EDPRSR);
if (!(val & (0x1 << 4)))
break;
} while (--timeout);
if (!timeout)
pr_emerg("Cannot restart cpu%d\n", cpu);
}
开发者ID:acorn-marvell,项目名称:brillo_pxa_kernel,代码行数:38,代码来源:coresight-v8.c
示例6: ras_error_interrupt
/*
* Handle hardware error interrupts.
*
* RTAS check-exception is called to collect data on the exception. If
* the error is deemed recoverable, we log a warning and return.
* For nonrecoverable errors, an error is logged and we stop all processing
* as quickly as possible in order to prevent propagation of the failure.
*/
static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
{
struct rtas_error_log *rtas_elog;
int status;
int fatal;
spin_lock(&ras_log_buf_lock);
status = rtas_call(ras_check_exception_token, 6, 1, NULL,
RTAS_VECTOR_EXTERNAL_INTERRUPT,
virq_to_hw(irq),
RTAS_INTERNAL_ERROR, 1 /* Time Critical */,
__pa(&ras_log_buf),
rtas_get_error_log_max());
rtas_elog = (struct rtas_error_log *)ras_log_buf;
if (status == 0 &&
rtas_error_severity(rtas_elog) >= RTAS_SEVERITY_ERROR_SYNC)
fatal = 1;
else
fatal = 0;
/* format and print the extended information */
log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, fatal);
if (fatal) {
pr_emerg("Fatal hardware error detected. Check RTAS error"
" log for details. Powering off immediately\n");
emergency_sync();
kernel_power_off();
} else {
pr_err("Recoverable hardware error detected\n");
}
spin_unlock(&ras_log_buf_lock);
return IRQ_HANDLED;
}
开发者ID:150balbes,项目名称:Amlogic_s905-kernel,代码行数:46,代码来源:ras.c
示例7: s5m_rtc_shutdown
static void s5m_rtc_shutdown(struct platform_device *pdev)
{
struct s5m_rtc_info *info = platform_get_drvdata(pdev);
int i;
unsigned int val = 0;
if (info->wtsr_smpl) {
for (i = 0; i < 3; i++) {
s5m_rtc_enable_wtsr(info, false);
regmap_read(info->rtc, SEC_WTSR_SMPL_CNTL, &val);
pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val);
if (val & WTSR_ENABLE_MASK)
pr_emerg("%s: fail to disable WTSR\n",
__func__);
else {
pr_info("%s: success to disable WTSR\n",
__func__);
break;
}
}
}
/* Disable SMPL when power off */
s5m_rtc_enable_smpl(info, false);
}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:23,代码来源:rtc-s5m.c
示例8: add_kvm_device
/*
* adds a new device and register it with virtio
* appropriate drivers are loaded by the device model
*/
static void add_kvm_device(struct kvm_device_desc *d, unsigned int offset)
{
struct kvm_device *kdev;
kdev = kzalloc(sizeof(*kdev), GFP_KERNEL);
if (!kdev) {
pr_emerg("Cannot allocate kvm dev %u type %u\n",
offset, d->type);
return;
}
kdev->vdev.dev.parent = kvm_root;
kdev->vdev.id.device = d->type;
kdev->vdev.config = &kvm_vq_config_ops;
kdev->desc = d;
kdev->desc_pa = PFN_PHYS(max_pfn) + offset;
if (register_virtio_device(&kdev->vdev) != 0) {
pr_err("Failed to register kvm device %u type %u\n",
offset, d->type);
kfree(kdev);
}
}
开发者ID:tcreech,项目名称:tilegx-linux-3.4.68-politestackrehome,代码行数:27,代码来源:kvm_virtio.c
示例9: xilinx_timer_init
static void __init xilinx_timer_init(struct device_node *timer)
{
u32 irq;
u32 timer_num = 1;
int ret;
timer_baseaddr = of_iomap(timer, 0);
if (!timer_baseaddr) {
pr_err("ERROR: invalid timer base address\n");
BUG();
}
irq = irq_of_parse_and_map(timer, 0);
of_property_read_u32(timer, "xlnx,one-timer-only", &timer_num);
if (timer_num) {
pr_emerg("Please enable two timers in HW\n");
BUG();
}
pr_info("%s: irq=%d\n", timer->full_name, irq);
/* If there is clock-frequency property than use it */
ret = of_property_read_u32(timer, "clock-frequency", &timer_clock_freq);
if (ret < 0)
timer_clock_freq = cpuinfo.cpu_clock_freq;
freq_div_hz = timer_clock_freq / HZ;
setup_irq(irq, &timer_irqaction);
#ifdef CONFIG_HEART_BEAT
setup_heartbeat();
#endif
xilinx_clocksource_init();
xilinx_clockevent_init();
timer_initialized = 1;
}
开发者ID:JasonCC,项目名称:linux-xlnx,代码行数:37,代码来源:timer.c
示例10: dump_backtrace
static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
{
struct stackframe frame;
pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk);
if (!tsk)
tsk = current;
if (regs) {
frame.fp = regs->regs[29];
frame.sp = regs->sp;
frame.pc = regs->pc;
} else if (tsk == current) {
frame.fp = (unsigned long)__builtin_frame_address(0);
frame.sp = current_stack_pointer;
frame.pc = (unsigned long)dump_backtrace;
} else {
/*
* task blocked in __switch_to
*/
frame.fp = thread_saved_fp(tsk);
frame.sp = thread_saved_sp(tsk);
frame.pc = thread_saved_pc(tsk);
}
pr_emerg("Call trace:\n");
while (1) {
unsigned long where = frame.pc;
int ret;
ret = unwind_frame(&frame);
if (ret < 0)
break;
dump_backtrace_entry(where, frame.sp);
}
}
开发者ID:Goshin,项目名称:android_kernel_mediatek,代码行数:37,代码来源:traps.c
示例11: dump_cpu_hwcaps
static int dump_cpu_hwcaps(struct notifier_block *self, unsigned long v, void *p)
{
/* file-wide pr_fmt adds "CPU features: " prefix */
pr_emerg("0x%*pb\n", ARM64_NCAPS, &cpu_hwcaps);
return 0;
}
开发者ID:Gentoo-zh,项目名称:linux-cjktty,代码行数:6,代码来源:cpufeature.c
示例12: panic
/**
* panic - halt the system
* @fmt: The text string to print
*
* Display a message, then perform cleanups.
*
* This function never returns.
*/
void panic(const char *fmt, ...)
{
static char buf[1024];
va_list args;
long i, i_next = 0, len;
int state = 0;
int old_cpu, this_cpu;
bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers;
/*
* Disable local interrupts. This will prevent panic_smp_self_stop
* from deadlocking the first cpu that invokes the panic, since
* there is nothing to prevent an interrupt handler (that runs
* after setting panic_cpu) from invoking panic() again.
*/
local_irq_disable();
/*
* It's possible to come here directly from a panic-assertion and
* not have preempt disabled. Some functions called from here want
* preempt to be disabled. No point enabling it later though...
*
* Only one CPU is allowed to execute the panic code from here. For
* multiple parallel invocations of panic, all other CPUs either
* stop themself or will wait until they are stopped by the 1st CPU
* with smp_send_stop().
*
* `old_cpu == PANIC_CPU_INVALID' means this is the 1st CPU which
* comes here, so go ahead.
* `old_cpu == this_cpu' means we came from nmi_panic() which sets
* panic_cpu to this CPU. In this case, this is also the 1st CPU.
*/
this_cpu = raw_smp_processor_id();
old_cpu = atomic_cmpxchg(&panic_cpu, PANIC_CPU_INVALID, this_cpu);
if (old_cpu != PANIC_CPU_INVALID && old_cpu != this_cpu)
panic_smp_self_stop();
console_verbose();
bust_spinlocks(1);
va_start(args, fmt);
len = vscnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
if (len && buf[len - 1] == '\n')
buf[len - 1] = '\0';
pr_emerg("Kernel panic - not syncing: %s\n", buf);
#ifdef CONFIG_DEBUG_BUGVERBOSE
/*
* Avoid nested stack-dumping if a panic occurs during oops processing
*/
if (!test_taint(TAINT_DIE) && oops_in_progress <= 1)
dump_stack();
#endif
/*
* If we have crashed and we have a crash kernel loaded let it handle
* everything else.
* If we want to run this after calling panic_notifiers, pass
* the "crash_kexec_post_notifiers" option to the kernel.
*
* Bypass the panic_cpu check and call __crash_kexec directly.
*/
if (!_crash_kexec_post_notifiers) {
printk_safe_flush_on_panic();
__crash_kexec(NULL);
/*
* Note smp_send_stop is the usual smp shutdown function, which
* unfortunately means it may not be hardened to work in a
* panic situation.
*/
smp_send_stop();
} else {
/*
* If we want to do crash dump after notifier calls and
* kmsg_dump, we will need architecture dependent extra
* works in addition to stopping other CPUs.
*/
crash_smp_send_stop();
}
/*
* Run any panic handlers, including those that might need to
* add information to the kmsg dump output.
*/
atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
/* Call flush even twice. It tries harder with a single online CPU */
printk_safe_flush_on_panic();
kmsg_dump(KMSG_DUMP_PANIC);
//.........这里部分代码省略.........
开发者ID:AlexShiLucky,项目名称:linux,代码行数:101,代码来源:panic.c
示例13: mpi_set_buffer
int mpi_set_buffer(MPI a, const void *xbuffer, unsigned nbytes, int sign)
{
const uint8_t *buffer = xbuffer, *p;
mpi_limb_t alimb;
int nlimbs;
int i;
nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB;
if (RESIZE_IF_NEEDED(a, nlimbs) < 0)
return -ENOMEM;
a->sign = sign;
for (i = 0, p = buffer + nbytes - 1; p >= buffer + BYTES_PER_MPI_LIMB;) {
#if BYTES_PER_MPI_LIMB == 4
alimb = (mpi_limb_t) *p--;
alimb |= (mpi_limb_t) *p-- << 8;
alimb |= (mpi_limb_t) *p-- << 16;
alimb |= (mpi_limb_t) *p-- << 24;
#elif BYTES_PER_MPI_LIMB == 8
alimb = (mpi_limb_t) *p--;
alimb |= (mpi_limb_t) *p-- << 8;
alimb |= (mpi_limb_t) *p-- << 16;
alimb |= (mpi_limb_t) *p-- << 24;
alimb |= (mpi_limb_t) *p-- << 32;
alimb |= (mpi_limb_t) *p-- << 40;
alimb |= (mpi_limb_t) *p-- << 48;
alimb |= (mpi_limb_t) *p-- << 56;
#else
#error please implement for this limb size.
#endif
a->d[i++] = alimb;
}
if (p >= buffer) {
#if BYTES_PER_MPI_LIMB == 4
alimb = *p--;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 8;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 16;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 24;
#elif BYTES_PER_MPI_LIMB == 8
alimb = (mpi_limb_t) *p--;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 8;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 16;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 24;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 32;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 40;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 48;
if (p >= buffer)
alimb |= (mpi_limb_t) *p-- << 56;
#else
#error please implement for this limb size.
#endif
a->d[i++] = alimb;
}
a->nlimbs = i;
if (i != nlimbs) {
pr_emerg("MPI: mpi_set_buffer: Assertion failed (%d != %d)", i,
nlimbs);
BUG();
}
return 0;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:71,代码来源:mpicoder.c
示例14: throttle_delayed_work_fn
/*
* Check if the die sensor is cooling down. If it's higher than
* t_hot since the last throttle then throttle it again.
* OMAP junction temperature could stay for a long time in an
* unacceptable temperature range. The idea here is to check after
* t_hot->throttle the system really came below t_hot else re-throttle
* and keep doing till it's under t_hot temp range.
*/
static void throttle_delayed_work_fn(struct work_struct *work)
{
int curr;
struct omap_temp_sensor *temp_sensor =
container_of(work, struct omap_temp_sensor,
throttle_work.work);
curr = omap_read_current_temp(temp_sensor);
#ifdef CONFIG_OMAP_TEMP_CONTROL
if (curr >= temp_limit || curr < 0) {
#else
if (curr >= BGAP_THRESHOLD_T_HOT || curr < 0) {
#endif
pr_warn("%s: OMAP temp read %d exceeds the threshold\n",
__func__, curr);
omap_thermal_throttle();
schedule_delayed_work(&temp_sensor->throttle_work,
msecs_to_jiffies(THROTTLE_DELAY_MS));
} else {
schedule_delayed_work(&temp_sensor->throttle_work,
msecs_to_jiffies(THROTTLE_DELAY_MS));
}
}
static irqreturn_t omap_tshut_irq_handler(int irq, void *data)
{
struct omap_temp_sensor *temp_sensor = (struct omap_temp_sensor *)data;
/* Need to handle thermal mgmt in bootloader
* to avoid restart again at kernel level
*/
if (temp_sensor->is_efuse_valid) {
pr_emerg("%s: Thermal shutdown reached rebooting device\n",
__func__);
kernel_restart(NULL);
} else {
pr_err("%s:Invalid EFUSE, Non-trimmed BGAP\n", __func__);
}
return IRQ_HANDLED;
}
static irqreturn_t omap_talert_irq_handler(int irq, void *data)
{
struct omap_temp_sensor *temp_sensor = (struct omap_temp_sensor *)data;
int t_hot, t_cold, temp_offset;
t_hot = omap_temp_sensor_readl(temp_sensor, BGAP_STATUS_OFFSET)
& OMAP4_HOT_FLAG_MASK;
t_cold = omap_temp_sensor_readl(temp_sensor, BGAP_STATUS_OFFSET)
& OMAP4_COLD_FLAG_MASK;
temp_offset = omap_temp_sensor_readl(temp_sensor, BGAP_CTRL_OFFSET);
if (t_hot) {
omap_thermal_throttle();
schedule_delayed_work(&temp_sensor->throttle_work,
msecs_to_jiffies(THROTTLE_DELAY_MS));
temp_offset &= ~(OMAP4_MASK_HOT_MASK);
temp_offset |= OMAP4_MASK_COLD_MASK;
} else if (t_cold) {
cancel_delayed_work_sync(&temp_sensor->throttle_work);
omap_thermal_unthrottle();
temp_offset &= ~(OMAP4_MASK_COLD_MASK);
temp_offset |= OMAP4_MASK_HOT_MASK;
}
omap_temp_sensor_writel(temp_sensor, temp_offset, BGAP_CTRL_OFFSET);
return IRQ_HANDLED;
}
static int __devinit omap_temp_sensor_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct omap_temp_sensor_pdata *pdata = pdev->dev.platform_data;
struct omap_temp_sensor *temp_sensor;
struct resource *mem;
int ret = 0, val;
if (!pdata) {
dev_err(dev, "%s: platform data missing\n", __func__);
return -EINVAL;
}
temp_sensor = kzalloc(sizeof(struct omap_temp_sensor), GFP_KERNEL);
if (!temp_sensor)
return -ENOMEM;
spin_lock_init(&temp_sensor->lock);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(dev, "%s:no mem resource\n", __func__);
//.........这里部分代码省略.........
开发者ID:AndroidDeveloperAlliance,项目名称:ZenKernel_TUNA,代码行数:101,代码来源:omap_temp_sensor.c
示例15: omap_fatal_zone
/**
* omap_fatal_zone() - Shut-down the system to ensure OMAP Junction
* Temperature decreases enough
*
* @cpu_temp: The current adjusted CPU temperature
*
* No return forces a restart of the system
*/
static void omap_fatal_zone(int cpu_temp)
{
pr_emerg("%s:FATAL ZONE (hot spot temp: %i)\n", __func__, cpu_temp);
kernel_restart(NULL);
}
开发者ID:lchao-bit,项目名称:linaro-kernel,代码行数:14,代码来源:omap_die_governor.c
示例16: apanic_mmc_memdump
static void apanic_mmc_memdump(void)
{
int rc;
struct membank *bank;
struct apanic_data *ctx = &drv_ctx;
struct memdump_header *hdr =
(struct memdump_header *) drv_ctx.bounce;
if (!memdump_ctx.hd || !memdump_ctx.mmc_memdump_ops ||
!memdump_ctx.mmc_memdump_ops->panic_probe)
return;
memdump_wdt_disable();
if (memdump_ctx.mmc_memdump_ops->
panic_probe(memdump_ctx.hd,
memdump_ctx.mmc_memdump_ops->type)) {
pr_err("apanic: full memeory dump backing device"
" not detected, fail to do memory dump\n");
return;
}
memset(ctx->bounce, 0, PAGE_SIZE);
rc = memdump_ctx.mmc_memdump_ops->panic_write(memdump_ctx.
hd,
ctx->bounce, 0,
PAGE_SIZE);
if (rc <= 0) {
pr_emerg("apanic: memdump erase header failed (%d)\n", rc);
return;
}
/* no need to flush_cache_all(); */
/* get the last memory bank, probably the only bank */
if (meminfo.nr_banks >= 1 && meminfo.nr_banks < NR_BANKS)
bank = &meminfo.bank[meminfo.nr_banks - 1];
rc = memdump_ctx.mmc_memdump_ops->panic_write(memdump_ctx.
hd,
__va(bank->start),
PAGE_SIZE,
bank->size);
if (rc <= 0) {
pr_emerg("apanic: full memory write failed rc=%d)\n", rc);
return;
}
strncpy(hdr->magic, MEMDUMP_MAGIC, MEMDUMP_MAGIC_LEN);
hdr->version = PHDR_VERSION;
hdr->ts = current_kernel_time();
hdr->sdram_offset = PAGE_SIZE;
hdr->sdram_length = bank->size;
rc = memdump_ctx.mmc_memdump_ops->panic_write(memdump_ctx.
hd,
ctx->bounce, 0,
PAGE_SIZE);
if (rc <= 0) {
pr_emerg("apanic: memdump header write failed (%d)\n", rc);
return;
}
pr_emerg("apanic: full memory dump successfully written\n");
}
开发者ID:itsmerajit,项目名称:kernel_otus,代码行数:63,代码来源:apanic_mmc.c
示例17: sec_power_off
/* PM porting is needed */
static void sec_power_off(void)
{
int poweroff_try = 0;
#if defined(CONFIG_SAMSUNG_MUIC)
struct power_supply *psy = power_supply_get_by_name("battery");
union power_supply_propval value;
bool health = true;
if (!psy || !psy->get_property) {
pr_err("%s: fail to get battery psy\n", __func__);
} else {
psy->get_property(psy, POWER_SUPPLY_PROP_HEALTH, &value);
if (value.intval == POWER_SUPPLY_HEALTH_OVERVOLTAGE ||
value.intval == POWER_SUPPLY_HEALTH_UNDERVOLTAGE)
health = false;
}
#endif
local_irq_disable();
#if defined(CONFIG_SAMSUNG_MUIC)
pr_emerg("%s : cable state=%d, health=%d\n", __func__, is_cable_attached, health);
#endif /* CONFIG_SAMSUNG_MUIC */
while (1) {
/* Check reboot charging */
#if defined(CONFIG_SAMSUNG_MUIC)
if ((is_cable_attached && health) || (poweroff_try >= 5)) {
#else
if (poweroff_try >= 5) {
#endif /* CONFIG_SAMSUNG_MUIC */
#if defined(CONFIG_SAMSUNG_MUIC)
pr_emerg
("%s: charger connected(%d) or power"
"off failed(%d), reboot!\n",
__func__, is_cable_attached, poweroff_try);
#else
pr_emerg
("%s: power off failed(%d), reboot!\n",
__func__, poweroff_try);
#endif /* CONFIG_SAMSUNG_MUIC */
/* To enter LP charging */
writel(0x0, EXYNOS_INFORM2);
flush_cache_all();
outer_flush_all();
exynos4_restart(0, 0);
pr_emerg("%s: waiting for reboot\n", __func__);
while (1)
;
}
/* wait for power button release */
if (gpio_get_value(GPIO_PMIC_ONOB)) {
pr_emerg("%s: set PS_HOLD low\n", __func__);
/* power off code
* PS_HOLD Out/High -->
* Low PS_HOLD_CONTROL, R/W, 0x1002_330C
*/
writel(readl(EXYNOS_PS_HOLD_CONTROL) & 0xFFFFFEFF,
EXYNOS_PS_HOLD_CONTROL);
++poweroff_try;
pr_emerg
("%s: Should not reach here! (poweroff_try:%d)\n",
__func__, poweroff_try);
} else {
/* if power button is not released, wait and check TA again */
pr_info("%s: PowerButton is not released.\n", __func__);
}
mdelay(1000);
}
}
#define REBOOT_MODE_PREFIX 0x12345670
#define REBOOT_MODE_NONE 0
#define REBOOT_MODE_DOWNLOAD 1
#define REBOOT_MODE_UPLOAD 2
#define REBOOT_MODE_CHARGING 3
#define REBOOT_MODE_RECOVERY 4
#define REBOOT_MODE_FOTA 5
#define REBOOT_MODE_FOTA_BL 6 /* update bootloader */
#define REBOOT_MODE_SECURE 7 /* image secure check fail */
#define REBOOT_SET_PREFIX 0xabc00000
#define REBOOT_SET_DEBUG 0x000d0000
#define REBOOT_SET_SWSEL 0x000e0000
#define REBOOT_SET_SUD 0x000f0000
static void sec_reboot(char str, const char *cmd)
{
local_irq_disable();
pr_emerg("%s (%d, %s)\n", __func__, str, cmd ? cmd : "(null)");
writel(0x12345678, EXYNOS_INFORM2); /* Don't enter lpm mode */
//.........这里部分代码省略.........
开发者ID:Biktorgj,项目名称:kminilte_kernel,代码行数:101,代码来源:sec-reboot.c
示例18: amd_decode_nb_mce
void amd_decode_nb_mce(int node_id, struct mce *m, u32 nbcfg)
{
struct cpuinfo_x86 *c = &boot_cpu_data;
u16 ec = EC(m->status);
u8 xec = XEC(m->status, 0x1f);
u32 nbsh = (u32)(m->status >> 32);
int core = -1;
pr_emerg(HW_ERR "Northbridge Error (node %d", node_id);
/* F10h, revD can disable ErrCpu[3:0] through ErrCpuVal */
if (c->x86 == 0x10 && c->x86_model > 7) {
if (nbsh & NBSH_ERR_CPU_VAL)
core = nbsh & nb_err_cpumask;
} else {
u8 assoc_cpus = nbsh & nb_err_cpumask;
if (assoc_cpus > 0)
core = fls(assoc_cpus) - 1;
}
if (core >= 0)
pr_cont(", core %d): ", core);
else
pr_cont("): ");
switch (xec) {
case 0x2:
pr_cont("Sync error (sync packets on HT link detected).\n");
return;
case 0x3:
pr_cont("HT Master abort.\n");
return;
case 0x4:
pr_cont("HT Target abort.\n");
return;
case 0x7:
pr_cont("NB Watchdog timeout.\n");
return;
case 0x9:
pr_cont("SVM DMA Exclusion Vector error.\n");
return;
default:
break;
}
if (!fam_ops->nb_mce(ec, xec))
goto wrong_nb_mce;
if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x15)
if ((xec == 0x8 || xec == 0x0) && nb_bus_decoder)
nb_bus_decoder(node_id, m, nbcfg);
return;
wrong_nb_mce:
pr_emerg(HW_ERR "Corrupted NB MCE info?\n");
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:63,代码来源:mce_amd.c
示例19: force_error
static int force_error(const char *val, struct kernel_param *kp)
{
pr_emerg("!!!WARN forced error : %s\n", val);
if (!strncmp(val, "appdogbark", 10)) {
pr_emerg("Generating an apps wdog bark!\n");
simulate_apps_wdog_bark();
} else if (!strncmp(val, "appdogbite", 10)) {
pr_emerg("Generating an apps wdog bite!\n");
simulate_apps_wdog_bite();
} else if (!strncmp(val, "dabort", 6)) {
pr_emerg("Generating a data abort exception!\n");
*(unsigned int *)0x0 = 0x0;
} else if (!strncmp(val, "pabort", 6)) {
pr_emerg("Generating a prefetch abort exception!\n");
((void (*)(void))0x0)();
} else if (!strncmp(val, "undef", 5)) {
pr_emerg("Generating a undefined instruction exception!\n");
BUG();
} else if (!strncmp(val, "bushang", 7)) {
pr_emerg("Generating a Bus Hang!\n");
simulate_bus_hang();
} else if (!strncmp(val, "thermal_reset", 13)) {
pr_emerg("Generating a thermal reset!\n");
simulate_msm_thermal_bite();
} else if (!strncmp(val, "dblfree", 7)) {
void *p = kmalloc(sizeof(int), GFP_KERNEL);
kfree(p);
msleep(1000);
kfree(p);
} else if (!strncmp(val, "danglingref", 11)) {
unsigned int *p = kmalloc(sizeof(int), GFP_KERNEL);
kfree(p);
*p = 0x1234;
} else if (!strncmp(val, "lowmem", 6)) {
int i = 0;
pr_emerg("Allocating memory until failure!\n");
while (kmalloc(128*1024, GFP_KERNEL))
i++;
pr_emerg("Allocated %d KB!\n", i*128);
} else if (!strncmp(val, "memcorrupt", 10)) {
int *ptr = kmalloc(sizeof(int), GFP_KERNEL);
*ptr++ = 4;
*ptr = 2;
panic("MEMORY CORRUPTION");
#ifdef CONFIG_SEC_DEBUG_SEC_WDOG_BITE
}else if (!strncmp(val, "secdogbite", 10)) {
simulate_secure_wdog_bite();
#endif
} else {
pr_emerg("No such error defined for now!\n");
}
return 0;
}
开发者ID:DaMadOne,项目名称:android_kernel_samsung_msm8976,代码行数:56,代码来源:sec_debug.c
示例20: native_stop_other_cpus
static void native_stop_other_cpus(int wait)
{
unsigned long flags;
unsigned long timeout;
if (reboot_force)
return;
/*
* Use an own vector here because smp_call_function
* does lots of things not suitable in a panic situation.
*/
/*
* We start by using the REBOOT_VECTOR irq.
* The irq is treated as a sync point to allow critical
* regions of code on other cpus to release their spin locks
* and re-enable irqs. Jumping straight to an NMI might
* accidentally cause deadlocks with further shutdown/panic
* code. By syncing, we give the cpus up to one second to
* finish their work before we force them off with the NMI.
*/
if (num_online_cpus() > 1) {
/* did someone beat us here? */
if (atomic_cmpxchg(&stopping_cpu, -1, safe_smp_processor_id()) != -1)
return;
/* sync above data before sending IRQ */
wmb();
apic->send_IPI_allbutself(REBOOT_VECTOR);
/*
* Don't wait longer than a second if the caller
* didn't ask us to wait.
*/
timeout = USEC_PER_SEC;
while (num_online_cpus() > 1 && (wait || timeout--))
udelay(1);
}
/* if the REBOOT_VECTOR didn't work, try with the NMI */
if ((num_online_cpus() > 1) && (!smp_no_nmi_ipi)) {
if (register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
NMI_FLAG_FIRST, "smp_stop"))
/* Note: we ignore failures here */
/* Hope the REBOOT_IRQ is good enough */
goto finish;
/* sync above data before sending IRQ */
wmb();
pr_emerg("Shutting down cpus with NMI\n");
apic->send_IPI_allbutself(NMI_VECTOR);
/*
* Don't wait longer than a 10 ms if the caller
* didn't ask us to wait.
*/
timeout = USEC_PER_MSEC * 10;
while (num_online_cpus() > 1 && (wait || timeout--))
udelay(1);
}
finish:
local_irq_save(flags);
disable_local_APIC();
local_irq_restore(flags);
}
开发者ID:B-Rich,项目名称:L4Reap,代码行数:70,代码来源:smp.c
注:本文中的pr_emerg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论