aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2015-06-12 10:58:46 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-06-15 06:15:56 -0400
commit32be6d3e362b896c81aae7c635d44e5a91406ce2 (patch)
tree15c9514a838b2bd6cd75d748ba8c240299cf5245
parent81781e681551ed3f56c9202e9adc7ef941cba654 (diff)
crypto: nx - move include/linux/nx842.h into drivers/crypto/nx/nx-842.h
Move the contents of the include/linux/nx842.h header file into the drivers/crypto/nx/nx-842.h header file. Remove the nx842.h header file and its entry in the MAINTAINERS file. The include/linux/nx842.h header originally was there because the crypto/842.c driver needed it to communicate with the nx-842 hw driver. However, that crypto compression driver was moved into the drivers/crypto/nx/ directory, and now can directly include the nx-842.h header. Nothing else needs the public include/linux/nx842.h header file, as all use of the nx-842 hardware driver will be through the "842-nx" crypto compression driver, since the direct nx-842 api is very limited in the buffer alignments and sizes that it will accept, and the crypto compression interface handles those limitations and allows any alignment and size buffers. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--MAINTAINERS1
-rw-r--r--drivers/crypto/nx/nx-842-crypto.c3
-rw-r--r--drivers/crypto/nx/nx-842.h21
-rw-r--r--include/linux/nx842.h24
4 files changed, 22 insertions, 27 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 912c9d9f741c..fb06e1eba758 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4862,7 +4862,6 @@ IBM Power 842 compression accelerator
4862M: Dan Streetman <ddstreet@us.ibm.com> 4862M: Dan Streetman <ddstreet@us.ibm.com>
4863S: Supported 4863S: Supported
4864F: drivers/crypto/nx/nx-842* 4864F: drivers/crypto/nx/nx-842*
4865F: include/linux/nx842.h
4866F: include/linux/sw842.h 4865F: include/linux/sw842.h
4867F: crypto/842.c 4866F: crypto/842.c
4868F: lib/842/ 4867F: lib/842/
diff --git a/drivers/crypto/nx/nx-842-crypto.c b/drivers/crypto/nx/nx-842-crypto.c
index 2ffa1031c91f..95066f336b26 100644
--- a/drivers/crypto/nx/nx-842-crypto.c
+++ b/drivers/crypto/nx/nx-842-crypto.c
@@ -58,10 +58,11 @@
58#include <linux/module.h> 58#include <linux/module.h>
59#include <linux/crypto.h> 59#include <linux/crypto.h>
60#include <linux/vmalloc.h> 60#include <linux/vmalloc.h>
61#include <linux/nx842.h>
62#include <linux/sw842.h> 61#include <linux/sw842.h>
63#include <linux/ratelimit.h> 62#include <linux/ratelimit.h>
64 63
64#include "nx-842.h"
65
65/* The first 5 bits of this magic are 0x1f, which is an invalid 842 5-bit 66/* The first 5 bits of this magic are 0x1f, which is an invalid 842 5-bit
66 * template (see lib/842/842.h), so this magic number will never appear at 67 * template (see lib/842/842.h), so this magic number will never appear at
67 * the start of a raw 842 compressed buffer. That is important, as any buffer 68 * the start of a raw 842 compressed buffer. That is important, as any buffer
diff --git a/drivers/crypto/nx/nx-842.h b/drivers/crypto/nx/nx-842.h
index 1730f4da1cf6..4dbac11c2aa5 100644
--- a/drivers/crypto/nx/nx-842.h
+++ b/drivers/crypto/nx/nx-842.h
@@ -4,7 +4,6 @@
4 4
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/nx842.h>
8#include <linux/sw842.h> 7#include <linux/sw842.h>
9#include <linux/of.h> 8#include <linux/of.h>
10#include <linux/slab.h> 9#include <linux/slab.h>
@@ -12,6 +11,12 @@
12#include <linux/mm.h> 11#include <linux/mm.h>
13#include <linux/ratelimit.h> 12#include <linux/ratelimit.h>
14 13
14#define __NX842_PSERIES_MEM_COMPRESS (10240)
15#define __NX842_POWERNV_MEM_COMPRESS (1024)
16
17#define NX842_MEM_COMPRESS (max_t(unsigned int, \
18 __NX842_PSERIES_MEM_COMPRESS, __NX842_POWERNV_MEM_COMPRESS))
19
15/* Restrictions on Data Descriptor List (DDL) and Entry (DDE) buffers 20/* Restrictions on Data Descriptor List (DDL) and Entry (DDE) buffers
16 * 21 *
17 * From NX P8 workbook, sec 4.9.1 "842 details" 22 * From NX P8 workbook, sec 4.9.1 "842 details"
@@ -104,6 +109,13 @@ static inline unsigned long nx842_get_pa(void *addr)
104#define GET_FIELD(v, m) (((v) & (m)) >> MASK_LSH(m)) 109#define GET_FIELD(v, m) (((v) & (m)) >> MASK_LSH(m))
105#define SET_FIELD(v, m, val) (((v) & ~(m)) | (((val) << MASK_LSH(m)) & (m))) 110#define SET_FIELD(v, m, val) (((v) & ~(m)) | (((val) << MASK_LSH(m)) & (m)))
106 111
112struct nx842_constraints {
113 int alignment;
114 int multiple;
115 int minimum;
116 int maximum;
117};
118
107struct nx842_driver { 119struct nx842_driver {
108 char *name; 120 char *name;
109 struct module *owner; 121 struct module *owner;
@@ -124,4 +136,11 @@ void nx842_platform_driver_unset(struct nx842_driver *driver);
124bool nx842_platform_driver_get(void); 136bool nx842_platform_driver_get(void);
125void nx842_platform_driver_put(void); 137void nx842_platform_driver_put(void);
126 138
139int nx842_constraints(struct nx842_constraints *constraints);
140
141int nx842_compress(const unsigned char *in, unsigned int in_len,
142 unsigned char *out, unsigned int *out_len, void *wrkmem);
143int nx842_decompress(const unsigned char *in, unsigned int in_len,
144 unsigned char *out, unsigned int *out_len, void *wrkmem);
145
127#endif /* __NX_842_H__ */ 146#endif /* __NX_842_H__ */
diff --git a/include/linux/nx842.h b/include/linux/nx842.h
deleted file mode 100644
index 4ddf68d9c0d4..000000000000
--- a/include/linux/nx842.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef __NX842_H__
2#define __NX842_H__
3
4#define __NX842_PSERIES_MEM_COMPRESS (10240)
5#define __NX842_POWERNV_MEM_COMPRESS (1024)
6
7#define NX842_MEM_COMPRESS (max_t(unsigned int, \
8 __NX842_PSERIES_MEM_COMPRESS, __NX842_POWERNV_MEM_COMPRESS))
9
10struct nx842_constraints {
11 int alignment;
12 int multiple;
13 int minimum;
14 int maximum;
15};
16
17int nx842_constraints(struct nx842_constraints *constraints);
18
19int nx842_compress(const unsigned char *in, unsigned int in_len,
20 unsigned char *out, unsigned int *out_len, void *wrkmem);
21int nx842_decompress(const unsigned char *in, unsigned int in_len,
22 unsigned char *out, unsigned int *out_len, void *wrkmem);
23
24#endif