struct scu_ipc_data {
u32 count; /* No. of registers */
u16 addr[5]; /* Register addresses */
u8 data[5]; /* Register data */
u8 mask; /* Valid for read-modify-write */
};
/** * scu_reg_access - implement register access ioctls * @cmd: command we are doing (read/write/update) * @data: kernel copy of ioctl data * * Allow the user to perform register accesses on the SCU via the * kernel interface
*/
switch (cmd) { case INTE_SCU_IPC_REGISTER_READ: return intel_scu_ipc_dev_readv(scu, data->addr, data->data, count); case INTE_SCU_IPC_REGISTER_WRITE: return intel_scu_ipc_dev_writev(scu, data->addr, data->data, count); case INTE_SCU_IPC_REGISTER_UPDATE: return intel_scu_ipc_dev_update(scu, data->addr[0], data->data[0],
data->mask); default: return -ENOTTY;
}
}
/** * 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
*/ staticlong scu_ipc_ioctl(struct file *fp, unsignedint cmd, unsignedlong arg)
{ int ret; struct scu_ipc_data data; void __user *argp = (void __user *)arg;
if (!capable(CAP_SYS_RAWIO)) return -EPERM;
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;
}
staticint scu_ipc_open(struct inode *inode, struct file *file)
{ int ret = 0;
/* Only single open at the time */
mutex_lock(&scu_lock); if (scu) {
ret = -EBUSY; goto unlock;
}
scu = intel_scu_ipc_dev_get(); if (!scu)
ret = -ENODEV;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.