@@ -9765,6 +9765,13 @@ type String struct {
9765
9765
Str string `json:"str"`
9766
9766
}
9767
9767
9768
+ // TPMEmulatorOptions -> TPMEmulatorOptions (struct)
9769
+
9770
+ // TPMEmulatorOptions implements the "TPMEmulatorOptions" QMP API type.
9771
+ type TPMEmulatorOptions struct {
9772
+ Chardev string `json:"chardev"`
9773
+ }
9774
+
9768
9775
// TPMInfo -> TPMInfo (struct)
9769
9776
9770
9777
// TPMInfo implements the "TPMInfo" QMP API type.
@@ -9863,13 +9870,16 @@ type TPMType int
9863
9870
// Known values of TPMType.
9864
9871
const (
9865
9872
TPMTypePassthrough TPMType = iota
9873
+ TPMTypeEmulator
9866
9874
)
9867
9875
9868
9876
// String implements fmt.Stringer.
9869
9877
func (e TPMType ) String () string {
9870
9878
switch e {
9871
9879
case TPMTypePassthrough :
9872
9880
return "passthrough"
9881
+ case TPMTypeEmulator :
9882
+ return "emulator"
9873
9883
default :
9874
9884
return fmt .Sprintf ("TPMType(%d)" , e )
9875
9885
}
@@ -9880,6 +9890,8 @@ func (e TPMType) MarshalJSON() ([]byte, error) {
9880
9890
switch e {
9881
9891
case TPMTypePassthrough :
9882
9892
return json .Marshal ("passthrough" )
9893
+ case TPMTypeEmulator :
9894
+ return json .Marshal ("emulator" )
9883
9895
default :
9884
9896
return nil , fmt .Errorf ("unknown enum value %q for TPMType" , e )
9885
9897
}
@@ -9894,6 +9906,8 @@ func (e *TPMType) UnmarshalJSON(bs []byte) error {
9894
9906
switch s {
9895
9907
case "passthrough" :
9896
9908
* e = TPMTypePassthrough
9909
+ case "emulator" :
9910
+ * e = TPMTypeEmulator
9897
9911
default :
9898
9912
return fmt .Errorf ("unknown enum value %q for TPMType" , s )
9899
9913
}
@@ -9905,11 +9919,26 @@ func (e *TPMType) UnmarshalJSON(bs []byte) error {
9905
9919
// TPMTypeOptions implements the "TpmTypeOptions" QMP API type.
9906
9920
//
9907
9921
// Can be one of:
9922
+ // - TPMTypeOptionsEmulator
9908
9923
// - TPMTypeOptionsPassthrough
9909
9924
type TPMTypeOptions interface {
9910
9925
isTPMTypeOptions ()
9911
9926
}
9912
9927
9928
+ // TPMTypeOptionsEmulator is an implementation of TPMTypeOptions.
9929
+ type TPMTypeOptionsEmulator TPMEmulatorOptions
9930
+
9931
+ func (TPMTypeOptionsEmulator ) isTPMTypeOptions () {}
9932
+
9933
+ // MarshalJSON implements json.Marshaler.
9934
+ func (s TPMTypeOptionsEmulator ) MarshalJSON () ([]byte , error ) {
9935
+ v := map [string ]interface {}{
9936
+ "type" : "emulator" ,
9937
+ "data" : s ,
9938
+ }
9939
+ return json .Marshal (v )
9940
+ }
9941
+
9913
9942
// TPMTypeOptionsPassthrough is an implementation of TPMTypeOptions.
9914
9943
type TPMTypeOptionsPassthrough TPMPassthroughOptions
9915
9944
@@ -9933,6 +9962,12 @@ func decodeTPMTypeOptions(bs json.RawMessage) (TPMTypeOptions, error) {
9933
9962
return nil , err
9934
9963
}
9935
9964
switch v .T {
9965
+ case "emulator" :
9966
+ var ret TPMTypeOptionsEmulator
9967
+ if err := json .Unmarshal ([]byte (v .V ), & ret ); err != nil {
9968
+ return nil , err
9969
+ }
9970
+ return ret , nil
9936
9971
case "passthrough" :
9937
9972
var ret TPMTypeOptionsPassthrough
9938
9973
if err := json .Unmarshal ([]byte (v .V ), & ret ); err != nil {
0 commit comments