Skip to contentSkip to conversation

RFC: [PATCH 2/5] staging: sep: update existing sep headers

PATCH Mark Allyn 2 participants 2 messages Feb 28, 2011 Staging

lore
Share & tools
lore

Mark Allyn

author
#0 lore raw

Updates include new structures and constants necessary for kernel crypto operation

Some functions in sep_main.c are made available to sep_crypto.c which will be added in subsequent patch

---
 drivers/staging/sep/sep_dev.h           |   24 ++++-
 drivers/staging/sep/sep_driver_api.h    |  192 ++++++++++++++++++++++++++++++-
 drivers/staging/sep/sep_driver_config.h |   14 +-
 3 files changed, 215 insertions(+), 15 deletions(-)
drivers/staging/sep/sep_dev.h +22 -2
index 0ffe68c..122dc94 100644
@@ -5,8 +5,8 @@
  *
  *  sep_dev.h - Security Processor Device Structures
  *
- *  Copyright(c) 2009,2010 Intel Corporation. All rights reserved.
- *  Contributions(c) 2009,2010 Discretix. All rights reserved.
+ *  Copyright(c) 2009,2011 Intel Corporation. All rights reserved.
+ *  Contributions(c) 2009,2011 Discretix. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License as published by the Free
@@ -28,6 +28,7 @@
  *
  *  CHANGES
  *  2010.09.14  upgrade to Medfield
+ *  2011.02.22  enable kernel crypto
  */
 
 struct sep_device {
@@ -51,6 +52,7 @@ struct sep_device {
 
 	struct mutex sep_mutex;
 	struct mutex ioctl_mutex;
+	struct mutex tasklet_mutex;
 	spinlock_t snd_rply_lck;
 
 	/* flags to indicate use and lock status of sep */
@@ -129,8 +131,26 @@ struct sep_device {
 
 	struct sep_dma_resource dma_res_arr[SEP_MAX_NUM_SYNC_DMA_OPS];
 
+	/* The following are used for kernel crypto client requests */
+	u32 in_kernel; /* Set for kernel client request */
+	struct tasklet_struct	finish_tasklet;
+	struct ahash_request	*current_hash_req;
+	struct ablkcipher_request *current_cypher_req;
+	spinlock_t		busy_lock;
+	enum type_of_request	current_request;
+	enum hash_stage		current_hash_stage;
+	void			*current_msg_ptr;
+	u32			out_msg_size;
+	u32			in_msg_size;
+	struct scatterlist	*src_sg;
+	struct scatterlist	*dst_sg;
+	/* Used only if scatterlist replace due to oddball page sizes */
+	struct scatterlist	*src_sg_hold;
+	struct scatterlist	*dst_sg_hold;
 };
 
+extern struct sep_device *sep_dev;
+
 static inline void sep_write_reg(struct sep_device *dev, int reg, u32 value)
 {
 	void __iomem *addr = dev->reg_addr + reg;
drivers/staging/sep/sep_driver_api.h +186 -6

220 lines not on this page · raw message

drivers/staging/sep/sep_driver_config.h +7 -7
index d3b9220..12ec690 100644
@@ -2,8 +2,8 @@
  *
  *  sep_driver_config.h - Security Processor Driver configuration
  *
- *  Copyright(c) 2009,2010 Intel Corporation. All rights reserved.
- *  Contributions(c) 2009,2010 Discretix. All rights reserved.
+ *  Copyright(c) 2009,2011 Intel Corporation. All rights reserved.
+ *  Contributions(c) 2009,2011 Discretix. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License as published by the Free
@@ -26,6 +26,7 @@
  *  CHANGES:
  *
  *  2010.06.26	Upgrade to Medfield
+ *  2011.02.22  Enable kernel crypto
  *
  */
 
@@ -76,10 +77,6 @@ held by the proccess (struct file) */
 #define SEP_REQUEST_DAEMON_MAPPED 1
 #define SEP_REQUEST_DAEMON_UNMAPPED 0
 
-#define SEP_DEV_NAME "sep_sec_driver"
-#define SEP_DEV_SINGLETON "sep_sec_singleton_driver"
-#define SEP_DEV_DAEMON "sep_req_daemon_driver"
-
 /*--------------------------------------------------------
 	SHARED AREA  memory total size is 36K
 	it is divided is following:
@@ -132,6 +129,9 @@ held by the proccess (struct file) */
 /* system data (time, caller id etc') pool */
 #define SEP_DRIVER_SYSTEM_DATA_MEMORY_SIZE_IN_BYTES		(1024 * 3)
 
+/* Offset of the sep printf buffer in the message area */
+#define SEP_DRIVER_PRINTF_OFFSET_IN_BYTES			(5888)
+
 /* the size in bytes of the time memory */
 #define SEP_DRIVER_TIME_MEMORY_SIZE_IN_BYTES			8
 
@@ -180,7 +180,7 @@ held by the proccess (struct file) */
 /* offset of the caller id area */
 #define SEP_CALLER_ID_OFFSET_BYTES \
 	(SEP_DRIVER_SYSTEM_RAR_MEMORY_OFFSET_IN_BYTES + \
-    SEP_DRIVER_SYSTEM_RAR_MEMORY_SIZE_IN_BYTES)
+	SEP_DRIVER_SYSTEM_RAR_MEMORY_SIZE_IN_BYTES)
 
 /* offset of the DCB area */
 #define SEP_DRIVER_SYSTEM_DCB_MEMORY_OFFSET_IN_BYTES \
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 18 lines · Mark Allyn

Updates include new structures and constants necessary for kernel crypto operation

Some functions in sep_main.c are made available to sep_crypto.c which will be added in subsequent patch

---
 drivers/staging/sep/sep_dev.h           |   24 ++++-
 drivers/staging/sep/sep_driver_api.h    |  192 ++++++++++++++++++++++++++++++-
 drivers/staging/sep/sep_driver_config.h |   14 +-
 3 files changed, 215 insertions(+), 15 deletions(-)
drivers/staging/sep/sep_dev.h +0 -0
index 0ffe68c..122dc94 100644

drivers/staging/sep/sep_dev.h line 9

Quoted 7 lines
drivers/staging/sep/sep_dev.h +2 -2
@@ -5,8 +5,8 @@
  *
  *  sep_dev.h - Security Processor Device Structures
  *
- *  Copyright(c) 2009,2010 Intel Corporation. All rights reserved.
- *  Contributions(c) 2009,2010 Discretix. All rights reserved.
+ *  Copyright(c) 2009,2011 Intel Corporation. All rights reserved.
+ *  Contributions(c) 2009,2011 Discretix. All rights reserved.

So the contributions came from both companies? Care to get a signed-off-by from Discretix as well?

drivers/staging/sep/sep_dev.h line 31

Quoted 8 lines
drivers/staging/sep/sep_dev.h +1 -0
  *
  *  This program is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License as published by the Free
@@ -28,6 +28,7 @@
  *
  *  CHANGES
  *  2010.09.14  upgrade to Medfield
+ *  2011.02.22  enable kernel crypto

Changes do NOT belong in the individual files, that's what the git changelog is for.

thanks,

greg k-h