1// Copyright 2015 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// THIS CODE IS GENERATED - DO NOT MODIFY!
6
7#ifndef TPM2_FIRMWAREREAD_FP_H_
8#define TPM2_FIRMWAREREAD_FP_H_
9
10#include "tpm_generated.h"
11
12typedef struct { UINT32 sequenceNumber; } FirmwareRead_In;
13
14typedef struct { TPM2B_MAX_BUFFER fuData; } FirmwareRead_Out;
15
16// Executes FirmwareRead with request handles and parameters from
17// |in| and computes response handles and parameters to |out|.
18TPM_RC TPM2_FirmwareRead(FirmwareRead_In* in, FirmwareRead_Out* out);
19
20// Initializes handle fields in |target| from |request_handles|. Unmarshals
21// parameter fields in |target| from |buffer|.
22TPM_RC FirmwareRead_In_Unmarshal(FirmwareRead_In* target,
23                                 TPM_HANDLE request_handles[],
24                                 BYTE** buffer,
25                                 INT32* size);
26
27// Marshals response handles and parameters from |source| to |buffer|. Computes
28// and marshals the size of the parameter area (parameter_size) if |tag| ==
29// TPM_ST_SESSIONS. Returns size of (parameter area + handle area) in bytes.
30// Return value does not include parameter_size field.
31UINT16 FirmwareRead_Out_Marshal(FirmwareRead_Out* source,
32                                TPMI_ST_COMMAND_TAG tag,
33                                BYTE** buffer,
34                                INT32* size);
35
36// Unmarshals any request parameters starting at |request_parameter_buffer|.
37// Executes command. Marshals any response handles and parameters to the
38// global response buffer and computes |*response_handle_buffer_size| and
39// |*response_parameter_buffer_size|. If |tag| == TPM_ST_SESSIONS, marshals
40// parameter_size indicating the size of the parameter area. parameter_size
41// field is located between the handle area and parameter area.
42TPM_RC Exec_FirmwareRead(TPMI_ST_COMMAND_TAG tag,
43                         BYTE** request_parameter_buffer,
44                         INT32* request_parameter_buffer_size,
45                         TPM_HANDLE request_handles[],
46                         UINT32* response_handle_buffer_size,
47                         UINT32* response_parameter_buffer_size);
48
49#endif  // TPM2_FIRMWAREREAD_FP_H
50