`
javasee
  • 浏览: 960966 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Solaris Source Insight: PCI system implementation - Part 2

阅读更多

Thu Oct 29 10:46:29 CST 2009

The bus resource enumerated in pci_setup_tree() are stored in pci_bus_res array.

common/sys/pci_impl.h
82 /* pci bus resource maps */
83 struct pci_bus_resource *pci_bus_res;
... ...
93 struct pci_bus_resource {
94 |_______struct memlist *io_avail;|______/* available free io res */
95 |_______struct memlist *io_used;|_______/* used io res */
96 |_______struct memlist *mem_avail;|_____/* available free mem res */
97 |_______struct memlist *mem_used;|______/* used mem res */
98 |_______struct memlist *pmem_avail; /* available free prefetchable mem res */
99 |_______struct memlist *pmem_used; /* used prefetchable mem res */
100 |_______struct memlist *bus_avail;|_____/* available free bus res */
101 |_______|_______|_______/* bus_space_used not needed; can read from regs */
102 |_______dev_info_t *dip;|_______/* devinfo node */
103 |_______void *privdata;||_______/* private data for configuration */
104 |_______uchar_t par_bus;|_______/* parent bus number */
105 |_______uchar_t sub_bus;|_______/* highest bus number beyond this bridge */
106 |_______uchar_t root_addr;|_____/* legacy peer bus address assignment */
107 |_______uchar_t num_cbb;|_______/* # of CardBus Bridges on the bus */
108 |_______boolean_t io_reprogram;|/* need io reprog on this bus */
109 |_______boolean_t mem_reprogram;|_______/* need mem reprog on this bus */
110 |_______boolean_t subtractive;|_/* subtractive PPB */
111 |_______uint_t mem_size;|_______/* existing children required MEM space size */
112 |_______uint_t io_size;||_______/* existing children required I/O space size */
113 };

1. Create pci root bus in device tree
This logic is in create_root_bus_dip(uchar_t bus). Since we may have multiple IOH's on some platforms, there may be multiple root bus dev_info nodes under rootnex node. If the root bus does indeed have PCI-Ex in the path, the "device-type" property will be set to "pciex" and "compatible" set to "pciex_root_complex". Otherwise, only "device-type" is set to "pci".

To judge if root bus has PCI-Ex in the path, the common way is to check MCFG in ACPI tables. However in current code, it is hard-coded. That means the logic enumerates each devices under the root bus (exclude the sub-bus) and checks if any device has PCI_Ex capability in it's configure space.

2. Enumerate devices on bus 0 (exclude sub-buses)
This logic is implemented in enumerate_bus_devs().

intel/io/pci/pci_boot.c
1471 /*
1472 * For any fixed configuration (often compatability) pci devices
1473 * and those with their own expansion rom, create device nodes
1474 * to hold the already configured device details.
1475 */
1476 void
1477 enumerate_bus_devs(uchar_t bus, int config_op)

It is used in multiple cases. The "bus" parameter is the bus about to enumerate and "config_op" can be set to:

CONFIG_NEW: configure the pci bus (called in pci_reprogram() path)
CONFIG_FIX: fix the pci bus (called in add_pci_fixes() path)
CONFIG_INFO: enumerate the pci bus (called in pci_setup_tree() path)

During enumeration, for each function enumerated, process_devfunc() is called with "config_op" passed.

intel/io/pci/pci_boot.c
1825 static void
1826 process_devfunc(uchar_t bus, uchar_t dev, uchar_t func, uchar_t header,
1827 ushort_t vendorid, int config_op)
1828 {

We are interested at two aspects. i) how the pci hierarchy is organized? Especially how multiple IOH's are supported? ii) which properties are created for each kind of pci device node?

1) How multiple IOH's are support?

1904 |_______/* make sure parent bus dip has been created */
1905 |_______if (pci_bus_res[bus].dip == NULL)
1906 |_______|_______create_root_bus_dip(bus);

So if a bus doesn't start from a pci bridge, it should be a seperated root complex.

2) How the pci hierarchy information are stored during enumeration?

common/sys/pci_impl.h
93 struct pci_bus_resource {
94 |_______struct memlist *io_avail;|______/* available free io res */
95 |_______struct memlist *io_used;|_______/* used io res */
96 |_______struct memlist *mem_avail;|_____/* available free mem res */
97 |_______struct memlist *mem_used;|______/* used mem res */
98 |_______struct memlist *pmem_avail; /* available free prefetchable mem res */
99 |_______struct memlist *pmem_used; /* used prefetchable mem res */
100 |_______struct memlist *bus_avail;|_____/* available free bus res */
101 |_______|_______|_______/* bus_space_used not needed; can read from regs */
102 |_______dev_info_t *dip;|_______/* devinfo node */
103 |_______void *privdata;||_______/* private data for configuration */
104 |_______uchar_t par_bus;|_______/* parent bus number */
105 |_______uchar_t sub_bus;|_______/* highest bus number beyond this bridge */
106 |_______uchar_t root_addr;|_____/* legacy peer bus address assignment */
107 |_______uchar_t num_cbb;|_______/* # of CardBus Bridges on the bus */
108 |_______boolean_t io_reprogram;|/* need io reprog on this bus */
109 |_______boolean_t mem_reprogram;|_______/* need mem reprog on this bus */
110 |_______boolean_t subtractive;|_/* subtractive PPB */
111 |_______uint_t mem_size;|_______/* existing children required MEM space size */
112 |_______uint_t io_size;||_______/* existing children required I/O space size */
113 };

"dip" holds the dev_info nodes on the system device tree. PCI nodes were created during enumeration according to their position in the PCI hierarchy. All devices/functions attached on the bus were linked to a list hooked on "privdata". The "par_bus" and "sub_bus" were used to mentain the hierarchy of the PCI system. The io/mem/prefetchable mem/bus resources consumed by the children buses and devices were recorded in the various "memlist".

In general, for each compatible PCI device, enumeration logic (process_devfunc() with CONFIG_INFO op type) will do the following items.

(a) create a dev_info node in the system device tree
If the device is under a bridge in the PCI hierarchy, the created device node will be placed under the node for the bridge; If the device is that integrated in the root complex, the logic will first create a special node under ddi_root_node() which present the root complex and the PCI device node would be under the root complex node.

(b) set the property values compliant with IEEE Std 1275-1994, refer to "PCI bus binding to IEEE Std 1275-1994"

(c) Set the device PM state to D0

(d) If the device is a normal PCI function, it will be put in the list hooked on the pci_bus_resource; if it is a bridge, the responding pci_bus_resouce is updated and the relationship between the parent bus and the secondary bus is built through updating the par_bus, sec_bus members in pci_bus_resource.

(e) Special handling of IOAPIC nodes
If the device/function is an IOAPIC node, a dev_info node will be created as the child of IOAPIC nexus node (located directly under ddi_root_node()). Some properties are created/updated: "vendor-id", "device-id", "device_type"(ioapic), "reg".

(f) for ck8-04 based PCI ISA bridge, some special properties created/updated

(g) set the compatible property values compliant with IEEE Std 1275-1994, refer to "PCI bus binding to IEEE Std 1275-1994". compatible property will be used for driver binding.

Here is how compatible property organized:

"compatible" Construct a list of names in most-specific to least-specific order. The names shall be derived from
values of the Vendor ID, Device ID, Subsystem Vendor ID, Subsystem ID, Revision ID and Class Code
bytes, and shall have the following form, and be placed in the list in the following order:
pciVVVV,DDDD.SSSS.ssss.RR (1)
pciVVVV,DDDD.SSSS.ssss (2)
pciSSSS,ssss (3)
pciVVVV,DDDD.RR (4)
pciVVVV,DDDD (5)
pciclass,CCSSPP (6)
pciclass,CCSS (7)
where:
VVVV is the Vendor ID
DDDD is the Device ID
SSSS is the Subsystem Vendor ID
ssss is the Subsystem ID
RR is the Revision ID
CC is the most-significant byte of the Class Code (base class code, at 0x0b).
SS is the second-most-significant byte of the Class Code (sub-class code, at 0x0a).
PP is the least-significant byte of the Class Code (programming interface, at 0x09).
Entries (1), (2) and (3) shall be included if and only if the Subsystem Vendor ID is non-zero.
Entry (3) is supplied only for backwards compatiblity with versions of the PCI Binding prior to Revision
2.1; new OS binding mechanisms should instead use forms (1) or (2) to select a driver based on the values
of the Subsystem Vendor ID and Subsystem ID.
VVVV, DDDD, SSSS, ssss and RR are lower-case ASCII hexadecimal numbers without leading zeroes.
CC, SS and PP are lower-case ASCII hexadecimal numbers including leading zeroes.

(h) special case for disk controller

2025 |_______/*
2026 |_______ * See if this device is a controller that advertises
2027 |_______ * itself to be a standard ATA task file controller, or one that
2028 |_______ * has been hard coded.
2029 |_______ *
2030 |_______ * If it is, check if any other higher precedence driver listed in
2031 |_______ * driver_aliases will claim the node by calling
2032 |_______ * ddi_compatibile_driver_major. If so, clear pciide and do not
2033 |_______ * create a pci-ide node or any other special handling.
2034 |_______ *
2035 |_______ * If another driver does not bind, set the node name to pci-ide
2036 |_______ * and then let the special pci-ide handling for registers and
2037 |_______ * child pci-ide nodes proceed below.
2038 |_______ */

(i) Add the "reg" and "assigned-addresses" property.
Read the mem/IO/rom resources from BAR and ROM register in PCI configure space. Create the "reg" and "assigned-addresses" properties compliant with IEEE Std 1275-1994. Refer to the spec for decoding of "reg" and "assigned-addresses" properties.

The resources allocation will be recorded in pci_bus_resource[].

(j) Bind the driver with this device node

ndi_devi_bind_driver() is called here.

To be continued ...

分享到:
评论

相关推荐

    source insight 3.5 UTF-8中文乱码插件_sourceinsight3.5_utf-8_插件补丁_中文乱码_

    2. 解压文件,确保你有权限访问和修改Source Insight的安装目录。 3. 找到Source Insight的配置文件或插件目录,将解压后的文件复制或移动到对应位置。这可能需要查阅Source Insight的官方文档或用户指南来获取准确...

    sourceinsight_4.0.86.0-setup.zip

    2. 解压缩后,您会找到"sourceinsight_4.0.86.0-setup.exe"这个可执行文件,双击运行开始安装。在安装过程中,遵循屏幕上的提示,选择合适的安装路径,一般推荐默认设置。 3. 安装过程中,系统可能会提示需要.NET ...

    sourceinsight_4.0.86.0-setup安装+破解码

    sourceinsight_4.0.86.0-setup.exe,加破解码

    sourceinsight_4.0.86.0-setup安装文件

    sourceinsight_4.0.86.0-setup安装及破解,不求发家致富,但求有口饭吃

    SourceInsight4配色xml文件-深色

    SourceInsight是一款强大的源代码查看和编辑工具,尤其在编程领域深受程序员喜爱。它提供了对多种编程语言的支持,包括C、C++、Java等,并且具有语法高亮、代码跳转、自动完成等功能,极大地提高了代码阅读和编辑的...

    Source Insight 3支持Utf-8

    Source Insight 3是一款广受欢迎的源代码阅读器和编辑器,尤其在软件开发领域中,它为程序员提供了强大的代码浏览、分析和编辑功能。对于处理各种编码格式的源代码文件,Source Insight 3表现出了良好的兼容性,其中...

    sourceinsight-4.0.86.0-密码123.zip

    2. **智能提示**:在编写代码时,SourceInsight能提供实时的函数、类和变量的自动完成建议,提高编码效率。 3. **查找与搜索**:强大的搜索功能允许用户快速定位代码中的特定字符串、函数或变量,支持正则表达式...

    sourceinsight_4.0.86.0-setup软件

    2. 快速导航:利用SourceInsight的“Go To Definition”功能,可以快速跳转到函数或变量的定义处。 3. 代码搜索:使用“Find”功能,可以在整个项目中搜索特定的代码片段。 4. 代码分析:SourceInsight会自动分析源...

    linux Ubuntu下安装 Source insight

    "Linux Ubuntu下安装Source Insight" Linux Ubuntu下安装Source Insight是指在Ubuntu操作系统下安装Source Insight软件,从而实现在Linux平台下使用Source Insight编辑和阅读源码。本文将详细介绍如何在Ubuntu下...

    source insight UTF-8插件

    Source Insight是一款广受欢迎的源代码阅读和分析工具,尤其在软件开发领域中,它以其强大的代码导航、搜索和理解功能而备受赞誉。然而,对于处理包含非英文字符,特别是中文字符的UTF-8编码文件时,原生的Source ...

    Source Insight 语言文件 -- MIPS ASM

    **Source Insight 语言文件介绍** Source Insight是一款广泛使用的源代码编辑器和分析工具,尤其在软件开发领域,它提供了一种高效的方式来进行代码浏览、编辑和理解。该工具的一个核心特性是其支持多种编程语言的...

    source insight 编辑器快捷键

    ### Source Insight 编辑器快捷键详解 #### 一、基本操作 - **退出程序**:Alt + F4 - 这个快捷键用于快速关闭 Source Insight 编辑器。 - **重绘屏幕**:Ctrl + Alt + Space - 当编辑器窗口显示异常时,可以...

    source insight 4.0自用黑色配色主题

    注意:这是source insight 4.0的主题。解压缩后,在source insight菜单进行导入操作:Source Insight 4->Options->load configurations->选择下载的配置文件

    Source Insight 3.5 序列号

    在探讨“Source Insight 3.5 序列号”这一主题时,首先需要明确的是,序列号(serial number)通常是指软件开发商为了控制软件的分发与使用而提供的一种授权方式。通过序列号,可以验证用户是否拥有使用该软件的合法...

    sourceInsight_4.0.0087 破解版 + 漂亮theme

    2. 替换原主程序:sourceinsight4.exe 3. 导入授权文件(Import a new license file):si4.pediy.lic Patched sourceinsight4.exe: Size Date Time Checksum Name --------- ---------- ----- -------- ---- ...

    source Insight---- Quicker

    **源码洞察——Source Insight更快捷使用指南** Source Insight是一款广受程序员喜爱的源代码查看和编辑工具,尤其在C/C++、Java等语言的开发中,它的智能高亮、语法分析、代码跳转等功能极大地提高了开发效率。...

    解决source insight3.5不支持中文utf8问题

    2. **使用外部工具转换编码**:在打开文件前,使用文本编辑器(如Notepad++)将文件从UTF-8转换为Source Insight支持的其他编码,如GBK。但这种方法的缺点是每次编辑后都需要重新转换,不够方便。 3. **修改Source ...

    让source insight支持AT&T汇编语法高亮

    ### 让Source Insight支持AT&T汇编语法高亮 #### 背景介绍 Source Insight是一款功能强大的编辑器,能够帮助开发者高效地进行代码编写、分析及管理等工作。它不仅支持多种编程语言,还能通过自定义配置来扩展对特定...

    Source Insight使用技巧

    Source Insight 使用技巧大全 Source Insight 是一款功能强大且灵活的代码编辑器,提供了大量的快捷键和使用技巧。本文将整理和总结 Source Insight 的常用快捷键和使用技巧,帮助开发者提高编码效率和工作质量。 ...

Global site tag (gtag.js) - Google Analytics