tpm_ibmvtpm.c (82ffd0454bd9bd57780966d47bfd56d579dd4fb3) tpm_ibmvtpm.c (f5595f5baa30e009bf54d0d7653a9a0cc465be60)
1/*
2 * Copyright (C) 2012 IBM Corporation
3 *
4 * Author: Ashley Lai <ashleydlai@gmail.com>
5 *
6 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
7 *
8 * Device driver for TCG/TCPA TPM (trusted platform module).

--- 125 unchanged lines hidden (view full) ---

134 memcpy((void *)buf, (void *)ibmvtpm->rtce_buf, len);
135 memset(ibmvtpm->rtce_buf, 0, len);
136 ibmvtpm->res_len = 0;
137 spin_unlock(&ibmvtpm->rtce_lock);
138 return len;
139}
140
141/**
1/*
2 * Copyright (C) 2012 IBM Corporation
3 *
4 * Author: Ashley Lai <ashleydlai@gmail.com>
5 *
6 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
7 *
8 * Device driver for TCG/TCPA TPM (trusted platform module).

--- 125 unchanged lines hidden (view full) ---

134 memcpy((void *)buf, (void *)ibmvtpm->rtce_buf, len);
135 memset(ibmvtpm->rtce_buf, 0, len);
136 ibmvtpm->res_len = 0;
137 spin_unlock(&ibmvtpm->rtce_lock);
138 return len;
139}
140
141/**
142 * tpm_ibmvtpm_send - Send tpm request
143 *
142 * tpm_ibmvtpm_send() - Send a TPM command
144 * @chip: tpm chip struct
145 * @buf: buffer contains data to send
146 * @count: size of buffer
147 *
148 * Return:
143 * @chip: tpm chip struct
144 * @buf: buffer contains data to send
145 * @count: size of buffer
146 *
147 * Return:
149 * Number of bytes sent or < 0 on error.
148 * 0 on success,
149 * -errno on error
150 */
151static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
152{
153 struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
154 int rc, sig;
155
156 if (!ibmvtpm->rtce_buf) {
157 dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");

--- 29 unchanged lines hidden (view full) ---

187 rc = ibmvtpm_send_crq(ibmvtpm->vdev,
188 IBMVTPM_VALID_CMD, VTPM_TPM_COMMAND,
189 count, ibmvtpm->rtce_dma_handle);
190 if (rc != H_SUCCESS) {
191 dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
192 rc = 0;
193 ibmvtpm->tpm_processing_cmd = false;
194 } else
150 */
151static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
152{
153 struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
154 int rc, sig;
155
156 if (!ibmvtpm->rtce_buf) {
157 dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");

--- 29 unchanged lines hidden (view full) ---

187 rc = ibmvtpm_send_crq(ibmvtpm->vdev,
188 IBMVTPM_VALID_CMD, VTPM_TPM_COMMAND,
189 count, ibmvtpm->rtce_dma_handle);
190 if (rc != H_SUCCESS) {
191 dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
192 rc = 0;
193 ibmvtpm->tpm_processing_cmd = false;
194 } else
195 rc = count;
195 rc = 0;
196
197 spin_unlock(&ibmvtpm->rtce_lock);
198 return rc;
199}
200
201static void tpm_ibmvtpm_cancel(struct tpm_chip *chip)
202{
203 return;

--- 529 unchanged lines hidden ---
196
197 spin_unlock(&ibmvtpm->rtce_lock);
198 return rc;
199}
200
201static void tpm_ibmvtpm_cancel(struct tpm_chip *chip)
202{
203 return;

--- 529 unchanged lines hidden ---