借助WinDriver认识Windows PCIE设备的空间结构
来源:互联网 发布:程序员技术博客 编辑:程序博客网 时间:2024/06/05 23:51
本文主要通过WinDriver工具图形化的查看PCIe设备,来认识PCIe设备的空间结构。本文主要参考《PCI Express体系结构导读》和网友博客:点击打开链接。
一、PCIe设备空间结构
PCIe设备有三个独立的物理地址空间:设备存储器空间(memory)、IO空间和配置空间(config)。由于PCIe设备支持即插即用,存储器空间和IO空间是在设备插入host后由操作系统决定其映射的基地址。系统加电时,BIOS检测PCI总线,确定所有连接在PCI总线上的设备以及它们配置要求,并进行系统配置。所以,所有PCI设备自身必须实现配置空间,从而能实现参数自动配置,实现真正的即插即用。参考博客:获取PCI设备并初始化。另外,可参考微软PLX9x5x的代码,在驱动中读取PCI设备的配置空间:
// // Parse the resource list and save the resource information. // for (i=0; i < WdfCmResourceListGetCount(ResourcesTranslated); i++) { desc = WdfCmResourceListGetDescriptor( ResourcesTranslated, i ); if(!desc) { TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, "WdfResourceCmGetDescriptor failed"); return STATUS_DEVICE_CONFIGURATION_ERROR; } switch (desc->Type) { case CmResourceTypeMemory: bar = NULL; if (foundSRAM && !foundSRAM2 && desc->u.Memory.Length == 0x400000) { SRAM2BasePA = desc->u.Memory.Start; SRAM2Length = desc->u.Memory.Length; foundSRAM2 = TRUE; bar = "BAR2";KdPrint(("BAR2 found.\n")); } if (foundRegs && !foundSRAM && desc->u.Memory.Length == 0x400000) { SRAMBasePA = desc->u.Memory.Start; SRAMLength = desc->u.Memory.Length; foundSRAM = TRUE; bar = "BAR1";KdPrint(("BAR1 found.\n" )); } if (!foundRegs && desc->u.Memory.Length == 0x1000) { regsBasePA = desc->u.Memory.Start; regsLength = desc->u.Memory.Length; foundRegs = TRUE; bar = "BAR0";KdPrint(("BAR0 found.\n")); } TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, " - Memory Resource [%I64X-%I64X] %s", desc->u.Memory.Start.QuadPart, desc->u.Memory.Start.QuadPart + desc->u.Memory.Length, (bar) ? bar : "<unrecognized>" );KdPrint(("desc->u.Memory.Start is %x, desc->u.Memory.length is %x\n", desc->u.Memory.Start, desc->u.Memory.Length)); break; case CmResourceTypePort: bar = NULL; if (!foundPort && desc->u.Port.Length >= 0x100) { foundPort = TRUE; bar = "Port"; } TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, " - Port Resource [%08I64X-%08I64X] %s", desc->u.Port.Start.QuadPart, desc->u.Port.Start.QuadPart + desc->u.Port.Length, (bar) ? bar : "<unrecognized>" );KdPrint(("CmResourceTypePort is found.\n" )); break; default: // // Ignore all other descriptors // break; } } if (!(foundRegs && foundSRAM)) { TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, "PLxMapResources: Missing resources"); return STATUS_DEVICE_CONFIGURATION_ERROR; }
二、WinDriver截图
1,存储器空间
该设备共映射了6块存储器空间,其中第一块4kB,后面5块大小都是32MB。也可重windows的设备管理器中看到相同的结果。
2,配置空间
1 0
- 借助WinDriver认识Windows PCIE设备的空间结构
- WinDriver&PCIE
- PCIe设备的配置空间
- PCIE 设备扫描的过程
- PCIE 设备扫描的过程
- pcie对设备的枚举
- PCIE 设备扫描的过程
- PCIE 设备扫描的过程
- 在pcie设备中找到pcie的root port
- 如何使用WinDriver为PCIe采集卡装驱动
- 如何使用WinDriver为PCIe采集卡装驱动
- 设备驱动的认识
- PCIe设备,功能,总线
- PCIe设备发现过程
- 大话PCIe:设备枚举
- 一个简单的PCIE驱动到设备的通信协议
- 4.3 PCIe设备的扩展配置空间
- WinDriver
- UDP协议的两个主要方法sendto和recvfrom详解
- iOS 页面间几种传值方式(属性,代理,block,单例,通知)
- matlab 矩阵数值比较总结
- 关于Request.Form的实验
- uboot中语句__asm__ __volatile__("": : :"memory");理解
- 借助WinDriver认识Windows PCIE设备的空间结构
- iOS 网络编程之TCP/IP <二> 框架的二次封装
- POJ 3618
- leetcode.304. Range Sum Query 2D - Immutable
- Codeforces Round #349 (Div. 2) C. Reberland Linguistics 【DP】
- dom4j回车换行符(给群中朋友需要解决的基础写的乱看看就行)
- iOS7.0导航栏设置
- stristr_strrchr.php
- java 资源获取