Commit | Line | Data |
---|---|---|
9fe757b0 JC |
1 | /* Copyright (C) 2003-2006, Advanced Micro Devices, Inc. |
2 | * | |
3 | * This program is free software; you can redistribute it and/or modify | |
4 | * it under the terms of the GNU General Public License as published by | |
5 | * the Free Software Foundation; either version 2 of the License, or | |
6 | * (at your option) any later version. | |
7 | */ | |
8 | ||
9 | #ifndef _GEODE_AES_H_ | |
10 | #define _GEODE_AES_H_ | |
11 | ||
b7a30da6 | 12 | /* driver logic flags */ |
9fe757b0 JC |
13 | #define AES_MODE_ECB 0 |
14 | #define AES_MODE_CBC 1 | |
15 | ||
16 | #define AES_DIR_DECRYPT 0 | |
17 | #define AES_DIR_ENCRYPT 1 | |
18 | ||
761e7846 | 19 | #define AES_FLAGS_HIDDENKEY (1 << 0) |
9fe757b0 | 20 | |
b7a30da6 SS |
21 | /* Register definitions */ |
22 | ||
23 | #define AES_CTRLA_REG 0x0000 | |
24 | ||
25 | #define AES_CTRL_START 0x01 | |
26 | #define AES_CTRL_DECRYPT 0x00 | |
27 | #define AES_CTRL_ENCRYPT 0x02 | |
28 | #define AES_CTRL_WRKEY 0x04 | |
29 | #define AES_CTRL_DCA 0x08 | |
30 | #define AES_CTRL_SCA 0x10 | |
31 | #define AES_CTRL_CBC 0x20 | |
32 | ||
33 | #define AES_INTR_REG 0x0008 | |
34 | ||
35 | #define AES_INTRA_PENDING (1 << 16) | |
36 | #define AES_INTRB_PENDING (1 << 17) | |
37 | ||
38 | #define AES_INTR_PENDING (AES_INTRA_PENDING | AES_INTRB_PENDING) | |
39 | #define AES_INTR_MASK 0x07 | |
40 | ||
41 | #define AES_SOURCEA_REG 0x0010 | |
42 | #define AES_DSTA_REG 0x0014 | |
43 | #define AES_LENA_REG 0x0018 | |
44 | #define AES_WRITEKEY0_REG 0x0030 | |
45 | #define AES_WRITEIV0_REG 0x0040 | |
46 | ||
47 | /* A very large counter that is used to gracefully bail out of an | |
48 | * operation in case of trouble | |
49 | */ | |
50 | ||
51 | #define AES_OP_TIMEOUT 0x50000 | |
52 | ||
9fe757b0 JC |
53 | struct geode_aes_op { |
54 | ||
55 | void *src; | |
56 | void *dst; | |
57 | ||
58 | u32 mode; | |
59 | u32 dir; | |
60 | u32 flags; | |
61 | int len; | |
62 | ||
2e1fc34b | 63 | u8 key[AES_KEYSIZE_128]; |
d2456c66 | 64 | u8 *iv; |
cd7c3bfe SS |
65 | |
66 | union { | |
67 | struct crypto_blkcipher *blk; | |
68 | struct crypto_cipher *cip; | |
69 | } fallback; | |
70 | u32 keylen; | |
9fe757b0 JC |
71 | }; |
72 | ||
9fe757b0 | 73 | #endif |