我试图交叉编译JetStream驱动程序,以通过PCIe与ARM(hf)Cortex A CPU(在NVIDIA TK1模块上)桥接FPGA。
github页面提到它已移植到Linux内核版本3.10,恰好也是Linux 4 Tegra(L4T)内核版本。
驱动程序的mmap函数实现显然使用x86特定的内核函数来设置一些缓存属性: set_memory_uc 和 set_memory_wb 。 这是mmap源代码,底部使用了提到的功能:
static int mmap(struct file* file, struct vm_area_struct* vma) {
int ret;
int slot = (uintptr_t)PDE_DATA(__parent(__parent(file->f_path.dentry))->d_inode);
int channel = (uintptr_t)proc_get_parent_data(file->f_inode);
int bufferNo = (uintptr_t)PDE_DATA(file->f_inode);
struct fpga_board* board = &FPCI3.boards[slot];
struct buffer* buffer = &board->channel[channel].buffer[bufferNo];
//printk("DATA Board id %d:%d:%d\n", slot, channel, buffer);
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
//vma->vm_page_prot = 0;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
//return ENOMEM;
set_memory_uc((uintptr_t)buffer->memoryAddress, getPageCount(BUF_SIZE));
ret=dma_mmap_attrs(&board->pcidev->dev, vma, buffer->memoryAddress, buffer->dmaAddress, BUF_SIZE, 0);
set_memory_wb((uintptr_t)buffer->memoryAddress, getPageCount(BUF_SIZE));
return ret;
}
(如何)为我的ARM CPU复制预期的行为?
编辑:这里提到它们是特定于x86的,并且由于缺少它们而无法编译:Link