本文介绍了UART 8250端口结构的mapbase和membase成员是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过阅读驱动程序代码来了解我们板上的pci Express总线上的8250串行端口,而我很难理解struct uart_8250_port

I am trying to understand the 8250 serial port on pci express bus of our board by going through the driver code and I am having hard time understanding the below two members of struct uart_8250_port

struct uart_8250_port x;
memset(&x, 0, sizeof(x));
....
....
x.port.regshift = 0;
x.port.iotype = UPIO_MEM;
x.port.flags = UPF_SHARE_IRQ | UPF_LOW_LATENCY;
x.port.membase = raw_address;
x.port.mapbase = ioremap(raw_address);

成员membasemapbase是什么?另外,为什么membase接受物理pci条地址,而mapbase接受从ioremap返回的地址?

What are the members membase and mapbase? Also, why does membase take physical pci bar address whereas mapbase takes address returned from ioremap ?

推荐答案

mapbase基本上是问题中端口寄存器空间的 bus 地址. membase是内存映射的IO(MMIO)在CPU虚拟地址空间中的相同地址,而iobase是IO的相似地址.

mapbase is basically a bus address of the port register space in the question. membase is the same address in CPU virtual address space for memory mapped IO (MMIO) and iobase is the similar for IO.

是的,您可能已经注意到您的示例中有一个错误,即应该交换membasemapbase.

Yes, you may already notice that in your example you have a mistake, i.e. membase and mapbase should be exchanged.

mapbase地址来执行UART硬件上的DMA操作,例如,因为DMA使用 bus 地址进行操作.

mapbase address is needed to do, for example, DMA operations on top of UART hardware since DMA operates with bus addresses.

这篇关于UART 8250端口结构的mapbase和membase成员是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 18:09