qemu/hw/tpm/tpm_tis.h
<<
>>
Prefs
   1/*
   2 * tpm_tis.h - QEMU's TPM TIS interface emulator
   3 *
   4 * Copyright (C) 2006, 2010-2013 IBM Corporation
   5 *
   6 * Authors:
   7 *  Stefan Berger <stefanb@us.ibm.com>
   8 *  David Safford <safford@us.ibm.com>
   9 *
  10 * This work is licensed under the terms of the GNU GPL, version 2 or later.
  11 * See the COPYING file in the top-level directory.
  12 *
  13 * Implementation of the TIS interface according to specs found at
  14 * http://www.trustedcomputinggroup.org
  15 *
  16 */
  17#ifndef TPM_TPM_TIS_H
  18#define TPM_TPM_TIS_H
  19
  20#include "hw/isa/isa.h"
  21#include "hw/acpi/tpm.h"
  22#include "qemu-common.h"
  23
  24#define TPM_TIS_NUM_LOCALITIES      5     /* per spec */
  25#define TPM_TIS_LOCALITY_SHIFT      12
  26#define TPM_TIS_NO_LOCALITY         0xff
  27
  28#define TPM_TIS_IS_VALID_LOCTY(x)   ((x) < TPM_TIS_NUM_LOCALITIES)
  29
  30#define TPM_TIS_BUFFER_MAX          4096
  31
  32typedef enum {
  33    TPM_TIS_STATE_IDLE = 0,
  34    TPM_TIS_STATE_READY,
  35    TPM_TIS_STATE_COMPLETION,
  36    TPM_TIS_STATE_EXECUTION,
  37    TPM_TIS_STATE_RECEPTION,
  38} TPMTISState;
  39
  40/* locality data  -- all fields are persisted */
  41typedef struct TPMLocality {
  42    TPMTISState state;
  43    uint8_t access;
  44    uint32_t sts;
  45    uint32_t iface_id;
  46    uint32_t inte;
  47    uint32_t ints;
  48
  49    uint16_t w_offset;
  50    uint16_t r_offset;
  51    TPMSizedBuffer w_buffer;
  52    TPMSizedBuffer r_buffer;
  53} TPMLocality;
  54
  55typedef struct TPMTISEmuState {
  56    QEMUBH *bh;
  57    uint32_t offset;
  58    uint8_t buf[TPM_TIS_BUFFER_MAX];
  59
  60    uint8_t active_locty;
  61    uint8_t aborting_locty;
  62    uint8_t next_locty;
  63
  64    TPMLocality loc[TPM_TIS_NUM_LOCALITIES];
  65
  66    qemu_irq irq;
  67    uint32_t irq_num;
  68} TPMTISEmuState;
  69
  70#endif /* TPM_TPM_TIS_H */
  71