direct-io.hg

changeset 12762:49bb6b82654a

[VTPM][HVM] 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 <stefanb@us.ibm.com>
author kfraser@localhost.localdomain
date Thu Dec 07 11:17:28 2006 +0000 (2006-12-07)
parents 0c1e2abc1888
children 44319e9dc0c5
files tools/ioemu/hw/tpm_tis.c
line diff
     1.1 --- a/tools/ioemu/hw/tpm_tis.c	Thu Dec 07 11:16:17 2006 +0000
     1.2 +++ b/tools/ioemu/hw/tpm_tis.c	Thu Dec 07 11:17:28 2006 +0000
     1.3 @@ -132,7 +132,7 @@ typedef struct TPMState {
     1.4  
     1.5  
     1.6  /* local prototypes */
     1.7 -static int TPM_Send(tpmState *s, tpmBuffer *buffer, char *msg);
     1.8 +static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, char *msg);
     1.9  static int TPM_Receive(tpmState *s, tpmBuffer *buffer);
    1.10  static uint32_t vtpm_instance_from_xenstore(void);
    1.11  static void tis_poll_timer(void *opaque);
    1.12 @@ -271,6 +271,8 @@ static int create_local_socket(tpmState 
    1.13  /*
    1.14   * the 'write' method for sending requests to the vTPM
    1.15   * four bytes with the vTPM instance number are prepended to each request
    1.16 + * the locality in which the command was sent is transmitted in the
    1.17 + * highest 3 bits
    1.18   */
    1.19  static int write_local_socket(tpmState *s, const tpmBuffer *buffer)
    1.20  {
    1.21 @@ -608,7 +610,7 @@ static void tis_mem_writel(void *opaque,
    1.22              }
    1.23          }
    1.24          if (val & STS_TPM_GO) {
    1.25 -            n = TPM_Send(s, &s->buffer,"tpm_data_write");
    1.26 +            n = TPM_Send(s, &s->buffer, locty, "tpm_data_write");
    1.27              if (n > 0) {
    1.28                  /* sending of data was successful */
    1.29                  s->offset = 0;
    1.30 @@ -915,7 +917,7 @@ const static unsigned char tpm_failure[]
    1.31  /*
    1.32   * Send a TPM request.
    1.33   */
    1.34 -static int TPM_Send(tpmState *s, tpmBuffer *buffer, char *msg)
    1.35 +static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, char *msg)
    1.36  {
    1.37      int len;
    1.38      uint32_t size = tpm_get_size_from_buffer(buffer->buf);
    1.39 @@ -945,6 +947,10 @@ static int TPM_Send(tpmState *s, tpmBuff
    1.40      showBuff(buffer->buf, "To TPM");
    1.41  #endif
    1.42  
    1.43 +    /* transmit the locality in the highest 3 bits */
    1.44 +    buffer->instance[0] &= 0x1f;
    1.45 +    buffer->instance[0] |= (locty << 5);
    1.46 +
    1.47      len = vTPMTransmit[s->Transmitlayer].write(s, buffer);
    1.48      if (len < 0) {
    1.49          s->Transmitlayer = -1;