CCF
Loading...
Searching...
No Matches
sev_snp_cpuid.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
5#include "ccf/ds/json.h"
6
7#include <cstdint>
8#include <stdexcept>
9#include <string>
10
11namespace ccf::pal::snp
12{
13 enum class ProductName
14 {
15 Milan,
16 Genoa,
17 };
18
19 inline std::string to_string(ProductName product)
20 {
21 switch (product)
22 {
24 return "Milan";
26 return "Genoa";
27 default:
28 throw std::logic_error("Unknown SEV-SNP product");
29 }
30 }
31
34 {
35 {ProductName::Milan, "Milan"},
36 {ProductName::Genoa, "Genoa"},
37 });
38
39 using AMDFamily = uint8_t;
40 using AMDModel = uint8_t;
41
43 {
44 if (family == 0x19 && model == 0x01)
45 {
46 return ProductName::Milan;
47 }
48 if (family == 0x19 && model == 0x11)
49 {
50 return ProductName::Genoa;
51 }
52 throw std::logic_error(fmt::format(
53 "SEV-SNP: Unsupported CPUID family {} model {}", family, model));
54 }
55}
#define DECLARE_JSON_ENUM(TYPE,...)
Definition json.h:835
Definition attestation_sev_snp.h:16
std::string to_string(ProductName product)
Definition sev_snp_cpuid.h:19
ProductName
Definition sev_snp_cpuid.h:14
uint8_t AMDModel
Definition sev_snp_cpuid.h:40
ProductName get_sev_snp_product(AMDFamily family, AMDModel model)
Definition sev_snp_cpuid.h:42
uint8_t AMDFamily
Definition sev_snp_cpuid.h:39