xref: /qemu/include/hw/misc/aspeed_hace.h (revision 80db93b2b88f9b3ed8927ae7ac74ca30e643a83e)
1c5475b3fSJoel Stanley /*
2c5475b3fSJoel Stanley  * ASPEED Hash and Crypto Engine
3c5475b3fSJoel Stanley  *
44c1d0af4SAlejandro Zeise  * Copyright (c) 2024 Seagate Technology LLC and/or its Affiliates
5c5475b3fSJoel Stanley  * Copyright (C) 2021 IBM Corp.
6c5475b3fSJoel Stanley  *
7c5475b3fSJoel Stanley  * SPDX-License-Identifier: GPL-2.0-or-later
8c5475b3fSJoel Stanley  */
9c5475b3fSJoel Stanley 
10c5475b3fSJoel Stanley #ifndef ASPEED_HACE_H
11c5475b3fSJoel Stanley #define ASPEED_HACE_H
12c5475b3fSJoel Stanley 
13c5475b3fSJoel Stanley #include "hw/sysbus.h"
144c1d0af4SAlejandro Zeise #include "crypto/hash.h"
15c5475b3fSJoel Stanley 
16c5475b3fSJoel Stanley #define TYPE_ASPEED_HACE "aspeed.hace"
17c5475b3fSJoel Stanley #define TYPE_ASPEED_AST2400_HACE TYPE_ASPEED_HACE "-ast2400"
18c5475b3fSJoel Stanley #define TYPE_ASPEED_AST2500_HACE TYPE_ASPEED_HACE "-ast2500"
19c5475b3fSJoel Stanley #define TYPE_ASPEED_AST2600_HACE TYPE_ASPEED_HACE "-ast2600"
20e056c522SSteven Lee #define TYPE_ASPEED_AST1030_HACE TYPE_ASPEED_HACE "-ast1030"
21393c908aSJamin Lin #define TYPE_ASPEED_AST2700_HACE TYPE_ASPEED_HACE "-ast2700"
22e056c522SSteven Lee 
23c5475b3fSJoel Stanley OBJECT_DECLARE_TYPE(AspeedHACEState, AspeedHACEClass, ASPEED_HACE)
24c5475b3fSJoel Stanley 
255cd7d856SSteven Lee #define ASPEED_HACE_MAX_SG  256 /* max number of entries */
26c5475b3fSJoel Stanley 
27c5475b3fSJoel Stanley struct AspeedHACEState {
28c5475b3fSJoel Stanley     SysBusDevice parent;
29c5475b3fSJoel Stanley 
30c5475b3fSJoel Stanley     MemoryRegion iomem;
31c5475b3fSJoel Stanley     qemu_irq irq;
32c5475b3fSJoel Stanley 
3389d2a9f3SJamin Lin     uint32_t *regs;
345cd7d856SSteven Lee     uint32_t total_req_len;
35c5475b3fSJoel Stanley 
36c5475b3fSJoel Stanley     MemoryRegion *dram_mr;
37c5475b3fSJoel Stanley     AddressSpace dram_as;
384c1d0af4SAlejandro Zeise 
394c1d0af4SAlejandro Zeise     QCryptoHash *hash_ctx;
40c5475b3fSJoel Stanley };
41c5475b3fSJoel Stanley 
42c5475b3fSJoel Stanley 
43c5475b3fSJoel Stanley struct AspeedHACEClass {
44c5475b3fSJoel Stanley     SysBusDeviceClass parent_class;
45c5475b3fSJoel Stanley 
4689d2a9f3SJamin Lin     const MemoryRegionOps *reg_ops;
47c5475b3fSJoel Stanley     uint32_t src_mask;
48c5475b3fSJoel Stanley     uint32_t dest_mask;
491877069cSSteven Lee     uint32_t key_mask;
50c5475b3fSJoel Stanley     uint32_t hash_mask;
5189d2a9f3SJamin Lin     uint64_t nr_regs;
528e002a69SJamin Lin     bool raise_crypt_interrupt_workaround;
536262c8adSJamin Lin     uint32_t src_hi_mask;
546262c8adSJamin Lin     uint32_t dest_hi_mask;
556262c8adSJamin Lin     uint32_t key_hi_mask;
56*7e65aa39SJamin Lin     bool has_dma64;
57c5475b3fSJoel Stanley };
58c5475b3fSJoel Stanley 
59ea9cea93SMarkus Armbruster #endif /* ASPEED_HACE_H */
60