/** * scu_ipc_ioctl - control ioctls for the SCU * @fp: file handle of the SCU device * @cmd: ioctl coce * @arg: pointer to user passed structure * * Support the I/O and firmware flashing interfaces of the SCU */ static long scu_ipc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) { int ret; struct scu_ipc_data data; void __user *argp = (void __user *)arg; if (!capable(CAP_SYS_RAWIO)) return -EPERM; if (cmd == INTE_SCU_IPC_FW_UPDATE) { u8 *fwbuf = kmalloc(MAX_FW_SIZE, GFP_KERNEL); if (fwbuf == NULL) return -ENOMEM; if (copy_from_user(fwbuf, (u8 *)arg, MAX_FW_SIZE)) { kfree(fwbuf); return -EFAULT; } ret = intel_scu_ipc_fw_update(fwbuf, MAX_FW_SIZE); kfree(fwbuf); return ret; } else { if (copy_from_user(&data, argp, sizeof(struct scu_ipc_data))) return -EFAULT; ret = scu_reg_access(cmd, &data); if (ret < 0) return ret; if (copy_to_user(argp, &data, sizeof(struct scu_ipc_data))) return -EFAULT; return 0; } }
static void intel_mid_reboot(void) { if (intel_scu_ipc_fw_update()) { pr_debug("intel_scu_fw_update: IFWI upgrade failed...\n"); } if (!reboot_force) { /* system_state is SYSTEM_RESTART now, * polling to wait for SCU not busy. */ while (intel_scu_ipc_check_status()) udelay(10); } if (force_cold_boot) #ifdef CONFIG_X86_MDFLD rpmsg_send_generic_simple_command(IPCMSG_COLD_BOOT, 0); #else outb(RSTC_COLD_BOOT, RSTC_IO_PORT_ADDR); #endif else { switch (reboot_force) {
static void intel_mid_reboot(void) { if (intel_scu_ipc_fw_update()) { pr_debug("intel_scu_fw_update: IFWI upgrade failed...\n"); } if (!reboot_force) { /* system_state is SYSTEM_RESTART now, * polling to wait for SCU not busy. */ while (intel_scu_ipc_check_status()) udelay(10); } if (force_cold_boot) outb(RSTC_COLD_BOOT, RSTC_IO_PORT_ADDR); else { switch (reboot_force) { case REBOOT_FORCE_OFF: /* this will cause context execution error when rebooting */ /* in panic, but this is the very last action we take */ rpmsg_send_generic_simple_command(RP_COLD_OFF, 0); break; case REBOOT_FORCE_ON: pr_info("***** INFO: reboot requested but forced to keep system on *****\n"); while(1); /* halt */ break; case REBOOT_FORCE_COLD_RESET: outb(RSTC_COLD_RESET, RSTC_IO_PORT_ADDR); break; case REBOOT_FORCE_COLD_BOOT: outb(RSTC_COLD_BOOT, RSTC_IO_PORT_ADDR); break; default: outb(RSTC_COLD_RESET, RSTC_IO_PORT_ADDR); } } }