45
45
*
46
46
* Input Parameters:
47
47
* epc - The EPC device
48
- * phys_addr - Physical address alloced to be matched
48
+ * phys_addr - Virtual address alloced to be matched
49
49
*
50
50
* Returned Value:
51
51
* Memory window alloced if success, NULL if failed
@@ -119,6 +119,7 @@ int pci_epc_mem_multi_init(FAR struct pci_epc_ctrl_s *epc,
119
119
goto err ;
120
120
}
121
121
122
+ epc -> mem [i ].virt_base = windows [i ].virt_base ;
122
123
epc -> mem [i ].phys_base = windows [i ].phys_base ;
123
124
epc -> mem [i ].size = windows [i ].size ;
124
125
epc -> mem [i ].page_size = windows [i ].page_size ;
@@ -152,20 +153,22 @@ int pci_epc_mem_multi_init(FAR struct pci_epc_ctrl_s *epc,
152
153
*
153
154
* Input Parameters:
154
155
* epc - PCI EPC device
155
- * base - The physical base address of the PCI address window
156
+ * virt - The virtual base address of the PCI address window
157
+ * phys - The phys base address of the PCI address window
156
158
* size - The PCI window size
157
159
* page_size - Size of each window page
158
160
*
159
161
* Returned Value:
160
162
* 0 if success, negative if failed
161
163
****************************************************************************/
162
164
163
- int pci_epc_mem_init (FAR struct pci_epc_ctrl_s * epc , uintptr_t base ,
164
- size_t size , size_t page_size )
165
+ int pci_epc_mem_init (FAR struct pci_epc_ctrl_s * epc , FAR void * virt ,
166
+ uintptr_t phys , size_t size , size_t page_size )
165
167
{
166
168
struct pci_epc_mem_window_s window ;
167
169
168
- window .phys_base = base ;
170
+ window .virt_base = virt ;
171
+ window .phys_base = phys ;
169
172
window .size = size ;
170
173
window .page_size = page_size ;
171
174
@@ -218,14 +221,16 @@ void pci_epc_mem_exit(FAR struct pci_epc_ctrl_s *epc)
218
221
* is usually done to map the remote RC address into the local system.
219
222
*
220
223
* Input Parameters:
221
- * epc - The EPC device on which memory has to be allocated
222
- * size - The size of the address space that has to be allocated
224
+ * epc - The EPC device on which memory has to be allocated
225
+ * phys - The virtual addr
226
+ * size - The size of the address space that has to be allocated
223
227
*
224
228
* Returned Value:
225
- * The memory address alloced if success, 0 if failed
229
+ * The memory address alloced if success, NULL if failed
226
230
****************************************************************************/
227
231
228
- uintptr_t pci_epc_mem_alloc_addr (FAR struct pci_epc_ctrl_s * epc , size_t size )
232
+ FAR void * pci_epc_mem_alloc_addr (FAR struct pci_epc_ctrl_s * epc ,
233
+ FAR uintptr_t * phys , size_t size )
229
234
{
230
235
unsigned int i ;
231
236
@@ -241,11 +246,12 @@ uintptr_t pci_epc_mem_alloc_addr(FAR struct pci_epc_ctrl_s *epc, size_t size)
241
246
242
247
if (pageno != mem -> pages )
243
248
{
244
- return mem -> phys_base + pageno * mem -> page_size ;
249
+ * phys = mem -> phys_base + pageno * mem -> page_size ;
250
+ return mem -> virt_base + pageno * mem -> page_size ;
245
251
}
246
252
}
247
253
248
- return 0 ;
254
+ return NULL ;
249
255
}
250
256
251
257
/****************************************************************************
@@ -258,7 +264,7 @@ uintptr_t pci_epc_mem_alloc_addr(FAR struct pci_epc_ctrl_s *epc, size_t size)
258
264
*
259
265
* Input Parameters:
260
266
* epc - The EPC device on which memory was allocated
261
- * phys_addr - The allocated physical address
267
+ * phys_addr - The allocated virtual address
262
268
* size - The size of the allocated address space
263
269
*
264
270
* Returned Value:
0 commit comments