Linux-pcie ranges介绍

参考链接:https://elinux.org/Device_Tree_Usage#PCI_Host_Bridge

pcie bar高低端BAR起始地址介绍

pcie设备树节点

复制代码
/ {
	compatible = "rockchip,rk3588";

	interrupt-parent = <&gic>;
	#address-cells = <2>;
	#size-cells = <2>;
	
	pcie3x4: pcie@fe150000 {
		compatible = "rockchip,rk3588-pcie", "snps,dw-pcie";
		#address-cells = <3>;
		#size-cells = <2>;
		bus-range = <0x00 0x0f>;
		clocks = <&cru ACLK_PCIE_4L_MSTR>, <&cru ACLK_PCIE_4L_SLV>,
			 <&cru ACLK_PCIE_4L_DBI>, <&cru PCLK_PCIE_4L>,
			 <&cru CLK_PCIE_AUX0>, <&cru CLK_PCIE4L_PIPE>;
		clock-names = "aclk_mst", "aclk_slv",
				  "aclk_dbi", "pclk",
				  "aux", "pipe";
		device_type = "pci";
		interrupts = <GIC_SPI 263 IRQ_TYPE_LEVEL_HIGH>,
				 <GIC_SPI 262 IRQ_TYPE_LEVEL_HIGH>,
				 <GIC_SPI 261 IRQ_TYPE_LEVEL_HIGH>,
				 <GIC_SPI 260 IRQ_TYPE_LEVEL_HIGH>,
				 <GIC_SPI 259 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "sys", "pmc", "msg", "legacy", "err";
		#interrupt-cells = <1>;
		interrupt-map-mask = <0 0 0 7>;
		interrupt-map = <0 0 0 1 &pcie3x4_intc 0>,
				<0 0 0 2 &pcie3x4_intc 1>,
				<0 0 0 3 &pcie3x4_intc 2>,
				<0 0 0 4 &pcie3x4_intc 3>;
		linux,pci-domain = <0>;
		num-ib-windows = <16>;
		num-ob-windows = <16>;
		num-viewport = <8>;
		max-link-speed = <3>;
		msi-map = <0x0000 &its1 0x0000 0x1000>;
		num-lanes = <4>;
		phys = <&pcie30phy>;
		phy-names = "pcie-phy";
		power-domains = <&power RK3588_PD_PCIE>;
		ranges = <0x00000800 0x0 0xf0000000 0x0 0xf0000000 0x0 0x100000
			  0x81000000 0x0 0xf0100000 0x0 0xf0100000 0x0 0x100000
			  0x82000000 0x0 0xf0200000 0x0 0xf0200000 0x0 0xe00000
			  0xc3000000 0x9 0x00000000 0x9 0x00000000 0x0 0x40000000>;
		reg = <0x0 0xfe150000 0x0 0x10000>,
			  <0xa 0x40000000 0x0 0x400000>;
		reg-names = "pcie-apb", "pcie-dbi";
		resets = <&cru SRST_PCIE0_POWER_UP>, <&cru SRST_P_PCIE0>;
		reset-names = "pcie", "periph";
		rockchip,pipe-grf = <&php_grf>;
		status = "disabled";

		pcie3x4_intc: legacy-interrupt-controller {
			interrupt-controller;
			#address-cells = <0>;
			#interrupt-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 260 IRQ_TYPE_EDGE_RISING>;
		};
	};
};

ranges = <子节点#address-cells 父节点#address-cells 子节点#size-cells>;
ranges = <3个字长(32位) 2个字长(32位) 2个字长(32位)>;
ranges = <0x00000800 0x0 0xf0000000 0x0 0xf0000000 0x0 0x100000 //表示外设配置空间,将PCIE地址0xf0000000大小1MB映射到CPU地址0xf0000000上。
	  0x81000000 0x0 0xf0100000 0x0 0xf0100000 0x0 0x100000	//表示I/O空间,将PCIE地址0xf0100000大小1MB映射到CPU地址0xf0100000上。
	  0x82000000 0x0 0xf0200000 0x0 0xf0200000 0x0 0xe00000	//表示32位内存空间,将PCIE地址0xf0200000大小14MB映射到CPU地址0xf0200000上。
	  0xc3000000 0x9 0x00000000 0x9 0x00000000 0x0 0x40000000>;	//表示64位内存空间,将PCIE地址0x900000000大小1GB映射到CPU地址0x900000000上。

保留内存

复制代码
reserved-memory {
	#address-cells = <2>;
	#size-cells = <2>;
	ranges;
	dma_trans: dma-trans@3c000000 {
		reg = <0x0 0x3c000000 0x0 0x04000000>;
	};

	/* Reserve 256MB memory for hdmirx-controller@fdee0000 */
	cma {
		compatible = "shared-dma-pool";
		reusable;
		reg = <0x0 (256 * 0x100000) 0x0 (256 * 0x100000)>;
		linux,cma-default;
	};
	pcie3x4_range: pcie3x4-range@30000000 {
		reg = <0x0 0xdfe00000 0x0 0x10200000>; //定义一个名为 pcie3x4_range 的 PCIe 设备,其内存映射从地址 0xdfe00000 开始,大小为 0x10200000 字节,映射到目标地址区域 0x30000000。
	};
};
相关推荐
##echo33 分钟前
嵌入式Linux裸机开发笔记9(IMX6ULL)GPIO 中断实验(1)
linux·c语言·笔记·单片机·嵌入式硬件
Reggie_L40 分钟前
RabbiteMQ安装-ubuntu
linux·ubuntu·ruby
AIGC_北苏1 小时前
让UV管理一切!!!
linux·人工智能·uv
YCY^v^3 小时前
centos 7 开启80,443端口,怎么弄?
linux·运维·centos
北南京海3 小时前
[Linux]进程地址空间
linux·运维·服务器
db_murphy5 小时前
Oracle数据块8KB、OS默认认块管理4KB,是否需调整大小为一致?
linux
mCell8 小时前
从删库到跑路?这50个Linux命令能保你职业生涯
linux·windows·macos
杰克逊的日记8 小时前
GPU运维常见问题处理
linux·运维·gpu
誰能久伴不乏9 小时前
Linux系统调用概述与实现:深入浅出的解析
linux·运维·服务器
程序员学习随笔10 小时前
Linux进程深度解析(2):fork/exec写时拷贝性能优化与exit资源回收机制(进程创建和销毁)
linux·运维·服务器