From: Patrick McHardy <kaber@trash.net>
To: linux-crypto@vger.kernel.org
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: [HIFN 01/n]: Endianess fixes
Date: Wed, 07 May 2008 14:14:28 +0200 [thread overview]
Message-ID: <48219D24.1040702@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 236 bytes --]
Attached is the first of my fixes for the HIFN driver. I've
got it to a working state with tcrypt, IPsec and dm-crypt, a
few of the patches still need a bit work though, so I'll send
the ones that I already consider ready one by one.
[-- Attachment #2: 01.diff --]
[-- Type: text/x-diff, Size: 4427 bytes --]
commit aa543b1fcddd097b5129a9a3056f888737d88102
Author: Patrick McHardy <kaber@trash.net>
Date: Wed May 7 12:27:09 2008 +0200
[HIFN]: Endianess fixes
HIFN uses little-endian by default, move cpu_to_le32 conversion to hifn_write_0/
hifn_write_1, add sparse annotations and fix an invalid endian conversion in
hifn_setup_src_desc.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index 81f3f95..d7a51ee 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -535,10 +535,10 @@ struct hifn_crypt_command
*/
struct hifn_mac_command
{
- volatile u16 masks;
- volatile u16 header_skip;
- volatile u16 source_count;
- volatile u16 reserved;
+ volatile __le16 masks;
+ volatile __le16 header_skip;
+ volatile __le16 source_count;
+ volatile __le16 reserved;
};
#define HIFN_MAC_CMD_ALG_MASK 0x0001
@@ -564,10 +564,10 @@ struct hifn_mac_command
struct hifn_comp_command
{
- volatile u16 masks;
- volatile u16 header_skip;
- volatile u16 source_count;
- volatile u16 reserved;
+ volatile __le16 masks;
+ volatile __le16 header_skip;
+ volatile __le16 source_count;
+ volatile __le16 reserved;
};
#define HIFN_COMP_CMD_SRCLEN_M 0xc000
@@ -583,10 +583,10 @@ struct hifn_comp_command
struct hifn_base_result
{
- volatile u16 flags;
- volatile u16 session;
- volatile u16 src_cnt; /* 15:0 of source count */
- volatile u16 dst_cnt; /* 15:0 of dest count */
+ volatile __le16 flags;
+ volatile __le16 session;
+ volatile __le16 src_cnt; /* 15:0 of source count */
+ volatile __le16 dst_cnt; /* 15:0 of dest count */
};
#define HIFN_BASE_RES_DSTOVERRUN 0x0200 /* destination overrun */
@@ -597,8 +597,8 @@ struct hifn_base_result
struct hifn_comp_result
{
- volatile u16 flags;
- volatile u16 crc;
+ volatile __le16 flags;
+ volatile __le16 crc;
};
#define HIFN_COMP_RES_LCB_M 0xff00 /* longitudinal check byte */
@@ -609,8 +609,8 @@ struct hifn_comp_result
struct hifn_mac_result
{
- volatile u16 flags;
- volatile u16 reserved;
+ volatile __le16 flags;
+ volatile __le16 reserved;
/* followed by 0, 6, 8, or 10 u16's of the MAC, then crypt */
};
@@ -619,8 +619,8 @@ struct hifn_mac_result
struct hifn_crypt_result
{
- volatile u16 flags;
- volatile u16 reserved;
+ volatile __le16 flags;
+ volatile __le16 reserved;
};
#define HIFN_CRYPT_RES_SRC_NOTZERO 0x0001 /* source expired */
@@ -686,12 +686,12 @@ static inline u32 hifn_read_1(struct hifn_device *dev, u32 reg)
static inline void hifn_write_0(struct hifn_device *dev, u32 reg, u32 val)
{
- writel(val, dev->bar[0] + reg);
+ writel((__force u32)cpu_to_le32(val), dev->bar[0] + reg);
}
static inline void hifn_write_1(struct hifn_device *dev, u32 reg, u32 val)
{
- writel(val, dev->bar[1] + reg);
+ writel((__force u32)cpu_to_le32(val), dev->bar[1] + reg);
}
static void hifn_wait_puc(struct hifn_device *dev)
@@ -1037,14 +1037,14 @@ static void hifn_init_registers(struct hifn_device *dev)
hifn_write_0(dev, HIFN_0_PUIER, HIFN_PUIER_DSTOVER);
/* write all 4 ring address registers */
- hifn_write_1(dev, HIFN_1_DMA_CRAR, __cpu_to_le32(dptr +
- offsetof(struct hifn_dma, cmdr[0])));
- hifn_write_1(dev, HIFN_1_DMA_SRAR, __cpu_to_le32(dptr +
- offsetof(struct hifn_dma, srcr[0])));
- hifn_write_1(dev, HIFN_1_DMA_DRAR, __cpu_to_le32(dptr +
- offsetof(struct hifn_dma, dstr[0])));
- hifn_write_1(dev, HIFN_1_DMA_RRAR, __cpu_to_le32(dptr +
- offsetof(struct hifn_dma, resr[0])));
+ hifn_write_1(dev, HIFN_1_DMA_CRAR, dptr +
+ offsetof(struct hifn_dma, cmdr[0]));
+ hifn_write_1(dev, HIFN_1_DMA_SRAR, dptr +
+ offsetof(struct hifn_dma, srcr[0]));
+ hifn_write_1(dev, HIFN_1_DMA_DRAR, dptr +
+ offsetof(struct hifn_dma, dstr[0]));
+ hifn_write_1(dev, HIFN_1_DMA_RRAR, dptr +
+ offsetof(struct hifn_dma, resr[0]));
mdelay(2);
#if 0
@@ -1178,8 +1178,8 @@ static int hifn_setup_src_desc(struct hifn_device *dev, struct page *page,
idx = dma->srci;
dma->srcr[idx].p = __cpu_to_le32(addr);
- dma->srcr[idx].l = __cpu_to_le32(size) | HIFN_D_VALID |
- HIFN_D_MASKDONEIRQ | HIFN_D_NOINVALID | HIFN_D_LAST;
+ dma->srcr[idx].l = __cpu_to_le32(size | HIFN_D_VALID |
+ HIFN_D_MASKDONEIRQ | HIFN_D_NOINVALID | HIFN_D_LAST);
if (++idx == HIFN_D_SRC_RSIZE) {
dma->srcr[idx].l = __cpu_to_le32(HIFN_D_VALID |
next reply other threads:[~2008-05-07 12:15 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-07 12:14 Patrick McHardy [this message]
2008-05-07 12:15 ` [HIFN 02/n]: Remove printk_ratelimit() for debugging printk Patrick McHardy
2008-05-07 12:23 ` Evgeniy Polyakov
2008-05-07 12:19 ` [HIFN 03/n]: Indicate asynchronous processing to crypto API Patrick McHardy
2008-05-07 12:23 ` Evgeniy Polyakov
2008-05-07 12:29 ` Patrick McHardy
2008-05-07 12:20 ` [HIFN 04/n]: Handle ablkcipher_walk errors Patrick McHardy
2008-05-07 12:44 ` Evgeniy Polyakov
2008-05-07 12:26 ` [HIFN 05/n]: Fix data alignment checks Patrick McHardy
2008-05-07 12:42 ` Evgeniy Polyakov
2008-05-07 12:45 ` Patrick McHardy
2008-05-07 13:04 ` Evgeniy Polyakov
2008-05-07 13:05 ` Patrick McHardy
2008-05-07 13:22 ` Evgeniy Polyakov
2008-05-07 12:48 ` Herbert Xu
2008-05-07 12:51 ` Patrick McHardy
2008-05-07 12:30 ` [HIFN 06/n]: Properly handle requests for less than the full scatterlist Patrick McHardy
2008-05-07 13:01 ` Evgeniy Polyakov
2008-05-07 12:32 ` [HIFN 07/n]: Use unique driver names for different algos Patrick McHardy
2008-05-07 13:07 ` Evgeniy Polyakov
2008-05-07 12:36 ` [HIFN 08/n]: Properly initialize ivsize for CBC modes Patrick McHardy
2008-05-07 12:38 ` [HIFN 09/n]: Fix max queue length value Patrick McHardy
2008-05-07 12:46 ` Evgeniy Polyakov
2008-05-07 12:50 ` [HIFN 10/n]: Move command descriptor setup to seperate function Patrick McHardy
2008-05-07 13:11 ` Evgeniy Polyakov
2008-05-07 12:53 ` [HIFN 11/n]: Have HW invalidate src and dest descriptors after processing Patrick McHardy
2008-05-07 13:14 ` Evgeniy Polyakov
2008-05-07 13:18 ` Patrick McHardy
2008-05-07 13:00 ` [HIFN 01/n]: Endianess fixes Evgeniy Polyakov
2008-05-07 13:01 ` Patrick McHardy
2008-05-07 13:23 ` Evgeniy Polyakov
2008-05-07 13:46 ` Patrick McHardy
2008-05-07 14:04 ` Evgeniy Polyakov
2008-05-07 14:38 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48219D24.1040702@trash.net \
--to=kaber@trash.net \
--cc=herbert@gondor.apana.org.au \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox