Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

scc2_driver.c File Reference

Detailed Description

This is the driver code for the Security Controller version 2 (SCC2). It's interaction with the Linux kernel is from calls to scc_init() when the driver is loaded, and scc_cleanup() should the driver be unloaded. The driver uses locking and (task-sleep/task-wakeup) functions from the kernel. It also registers itself to handle the interrupt line(s) from the SCC. New to this version of the driver is an interface providing access to the secure partitions. This is in turn exposed to the API user through the fsl_shw_smalloc() series of functions. Other drivers in the kernel may use the remaining API functions to get at the services of the SCC. The main service provided is the Secure Memory, which allows encoding and decoding of secrets with a per-chip secret key.

The SCC is single-threaded, and so is this module. When the scc_crypt() routine is called, it will lock out other accesses to the function. If another task is already in the module, the subsequent caller will spin on a lock waiting for the other access to finish.

Note that long crypto operations could cause a task to spin for a while, preventing other kernel work (other than interrupt processing) to get done.

The external (kernel module) interface is through the following functions:

All other functions are internal to the driver.

Definition in file scc2_driver.c.

#include "sahara2/include/portable_os.h"
#include "scc2_internals.h"
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/dmapool.h>

Go to the source code of this file.




static scc_return_t check_register_accessible (uint32_t register_offset, uint32_t smn_status, uint32_t scm_status)
static scc_return_t check_register_offset (uint32_t register_offset)
static uint32_t host_owns_partition (uint32_t part_no)
static int is_cipher_done (uint32_t *scm_status)
static int offset_within_scm (uint32_t register_offset)
static int offset_within_smn (uint32_t register_offset)
 OS_DEV_ISR (scc_irq)
static uint32_t partition_engaged (uint32_t part_no)
scc_return_t scc_allocate_partition (uint32_t smid_value, int *part_no, void **part_base, uint32_t *part_phys)
static void scc_cleanup (void)
scc_return_t scc_decrypt_region (uint32_t part_base, uint32_t offset_bytes, uint32_t byte_count, uint8_t *black_data, uint32_t *IV, scc_cypher_mode_t cypher_mode)
scc_return_t scc_diminish_permissions (void *part_base, uint32_t permissions)
static uint32_t scc_do_crypto (int byte_count, uint32_t scm_command)
scc_return_t scc_encrypt_region (uint32_t part_base, uint32_t offset_bytes, uint32_t byte_count, uint8_t *black_data, uint32_t *IV, scc_cypher_mode_t cypher_mode)
scc_return_t scc_engage_partition (void *part_base, const uint8_t *UMID, uint32_t permissions)
scc_config_tscc_get_configuration (void)
static uint32_t scc_grab_config_values (void)
static int scc_init (void)
static void scc_init_ccitt_crc (void)
scc_return_t scc_monitor_security_failure (void callback_func(void))
scc_partition_status_t scc_partition_status (void *part_base)
static void scc_perform_callbacks (void)
scc_return_t scc_read_register (int register_offset, uint32_t *value)
scc_return_t scc_release_partition (void *part_base)
void scc_set_sw_alarm (void)
void scc_stop_monitoring_security_failure (void callback_func(void))
static uint32_t scc_update_state (void)
uint32_t scc_virt_to_phys (void *address)
static scc_return_t scc_wait_completion (uint32_t *scm_status)
scc_return_t scc_write_register (int register_offset, uint32_t value)
scc_return_t scc_zeroize_memories (void)
static int setup_interrupt_handling (void)


static enum scc_status scc_availability = SCC_STATUS_INITIAL
static volatile void * scc_base
static void(* scc_callbacks [SCC_CALLBACK_SIZE])(void)
static os_lock_t scc_callbacks_lock = NULL
static scc_config_t scc_configuration
static uint16_t scc_crc_lookup_table [256]
static os_lock_t scc_crypto_lock = NULL
static int scm_irq_set = 0
uint32_t scm_memory_size_bytes
void * scm_ram_base = NULL
uint32_t scm_ram_phys_base = IRAM_BASE_ADDR
static int smn_irq_set = 0

Generated by  Doxygen 1.6.0   Back to index