diff mbox series

[v1,1/1] aspeed/hace: Support AST1030 HACE

Message ID 20220503022710.4119-2-steven_lee@aspeedtech.com (mailing list archive)
State New, archived
Headers show
Series aspeed/hace: Support AST1030 HACE | expand

Commit Message

Steven Lee May 3, 2022, 2:27 a.m. UTC
Per ast1030_v7.pdf, AST1030 HACE engine is identical to AST2600's HACE
engine.

Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
---
 hw/misc/aspeed_hace.c         | 20 ++++++++++++++++++++
 include/hw/misc/aspeed_hace.h |  2 ++
 2 files changed, 22 insertions(+)

Comments

Cédric Le Goater May 3, 2022, 5:15 a.m. UTC | #1
On 5/3/22 04:27, Steven Lee wrote:
> Per ast1030_v7.pdf, AST1030 HACE engine is identical to AST2600's HACE
> engine.
> 
> Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks

C.

> ---
>   hw/misc/aspeed_hace.c         | 20 ++++++++++++++++++++
>   include/hw/misc/aspeed_hace.h |  2 ++
>   2 files changed, 22 insertions(+)
> 
> diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c
> index 10f00e65f4..91f3c0b208 100644
> --- a/hw/misc/aspeed_hace.c
> +++ b/hw/misc/aspeed_hace.c
> @@ -378,11 +378,31 @@ static const TypeInfo aspeed_ast2600_hace_info = {
>       .class_init = aspeed_ast2600_hace_class_init,
>   };
>   
> +static void aspeed_ast1030_hace_class_init(ObjectClass *klass, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(klass);
> +    AspeedHACEClass *ahc = ASPEED_HACE_CLASS(klass);
> +
> +    dc->desc = "AST1030 Hash and Crypto Engine";
> +
> +    ahc->src_mask = 0x7FFFFFFF;
> +    ahc->dest_mask = 0x7FFFFFF8;
> +    ahc->key_mask = 0x7FFFFFF8;
> +    ahc->hash_mask = 0x00147FFF;
> +}
> +
> +static const TypeInfo aspeed_ast1030_hace_info = {
> +    .name = TYPE_ASPEED_AST1030_HACE,
> +    .parent = TYPE_ASPEED_HACE,
> +    .class_init = aspeed_ast1030_hace_class_init,
> +};
> +
>   static void aspeed_hace_register_types(void)
>   {
>       type_register_static(&aspeed_ast2400_hace_info);
>       type_register_static(&aspeed_ast2500_hace_info);
>       type_register_static(&aspeed_ast2600_hace_info);
> +    type_register_static(&aspeed_ast1030_hace_info);
>       type_register_static(&aspeed_hace_info);
>   }
>   
> diff --git a/include/hw/misc/aspeed_hace.h b/include/hw/misc/aspeed_hace.h
> index 94d5ada95f..e9d3563a05 100644
> --- a/include/hw/misc/aspeed_hace.h
> +++ b/include/hw/misc/aspeed_hace.h
> @@ -15,6 +15,8 @@
>   #define TYPE_ASPEED_AST2400_HACE TYPE_ASPEED_HACE "-ast2400"
>   #define TYPE_ASPEED_AST2500_HACE TYPE_ASPEED_HACE "-ast2500"
>   #define TYPE_ASPEED_AST2600_HACE TYPE_ASPEED_HACE "-ast2600"
> +#define TYPE_ASPEED_AST1030_HACE TYPE_ASPEED_HACE "-ast1030"
> +
>   OBJECT_DECLARE_TYPE(AspeedHACEState, AspeedHACEClass, ASPEED_HACE)
>   
>   #define ASPEED_HACE_NR_REGS (0x64 >> 2)
diff mbox series

Patch

diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c
index 10f00e65f4..91f3c0b208 100644
--- a/hw/misc/aspeed_hace.c
+++ b/hw/misc/aspeed_hace.c
@@ -378,11 +378,31 @@  static const TypeInfo aspeed_ast2600_hace_info = {
     .class_init = aspeed_ast2600_hace_class_init,
 };
 
+static void aspeed_ast1030_hace_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    AspeedHACEClass *ahc = ASPEED_HACE_CLASS(klass);
+
+    dc->desc = "AST1030 Hash and Crypto Engine";
+
+    ahc->src_mask = 0x7FFFFFFF;
+    ahc->dest_mask = 0x7FFFFFF8;
+    ahc->key_mask = 0x7FFFFFF8;
+    ahc->hash_mask = 0x00147FFF;
+}
+
+static const TypeInfo aspeed_ast1030_hace_info = {
+    .name = TYPE_ASPEED_AST1030_HACE,
+    .parent = TYPE_ASPEED_HACE,
+    .class_init = aspeed_ast1030_hace_class_init,
+};
+
 static void aspeed_hace_register_types(void)
 {
     type_register_static(&aspeed_ast2400_hace_info);
     type_register_static(&aspeed_ast2500_hace_info);
     type_register_static(&aspeed_ast2600_hace_info);
+    type_register_static(&aspeed_ast1030_hace_info);
     type_register_static(&aspeed_hace_info);
 }
 
diff --git a/include/hw/misc/aspeed_hace.h b/include/hw/misc/aspeed_hace.h
index 94d5ada95f..e9d3563a05 100644
--- a/include/hw/misc/aspeed_hace.h
+++ b/include/hw/misc/aspeed_hace.h
@@ -15,6 +15,8 @@ 
 #define TYPE_ASPEED_AST2400_HACE TYPE_ASPEED_HACE "-ast2400"
 #define TYPE_ASPEED_AST2500_HACE TYPE_ASPEED_HACE "-ast2500"
 #define TYPE_ASPEED_AST2600_HACE TYPE_ASPEED_HACE "-ast2600"
+#define TYPE_ASPEED_AST1030_HACE TYPE_ASPEED_HACE "-ast1030"
+
 OBJECT_DECLARE_TYPE(AspeedHACEState, AspeedHACEClass, ASPEED_HACE)
 
 #define ASPEED_HACE_NR_REGS (0x64 >> 2)