From: Stefan Berger Subject: [PATCH] [QEMU] TPM TIS dm suspend code fix Date: Mon, 29 Jan 2007 08:34:09 -0500 Message-ID: <1170077649.8311.21.camel@woodcrest1.watson.ibm.com> Reply-To: stefanb@us.ibm.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-9bPLnuInyacTt51YljMM" 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@lists.xensource.com Cc: keir@xensource.com List-Id: xen-devel@lists.xenproject.org --=-9bPLnuInyacTt51YljMM Content-Type: text/plain Content-Transfer-Encoding: 7bit This fixes a bug in the TPM TIS device model's state suspend code and adds some casts to variables to avoid compiler warnings. Signed-off-by: Stefan Berger --=-9bPLnuInyacTt51YljMM Content-Disposition: attachment; filename=qemu_tis_fix.diff Content-Type: text/x-patch; name=qemu_tis_fix.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 @@ -517,7 +517,7 @@ static uint32_t tis_mem_readl(void *opaq #ifdef DEBUG_TPM fprintf(logfile," read(%08x) = %08x\n", - addr, + (int)addr, val); #endif @@ -538,7 +538,7 @@ static void tis_mem_writel(void *opaque, #ifdef DEBUG_TPM fprintf(logfile,"write(%08x) = %08x\n", - addr, + (int)addr, val); #endif @@ -757,10 +757,11 @@ static CPUWriteMemoryFunc *tis_writefn[3 static void tpm_save(QEMUFile* f,void* opaque) { tpmState* s=(tpmState*)opaque; + uint8_t locty = s->active_loc; int c; /* need to wait for outstanding requests to complete */ - if (IS_COMM_WITH_VTPM(s)) { + if (s->loc[locty].state == STATE_EXECUTION) { int repeats = 30; /* 30 seconds; really should be infty */ while (repeats > 0 && !(s->loc[s->active_loc].sts & STS_DATA_AVAILABLE)) { @@ -777,6 +778,10 @@ static void tpm_save(QEMUFile* f,void* o } } + if (IS_COMM_WITH_VTPM(s)) { + close_vtpm_channel(s, 1); + } + qemu_put_be32s(f,&s->offset); qemu_put_buffer(f, s->buffer.buf, TPM_MAX_PKT); qemu_put_8s(f, &s->active_loc); @@ -993,7 +998,7 @@ static int TPM_Receive(tpmState *s, tpmB uint32_t size = tpm_get_size_from_buffer(buffer->buf); if (size + sizeof(buffer->instance) != off) { fprintf(logfile,"TPM: Packet size is bad! %d != %d\n", - size + sizeof(buffer->instance), + (int)(size + sizeof(buffer->instance)), off); } else { uint32_t ret; --=-9bPLnuInyacTt51YljMM 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 --=-9bPLnuInyacTt51YljMM--