Full support for Ginger Console
[linux-ginger.git] / drivers / staging / sep / sep_dev.h
blob9200524bb64d2cbff10bac8020f70043aa5a7b9a
1 #ifndef __SEP_DEV_H__
2 #define __SEP_DEV_H__
4 /*
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)
14 * any later version.
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
19 * more details.
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.
25 * CONTACTS:
27 * Alan Cox alan@linux.intel.com
31 struct sep_device {
32 /* pointer to pci dev */
33 struct pci_dev *pdev;
35 unsigned long in_use;
37 /* address of the shared memory allocated during init for SEP driver
38 (coherent alloc) */
39 void *shared_addr;
40 /* the physical address of the shared area */
41 dma_addr_t shared_bus;
43 /* restricted access region (coherent alloc) */
44 dma_addr_t rar_bus;
45 void *rar_addr;
46 /* firmware regions: cache is at rar_addr */
47 unsigned long cache_size;
49 /* follows the cache */
50 dma_addr_t resident_bus;
51 unsigned long resident_size;
52 void *resident_addr;
54 /* start address of the access to the SEP registers from driver */
55 void __iomem *reg_addr;
56 /* transaction counter that coordinates the transactions between SEP and HOST */
57 unsigned long send_ct;
58 /* counter for the messages from sep */
59 unsigned long reply_ct;
60 /* counter for the number of bytes allocated in the pool for the current
61 transaction */
62 unsigned long data_pool_bytes_allocated;
64 /* array of pointers to the pages that represent input data for the synchronic
65 DMA action */
66 struct page **in_page_array;
68 /* array of pointers to the pages that represent out data for the synchronic
69 DMA action */
70 struct page **out_page_array;
72 /* number of pages in the sep_in_page_array */
73 unsigned long in_num_pages;
75 /* number of pages in the sep_out_page_array */
76 unsigned long out_num_pages;
78 /* global data for every flow */
79 struct sep_flow_context_t flows[SEP_DRIVER_NUM_FLOWS];
81 /* pointer to the workqueue that handles the flow done interrupts */
82 struct workqueue_struct *flow_wq;
86 static struct sep_device *sep_dev;
88 static inline void sep_write_reg(struct sep_device *dev, int reg, u32 value)
90 void __iomem *addr = dev->reg_addr + reg;
91 writel(value, addr);
94 static inline u32 sep_read_reg(struct sep_device *dev, int reg)
96 void __iomem *addr = dev->reg_addr + reg;
97 return readl(addr);
100 /* wait for SRAM write complete(indirect write */
101 static inline void sep_wait_sram_write(struct sep_device *dev)
103 u32 reg_val;
105 reg_val = sep_read_reg(dev, HW_SRAM_DATA_READY_REG_ADDR);
106 while (!(reg_val & 1));
110 #endif