| Jordan Crouse | 9fe757b | 2006-10-04 18:48:57 +1000 | [diff] [blame] | 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 |  | 
| Sebastian Siewior | b7a30da | 2007-10-21 16:21:25 +0800 | [diff] [blame] | 12 | /* driver logic flags */ | 
| Jordan Crouse | 9fe757b | 2006-10-04 18:48:57 +1000 | [diff] [blame] | 13 | #define AES_IV_LENGTH  16 | 
| Sebastian Siewior | b7a30da | 2007-10-21 16:21:25 +0800 | [diff] [blame] | 14 | #define AES_KEY_LENGTH 16 | 
| Jordan Crouse | 9fe757b | 2006-10-04 18:48:57 +1000 | [diff] [blame] | 15 | #define AES_MIN_BLOCK_SIZE 16 | 
|  | 16 |  | 
|  | 17 | #define AES_MODE_ECB 0 | 
|  | 18 | #define AES_MODE_CBC 1 | 
|  | 19 |  | 
|  | 20 | #define AES_DIR_DECRYPT 0 | 
|  | 21 | #define AES_DIR_ENCRYPT 1 | 
|  | 22 |  | 
| Jordan Crouse | 761e784 | 2007-05-24 21:23:24 +1000 | [diff] [blame] | 23 | #define AES_FLAGS_HIDDENKEY (1 << 0) | 
| Jordan Crouse | 9fe757b | 2006-10-04 18:48:57 +1000 | [diff] [blame] | 24 |  | 
| Sebastian Siewior | b7a30da | 2007-10-21 16:21:25 +0800 | [diff] [blame] | 25 | /* Register definitions */ | 
|  | 26 |  | 
|  | 27 | #define AES_CTRLA_REG  0x0000 | 
|  | 28 |  | 
|  | 29 | #define AES_CTRL_START     0x01 | 
|  | 30 | #define AES_CTRL_DECRYPT   0x00 | 
|  | 31 | #define AES_CTRL_ENCRYPT   0x02 | 
|  | 32 | #define AES_CTRL_WRKEY     0x04 | 
|  | 33 | #define AES_CTRL_DCA       0x08 | 
|  | 34 | #define AES_CTRL_SCA       0x10 | 
|  | 35 | #define AES_CTRL_CBC       0x20 | 
|  | 36 |  | 
|  | 37 | #define AES_INTR_REG  0x0008 | 
|  | 38 |  | 
|  | 39 | #define AES_INTRA_PENDING (1 << 16) | 
|  | 40 | #define AES_INTRB_PENDING (1 << 17) | 
|  | 41 |  | 
|  | 42 | #define AES_INTR_PENDING  (AES_INTRA_PENDING | AES_INTRB_PENDING) | 
|  | 43 | #define AES_INTR_MASK     0x07 | 
|  | 44 |  | 
|  | 45 | #define AES_SOURCEA_REG   0x0010 | 
|  | 46 | #define AES_DSTA_REG      0x0014 | 
|  | 47 | #define AES_LENA_REG      0x0018 | 
|  | 48 | #define AES_WRITEKEY0_REG 0x0030 | 
|  | 49 | #define AES_WRITEIV0_REG  0x0040 | 
|  | 50 |  | 
|  | 51 | /*  A very large counter that is used to gracefully bail out of an | 
|  | 52 | *  operation in case of trouble | 
|  | 53 | */ | 
|  | 54 |  | 
|  | 55 | #define AES_OP_TIMEOUT    0x50000 | 
|  | 56 |  | 
| Jordan Crouse | 9fe757b | 2006-10-04 18:48:57 +1000 | [diff] [blame] | 57 | struct geode_aes_op { | 
|  | 58 |  | 
|  | 59 | void *src; | 
|  | 60 | void *dst; | 
|  | 61 |  | 
|  | 62 | u32 mode; | 
|  | 63 | u32 dir; | 
|  | 64 | u32 flags; | 
|  | 65 | int len; | 
|  | 66 |  | 
|  | 67 | u8 key[AES_KEY_LENGTH]; | 
| Sebastian Siewior | d2456c6 | 2007-11-30 16:36:57 +1100 | [diff] [blame] | 68 | u8 *iv; | 
| Sebastian Siewior | cd7c3bf | 2007-11-10 19:29:33 +0800 | [diff] [blame] | 69 |  | 
|  | 70 | union { | 
|  | 71 | struct crypto_blkcipher *blk; | 
|  | 72 | struct crypto_cipher *cip; | 
|  | 73 | } fallback; | 
|  | 74 | u32 keylen; | 
| Jordan Crouse | 9fe757b | 2006-10-04 18:48:57 +1000 | [diff] [blame] | 75 | }; | 
|  | 76 |  | 
| Jordan Crouse | 9fe757b | 2006-10-04 18:48:57 +1000 | [diff] [blame] | 77 | #endif |