Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
sep_main.c File Reference
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/kdev_t.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/poll.h>
#include <linux/wait.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/ioctl.h>
#include <asm/current.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/pagemap.h>
#include <asm/cacheflush.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
#include <linux/async.h>
#include <linux/crypto.h>
#include <crypto/internal/hash.h>
#include <crypto/scatterwalk.h>
#include <crypto/sha.h>
#include <crypto/md5.h>
#include <crypto/aes.h>
#include <crypto/des.h>
#include <crypto/hash.h>
#include "sep_driver_hw_defs.h"
#include "sep_driver_config.h"
#include "sep_driver_api.h"
#include "sep_dev.h"
#include "sep_crypto.h"
#include "sep_trace_events.h"

Go to the source code of this file.

Macros

#define CREATE_TRACE_POINTS
 
#define sep_dump_message(sep)
 

Functions

void sep_queue_status_remove (struct sep_device *sep, struct sep_queue_info **queue_elem)
 

Variables

struct sep_devicesep_dev
 

: current process name

sep_queue_status_add - Adds transaction to status queue : SEP device : transaction opcode : input data size : pid of current process

: length of name (current process)

This function adds information about about transaction started to the status queue.

struct sep_queue_infosep_queue_status_add (struct sep_device *sep, u32 opcode, u32 size, u32 pid, u8 *name, size_t name_len)
 
int sep_wait_transaction (struct sep_device *sep)
 
int sep_free_dma_table_data_handler (struct sep_device *sep, struct sep_dma_context **dma_ctx)
 
int sep_send_command_handler (struct sep_device *sep)
 
int sep_prepare_input_output_dma_table_in_dcb (struct sep_device *sep, unsigned long app_in_address, unsigned long app_out_address, u32 data_in_size, u32 block_size, u32 tail_block_size, bool isapplet, bool is_kva, bool secure_dma, struct sep_dcblock *dcb_region, void **dmatables_region, struct sep_dma_context **dma_ctx, struct scatterlist *src_sg, struct scatterlist *dst_sg)
 
ssize_t sep_activate_dcb_dmatables_context (struct sep_device *sep, struct sep_dcblock **dcb_region, void **dmatables_region, struct sep_dma_context *dma_ctx)
 
int sep_create_dcb_dmatables_context_kernel (struct sep_device *sep, struct sep_dcblock **dcb_region, void **dmatables_region, struct sep_dma_context **dma_ctx, const struct build_dcb_struct_kernel *dcb_data, const u32 num_dcbs)
 
 MODULE_DEVICE_TABLE (pci, sep_pci_id_tbl)
 

: name identifier for this driver

sep_pci_driver - registers this device with pci subsystem

: pointer to struct pci_device_id table : pointer to probe function in PCI driver : pointer to remove function in PCI driver

 module_pci_driver (sep_pci_driver)
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define CREATE_TRACE_POINTS

Definition at line 82 of file sep_main.c.

#define sep_dump_message (   sep)

Definition at line 92 of file sep_main.c.

Function Documentation

MODULE_DEVICE_TABLE ( pci  ,
sep_pci_id_tbl   
)
MODULE_LICENSE ( "GPL"  )
module_pci_driver ( sep_pci_driver  )
ssize_t sep_activate_dcb_dmatables_context ( struct sep_device sep,
struct sep_dcblock **  dcb_region,
void **  dmatables_region,
struct sep_dma_context dma_ctx 
)

sep_activate_dcb_dmatables_context - Takes DCB & DMA tables contexts into use : SEP device : DCB region copy : MLLI/DMA tables copy : DMA context for current transaction

Definition at line 3300 of file sep_main.c.

int sep_create_dcb_dmatables_context_kernel ( struct sep_device sep,
struct sep_dcblock **  dcb_region,
void **  dmatables_region,
struct sep_dma_context **  dma_ctx,
const struct build_dcb_struct_kernel dcb_data,
const u32  num_dcbs 
)

sep_create_dcb_dmatables_context_kernel - Creates DCB & MLLI/DMA table context for kernel crypto : SEP device : DCB region buf to create for current transaction : MLLI/DMA tables buf to create for current transaction : DMA context buf to create for current transaction : User arguments for DCB/MLLI creation : Number of DCBs to create This does that same thing as sep_create_dcb_dmatables_context except that it is used only for the kernel crypto operation. It is separate because there is no user data involved; the dcb data structure is specific for kernel crypto (build_dcb_struct_kernel)

Definition at line 3491 of file sep_main.c.

int sep_free_dma_table_data_handler ( struct sep_device sep,
struct sep_dma_context **  dma_ctx 
)

sep_free_dma_table_data_handler - free DMA table : pointer to struct sep_device : dma context

Handles the request to free DMA table for synchronic actions

Output is handled different. If this was a secure dma into restricted memory, then we skip this step altogether as restricted memory is not available to the o/s at all.

Note that here we use in_map_num_entries because we don't have a page array; the page array is generated only in the lock_user_pages, which is not called for kernel crypto, which is what the sg (scatter gather is used for exclusively)

Definition at line 454 of file sep_main.c.

int sep_prepare_input_output_dma_table_in_dcb ( struct sep_device sep,
unsigned long  app_in_address,
unsigned long  app_out_address,
u32  data_in_size,
u32  block_size,
u32  tail_block_size,
bool  isapplet,
bool  is_kva,
bool  secure_dma,
struct sep_dcblock dcb_region,
void **  dmatables_region,
struct sep_dma_context **  dma_ctx,
struct scatterlist src_sg,
struct scatterlist dst_sg 
)

sep_prepare_input_output_dma_table_in_dcb - prepare control blocks : unsigned long; for data buffer in (user space) : unsigned long; for data buffer out (user space) : u32; for size of data : u32; for block size : u32; for size of tail block : bool; to indicate external app : bool; kernel buffer; only used for kernel crypto module ; indicates whether this is secure_dma using IMR

This function prepares the linked DMA tables and puts the address for the linked list of tables inta a DCB (data control block) the address of which is known by the SEP hardware Note that all bus addresses that are passed to the SEP are in 32 bit format; the SEP is a 32 bit device

Definition at line 2626 of file sep_main.c.

struct sep_queue_info* sep_queue_status_add ( struct sep_device sep,
u32  opcode,
u32  size,
u32  pid,
u8 name,
size_t  name_len 
)
read

Definition at line 149 of file sep_main.c.

void sep_queue_status_remove ( struct sep_device sep,
struct sep_queue_info **  queue_elem 
)

sep_queue_status_remove - Removes transaction from status queue : SEP device : pointer to status queue

This function will remove information about transaction from the queue.

Definition at line 110 of file sep_main.c.

int sep_send_command_handler ( struct sep_device sep)

sep_send_command_handler - kick off a command : SEP being signalled

This function raises interrupt to SEP that signals that is has a new command from the host

Note that this function does fall under the ioctl lock

Definition at line 895 of file sep_main.c.

int sep_wait_transaction ( struct sep_device sep)

sep_wait_transaction - Used for synchronizing transactions : SEP device

Definition at line 247 of file sep_main.c.

Variable Documentation

struct sep_device* sep_dev

Currently, there is only one SEP device per platform; In event platforms in the future have more than one SEP device, this will be a linked list

Definition at line 101 of file sep_main.c.