From patchwork Mon Feb 8 19:27:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Berger X-Patchwork-Id: 580480 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 028FA1409A0 for ; Tue, 9 Feb 2016 06:27:29 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aSrT4-0004Wz-Q2; Mon, 08 Feb 2016 19:27:26 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aSrT4-0004Wo-1H for tpmdd-devel@lists.sourceforge.net; Mon, 08 Feb 2016 19:27:26 +0000 X-ACL-Warn: Received: from e34.co.us.ibm.com ([32.97.110.152]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1aSrT2-0005AJ-2j for tpmdd-devel@lists.sourceforge.net; Mon, 08 Feb 2016 19:27:26 +0000 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Feb 2016 12:27:18 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 8 Feb 2016 12:27:15 -0700 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: stefanb@linux.vnet.ibm.com X-IBM-RcptTo: tpmdd-devel@lists.sourceforge.net Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id CB33219D8045 for ; Mon, 8 Feb 2016 12:15:13 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u18JRFxr18612318 for ; Mon, 8 Feb 2016 12:27:15 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u18JREeW016115 for ; Mon, 8 Feb 2016 12:27:14 -0700 Received: from dhcp-9-2-140-43.watson.ibm.com (dhcp-9-2-140-28.watson.ibm.com [9.2.140.28]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u18JRBMA015717; Mon, 8 Feb 2016 12:27:13 -0700 From: Stefan Berger To: tpmdd-devel@lists.sourceforge.net Date: Mon, 8 Feb 2016 14:27:06 -0500 Message-Id: <1454959628-30582-4-git-send-email-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1454959628-30582-1-git-send-email-stefanb@linux.vnet.ibm.com> References: <1454959628-30582-1-git-send-email-stefanb@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16020819-0017-0000-0000-000011ECC7EF X-Spam-Score: -0.2 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.1 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1aSrT2-0005AJ-2j Cc: dhowells@redhat.com, dwmw2@infradead.org Subject: [tpmdd-devel] [PATCH v5 3/5] Make tpm_startup() available X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net Make tpm_startup() available for others to call. Signed-off-by: Stefan Berger --- drivers/char/tpm/tpm-interface.c | 8 +++----- drivers/char/tpm/tpm.h | 7 +++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 792731e..cda8ef6 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -474,24 +474,22 @@ void tpm_gen_interrupt(struct tpm_chip *chip) EXPORT_SYMBOL_GPL(tpm_gen_interrupt); #define TPM_ORD_STARTUP cpu_to_be32(153) -#define TPM_ST_CLEAR cpu_to_be16(1) -#define TPM_ST_STATE cpu_to_be16(2) -#define TPM_ST_DEACTIVATED cpu_to_be16(3) static const struct tpm_input_header tpm_startup_header = { .tag = TPM_TAG_RQU_COMMAND, .length = cpu_to_be32(12), .ordinal = TPM_ORD_STARTUP }; -static int tpm_startup(struct tpm_chip *chip, __be16 startup_type) +int tpm_startup(struct tpm_chip *chip, u16 startup_type) { struct tpm_cmd_t start_cmd; start_cmd.header.in = tpm_startup_header; - start_cmd.params.startup_in.startup_type = startup_type; + start_cmd.params.startup_in.startup_type = cpu_to_be16(startup_type); return tpm_transmit_cmd(chip, &start_cmd, TPM_INTERNAL_RESULT_SIZE, "attempting to start the TPM"); } +EXPORT_SYMBOL_GPL(tpm_startup); int tpm_get_timeouts(struct tpm_chip *chip) { diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 2fb59f8..68510d8 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -383,6 +383,12 @@ struct tpm_startup_in { __be16 startup_type; } __packed; +enum tpm_startup_types { + TPM_ST_CLEAR = 0x0001, + TPM_ST_STATE = 0x0002, + TPM_ST_DEACTIVATED = 0x0003, +}; + typedef union { struct tpm_getcap_params_out getcap_out; struct tpm_readpubek_params_out readpubek_out; @@ -505,6 +511,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, size_t bufsiz); ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd, int len, const char *desc); +extern int tpm_startup(struct tpm_chip *, u16 startup_type); extern int tpm_get_timeouts(struct tpm_chip *); extern void tpm_gen_interrupt(struct tpm_chip *); extern int tpm_do_selftest(struct tpm_chip *);