From: Stefan Berger Subject: [PATCH] [QEMU] [TPM-TIS] Transmit the locality in which the command was sent Date: Wed, 06 Dec 2006 21:21:29 -0500 Message-ID: <1165458089.30340.12.camel@lt2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-kyCETyFTORnnOLlwOy8p" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen-devel List-Id: xen-devel@lists.xenproject.org --=-kyCETyFTORnnOLlwOy8p Content-Type: text/plain Content-Transfer-Encoding: 7bit Transmit the locality in which the command was sent in the highest 3 bits of the 4 bytes prepended to each packet. Signed-off-by: Stefan Berger --=-kyCETyFTORnnOLlwOy8p Content-Disposition: inline; filename=tpm-tis-send-locality.diff Content-Type: text/x-patch; name=tpm-tis-send-locality.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/ioemu/hw/tpm_tis.c =================================================================== --- root.orig/xen-unstable.hg/tools/ioemu/hw/tpm_tis.c +++ root/xen-unstable.hg/tools/ioemu/hw/tpm_tis.c @@ -132,7 +132,7 @@ typedef struct TPMState { /* local prototypes */ -static int TPM_Send(tpmState *s, tpmBuffer *buffer, char *msg); +static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, char *msg); static int TPM_Receive(tpmState *s, tpmBuffer *buffer); static uint32_t vtpm_instance_from_xenstore(void); static void tis_poll_timer(void *opaque); @@ -271,6 +271,8 @@ static int create_local_socket(tpmState /* * the 'write' method for sending requests to the vTPM * four bytes with the vTPM instance number are prepended to each request + * the locality in which the command was sent is transmitted in the + * highest 3 bits */ static int write_local_socket(tpmState *s, const tpmBuffer *buffer) { @@ -608,7 +610,7 @@ static void tis_mem_writel(void *opaque, } } if (val & STS_TPM_GO) { - n = TPM_Send(s, &s->buffer,"tpm_data_write"); + n = TPM_Send(s, &s->buffer, locty, "tpm_data_write"); if (n > 0) { /* sending of data was successful */ s->offset = 0; @@ -915,7 +917,7 @@ const static unsigned char tpm_failure[] /* * Send a TPM request. */ -static int TPM_Send(tpmState *s, tpmBuffer *buffer, char *msg) +static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, char *msg) { int len; uint32_t size = tpm_get_size_from_buffer(buffer->buf); @@ -945,6 +947,10 @@ static int TPM_Send(tpmState *s, tpmBuff showBuff(buffer->buf, "To TPM"); #endif + /* transmit the locality in the highest 3 bits */ + buffer->instance[0] &= 0x1f; + buffer->instance[0] |= (locty << 5); + len = vTPMTransmit[s->Transmitlayer].write(s, buffer); if (len < 0) { s->Transmitlayer = -1; --=-kyCETyFTORnnOLlwOy8p Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-kyCETyFTORnnOLlwOy8p--