Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
drv_trio_intf.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Tilera Corporation. All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation, version 2.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11  * NON INFRINGEMENT. See the GNU General Public License for
12  * more details.
13  */
14 
19 #ifndef _SYS_HV_DRV_TRIO_INTF_H
20 #define _SYS_HV_DRV_TRIO_INTF_H
21 
22 #include <arch/trio.h>
23 
25 #define TILERA_VENDOR_ID 0x1a41
26 
28 #define TILERA_GX36_DEV_ID 0x0200
29 
31 #define TILERA_GX36_RC_DEV_ID 0x2000
32 
34 #define TILEGX_NUM_TRIO 2
35 
37 #define TILEGX_TRIO_PCIES 3
38 
41 {
44 
47 
50 
54 
58 
62 
66 
69 
70 };
71 
74 {
77 
80 
83 }
85 
86 
88 #define HV_TRIO_CONFIG_OFFSET \
89  ((unsigned long long)TRIO_MMIO_ADDRESS_SPACE__REGION_VAL_CFG << \
90  TRIO_MMIO_ADDRESS_SPACE__REGION_SHIFT)
91 
93 #define HV_TRIO_CONFIG_SIZE \
94  (1ULL << TRIO_CFG_REGION_ADDR__REGION_SHIFT)
95 
102 #define HV_TRIO_CONFIG_IOREMAP_SIZE \
103  ((uint64_t) 1 << TRIO_CFG_REGION_ADDR__PROT_SHIFT)
104 
106 #define HV_TRIO_SQ_OFFSET(queue) \
107  (((unsigned long long)TRIO_MMIO_ADDRESS_SPACE__REGION_VAL_MAP_SQ << \
108  TRIO_MMIO_ADDRESS_SPACE__REGION_SHIFT) | \
109  ((queue) << TRIO_MAP_SQ_REGION_ADDR__SQ_SEL_SHIFT))
110 
112 #define HV_TRIO_SQ_SIZE \
113  (1ULL << TRIO_MAP_SQ_REGION_ADDR__SQ_SEL_SHIFT)
114 
115 
117 #define HV_TRIO_FIRST_PIO_REGION 8
118 
120 #define HV_TRIO_PIO_OFFSET(region) \
121  (((unsigned long long)(region) + HV_TRIO_FIRST_PIO_REGION) \
122  << TRIO_PIO_REGIONS_ADDR__REGION_SHIFT)
123 
125 #define HV_TRIO_PIO_SIZE (1ULL << TRIO_PIO_REGIONS_ADDR__ADDR_WIDTH)
126 
127 
129 #define HV_TRIO_PUSH_DMA_OFFSET(ring) \
130  (((unsigned long long)TRIO_MMIO_ADDRESS_SPACE__REGION_VAL_PUSH_DMA << \
131  TRIO_MMIO_ADDRESS_SPACE__REGION_SHIFT) | \
132  ((ring) << TRIO_PUSH_DMA_REGION_ADDR__RING_SEL_SHIFT))
133 
135 #define HV_TRIO_PULL_DMA_OFFSET(ring) \
136  (((unsigned long long)TRIO_MMIO_ADDRESS_SPACE__REGION_VAL_PULL_DMA << \
137  TRIO_MMIO_ADDRESS_SPACE__REGION_SHIFT) | \
138  ((ring) << TRIO_PULL_DMA_REGION_ADDR__RING_SEL_SHIFT))
139 
141 #define HV_TRIO_DMA_REGION_SIZE \
142  (1ULL << TRIO_PUSH_DMA_REGION_ADDR__RING_SEL_SHIFT)
143 
144 
146 #define HV_TRIO_MEM_MAP_INTR_OFFSET(map) \
147  (((unsigned long long)TRIO_MMIO_ADDRESS_SPACE__REGION_VAL_MAP_MEM << \
148  TRIO_MMIO_ADDRESS_SPACE__REGION_SHIFT) | \
149  ((map) << TRIO_MAP_MEM_REGION_ADDR__MAP_SEL_SHIFT))
150 
152 #define HV_TRIO_MEM_MAP_INTR_SIZE \
153  (1ULL << TRIO_MAP_MEM_REGION_ADDR__MAP_SEL_SHIFT)
154 
155 
157 #define HV_TRIO_ALLOC_FIXED 0x01
158 
160 #define HV_TRIO_PAGE_SHIFT 12
161 
163 #define HV_TRIO_PAGE_SIZE (1ull << HV_TRIO_PAGE_SHIFT)
164 
165 
166 /* Specify all PCIe port properties for a TRIO. */
168 {
170 };
171 
172 /* Flags indicating traffic class. */
173 #define HV_TRIO_FLAG_TC_SHIFT 4
174 #define HV_TRIO_FLAG_TC_RMASK 0xf
175 #define HV_TRIO_FLAG_TC(N) \
176  ((((N) & HV_TRIO_FLAG_TC_RMASK) + 1) << HV_TRIO_FLAG_TC_SHIFT)
177 
178 /* Flags indicating virtual functions. */
179 #define HV_TRIO_FLAG_VFUNC_SHIFT 8
180 #define HV_TRIO_FLAG_VFUNC_RMASK 0xff
181 #define HV_TRIO_FLAG_VFUNC(N) \
182  ((((N) & HV_TRIO_FLAG_VFUNC_RMASK) + 1) << HV_TRIO_FLAG_VFUNC_SHIFT)
183 
184 
185 /* Flag indicating an ordered PIO region. */
186 #define HV_TRIO_PIO_FLAG_ORDERED (1 << 16)
187 
188 /* Flags indicating special types of PIO regions. */
189 #define HV_TRIO_PIO_FLAG_SPACE_SHIFT 17
190 #define HV_TRIO_PIO_FLAG_SPACE_MASK (0x3 << HV_TRIO_PIO_FLAG_SPACE_SHIFT)
191 #define HV_TRIO_PIO_FLAG_CONFIG_SPACE (0x1 << HV_TRIO_PIO_FLAG_SPACE_SHIFT)
192 #define HV_TRIO_PIO_FLAG_IO_SPACE (0x2 << HV_TRIO_PIO_FLAG_SPACE_SHIFT)
193 
194 
195 #endif /* _SYS_HV_DRV_TRIO_INTF_H */