6 * sep_dev.h - Security Processor Device Structures
8 * Copyright(c) 2009 Intel Corporation. All rights reserved.
9 * Copyright(c) 2009 Discretix. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free
13 * Software Foundation; either version 2 of the License, or (at your option)
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21 * You should have received a copy of the GNU General Public License along with
22 * this program; if not, write to the Free Software Foundation, Inc., 59
23 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 * Alan Cox alan@linux.intel.com
32 /* pointer to pci dev */
36 unsigned long io_end_bus;
37 unsigned long io_memory_size;
38 void __iomem *io_addr;
40 /* restricted access region */
44 /* shared memory region */
45 dma_addr_t shared_bus;
48 /* firmware regions */
50 unsigned long cache_size;
53 dma_addr_t resident_bus;
54 unsigned long resident_size;
57 unsigned long rar_region_addr;
59 /* start address of the access to the SEP registers from driver */
60 void __iomem *reg_addr;
61 /* transaction counter that coordinates the transactions between SEP and HOST */
62 unsigned long send_ct;
63 /* counter for the messages from sep */
64 unsigned long reply_ct;
65 /* counter for the number of bytes allocated in the pool for the current
67 unsigned long data_pool_bytes_allocated;
69 /* array of pointers to the pages that represent input data for the synchronic
71 struct page **in_page_array;
73 /* array of pointers to the pages that represent out data for the synchronic
75 struct page **out_page_array;
77 /* number of pages in the sep_in_page_array */
78 unsigned long in_num_pages;
80 /* number of pages in the sep_out_page_array */
81 unsigned long out_num_pages;
83 /* global data for every flow */
84 struct sep_flow_context_t flows[SEP_DRIVER_NUM_FLOWS];
86 /* pointer to the workqueue that handles the flow done interrupts */
87 struct workqueue_struct *flow_wq;
89 /* address of the shared memory allocated during init for SEP driver */
91 /* the physical address of the shared area */
92 dma_addr_t shared_area_bus;
94 /* Message Shared Area start address - will be allocated during init */
95 void *message_shared_area_addr;
98 static struct sep_device *sep_dev;
100 static inline void sep_write_reg(struct sep_device *dev, int reg, u32 value)
102 void __iomem *addr = dev->reg_addr + reg;
106 static inline u32 sep_read_reg(struct sep_device *dev, int reg)
108 void __iomem *addr = dev->reg_addr + reg;
112 /* wait for SRAM write complete(indirect write */
113 static inline void sep_wait_sram_write(struct sep_device *dev)
117 reg_val = sep_read_reg(dev, HW_SRAM_DATA_READY_REG_ADDR);
118 while (!(reg_val & 1));