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。
	};
};
相关推荐
上学的小垃圾2 小时前
基于docker安装MySQL(openEuler系统)
linux·mysql·docker·容器
一直C3 小时前
Linux网络编程|HTTP协议详解(报文、请求方法、状态码)
linux·http·wireshark·vim·visual studio
Brilliantwxx6 小时前
【Linux】 进程(10) 进程控制深度解析:创建、终止与等待
linux·运维·服务器·c语言·开发语言·网络
欧米欧6 小时前
Linux基础指令上
linux·运维·服务器
ARM|X86+FPGA工业主板厂家7 小时前
基于嵌入式 GPU 的智能服务机器人
linux·运维·arm开发·fpga开发·机器人
sulikey8 小时前
Linux 粘滞位(Sticky Bit)完全指南:为什么共享目录需要“防删除“?
linux·服务器
mengge.cloud8 小时前
网络技术基础小白教程
linux·服务器·网络·云计算
学代码的CJY8 小时前
Linux 重定向、管道与环境变量
linux·spring boot·spring
treacle田8 小时前
达梦数据库-Linux DM数据守护主备集群缩改为单机-记录总结
linux·服务器·数据库·主备集群改单机
IT大白鼠9 小时前
CentOS 7.9 自建 Yum 源服务器搭建指南
linux·服务器·centos