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。
	};
};
相关推荐
waving-black3 小时前
Linux中自定义服务开机自启nginx
linux·服务器·nginx
Lenyiin3 小时前
《 Linux 修炼全景指南: 六 》软件包管理器
linux·运维·服务器
NiKo_W3 小时前
Linux 重定向与Cookie
linux·运维·服务器·前端·网络·线程·协议
ytttr8734 小时前
Rocky Linux 8.9配置Kubernetes集群详解,适用于CentOS环境
linux·kubernetes·centos
HLJ洛神千羽4 小时前
Linux下程序设计综合实验报告——图书管理系统(黑龙江大学)
linux·运维·服务器
Arvin6274 小时前
Ubuntu 22.04 Docker 安装指南
linux·ubuntu·docker
Arvin6274 小时前
Jenkins Jobs 备份与恢复
linux·运维·服务器
小旺不正经5 小时前
Linux介绍及常用命令
linux·运维·数据库
icy、泡芙5 小时前
移远 5G RG255AA-CN 调试
linux·单片机·5g
Albert Edison5 小时前
【项目设计】基于正倒排索引的Boost搜索引擎
linux·网络·c++·后端·http·搜索引擎