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。
	};
};
相关推荐
jimy16 小时前
安卓里运行Linux
linux·运维·服务器
爱凤的小光7 小时前
Linux清理磁盘技巧---个人笔记
linux·运维
耗同学一米八7 小时前
2026年河北省职业院校技能大赛中职组“网络建设与运维”赛项答案解析 1.系统安装
linux·服务器·centos
知星小度S8 小时前
系统核心解析:深入文件系统底层机制——Ext系列探秘:从磁盘结构到挂载链接的全链路解析
linux
2401_890443028 小时前
Linux 基础IO
linux·c语言
智慧地球(AI·Earth)9 小时前
在Linux上使用Claude Code 并使用本地VS Code SSH远程访问的完整指南
linux·ssh·ai编程
老王熬夜敲代码10 小时前
解决IP不够用的问题
linux·网络·笔记
zly350010 小时前
linux查看正在运行的nginx的当前工作目录(webroot)
linux·运维·nginx
QT 小鲜肉11 小时前
【Linux命令大全】001.文件管理之file命令(实操篇)
linux·运维·前端·网络·chrome·笔记
问道飞鱼11 小时前
【Linux知识】Linux 虚拟机磁盘扩缩容操作指南(按文件系统分类)
linux·运维·服务器·磁盘扩缩容