Staging: sep: indent pass

Ok time to indent and get the code in vague shape. No other changes in this
patch.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Alan Cox 2009-08-06 20:45:57 +01:00 committed by Greg Kroah-Hartman
parent 46eb5a13b7
commit d19cf32fdd
6 changed files with 1987 additions and 2612 deletions

View file

@ -66,15 +66,15 @@ struct sep_device {
/* counter for the messages from sep */
unsigned long sep_to_host_reply_counter;
/* counter for the number of bytes allocated in the pool for the current
transaction */
transaction */
unsigned long data_pool_bytes_allocated;
/* array of pointers to the pages that represent input data for the synchronic
DMA action */
DMA action */
struct page **in_page_array;
/* array of pointers to the pages that represent out data for the synchronic
DMA action */
DMA action */
struct page **out_page_array;
/* number of pages in the sep_in_page_array */
@ -121,9 +121,8 @@ static inline void sep_wait_sram_write(struct sep_device *dev)
u32 reg_val;
do
reg_val = sep_read_reg(dev, HW_SRAM_DATA_READY_REG_ADDR);
while(!(reg_val & 1));
while (!(reg_val & 1));
}
#endif

View file

@ -106,11 +106,11 @@
init command struct
*/
struct sep_driver_init_t {
/* start of the 1G of the host memory address that SEP can access */
unsigned long message_addr;
/* start of the 1G of the host memory address that SEP can access */
unsigned long message_addr;
/* start address of resident */
unsigned long message_size_in_words;
/* start address of resident */
unsigned long message_size_in_words;
};
@ -119,168 +119,168 @@ struct sep_driver_init_t {
realloc cache resident command
*/
struct sep_driver_realloc_cache_resident_t {
/* base address */
unsigned long base_addr;
/* base address */
unsigned long base_addr;
/* current cache address */
unsigned long cache_addr;
/* current cache address */
unsigned long cache_addr;
/* cache size in bytes*/
unsigned long cache_size_in_bytes;
/* cache size in bytes */
unsigned long cache_size_in_bytes;
/* current resident address */
unsigned long resident_addr;
/* current resident address */
unsigned long resident_addr;
/* resident size in bytes*/
unsigned long resident_size_in_bytes;
/* resident size in bytes */
unsigned long resident_size_in_bytes;
/* new cache address */
unsigned long new_cache_addr;
/* new cache address */
unsigned long new_cache_addr;
/* new resident address */
unsigned long new_resident_addr;
/* new resident address */
unsigned long new_resident_addr;
/* new resident address */
unsigned long new_shared_area_addr;
/* new resident address */
unsigned long new_shared_area_addr;
/* new base address */
unsigned long new_base_addr;
/* new base address */
unsigned long new_base_addr;
};
/*
set api mode command struct
*/
struct sep_driver_set_api_mode_t {
/* mode to set - 1 - blocking, 0 - non-blocking */
unsigned long mode;
/* mode to set - 1 - blocking, 0 - non-blocking */
unsigned long mode;
};
struct sep_driver_alloc_t {
/* virtual address of allocated space */
unsigned long offset;
/* virtual address of allocated space */
unsigned long offset;
/* physical address of allocated space */
unsigned long phys_address;
/* physical address of allocated space */
unsigned long phys_address;
/* number of bytes to allocate */
unsigned long num_bytes;
/* number of bytes to allocate */
unsigned long num_bytes;
};
/*
*/
struct sep_driver_write_t {
/* application space address */
unsigned long app_address;
/* application space address */
unsigned long app_address;
/* address of the data pool */
unsigned long datapool_address;
/* address of the data pool */
unsigned long datapool_address;
/* number of bytes to write */
unsigned long num_bytes;
/* number of bytes to write */
unsigned long num_bytes;
};
/*
*/
struct sep_driver_read_t {
/* application space address */
unsigned long app_address;
/* application space address */
unsigned long app_address;
/* address of the data pool */
unsigned long datapool_address;
/* address of the data pool */
unsigned long datapool_address;
/* number of bytes to read */
unsigned long num_bytes;
/* number of bytes to read */
unsigned long num_bytes;
};
/*
*/
struct sep_driver_build_sync_table_t {
/* address value of the data in */
unsigned long app_in_address;
/* address value of the data in */
unsigned long app_in_address;
/* size of data in */
unsigned long data_in_size;
/* size of data in */
unsigned long data_in_size;
/* address of the data out */
unsigned long app_out_address;
/* address of the data out */
unsigned long app_out_address;
/* the size of the block of the operation - if needed,
every table will be modulo this parameter */
unsigned long block_size;
/* the size of the block of the operation - if needed,
every table will be modulo this parameter */
unsigned long block_size;
/* the physical address of the first input DMA table */
unsigned long in_table_address;
/* the physical address of the first input DMA table */
unsigned long in_table_address;
/* number of entries in the first input DMA table */
unsigned long in_table_num_entries;
/* number of entries in the first input DMA table */
unsigned long in_table_num_entries;
/* the physical address of the first output DMA table */
unsigned long out_table_address;
/* the physical address of the first output DMA table */
unsigned long out_table_address;
/* number of entries in the first output DMA table */
unsigned long out_table_num_entries;
/* number of entries in the first output DMA table */
unsigned long out_table_num_entries;
/* data in the first input table */
unsigned long table_data_size;
/* data in the first input table */
unsigned long table_data_size;
/* distinct user/kernel layout */
bool isKernelVirtualAddress;
/* distinct user/kernel layout */
bool isKernelVirtualAddress;
};
/*
*/
struct sep_driver_build_flow_table_t {
/* flow type */
unsigned long flow_type;
/* flow type */
unsigned long flow_type;
/* flag for input output */
unsigned long input_output_flag;
/* flag for input output */
unsigned long input_output_flag;
/* address value of the data in */
unsigned long virt_buff_data_addr;
/* address value of the data in */
unsigned long virt_buff_data_addr;
/* size of data in */
unsigned long num_virtual_buffers;
/* size of data in */
unsigned long num_virtual_buffers;
/* the physical address of the first input DMA table */
unsigned long first_table_addr;
/* the physical address of the first input DMA table */
unsigned long first_table_addr;
/* number of entries in the first input DMA table */
unsigned long first_table_num_entries;
/* number of entries in the first input DMA table */
unsigned long first_table_num_entries;
/* data in the first input table */
unsigned long first_table_data_size;
/* data in the first input table */
unsigned long first_table_data_size;
/* distinct user/kernel layout */
bool isKernelVirtualAddress;
/* distinct user/kernel layout */
bool isKernelVirtualAddress;
};
struct sep_driver_add_flow_table_t {
/* flow id */
unsigned long flow_id;
/* flow id */
unsigned long flow_id;
/* flag for input output */
unsigned long inputOutputFlag;
/* flag for input output */
unsigned long inputOutputFlag;
/* address value of the data in */
unsigned long virt_buff_data_addr;
/* address value of the data in */
unsigned long virt_buff_data_addr;
/* size of data in */
unsigned long num_virtual_buffers;
/* size of data in */
unsigned long num_virtual_buffers;
/* address of the first table */
unsigned long first_table_addr;
/* address of the first table */
unsigned long first_table_addr;
/* number of entries in the first table */
unsigned long first_table_num_entries;
/* number of entries in the first table */
unsigned long first_table_num_entries;
/* data size of the first table */
unsigned long first_table_data_size;
/* data size of the first table */
unsigned long first_table_data_size;
/* distinct user/kernel layout */
bool isKernelVirtualAddress;
/* distinct user/kernel layout */
bool isKernelVirtualAddress;
};
@ -288,49 +288,49 @@ struct sep_driver_add_flow_table_t {
command struct for set flow id
*/
struct sep_driver_set_flow_id_t {
/* flow id to set */
unsigned long flow_id;
/* flow id to set */
unsigned long flow_id;
};
/* command struct for add tables message */
struct sep_driver_add_message_t {
/* flow id to set */
unsigned long flow_id;
/* flow id to set */
unsigned long flow_id;
/* message size in bytes */
unsigned long message_size_in_bytes;
/* message size in bytes */
unsigned long message_size_in_bytes;
/* address of the message */
unsigned long message_address;
/* address of the message */
unsigned long message_address;
};
/* command struct for static pool addresses */
struct sep_driver_static_pool_addr_t {
/* physical address of the static pool */
unsigned long physical_static_address;
/* physical address of the static pool */
unsigned long physical_static_address;
/* virtual address of the static pool */
unsigned long virtual_static_address;
/* virtual address of the static pool */
unsigned long virtual_static_address;
};
/* command struct for getiing offset of the physical address from
the start of the mapped area */
struct sep_driver_get_mapped_offset_t {
/* physical address of the static pool */
unsigned long physical_address;
/* physical address of the static pool */
unsigned long physical_address;
/* virtual address of the static pool */
unsigned long offset;
/* virtual address of the static pool */
unsigned long offset;
};
/* command struct for getting time value and address */
struct sep_driver_get_time_t {
/* physical address of stored time */
unsigned long time_physical_address;
/* physical address of stored time */
unsigned long time_physical_address;
/* value of the stored time */
unsigned long time_value;
/* value of the stored time */
unsigned long time_value;
};
@ -338,34 +338,34 @@ struct sep_driver_get_time_t {
structure that represent one entry in the DMA LLI table
*/
struct sep_lli_entry_t {
/* physical address */
unsigned long physical_address;
/* physical address */
unsigned long physical_address;
/* block size */
unsigned long block_size;
/* block size */
unsigned long block_size;
};
/*
structure that reperesents data needed for lli table construction
*/
struct sep_lli_prepare_table_data_t {
/* pointer to the memory where the first lli entry to be built */
struct sep_lli_entry_t *lli_entry_ptr;
/* pointer to the memory where the first lli entry to be built */
struct sep_lli_entry_t *lli_entry_ptr;
/* pointer to the array of lli entries from which the table is to be built */
struct sep_lli_entry_t *lli_array_ptr;
/* pointer to the array of lli entries from which the table is to be built */
struct sep_lli_entry_t *lli_array_ptr;
/* number of elements in lli array */
int lli_array_size;
/* number of elements in lli array */
int lli_array_size;
/* number of entries in the created table */
int num_table_entries;
/* number of entries in the created table */
int num_table_entries;
/* number of array entries processed during table creation */
int num_array_entries_processed;
/* number of array entries processed during table creation */
int num_array_entries_processed;
/* the totatl data size in the created table */
int lli_table_total_data_size;
/* the totatl data size in the created table */
int lli_table_total_data_size;
};
/*
@ -373,19 +373,19 @@ struct sep_lli_prepare_table_data_t {
to show what table looks like
*/
struct sep_lli_table_t {
/* number of pages mapped in this tables. If 0 - means that the table
is not defined (used as a valid flag)*/
unsigned long num_pages;
/*
pointer to array of page pointers that represent the mapping of the
virtual buffer defined by the table to the physical memory. If this
pointer is NULL, it means that the table is not defined
(used as a valid flag)
*/
struct page **table_page_array_ptr;
/* number of pages mapped in this tables. If 0 - means that the table
is not defined (used as a valid flag) */
unsigned long num_pages;
/*
pointer to array of page pointers that represent the mapping of the
virtual buffer defined by the table to the physical memory. If this
pointer is NULL, it means that the table is not defined
(used as a valid flag)
*/
struct page **table_page_array_ptr;
/* maximum flow entries in table */
struct sep_lli_entry_t lli_entries[SEP_DRIVER_MAX_FLOW_NUM_ENTRIES_IN_TABLE];
/* maximum flow entries in table */
struct sep_lli_entry_t lli_entries[SEP_DRIVER_MAX_FLOW_NUM_ENTRIES_IN_TABLE];
};
@ -393,61 +393,61 @@ struct sep_lli_table_t {
structure for keeping the mapping of the virtual buffer into physical pages
*/
struct sep_flow_buffer_data {
/* pointer to the array of page structs pointers to the pages of the
virtual buffer */
struct page **page_array_ptr;
/* pointer to the array of page structs pointers to the pages of the
virtual buffer */
struct page **page_array_ptr;
/* number of pages taken by the virtual buffer */
unsigned long num_pages;
/* number of pages taken by the virtual buffer */
unsigned long num_pages;
/* this flag signals if this page_array is the last one among many that were
sent in one setting to SEP */
unsigned long last_page_array_flag;
/* this flag signals if this page_array is the last one among many that were
sent in one setting to SEP */
unsigned long last_page_array_flag;
};
/*
struct that keeps all the data for one flow
*/
struct sep_flow_context_t {
/*
work struct for handling the flow done interrupt in the workqueue
this structure must be in the first place, since it will be used
forcasting to the containing flow context
*/
struct work_struct flow_wq;
/*
work struct for handling the flow done interrupt in the workqueue
this structure must be in the first place, since it will be used
forcasting to the containing flow context
*/
struct work_struct flow_wq;
/* flow id */
unsigned long flow_id;
/* flow id */
unsigned long flow_id;
/* additional input tables exists */
unsigned long input_tables_flag;
/* additional input tables exists */
unsigned long input_tables_flag;
/* additional output tables exists */
unsigned long output_tables_flag;
/* additional output tables exists */
unsigned long output_tables_flag;
/* data of the first input file */
struct sep_lli_entry_t first_input_table;
/* data of the first input file */
struct sep_lli_entry_t first_input_table;
/* data of the first output table */
struct sep_lli_entry_t first_output_table;
/* data of the first output table */
struct sep_lli_entry_t first_output_table;
/* last input table data */
struct sep_lli_entry_t last_input_table;
/* last input table data */
struct sep_lli_entry_t last_input_table;
/* last output table data */
struct sep_lli_entry_t last_output_table;
/* last output table data */
struct sep_lli_entry_t last_output_table;
/* first list of table */
struct sep_lli_entry_t input_tables_in_process;
/* first list of table */
struct sep_lli_entry_t input_tables_in_process;
/* output table in process (in sep) */
struct sep_lli_entry_t output_tables_in_process;
/* output table in process (in sep) */
struct sep_lli_entry_t output_tables_in_process;
/* size of messages in bytes */
unsigned long message_size_in_bytes;
/* size of messages in bytes */
unsigned long message_size_in_bytes;
/* message */
unsigned char message[SEP_MAX_ADD_MESSAGE_LENGTH_IN_BYTES];
/* message */
unsigned char message[SEP_MAX_ADD_MESSAGE_LENGTH_IN_BYTES];
};
@ -478,54 +478,35 @@ void sep_send_msg_rdy_cmd(void);
This function releases all the application virtual
buffer physical pages, that were previously locked
*/
int sep_free_dma_pages(struct page **page_array_ptr,
unsigned long num_pages,
unsigned long dirtyFlag);
int sep_free_dma_pages(struct page **page_array_ptr, unsigned long num_pages, unsigned long dirtyFlag);
/*
This function creates the input and output dma tables for
symmetric operations (AES/DES) according to the block size
from LLI arays
*/
int sep_construct_dma_tables_from_lli(
struct sep_lli_entry_t *lli_in_array,
unsigned long sep_in_lli_entries,
struct sep_lli_entry_t *lli_out_array,
unsigned long sep_out_lli_entries,
unsigned long block_size,
unsigned long *lli_table_in_ptr,
unsigned long *lli_table_out_ptr,
unsigned long *in_num_entries_ptr,
unsigned long *out_num_entries_ptr,
unsigned long *table_data_size_ptr);
int sep_construct_dma_tables_from_lli(struct sep_lli_entry_t *lli_in_array,
unsigned long sep_in_lli_entries,
struct sep_lli_entry_t *lli_out_array,
unsigned long sep_out_lli_entries,
unsigned long block_size, unsigned long *lli_table_in_ptr, unsigned long *lli_table_out_ptr, unsigned long *in_num_entries_ptr, unsigned long *out_num_entries_ptr, unsigned long *table_data_size_ptr);
/*
This function builds input and output DMA tables for synhronic symmetric
operations (AES, DES) It also checks that each table is of the modular
block size
*/
int sep_prepare_input_output_dma_table(unsigned long app_virt_in_addr,
unsigned long app_virt_out_addr,
unsigned long data_size,
unsigned long block_size,
unsigned long *lli_table_in_ptr,
unsigned long *lli_table_out_ptr,
unsigned long *in_num_entries_ptr,
unsigned long *out_num_entries_ptr,
unsigned long *table_data_size_ptr,
bool isKernelVirtualAddress);
int sep_prepare_input_output_dma_table(unsigned long app_virt_in_addr,
unsigned long app_virt_out_addr,
unsigned long data_size,
unsigned long block_size,
unsigned long *lli_table_in_ptr, unsigned long *lli_table_out_ptr, unsigned long *in_num_entries_ptr, unsigned long *out_num_entries_ptr, unsigned long *table_data_size_ptr, bool isKernelVirtualAddress);
/*
This function prepares only input DMA table for synhronic symmetric
operations (HASH)
*/
int sep_prepare_input_dma_table(unsigned long app_virt_addr,
unsigned long data_size,
unsigned long block_size,
unsigned long *lli_table_ptr,
unsigned long *num_entries_ptr,
unsigned long *table_data_size_ptr,
bool isKernelVirtualAddress);
int sep_prepare_input_dma_table(unsigned long app_virt_addr, unsigned long data_size, unsigned long block_size, unsigned long *lli_table_ptr, unsigned long *num_entries_ptr, unsigned long *table_data_size_ptr, bool isKernelVirtualAddress);
/* this functions frees all the resources that were allocated for the building
of the LLI DMA tables */

View file

@ -51,12 +51,7 @@ This functions copies the cache and resident from their source location into
destination memory, which is external to Linux VM and is given as physical
address
*/
int sep_copy_cache_resident_to_area(unsigned long src_cache_addr,
unsigned long cache_size_in_bytes,
unsigned long src_resident_addr,
unsigned long resident_size_in_bytes,
unsigned long *dst_new_cache_addr_ptr,
unsigned long *dst_new_resident_addr_ptr);
int sep_copy_cache_resident_to_area(unsigned long src_cache_addr, unsigned long cache_size_in_bytes, unsigned long src_resident_addr, unsigned long resident_size_in_bytes, unsigned long *dst_new_cache_addr_ptr, unsigned long *dst_new_resident_addr_ptr);
/*
This functions maps and allocates the shared area on the external
@ -65,9 +60,7 @@ to allocate. The outputs are kernel_shared_area_addr_ptr - the kerenl
address of the mapped and allocated shared area, and
phys_shared_area_addr_ptr - the physical address of the shared area
*/
int sep_map_and_alloc_shared_area(unsigned long shared_area_size,
unsigned long *kernel_shared_area_addr_ptr,
unsigned long *phys_shared_area_addr_ptr);
int sep_map_and_alloc_shared_area(unsigned long shared_area_size, unsigned long *kernel_shared_area_addr_ptr, unsigned long *phys_shared_area_addr_ptr);
/*
This functions unmaps and deallocates the shared area on the external
@ -76,9 +69,7 @@ deallocate,kernel_shared_area_addr_ptr - the kernel address of the
mapped and allocated shared area,phys_shared_area_addr_ptr - the physical
address of the shared area
*/
void sep_unmap_and_free_shared_area(unsigned long shared_area_size,
unsigned long kernel_shared_area_addr,
unsigned long phys_shared_area_addr);
void sep_unmap_and_free_shared_area(unsigned long shared_area_size, unsigned long kernel_shared_area_addr, unsigned long phys_shared_area_addr);
/*

View file

@ -229,4 +229,4 @@
#define HW_CLR_SRAM_BUSY_REG_REG_ADDR 0x0F0CUL
#define HW_CC_SRAM_BASE_ADDRESS 0x5800UL
#endif /* ifndef HW_DEFS */
#endif /* ifndef HW_DEFS */

View file

@ -85,12 +85,12 @@ static unsigned long CRYS_SEP_ROM[] = {
/* 2M size */
#endif /* SEP_DRIVER_ARM_DEBUG_MODE */
#endif /* SEP_DRIVER_ARM_DEBUG_MODE */
#define BASE_ADDRESS_FOR_SYSTEM 0xfffc0000
#define SEP_RAR_IO_MEM_REGION_SIZE 0x40000
irqreturn_t sep_inthandler(int irq , void* dev_id);
irqreturn_t sep_inthandler(int irq, void *dev_id);
/* Keep this a single static object for now to keep the conversion easy */
@ -107,12 +107,11 @@ unsigned long jiffies_future;
/*
function that is activated on the succesfull probe of the SEP device
*/
static int __devinit sep_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct pci_device_id sep_pci_id_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080c) },
{ 0 }
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080c)},
{0}
};
MODULE_DEVICE_TABLE(pci, sep_pci_id_tbl);
@ -141,12 +140,7 @@ void sep_lock_cache_resident_area(void)
destination memory, which is external to Linux VM and is given as
physical address
*/
int sep_copy_cache_resident_to_area(unsigned long src_cache_addr,
unsigned long cache_size_in_bytes,
unsigned long src_resident_addr,
unsigned long resident_size_in_bytes,
unsigned long *dst_new_cache_addr_ptr,
unsigned long *dst_new_resident_addr_ptr)
int sep_copy_cache_resident_to_area(unsigned long src_cache_addr, unsigned long cache_size_in_bytes, unsigned long src_resident_addr, unsigned long resident_size_in_bytes, unsigned long *dst_new_cache_addr_ptr, unsigned long *dst_new_resident_addr_ptr)
{
/* resident address in user space */
unsigned long resident_addr;
@ -157,7 +151,7 @@ int sep_copy_cache_resident_to_area(unsigned long src_cache_addr,
const struct firmware *fw;
char *cache_name = "cache.image.bin";
char *res_name = "resident.image.bin";
char *res_name = "resident.image.bin";
/* error */
int error;
@ -167,14 +161,10 @@ int sep_copy_cache_resident_to_area(unsigned long src_cache_addr,
-------------------------------------*/
error = 0;
edbg(
"SEP Driver:rar_virtual is %p\n",
sep_dev->rar_virtual_address);
edbg(
"SEP Driver:rar_physical is %08lx\n",
sep_dev->rar_physical_address);
edbg("SEP Driver:rar_virtual is %p\n", sep_dev->rar_virtual_address);
edbg("SEP Driver:rar_physical is %08lx\n", sep_dev->rar_physical_address);
sep_dev->rar_region_addr = (unsigned long)sep_dev->rar_virtual_address;
sep_dev->rar_region_addr = (unsigned long) sep_dev->rar_virtual_address;
sep_dev->cache_physical_address = sep_dev->rar_physical_address;
sep_dev->cache_virtual_address = sep_dev->rar_virtual_address;
@ -182,72 +172,50 @@ int sep_copy_cache_resident_to_area(unsigned long src_cache_addr,
/* load cache */
error = request_firmware(&fw, cache_name, &sep_dev->sep_pci_dev_ptr->dev);
if (error) {
edbg(
"SEP Driver:cant request cache fw\n");
edbg("SEP Driver:cant request cache fw\n");
goto end_function;
}
edbg(
"SEP Driver:cache data loc is %p\n",
(void *)fw->data);
edbg(
"SEP Driver:cache data size is %08Zx\n",
fw->size);
edbg("SEP Driver:cache data loc is %p\n", (void *) fw->data);
edbg("SEP Driver:cache data size is %08Zx\n", fw->size);
memcpy((void *)sep_dev->cache_virtual_address, (void *)fw->data, fw->size);
memcpy((void *) sep_dev->cache_virtual_address, (void *) fw->data, fw->size);
sep_dev->cache_size = fw->size;
cache_addr = (unsigned long)sep_dev->cache_virtual_address;
cache_addr = (unsigned long) sep_dev->cache_virtual_address;
release_firmware(fw);
sep_dev->resident_physical_address = sep_dev->cache_physical_address
+ sep_dev->cache_size;
sep_dev->resident_virtual_address = sep_dev->cache_virtual_address
+ sep_dev->cache_size;
sep_dev->resident_physical_address = sep_dev->cache_physical_address + sep_dev->cache_size;
sep_dev->resident_virtual_address = sep_dev->cache_virtual_address + sep_dev->cache_size;
/* load resident */
error = request_firmware(&fw, res_name, &sep_dev->sep_pci_dev_ptr->dev);
if (error) {
edbg(
"SEP Driver:cant request res fw\n");
edbg("SEP Driver:cant request res fw\n");
goto end_function;
}
edbg(
"SEP Driver:res data loc is %p\n",
(void *)fw->data);
edbg(
"SEP Driver:res data size is %08Zx\n",
fw->size);
edbg("SEP Driver:res data loc is %p\n", (void *) fw->data);
edbg("SEP Driver:res data size is %08Zx\n", fw->size);
memcpy((void *)sep_dev->resident_virtual_address, (void *)fw->data, fw->size);
memcpy((void *) sep_dev->resident_virtual_address, (void *) fw->data, fw->size);
sep_dev->resident_size = fw->size;
release_firmware(fw);
resident_addr = (unsigned long)sep_dev->resident_virtual_address;
resident_addr = (unsigned long) sep_dev->resident_virtual_address;
edbg(
"SEP Driver:resident_addr (physical )is %08lx\n",
sep_dev->resident_physical_address);
edbg(
"SEP Driver:cache_addr (physical) is %08lx\n",
sep_dev->cache_physical_address);
edbg("SEP Driver:resident_addr (physical )is %08lx\n", sep_dev->resident_physical_address);
edbg("SEP Driver:cache_addr (physical) is %08lx\n", sep_dev->cache_physical_address);
edbg(
"SEP Driver:resident_addr (logical )is %08lx\n",
resident_addr);
edbg(
"SEP Driver:cache_addr (logical) is %08lx\n",
cache_addr);
edbg("SEP Driver:resident_addr (logical )is %08lx\n", resident_addr);
edbg("SEP Driver:cache_addr (logical) is %08lx\n", cache_addr);
edbg(
"SEP Driver:resident_size is %08lx\n", sep_dev->resident_size);
edbg(
"SEP Driver:cache_size is %08lx\n", sep_dev->cache_size);
edbg("SEP Driver:resident_size is %08lx\n", sep_dev->resident_size);
edbg("SEP Driver:cache_size is %08lx\n", sep_dev->cache_size);
@ -255,7 +223,7 @@ int sep_copy_cache_resident_to_area(unsigned long src_cache_addr,
*dst_new_cache_addr_ptr = sep_dev->cache_physical_address;
*dst_new_resident_addr_ptr = sep_dev->resident_physical_address;
end_function:
end_function:
return error;
}
@ -270,15 +238,12 @@ int sep_copy_cache_resident_to_area(unsigned long src_cache_addr,
shared area, and phys_shared_area_addr_ptr
- the physical address of the shared area
*/
int sep_map_and_alloc_shared_area(unsigned long shared_area_size,
unsigned long *kernel_shared_area_addr_ptr,
unsigned long *phys_shared_area_addr_ptr)
int sep_map_and_alloc_shared_area(unsigned long shared_area_size, unsigned long *kernel_shared_area_addr_ptr, unsigned long *phys_shared_area_addr_ptr)
{
// shared_virtual_address = ioremap_nocache(0xda00000,shared_area_size);
sep_dev->shared_virtual_address = kmalloc(shared_area_size, GFP_KERNEL);
if (!sep_dev->shared_virtual_address) {
edbg(
"sep_driver:shared memory kmalloc failed\n");
edbg("sep_driver:shared memory kmalloc failed\n");
return -1;
}
@ -286,19 +251,13 @@ int sep_map_and_alloc_shared_area(unsigned long shared_area_size,
sep_dev->shared_physical_address = __pa(sep_dev->shared_virtual_address);
// shared_physical_address = 0xda00000;
*kernel_shared_area_addr_ptr = (unsigned long)sep_dev->shared_virtual_address;
*kernel_shared_area_addr_ptr = (unsigned long) sep_dev->shared_virtual_address;
/* set the physical address of the shared area */
*phys_shared_area_addr_ptr = sep_dev->shared_physical_address;
edbg(
"SEP Driver:shared_virtual_address is %p\n",
sep_dev->shared_virtual_address);
edbg(
"SEP Driver:shared_region_size is %08lx\n",
shared_area_size);
edbg(
"SEP Driver:shared_physical_addr is %08lx\n",
*phys_shared_area_addr_ptr);
edbg("SEP Driver:shared_virtual_address is %p\n", sep_dev->shared_virtual_address);
edbg("SEP Driver:shared_region_size is %08lx\n", shared_area_size);
edbg("SEP Driver:shared_physical_addr is %08lx\n", *phys_shared_area_addr_ptr);
return 0;
}
@ -311,11 +270,9 @@ int sep_map_and_alloc_shared_area(unsigned long shared_area_size,
shared area,phys_shared_area_addr_ptr - the physical address of
the shared area
*/
void sep_unmap_and_free_shared_area(unsigned long shared_area_size,
unsigned long kernel_shared_area_addr,
unsigned long phys_shared_area_addr)
void sep_unmap_and_free_shared_area(unsigned long shared_area_size, unsigned long kernel_shared_area_addr, unsigned long phys_shared_area_addr)
{
kfree((void *)kernel_shared_area_addr);
kfree((void *) kernel_shared_area_addr);
return;
}
@ -327,16 +284,10 @@ void sep_unmap_and_free_shared_area(unsigned long shared_area_size,
*/
unsigned long sep_shared_area_virt_to_phys(unsigned long virt_address)
{
edbg(
"SEP Driver:sh virt to phys v %08lx\n",
virt_address);
edbg(
"SEP Driver:sh virt to phys p %08lx\n",
sep_dev->shared_physical_address
+ (virt_address - (unsigned long)sep_dev->shared_virtual_address));
edbg("SEP Driver:sh virt to phys v %08lx\n", virt_address);
edbg("SEP Driver:sh virt to phys p %08lx\n", sep_dev->shared_physical_address + (virt_address - (unsigned long) sep_dev->shared_virtual_address));
return (unsigned long)sep_dev->shared_physical_address +
(virt_address - (unsigned long)sep_dev->shared_virtual_address);
return (unsigned long) sep_dev->shared_physical_address + (virt_address - (unsigned long) sep_dev->shared_virtual_address);
}
/*
@ -347,16 +298,14 @@ unsigned long sep_shared_area_virt_to_phys(unsigned long virt_address)
*/
unsigned long sep_shared_area_phys_to_virt(unsigned long phys_address)
{
return (unsigned long)sep_dev->shared_virtual_address
+ (phys_address - sep_dev->shared_physical_address);
return (unsigned long) sep_dev->shared_virtual_address + (phys_address - sep_dev->shared_physical_address);
}
/*
function that is activaed on the succesfull probe of the SEP device
*/
static int __devinit sep_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
/* error */
int error;
@ -365,15 +314,13 @@ static int __devinit sep_probe(struct pci_dev *pdev,
CODE
---------------------------*/
edbg(
"Sep pci probe starting\n");
edbg("Sep pci probe starting\n");
error = 0;
/* enable the device */
error = pci_enable_device(pdev);
if (error) {
edbg(
"error enabling pci device\n");
edbg("error enabling pci device\n");
goto end_function;
}
@ -383,111 +330,83 @@ static int __devinit sep_probe(struct pci_dev *pdev,
/* get the io memory start address */
sep_dev->io_memory_start_physical_address = pci_resource_start(pdev, 0);
if (!sep_dev->io_memory_start_physical_address) {
edbg(
"SEP Driver error pci resource start\n");
edbg("SEP Driver error pci resource start\n");
goto end_function;
}
/* get the io memory end address */
sep_dev->io_memory_end_physical_address = pci_resource_end(pdev, 0);
if (!sep_dev->io_memory_end_physical_address) {
edbg(
"SEP Driver error pci resource end\n");
edbg("SEP Driver error pci resource end\n");
goto end_function;
}
sep_dev->io_memory_size = sep_dev->io_memory_end_physical_address -
sep_dev->io_memory_start_physical_address + 1;
sep_dev->io_memory_size = sep_dev->io_memory_end_physical_address - sep_dev->io_memory_start_physical_address + 1;
edbg(
"SEP Driver:io_memory_start_physical_address is %08lx\n",
sep_dev->io_memory_start_physical_address);
edbg("SEP Driver:io_memory_start_physical_address is %08lx\n", sep_dev->io_memory_start_physical_address);
edbg(
"SEP Driver:io_memory_end_phyaical_address is %08lx\n",
sep_dev->io_memory_end_physical_address);
edbg("SEP Driver:io_memory_end_phyaical_address is %08lx\n", sep_dev->io_memory_end_physical_address);
edbg(
"SEP Driver:io_memory_size is %08lx\n",
sep_dev->io_memory_size);
edbg("SEP Driver:io_memory_size is %08lx\n", sep_dev->io_memory_size);
sep_dev->io_memory_start_virtual_address =
ioremap_nocache(sep_dev->io_memory_start_physical_address,
sep_dev->io_memory_size);
sep_dev->io_memory_start_virtual_address = ioremap_nocache(sep_dev->io_memory_start_physical_address, sep_dev->io_memory_size);
if (!sep_dev->io_memory_start_virtual_address) {
edbg(
"SEP Driver error ioremap of io memory\n");
edbg("SEP Driver error ioremap of io memory\n");
goto end_function;
}
edbg(
"SEP Driver:io_memory_start_virtual_address is %p\n",
sep_dev->io_memory_start_virtual_address);
edbg("SEP Driver:io_memory_start_virtual_address is %p\n", sep_dev->io_memory_start_virtual_address);
sep_dev->reg_base_address = (void __iomem *)sep_dev->io_memory_start_virtual_address;
sep_dev->reg_base_address = (void __iomem *) sep_dev->io_memory_start_virtual_address;
/* set up system base address and shared memory location */
sep_dev->rar_virtual_address = kmalloc(2 * SEP_RAR_IO_MEM_REGION_SIZE,
GFP_KERNEL);
sep_dev->rar_virtual_address = kmalloc(2 * SEP_RAR_IO_MEM_REGION_SIZE, GFP_KERNEL);
if (!sep_dev->rar_virtual_address) {
edbg(
"SEP Driver:cant kmalloc rar\n");
edbg("SEP Driver:cant kmalloc rar\n");
goto end_function;
}
}
/* FIXME */
sep_dev->rar_physical_address = __pa(sep_dev->rar_virtual_address);
edbg(
"SEP Driver:rar_physical is %08lx\n",
sep_dev->rar_physical_address);
edbg("SEP Driver:rar_physical is %08lx\n", sep_dev->rar_physical_address);
edbg(
"SEP Driver:rar_virtual is %p\n",
sep_dev->rar_virtual_address);
edbg("SEP Driver:rar_virtual is %p\n", sep_dev->rar_virtual_address);
#if !SEP_DRIVER_POLLING_MODE
edbg(
"SEP Driver: about to write IMR and ICR REG_ADDR\n");
edbg("SEP Driver: about to write IMR and ICR REG_ADDR\n");
/* clear ICR register */
sep_write_reg(sep_dev, HW_HOST_ICR_REG_ADDR,
0xFFFFFFFF);
sep_write_reg(sep_dev, HW_HOST_ICR_REG_ADDR, 0xFFFFFFFF);
/* set the IMR register - open only GPR 2 */
sep_write_reg(sep_dev, HW_HOST_IMR_REG_ADDR,
(~(0x1 << 13)));
sep_write_reg(sep_dev, HW_HOST_IMR_REG_ADDR, (~(0x1 << 13)));
/* figure out our irq */
/* FIXME: */
error = pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, (u8 *)&sep_dev->sep_irq);
error = pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, (u8 *) & sep_dev->sep_irq);
edbg(
"SEP Driver: my irq is %d\n", sep_irq);
edbg("SEP Driver: my irq is %d\n", sep_irq);
edbg(
"SEP Driver: about to call request_irq\n");
edbg("SEP Driver: about to call request_irq\n");
/* get the interrupt line */
error = request_irq(sep_irq, sep_inthandler, IRQF_SHARED,
"sep_driver", &sep_dev->reg_base_address);
error = request_irq(sep_irq, sep_inthandler, IRQF_SHARED, "sep_driver", &sep_dev->reg_base_address);
if (error)
goto end_function;
goto end_function;
edbg(
"SEP Driver: about to write IMR REG_ADDR");
edbg("SEP Driver: about to write IMR REG_ADDR");
/* set the IMR register - open only GPR 2 */
sep_write_reg(sep_dev, HW_HOST_IMR_REG_ADDR,
(~(0x1 << 13)));
sep_write_reg(sep_dev, HW_HOST_IMR_REG_ADDR, (~(0x1 << 13)));
#endif /* SEP_DRIVER_POLLING_MODE */
#endif /* SEP_DRIVER_POLLING_MODE */
end_function:
end_function:
return error;
}
@ -515,26 +434,18 @@ void sep_load_rom_code(void)
/* Loading ROM from SEP_ROM_image.h file */
k = sizeof(CRYS_SEP_ROM);
edbg(
"SEP Driver: DX_CC_TST_SepRomLoader start\n");
edbg("SEP Driver: DX_CC_TST_SepRomLoader start\n");
edbg(
"SEP Driver: k is %lu\n", k);
edbg(
"SEP Driver: sep_dev->reg_base_address is %p\n",
sep_dev->reg_base_address);
edbg(
"SEP Driver: CRYS_SEP_ROM_start_address_offset is %p\n",
CRYS_SEP_ROM_start_address_offset);
edbg("SEP Driver: k is %lu\n", k);
edbg("SEP Driver: sep_dev->reg_base_address is %p\n", sep_dev->reg_base_address);
edbg("SEP Driver: CRYS_SEP_ROM_start_address_offset is %p\n", CRYS_SEP_ROM_start_address_offset);
for (i = 0; i < 4; i++) {
/* write bank */
sep_write_reg(sep_dev, SEP_ROM_BANK_register_offset, i);
for (j = 0; j < CRYS_SEP_ROM_length / 4; j++) {
sep_write_reg(sep_dev,
CRYS_SEP_ROM_start_address_offset + 4*j,
CRYS_SEP_ROM[i * 0x1000 + j]);
sep_write_reg(sep_dev, CRYS_SEP_ROM_start_address_offset + 4 * j, CRYS_SEP_ROM[i * 0x1000 + j]);
k = k - 4;
@ -545,7 +456,7 @@ void sep_load_rom_code(void)
}
}
/* reset the SEP*/
/* reset the SEP */
sep_write_reg(sep_dev, HW_HOST_SEP_SW_RST_REG_ADDR, 0x1);
/* poll for SEP ROM boot finish */
@ -553,49 +464,41 @@ void sep_load_rom_code(void)
retVal = sep_read_reg(sep_dev, HW_HOST_SEP_HOST_GPR3_REG_ADDR);
} while (!regVal);
edbg(
"SEP Driver: ROM polling ended\n");
edbg("SEP Driver: ROM polling ended\n");
switch (regVal) {
case 0x1:
/* fatal error - read erro status from GPRO */
Error = sep_read_reg(sep_dev, HW_HOST_SEP_HOST_GPR0_REG_ADDR);
edbg(
"SEP Driver: ROM polling case 1\n");
edbg("SEP Driver: ROM polling case 1\n");
break;
case 0x2:
/* Boot First Phase ended */
warning = sep_read_reg(sep_dev, HW_HOST_SEP_HOST_GPR0_REG_ADDR);
edbg(
"SEP Driver: ROM polling case 2\n");
edbg("SEP Driver: ROM polling case 2\n");
break;
case 0x4:
/* Cold boot ended successfully */
warning = sep_read_reg(sep_dev, HW_HOST_SEP_HOST_GPR0_REG_ADDR);
edbg(
"SEP Driver: ROM polling case 4\n");
edbg("SEP Driver: ROM polling case 4\n");
Error = 0;
break;
case 0x8:
/* Warmboot ended successfully */
warning = sep_read_reg(sep_dev, HW_HOST_SEP_HOST_GPR0_REG_ADDR);
edbg(
"SEP Driver: ROM polling case 8\n");
edbg("SEP Driver: ROM polling case 8\n");
Error = 0;
break;
case 0x10:
/* ColdWarm boot ended successfully */
warning = sep_read_reg(sep_dev, HW_HOST_SEP_HOST_GPR0_REG_ADDR);
edbg(
"SEP Driver: ROM polling case 16\n");
edbg("SEP Driver: ROM polling case 16\n");
Error = 0;
break;
case 0x20:
edbg(
"SEP Driver: ROM polling case 32\n");
edbg("SEP Driver: ROM polling case 32\n");
break;
}
#endif
}

File diff suppressed because it is too large Load diff