Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | drivers/char/toshiba.c | static int __init toshiba_init(void) {
int retval;
if (tosh_probe())
return -ENODEV;
pr_info("Toshiba System Management Mode driver v" TOSH_VERSION "\n");
/* set the port to use for Fn status if not specified as a parameter */
if (tosh_fn == 0x00)
tosh_set_fn_port();
/* register the device file ... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/eventlog/common.c | static int tpm_bios_measurements_open(struct inode *inode, struct file *file) {
int err;
struct seq_file *seq;
struct tpm_chip_seqops *chip_seqops;
const struct seq_operations *seqops;
struct tpm_chip *chip;
inode_lock(inode);
if (!inode->i_private) {
inode_unlock(inode);
return -ENODEV;
}
ch... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/eventlog/common.c | void tpm_bios_log_setup(struct tpm_chip *chip) {
const char *name = dev_name(&chip->dev);
unsigned int cnt;
int log_version;
int rc = 0;
if (chip->flags & TPM_CHIP_FLAG_VIRTUAL)
return;
rc = tpm_read_log(chip);
if (rc < 0)
return;
log_version = rc;
cnt = 0;
chip->bios_dir[cnt] = securityf... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/eventlog/common.c | void tpm_bios_log_teardown(struct tpm_chip *chip) {
int i;
struct inode *inode;
/* securityfs_remove currently doesn't take care of handling sync
* between removal and opening of pseudo files. To handle this, a
* workaround is added by making i_private = NULL here during removal
* and to check it during... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/eventlog/tpm1.c | static void *tpm1_bios_measurements_start(struct seq_file *m, loff_t *pos) {
loff_t i = 0;
struct tpm_chip *chip = m->private;
struct tpm_bios_log *log = &chip->log;
void *addr = log->bios_event_log;
void *limit = log->bios_event_log_end;
struct tcpa_event *event;
u32 converted_event_size;
u32 converted... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/eventlog/tpm1.c | static void *tpm1_bios_measurements_next(struct seq_file *m, void *v,
loff_t *pos) {
struct tcpa_event *event = v;
struct tpm_chip *chip = m->private;
struct tpm_bios_log *log = &chip->log;
void *limit = log->bios_event_log_end;
u32 converted_event_size;
u32 converte... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/eventlog/tpm2.c |
static void *tpm2_bios_measurements_start(struct seq_file *m, loff_t *pos) {
struct tpm_chip *chip = m->private;
struct tpm_bios_log *log = &chip->log;
void *addr = log->bios_event_log;
void *limit = log->bios_event_log_end;
struct tcg_pcr_event *event_header;
struct tcg_pcr_event2_head *event;
size_t si... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/i2c.c | static int read8_reg(void *phy_id, u8 tpm_register, u8 *tpm_data,
int tpm_size) {
struct st33zp24_i2c_phy *phy = phy_id;
u8 status = 0;
u8 data;
data = TPM_DUMMY_BYTE;
status = write8_reg(phy, tpm_register, &data, 1);
if (status == 2)
status = i2c_master_recv(phy->client, tpm_data,... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/spi.c | static int st33zp24_spi_recv(void *phy_id, u8 tpm_register, u8 *tpm_data,
int tpm_size) {
int ret;
ret = st33zp24_spi_read8_reg(phy_id, tpm_register, tpm_data, tpm_size);
if (!st33zp24_status_to_errno(ret))
return tpm_size;
return ret;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/spi.c | static int st33zp24_spi_probe(struct spi_device *dev) {
struct st33zp24_spi_phy *phy;
phy = devm_kzalloc(&dev->dev, sizeof(struct st33zp24_spi_phy), GFP_KERNEL);
if (!phy)
return -ENOMEM;
phy->spi_device = dev;
phy->latency = st33zp24_spi_evaluate_latency(phy);
if (phy->latency <= 0)
return -ENOD... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c | static void st33zp24_cancel(struct tpm_chip *chip) {
struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
u8 data;
data = TPM_STS_COMMAND_READY;
tpm_dev->ops->send(tpm_dev->phy_id, TPM_STS, &data, 1);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c | static bool check_locality(struct tpm_chip *chip) {
struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
u8 data;
u8 status;
status = tpm_dev->ops->recv(tpm_dev->phy_id, TPM_ACCESS, &data, 1);
if (status && (data & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
(TPM_ACCESS_ACT... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c | static int request_locality(struct tpm_chip *chip) {
struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
unsigned long stop;
long ret;
u8 data;
if (check_locality(chip))
return tpm_dev->locality;
data = TPM_ACCESS_REQUEST_USE;
ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_ACCESS, &data, 1);
... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c |
static bool wait_for_tpm_stat_cond(struct tpm_chip *chip, u8 mask,
bool check_cancel, bool *canceled) {
u8 status = chip->ops->status(chip);
*canceled = false;
if ((status & mask) == mask)
return true;
if (check_cancel && chip->ops->req_canceled(chip, status)) {
*can... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c |
static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) {
struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
int size = 0, burstcnt, len, ret;
while (size < count &&
wait_for_stat(chip, TPM_STS_DATA_AVAIL | TPM_STS_VALID,
chip->timeout_c, &tpm_dev->read_queue,... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c |
static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id) {
struct tpm_chip *chip = dev_id;
struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
tpm_dev->intrs++;
wake_up_interruptible(&tpm_dev->read_queue);
disable_irq_nosync(tpm_dev->irq);
return IRQ_HANDLED;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c |
static bool st33zp24_req_canceled(struct tpm_chip *chip, u8 status) {
return (status == TPM_STS_COMMAND_READY);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c | int st33zp24_pm_suspend(struct device *dev) {
struct tpm_chip *chip = dev_get_drvdata(dev);
struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
int ret = 0;
if (tpm_dev->io_lpcpd)
gpiod_set_value_cansleep(tpm_dev->io_lpcpd, 0);
else
ret = tpm_pm_suspend(dev);
return ret;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/st33zp24/st33zp24.c |
int st33zp24_pm_resume(struct device *dev) {
struct tpm_chip *chip = dev_get_drvdata(dev);
struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
int ret = 0;
if (tpm_dev->io_lpcpd) {
gpiod_set_value_cansleep(tpm_dev->io_lpcpd, 1);
ret = wait_for_stat(chip, TPM_STS_VALID, chip->timeout_b,
... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-chip.c |
static int tpm_cmd_ready(struct tpm_chip *chip) {
if (!chip->ops->cmd_ready)
return 0;
return chip->ops->cmd_ready(chip);
} | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm-chip.c | void tpm_put_ops(struct tpm_chip *chip) {
tpm_chip_stop(chip);
mutex_unlock(&chip->tpm_mutex);
up_read(&chip->ops_sem);
put_device(&chip->dev);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-chip.c | struct tpm_chip *tpm_default_chip(void) {
struct tpm_chip *chip, *res = NULL;
int chip_num = 0;
int chip_prev;
mutex_lock(&idr_lock);
do {
chip_prev = chip_num;
chip = idr_get_next(&dev_nums_idr, &chip_num);
if (chip) {
get_device(&chip->dev);
res = chip;
break;
}
} while... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-chip.c | static int tpm_add_char_device(struct tpm_chip *chip) {
int rc;
rc = cdev_device_add(&chip->cdev, &chip->dev);
if (rc) {
dev_err(&chip->dev,
"unable to cdev_device_add() %s, major %d, minor %d, err=%d\n",
dev_name(&chip->dev), MAJOR(chip->dev.devt), MINOR(chip->dev.devt),
... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm-chip.c | static int tpm_add_legacy_sysfs(struct tpm_chip *chip) {
struct attribute **i;
int rc;
if (chip->flags & (TPM_CHIP_FLAG_TPM2 | TPM_CHIP_FLAG_VIRTUAL) ||
tpm_is_firmware_upgrade(chip))
return 0;
rc = compat_only_sysfs_link_entry_to_kobj(&chip->dev.parent->kobj,
... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm-chip.c | int tpm_chip_register(struct tpm_chip *chip) {
int rc;
rc = tpm_chip_start(chip);
if (rc)
return rc;
rc = tpm_auto_startup(chip);
if (rc) {
tpm_chip_stop(chip);
return rc;
}
rc = tpm_get_pcr_allocation(chip);
tpm_chip_stop(chip);
if (rc)
return rc;
tpm_sysfs_add_device(chip);
t... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-dev-common.c | void tpm_common_release(struct file *file, struct file_priv *priv) {
flush_work(&priv->async_work);
del_timer_sync(&priv->user_read_timer);
flush_work(&priv->timeout_work);
file->private_data = NULL;
priv->response_length = 0;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-dev-common.c |
void __exit tpm_dev_common_exit(void) {
if (tpm_dev_wq) {
destroy_workqueue(tpm_dev_wq);
tpm_dev_wq = NULL;
}
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-interface.c | ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz) {
struct tpm_header *header = (struct tpm_header *)buf;
u8 save[TPM_HEADER_SIZE + 3 * sizeof(u32)];
unsigned int delay_msec = TPM2_DURATION_SHORT;
u32 rc = 0;
ssize_t ret;
const size_t save_size = min(sizeof(save), bufsiz);
/* the comman... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm-interface.c | ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf,
size_t min_rsp_body_length, const char *desc) {
const struct tpm_header *header = (struct tpm_header *)buf->data;
int err;
ssize_t len;
len = tpm_transmit(chip, buf->data, PAGE_SIZE);
if (len < 0)
return len;
... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm-interface.c |
int tpm_get_timeouts(struct tpm_chip *chip) {
if (chip->flags & TPM_CHIP_FLAG_HAVE_TIMEOUTS)
return 0;
if (chip->flags & TPM_CHIP_FLAG_TPM2)
return tpm2_get_timeouts(chip);
else
return tpm1_get_timeouts(chip);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-interface.c | int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen) {
struct tpm_buf buf;
int rc;
chip = tpm_find_get_ops(chip);
if (!chip)
return -ENODEV;
buf.data = cmd;
rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to a send a command");
tpm_put_ops(chip);
return rc;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-interface.c |
static int __init tpm_init(void) {
int rc;
tpm_class = class_create(THIS_MODULE, "tpm");
if (IS_ERR(tpm_class)) {
pr_err("couldn't create tpm class\n");
return PTR_ERR(tpm_class);
}
tpmrm_class = class_create(THIS_MODULE, "tpmrm");
if (IS_ERR(tpmrm_class)) {
pr_err("couldn't create tpmrm clas... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-interface.c |
static void __exit tpm_exit(void) {
idr_destroy(&dev_nums_idr);
class_destroy(tpm_class);
class_destroy(tpmrm_class);
unregister_chrdev_region(tpm_devt, 2 * TPM_NUM_DEVICES);
tpm_dev_common_exit();
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm-sysfs.c |
static ssize_t pcrs_show(struct device *dev, struct device_attribute *attr,
char *buf) {
cap_t cap;
u8 digest[TPM_DIGEST_SIZE];
u32 i, j, num_pcrs;
char *str = buf;
struct tpm_chip *chip = to_tpm_chip(dev);
if (tpm_try_get_ops(chip))
return 0;
if (tpm1_getcap(chip, TPM_CAP_... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm.h |
static inline void tpm_msleep(unsigned int delay_msec) {
usleep_range((delay_msec * 1000) - TPM_TIMEOUT_RANGE_US, delay_msec * 1000);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm.h | static inline void tpm_add_ppi(struct tpm_chip *chip) {}
#endif | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm1-cmd.c | int tpm1_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, const u8 *hash,
const char *log_msg) {
struct tpm_buf buf;
int rc;
rc = tpm_buf_init(&buf, TPM_TAG_RQU_COMMAND, TPM_ORD_PCR_EXTEND);
if (rc)
return rc;
tpm_buf_append_u32(&buf, pcr_idx);
tpm_buf_append(&buf, hash, TPM_DIGEST_S... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm1-cmd.c | static int tpm1_continue_selftest(struct tpm_chip *chip) {
struct tpm_buf buf;
int rc;
rc = tpm_buf_init(&buf, TPM_TAG_RQU_COMMAND, TPM_ORD_CONTINUE_SELFTEST);
if (rc)
return rc;
rc = tpm_transmit_cmd(chip, &buf, 0, "continue selftest");
tpm_buf_destroy(&buf);
return rc;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm1-cmd.c | int tpm1_auto_startup(struct tpm_chip *chip) {
int rc;
rc = tpm1_get_timeouts(chip);
if (rc)
goto out;
rc = tpm1_do_selftest(chip);
if (rc == TPM_ERR_FAILEDSELFTEST) {
dev_warn(&chip->dev,
"TPM self test failed, switching to the firmware upgrade mode\n");
chip->flags |= TPM_CHIP_FLA... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm2-cmd.c | int tpm2_get_timeouts(struct tpm_chip *chip) {
chip->timeout_a = msecs_to_jiffies(TPM2_TIMEOUT_A);
chip->timeout_b = msecs_to_jiffies(TPM2_TIMEOUT_B);
chip->timeout_c = msecs_to_jiffies(TPM2_TIMEOUT_C);
chip->timeout_d = msecs_to_jiffies(TPM2_TIMEOUT_D);
/* PTP spec timeouts */
chip->duration[TPM_SHORT] =... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm2-cmd.c | unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal) {
unsigned int index;
index = tpm2_ordinal_duration_index(ordinal);
if (index != TPM_UNDEFINED)
return chip->duration[index];
else
return msecs_to_jiffies(TPM2_DURATION_DEFAULT);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm2-cmd.c | int tpm2_pcr_read(struct tpm_chip *chip, u32 pcr_idx, struct tpm_digest *digest,
u16 *digest_size_ptr) {
int i;
int rc;
struct tpm_buf buf;
struct tpm2_pcr_read_out *out;
u8 pcr_select[TPM2_PCR_SELECT_MIN] = {0};
u16 digest_size;
u16 expected_digest_size = 0;
if (pcr_idx >= TPM2_PLATF... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm2-cmd.c | void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type) {
struct tpm_buf buf;
int rc;
rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_SHUTDOWN);
if (rc)
return;
tpm_buf_append_u16(&buf, shutdown_type);
tpm_transmit_cmd(chip, &buf, 0, "stopping the TPM");
tpm_buf_destroy(&buf);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm2-cmd.c |
int tpm2_find_cc(struct tpm_chip *chip, u32 cc) {
int i;
for (i = 0; i < chip->nr_commands; i++)
if (cc == (chip->cc_attrs_tbl[i] & GENMASK(15, 0)))
return i;
return -1;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm2-space.c |
static int tpm2_save_context(struct tpm_chip *chip, u32 handle, u8 *buf,
unsigned int buf_size, unsigned int *offset) {
struct tpm_buf tbuf;
unsigned int body_size;
int rc;
rc = tpm_buf_init(&tbuf, TPM2_ST_NO_SESSIONS, TPM2_CC_CONTEXT_SAVE);
if (rc)
return rc;
tpm_buf_app... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm2-space.c |
int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, void *buf,
size_t *bufsiz) {
struct tpm_header *header = buf;
int rc;
if (!space)
return 0;
rc = tpm2_map_response_header(chip, chip->last_cc, buf, *bufsiz);
if (rc) {
tpm2_flush_space(chip);
goto out;
... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_atmel.c | static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) {
struct tpm_atmel_priv *priv = dev_get_drvdata(&chip->dev);
u8 status, *hdr = buf;
u32 size;
int i;
__be32 *native_size;
if (count < 6)
return -EIO;
for (i = 0; i < 6; i++) {
status = ioread8(priv->iobase + 1);
if ((stat... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_atmel.c |
static void tpm_atml_cancel(struct tpm_chip *chip) {
struct tpm_atmel_priv *priv = dev_get_drvdata(&chip->dev);
iowrite8(ATML_STATUS_ABORT, priv->iobase + 1);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_atmel.c |
static bool tpm_atml_req_canceled(struct tpm_chip *chip, u8 status) {
return (status == ATML_STATUS_READY);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_atmel.c |
static void __exit cleanup_atmel(void) {
platform_driver_unregister(&atml_drv);
atml_plat_remove();
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_atmel.h |
static void __iomem *atmel_get_base_addr(unsigned long *base,
int *region_size) {
struct device_node *dn;
unsigned long address, size;
const unsigned int *reg;
int reglen;
int naddrc;
int nsizec;
dn = of_find_node_by_name(NULL, "tpm");
if (!dn)
return NULL... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_crb.c | static int __crb_cmd_ready(struct device *dev, struct crb_priv *priv) {
if ((priv->sm == ACPI_TPM2_START_METHOD) ||
(priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD) ||
(priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC))
return 0;
iowrite32(CRB_CTRL_REQ_CMD_READY, &priv->regs_t->ctrl_req);
... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_crb.c |
static int crb_cmd_ready(struct tpm_chip *chip) {
struct device *dev = &chip->dev;
struct crb_priv *priv = dev_get_drvdata(dev);
return __crb_cmd_ready(dev, priv);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_crb.c |
static int __crb_request_locality(struct device *dev, struct crb_priv *priv,
int loc) {
u32 value = CRB_LOC_STATE_LOC_ASSIGNED | CRB_LOC_STATE_TPM_REG_VALID_STS;
if (!priv->regs_h)
return 0;
iowrite32(CRB_LOC_CTRL_REQUEST_ACCESS, &priv->regs_h->loc_ctrl);
if (!crb_wait_f... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_crb.c |
static u8 crb_status(struct tpm_chip *chip) {
struct crb_priv *priv = dev_get_drvdata(&chip->dev);
u8 sts = 0;
if ((ioread32(&priv->regs_t->ctrl_start) & CRB_START_INVOKE) !=
CRB_START_INVOKE)
sts |= CRB_DRV_STS_COMPLETE;
return sts;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_crb.c |
static int crb_check_resource(struct acpi_resource *ares, void *data) {
struct resource *iores_array = data;
struct resource_win win;
struct resource *res = &(win.res);
int i;
if (acpi_dev_resource_memory(ares, res) ||
acpi_dev_resource_address_space(ares, &win)) {
for (i = 0; i < TPM_CRB_MAX_RESO... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_crb.c | static void __iomem *crb_map_res(struct device *dev, struct resource *iores,
void __iomem **iobase_ptr, u64 start,
u32 size) {
struct resource new_res = {
.start = start,
.end = start + size - 1,
.flags = IORESOURCE_MEM,
};
if (s... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_crb.c |
static void crb_acpi_remove(struct acpi_device *device) {
struct device *dev = &device->dev;
struct tpm_chip *chip = dev_get_drvdata(dev);
tpm_chip_unregister(chip);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ftpm_tee.c |
static int ftpm_plat_tee_probe(struct platform_device *pdev) {
struct device *dev = &pdev->dev;
return ftpm_tee_probe(dev);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ftpm_tee.c | static int ftpm_tee_remove(struct device *dev) {
struct ftpm_tee_private *pvt_data = dev_get_drvdata(dev);
tpm_chip_unregister(pvt_data->chip);
/* frees chip */
put_device(&pvt_data->chip->dev);
/* Free the shared memory pool */
tee_shm_free(pvt_data->shm);
/* close the existing session with fTPM TA*/... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_atmel.c | static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) {
struct priv_data *priv = dev_get_drvdata(&chip->dev);
struct i2c_client *client = to_i2c_client(chip->dev.parent);
s32 status;
priv->len = 0;
if (len <= 2)
return -EIO;
status = i2c_master_send(client, buf, len);
dev_dbg(&chip... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_atmel.c | static int i2c_atmel_probe(struct i2c_client *client,
const struct i2c_device_id *id) {
struct tpm_chip *chip;
struct device *dev = &client->dev;
struct priv_data *priv;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -ENODEV;
chip = tpmm_chip_alloc(dev, &i... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_infineon.c | static int iic_tpm_write(u8 addr, u8 *buffer, size_t len) {
return iic_tpm_write_generic(addr, buffer, len, SLEEP_DURATION_LOW,
SLEEP_DURATION_HI, MAX_COUNT);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_infineon.c |
static bool check_locality(struct tpm_chip *chip, int loc) {
u8 buf;
int rc;
rc = iic_tpm_read(TPM_ACCESS(loc), &buf, 1);
if (rc < 0)
return false;
if ((buf & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) {
tpm_dev.locality = loc;
ret... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_infineon.c | static u8 tpm_tis_i2c_status(struct tpm_chip *chip) {
u8 buf = 0xFF;
u8 i = 0;
do {
if (iic_tpm_read(TPM_STS(tpm_dev.locality), &buf, 1) < 0)
return 0;
i++;
/* if locallity is set STS should not be 0xFF */
} while ((buf == 0xFF) && i < 10);
return buf;
} | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_infineon.c | static void tpm_tis_i2c_ready(struct tpm_chip *chip) {
u8 buf = TPM_STS_COMMAND_READY;
iic_tpm_write_long(TPM_STS(tpm_dev.locality), &buf, 1);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_infineon.c | static int tpm_tis_i2c_init(struct device *dev) {
u32 vendor;
int rc = 0;
struct tpm_chip *chip;
chip = tpmm_chip_alloc(dev, &tpm_tis_i2c);
if (IS_ERR(chip))
return PTR_ERR(chip);
chip->timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
chip->timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT);
chip->tim... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_nuvoton.c |
static s32 i2c_nuvoton_write_buf(struct i2c_client *client, u8 offset, u8 size,
u8 *data) {
s32 status;
status = i2c_smbus_write_i2c_block_data(client, offset, size, data);
dev_dbg(&client->dev, "%s(offset=%u size=%u data=%*ph) -> sts=%d\n", __func__,
offset, size, (in... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_nuvoton.c | static int i2c_nuvoton_wait_for_stat(struct tpm_chip *chip, u8 mask, u8 value,
u32 timeout, wait_queue_head_t *queue) {
if ((chip->flags & TPM_CHIP_FLAG_IRQ) && queue) {
s32 rc;
struct priv_data *priv = dev_get_drvdata(&chip->dev);
unsigned int cur_intrs = priv->intrs;... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_i2c_nuvoton.c | static irqreturn_t i2c_nuvoton_int_handler(int dummy, void *dev_id) {
struct tpm_chip *chip = dev_id;
struct priv_data *priv = dev_get_drvdata(&chip->dev);
priv->intrs++;
wake_up(&priv->read_queue);
disable_irq_nosync(priv->irq);
return IRQ_HANDLED;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ibmvtpm.c | static int ibmvtpm_send_crq(struct vio_dev *vdev, u8 valid, u8 msg, u16 len,
u32 data) {
u64 w1 = ((u64)valid << 56) | ((u64)msg << 48) | ((u64)len << 32) | (u64)data;
return ibmvtpm_send_crq_word(vdev, w1);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ibmvtpm.c | static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm) {
int rc;
rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_CMD);
if (rc != H_SUCCESS)
dev_err(ibmvtpm->dev, "%s failed rc=%d\n", __func__, rc);
return rc;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ibmvtpm.c | static int ibmvtpm_crq_send_init_complete(struct ibmvtpm_dev *ibmvtpm) {
int rc;
rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_COMP_CMD);
if (rc != H_SUCCESS)
dev_err(ibmvtpm->dev, "ibmvtpm_crq_send_init_complete failed rc=%d\n", rc);
return rc;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ibmvtpm.c | static void tpm_ibmvtpm_remove(struct vio_dev *vdev) {
struct tpm_chip *chip = dev_get_drvdata(&vdev->dev);
struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
int rc = 0;
tpm_chip_unregister(chip);
free_irq(vdev->irq, ibmvtpm);
do {
if (rc)
msleep(100);
rc = plpar_hcall_norets(H_FRE... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ibmvtpm.c | static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev) {
struct tpm_chip *chip = dev_get_drvdata(&vdev->dev);
struct ibmvtpm_dev *ibmvtpm;
if (chip)
ibmvtpm = dev_get_drvdata(&chip->dev);
else
return CRQ_RES_BUF_SIZE + PAGE_SIZE;
return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size;
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ibmvtpm.c | static struct ibmvtpm_crq *ibmvtpm_crq_get_next(struct ibmvtpm_dev *ibmvtpm) {
struct ibmvtpm_crq_queue *crq_q = &ibmvtpm->crq_queue;
struct ibmvtpm_crq *crq = &crq_q->crq_addr[crq_q->index];
if (crq->valid & VTPM_MSG_RES) {
if (++crq_q->index == crq_q->num_entry)
crq_q->index = 0;
smp_rmb();
} e... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ibmvtpm.c | static void __exit ibmvtpm_module_exit(void) {
vio_unregister_driver(&ibmvtpm_driver);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_infineon.c | calculation time, it sends a WTX - package,
which has to be acknowledged or
aborted.This usually occurs if you are hammering the TPM with key
creation.Set the maximum number of WTX -
packages in the definitions above,
if the number is reached,
the waiting - time will be d... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_infineon.c |
static void tpm_wtx_abort(struct tpm_chip *chip) {
dev_info(&chip->dev, "Aborting WTX\n");
wait_and_send(chip, TPM_VL_VER);
wait_and_send(chip, TPM_CTRL_WTX_ABORT);
wait_and_send(chip, 0x00);
wait_and_send(chip, 0x00);
number_of_wtx = 0;
tpm_msleep(TPM_WTX_MSLEEP_TIME);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_nsc.c | static int tpm_nsc_recv(struct tpm_chip *chip, u8 *buf, size_t count) {
struct tpm_nsc_priv *priv = dev_get_drvdata(&chip->dev);
u8 *buffer = buf;
u8 data, *p;
u32 size;
__be32 *native_size;
if (count < 6)
return -EIO;
if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) {
dev_err(&... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_nsc.c |
static void tpm_nsc_cancel(struct tpm_chip *chip) {
struct tpm_nsc_priv *priv = dev_get_drvdata(&chip->dev);
outb(NSC_COMMAND_CANCEL, priv->base + NSC_COMMAND);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_nsc.c |
static inline void tpm_write_index(int base, int index, int value) {
outb(index, base);
outb(value & 0xFF, base + 1);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_nsc.c |
static void __exit cleanup_nsc(void) {
if (pdev) {
tpm_nsc_remove(&pdev->dev);
platform_device_unregister(pdev);
}
platform_driver_unregister(&nsc_drv);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ppi.c |
static inline union acpi_object *tpm_eval_dsm(acpi_handle ppi_handle, int func,
acpi_object_type type,
union acpi_object *argv4,
u64 rev) {
BUG_ON(!ppi_handle);
return acpi_eval... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ppi.c |
static ssize_t tpm_show_ppi_version(struct device *dev,
struct device_attribute *attr, char *buf) {
struct tpm_chip *chip = to_tpm_chip(dev);
return scnprintf(buf, PAGE_SIZE, "%s\n", chip->ppi_version);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_ppi.c | void tpm_add_ppi(struct tpm_chip *chip) {
union acpi_object *obj;
if (!chip->acpi_dev_handle)
return;
if (!acpi_check_dsm(chip->acpi_dev_handle, &tpm_ppi_guid,
TPM_PPI_REVISION_ID_1, 1 << TPM_PPI_FN_VERSION))
return;
obj = acpi_evaluate_dsm_typed(chip->acpi_dev_handle, &tpm_ppi_... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis.c | static inline int is_itpm(struct acpi_device *dev) { return 0; }
#endif
#if defined(CONFIG_ACPI)
#define DEVICE_IS_TPM2 1 | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_core.c |
static bool wait_for_tpm_stat_cond(struct tpm_chip *chip, u8 mask,
bool check_cancel, bool *canceled) {
u8 status = chip->ops->status(chip);
*canceled = false;
if ((status & mask) == mask)
return true;
if (check_cancel && chip->ops->req_canceled(chip, status)) {
*can... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_core.c | static int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask,
unsigned long timeout, wait_queue_head_t *queue,
bool check_cancel) {
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
unsigned long stop;
long rc;
u8 status;
bool canceled = false;
... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_core.c | static int wait_startup(struct tpm_chip *chip, int l) {
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
unsigned long stop = jiffies + chip->timeout_a;
do {
int rc;
u8 access;
rc = tpm_tis_read8(priv, TPM_ACCESS(l), &access);
if (rc < 0)
return rc;
if (access & TPM_ACCESS_VAL... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_core.c |
static bool check_locality(struct tpm_chip *chip, int l) {
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
int rc;
u8 access;
rc = tpm_tis_read8(priv, TPM_ACCESS(l), &access);
if (rc < 0)
return false;
if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID |
TPM_ACCESS... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_core.c | static irqreturn_t tis_int_handler(int dummy, void *dev_id) {
struct tpm_chip *chip = dev_id;
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
u32 interrupt;
int i, rc;
rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &interrupt);
if (rc < 0)
return IRQ_NONE;
if (interrupt == 0)
... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_core.h |
static inline int tpm_tis_read8(struct tpm_tis_data *data, u32 addr,
u8 *result) {
return data->phy_ops->read_bytes(data, addr, 1, result, TPM_TIS_PHYS_8);
} | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_core.h |
static inline int tpm_tis_read32(struct tpm_tis_data *data, u32 addr,
u32 *result) {
__le32 result_le;
int rc;
rc = data->phy_ops->read_bytes(data, addr, sizeof(u32), (u8 *)&result_le,
TPM_TIS_PHYS_32);
if (!rc)
*result = le32_to_cpu(result... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_i2c.c | static u8 tpm_tis_i2c_address_to_register(u32 addr) {
addr &= TPM_TIS_REGISTER_MASK;
switch (addr) {
case TPM_ACCESS(0):
return TPM_I2C_ACCESS;
case TPM_LOC_SEL:
return TPM_I2C_LOC_SEL;
case TPM_DID_VID(0):
return TPM_I2C_DID_VID;
case TPM_RID(0):
return TPM_I2C_RID;
default:
return a... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_i2c.c | static int tpm_tis_i2c_sanity_check_read(u8 reg, u16 len, u8 *buf) {
u32 zero_mask;
u32 value;
switch (len) {
case sizeof(u8):
value = buf[0];
break;
case sizeof(u16):
value = le16_to_cpup((__le16 *)buf);
break;
case sizeof(u32):
value = le32_to_cpup((__le32 *)buf);
break;
default... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_i2c.c | static int tpm_tis_i2c_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
u8 *result, enum tpm_tis_io_mode io_mode) {
struct tpm_tis_i2c_phy *phy = to_tpm_tis_i2c_phy(data);
struct i2c_msg msg = {.addr = phy->i2c_client->addr};
u8 reg = tpm_tis_i2c_address_to_register(addr)... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_i2c.c | static int tpm_tis_i2c_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
const u8 *value,
enum tpm_tis_io_mode io_mode) {
struct tpm_tis_i2c_phy *phy = to_tpm_tis_i2c_phy(data);
struct i2c_msg msg = {.addr = phy->i2c_client->addr};
u8 r... | [
1,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_i2c.c | static int tpm_tis_i2c_verify_crc(struct tpm_tis_data *data, size_t len,
const u8 *value) {
u16 crc_tpm, crc_host;
int rc;
rc = tpm_tis_read16(data, TPM_DATA_CSUM, &crc_tpm);
if (rc < 0)
return rc;
crc_host = swab16(crc_ccitt(0, value, len));
if (crc_tpm != crc_host)
... | [
0,
0
] |
Linux Kernel | drivers/char/tpm/tpm_tis_i2c.c | static int tpm_tis_i2c_init_guard_time(struct tpm_tis_i2c_phy *phy) {
u32 i2c_caps;
int ret;
phy->guard_time_read = true;
phy->guard_time_write = true;
phy->guard_time_min = GUARD_TIME_DEFAULT_MIN;
phy->guard_time_max = GUARD_TIME_DEFAULT_MAX;
ret = tpm_tis_i2c_read_bytes(&phy->priv, TPM_I2C_INTERFACE_C... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.