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。
	};
};
相关推荐
Android系统攻城狮7 小时前
Linux Gstreamer深度解析之gst_audio_ring_buffer_delay调用流程与实战(七十二)
linux·运维·服务器·gstreamer音视频·音视频进阶
快乐的韭菜根根8 小时前
ubuntu 安装slurm并配置
linux·运维·ubuntu
倒头就睡的小比特9 小时前
Linux基础指令3
linux·服务器
梦帮科技10 小时前
Kali Linux Scapy 畸形报文构造学——深度解剖非法 TCP Flags 与反常序列号
linux·爬虫·神经网络·算法·数学建模·系统架构·模拟退火算法
半杯咖啡半行码11 小时前
Linux 驱动开发入门:内核模块编程基础
linux·服务器·网络
别动我齐刘海11 小时前
Linux 系统调试学习2
linux·运维·c++·人工智能·学习·机器学习·机器人
龙虾电话11 小时前
语音机器人打断不进去:VAD 双阈值迟滞里一个共用的 bool,和它引发的连锁误判
linux
honsor11 小时前
机房IP化改造首选:以太网温湿度传感器,PoE供电+Modbus TCP一网搞定
linux·运维·服务器
默|笙12 小时前
【Linux网络】_udp_socket(认识)
linux·网络·udp
程序员梅雨12 小时前
ZooKeeper面经总结
java·大数据·linux·分布式·后端·zookeeper·中间件