ENGR00142679 SCC2 and SAHARA: changes to support loadable modules

To allow SCC2 and SAHARA drivers to work as loadable modules, needed
to add GPL license to SAHARA driver, export a couple of functions
from SCC2 driver, and the following data buffer mapping change in
SAHARA driver:

When compiled as a loadable module, a data buffer to be DMA'ed in the
SAHARA driver may not be in the kernel direct-mapped region but in
the "Kernel module space" between TASK_SIZE and high_memory-1
(see http://www.arm.linux.org.uk/developer/memory.txt). In this
scenario, the driver canno simply use the __pa macro to obtain
the physical address. It must walk the page tables to find the
page and use the page_to_phys function to find the physical
address that corresponds to the data buffer.

Signed-off-by: Anish Trivedi <anish@freescale.com>
This commit is contained in:
Anish Trivedi
2011-07-03 15:58:18 -05:00
committed by Matt Sealey
parent cbd383b002
commit fea4e4245d
4 changed files with 19 additions and 6 deletions

View File

@@ -48,6 +48,10 @@
#define interruptible_sleep_on(x) sah_Handle_Interrupt()
#endif
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Freescale Semiconductor");
MODULE_DESCRIPTION("Device Driver for SAHARA2 crypto hw block");
#define TEST_MODE_OFF 1
#define TEST_MODE_ON 2

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
* Copyright (C) 2004-2011 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
@@ -750,6 +750,7 @@ sah_Head_Desc *sah_Copy_Descriptors(fsl_shw_uco_t * user_ctx,
sah_Link *sah_Physicalise_Links(sah_Link * first_link)
{
sah_Link *link = first_link;
struct page *pg;
while (link != NULL) {
#ifdef DO_DBG
@@ -814,8 +815,16 @@ sah_Link *sah_Physicalise_Links(sah_Link * first_link)
if (!(link->flags & SAH_PREPHYS_DATA)) {
link->original_data = link->data;
/* All pointers are virtual right now */
link->data = (void *)os_pa(link->data);
/* if the data buffer is not in kernel direct-
* mapped region, find the physical addr
* via other means.
*/
if (!virt_addr_valid(link->data)) {
pg = vmalloc_to_page(link->data);
link->data = (uint8_t *) (page_to_phys(pg) + (((unsigned int) link->data) & ~PAGE_MASK));
} else {
link->data = (void *) os_pa(link->data);
}
#ifdef DO_DBG
os_printk("%sput: %p (%d)\n",
(link->

View File

@@ -415,7 +415,6 @@ scc_partition_status_t scc_partition_status(void *part_base)
break;
}
}
EXPORT_SYMBOL(scc_partition_status);
/**
* Calculate the physical address from the kernel virtual address.
@@ -428,7 +427,6 @@ uint32_t scc_virt_to_phys(void *address)
return (uint32_t) address - (uint32_t) scm_ram_base
+ (uint32_t) scm_ram_phys_base;
}
EXPORT_SYMBOL(scc_virt_to_phys);
/**
* Engage partition of secure memory

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
* Copyright (C) 2004-2011 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
@@ -507,6 +507,8 @@ EXPORT_SYMBOL(scc_release_partition);
EXPORT_SYMBOL(scc_diminish_permissions);
EXPORT_SYMBOL(scc_encrypt_region);
EXPORT_SYMBOL(scc_decrypt_region);
EXPORT_SYMBOL(scc_partition_status);
EXPORT_SYMBOL(scc_virt_to_phys);
/*EXPORT_SYMBOL(make_vpu_partition);*/