diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2014-12-21 15:54:00 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-12-23 16:14:22 -0500 |
commit | 011f3c6cbb97859860e451f2a75767cd4c1ffc03 (patch) | |
tree | 6662ed497e584d9de3caec1447c13115c9bdc2b6 /arch | |
parent | 1e585ef51c3fdcf296d2ce5cb8c9e74b1a36cfb4 (diff) |
MIPS: OCTEON: reintroduce crypto features check
Reintroduce run-time check for crypto features. The old one was deleted
because it was unreliable, now decide the crypto availability on early
boot when the model string is constructed.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/cavium-octeon/executive/octeon-model.c | 6 | ||||
-rw-r--r-- | arch/mips/include/asm/octeon/octeon-feature.h | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/arch/mips/cavium-octeon/executive/octeon-model.c b/arch/mips/cavium-octeon/executive/octeon-model.c index e15b049b3bd7..b2104bd9ab3b 100644 --- a/arch/mips/cavium-octeon/executive/octeon-model.c +++ b/arch/mips/cavium-octeon/executive/octeon-model.c | |||
@@ -27,6 +27,9 @@ | |||
27 | 27 | ||
28 | #include <asm/octeon/octeon.h> | 28 | #include <asm/octeon/octeon.h> |
29 | 29 | ||
30 | enum octeon_feature_bits __octeon_feature_bits __read_mostly; | ||
31 | EXPORT_SYMBOL_GPL(__octeon_feature_bits); | ||
32 | |||
30 | /** | 33 | /** |
31 | * Read a byte of fuse data | 34 | * Read a byte of fuse data |
32 | * @byte_addr: address to read | 35 | * @byte_addr: address to read |
@@ -103,6 +106,9 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id, | |||
103 | else | 106 | else |
104 | suffix = "NSP"; | 107 | suffix = "NSP"; |
105 | 108 | ||
109 | if (!fus_dat2.s.nocrypto) | ||
110 | __octeon_feature_bits |= OCTEON_HAS_CRYPTO; | ||
111 | |||
106 | /* | 112 | /* |
107 | * Assume pass number is encoded using <5:3><2:0>. Exceptions | 113 | * Assume pass number is encoded using <5:3><2:0>. Exceptions |
108 | * will be fixed later. | 114 | * will be fixed later. |
diff --git a/arch/mips/include/asm/octeon/octeon-feature.h b/arch/mips/include/asm/octeon/octeon-feature.h index c4fe81f47f53..8ebd3f579b84 100644 --- a/arch/mips/include/asm/octeon/octeon-feature.h +++ b/arch/mips/include/asm/octeon/octeon-feature.h | |||
@@ -46,8 +46,6 @@ enum octeon_feature { | |||
46 | OCTEON_FEATURE_SAAD, | 46 | OCTEON_FEATURE_SAAD, |
47 | /* Does this Octeon support the ZIP offload engine? */ | 47 | /* Does this Octeon support the ZIP offload engine? */ |
48 | OCTEON_FEATURE_ZIP, | 48 | OCTEON_FEATURE_ZIP, |
49 | /* Does this Octeon support crypto acceleration using COP2? */ | ||
50 | OCTEON_FEATURE_CRYPTO, | ||
51 | OCTEON_FEATURE_DORM_CRYPTO, | 49 | OCTEON_FEATURE_DORM_CRYPTO, |
52 | /* Does this Octeon support PCI express? */ | 50 | /* Does this Octeon support PCI express? */ |
53 | OCTEON_FEATURE_PCIE, | 51 | OCTEON_FEATURE_PCIE, |
@@ -86,6 +84,21 @@ enum octeon_feature { | |||
86 | OCTEON_MAX_FEATURE | 84 | OCTEON_MAX_FEATURE |
87 | }; | 85 | }; |
88 | 86 | ||
87 | enum octeon_feature_bits { | ||
88 | OCTEON_HAS_CRYPTO = 0x0001, /* Crypto acceleration using COP2 */ | ||
89 | }; | ||
90 | extern enum octeon_feature_bits __octeon_feature_bits; | ||
91 | |||
92 | /** | ||
93 | * octeon_has_crypto() - Check if this OCTEON has crypto acceleration support. | ||
94 | * | ||
95 | * Returns: Non-zero if the feature exists. Zero if the feature does not exist. | ||
96 | */ | ||
97 | static inline int octeon_has_crypto(void) | ||
98 | { | ||
99 | return __octeon_feature_bits & OCTEON_HAS_CRYPTO; | ||
100 | } | ||
101 | |||
89 | /** | 102 | /** |
90 | * Determine if the current Octeon supports a specific feature. These | 103 | * Determine if the current Octeon supports a specific feature. These |
91 | * checks have been optimized to be fairly quick, but they should still | 104 | * checks have been optimized to be fairly quick, but they should still |