PCI implementation in Solaris/OpenSolaris
Author: baolu.lu@intel.com
Date: October 28th, 2009
On a typical x86 platfomr, the PCI system implementation in Solaris/OpenSolaris includes the following modules.
[root@blu-nhm-ep:~]modinfo | grep PCI
15 fffffffffba46ce0 bfb0 - 1 pci_autoconfig (PCI BIOS interface)
37 fffffffffbacd3f0 ce28 183 1 npe (Host to PCIe nexus driver)
38 fffffffffbad95c8 5f50 - 1 pcihp (PCI nexus hotplug support)
40 fffffffffbae14f0 bb00 - 1 pcie (PCIE: PCI framework)
89 fffffffff7bff000 4c68 184 1 pcieb (PCIe to PCI nexus driver)
90 fffffffff7999000 1d68 84 1 pci_pci (PCI to PCI bridge nexus driver)
1. misc/pci_autoconfig
Pci_autoconfig module is the interface between PCI system and the BIOS. It "Determines the PCI configuration mechanism recommended by the BIOS". It was implemented in the following files.
156 PCI_AUTOCONFIG_OBJS += pci_autoconfig.o pci_boot.o pcie_nvidia.o \
157 pci_memlist.o pci_resource.o
The module itself only registers a bus probe function to the kernel.
intel/io/pci/pci_autoconfig.c
62 int
63 _init(void)
64 {
65 int err;
66
67 if ((err = mod_install(&modlinkage)) != 0)
68 return (err);
69
70 impl_bus_add_probe(pci_enumerate);
71 return (0);
72 }
i86pc/os/ddi_impl.c
2514 void
2515 impl_setup_ddi(void)
2516 {
... ...
2569 |_______/* do bus dependent probes. */
2570 |_______impl_bus_initialprobe();
2571 }
The first round of bus probe was called in impl_setup_ddi() during boot process. Bus reprober was called later in
i86pc/os/ddi_impl.c
157 /*
158 * Configure the hardware on the system.
159 * Called before the rootfs is mounted
160 */
161 void
162 configure(void)
163 {
... ...
203 |_______/* reprogram devices not set up by firmware (BIOS) */
204 |_______impl_bus_reprobe();
The bus probes in the linked list are executed in Last In First Service mode. If you have any dependency between the probes, you need to take care about this.
Let's pull the topic back by diving into the implementation of pci bus prober.
intel/io/pci/pci_autoconfig.c
94 /*
95 * This function is invoked twice: first time, with reprogram=0 to
96 * set up the PCI portion of the device tree. The second time is
97 * for reprogramming devices not set up by the BIOS.
98 */
99 void
100 pci_enumerate(int reprogram)
101 {
102 |_______extern void add_pci_fixes(void);
103 |_______extern void undo_pci_fixes(void);
104
105 |_______add_pci_fixes();
106
107 |_______if (reprogram) {
108 |_______|_______pci_reprogram();
109 |_______|_______undo_pci_fixes();
110 |_______|_______return;
111 |_______}
112
113 |_______/* setup device tree */
114 |_______pci_setup_tree();
115 |_______undo_pci_fixes();
116 }
add_pci_fixes()/undo_pci_fixes()
================================
Fix some hardware specific issues before enumerating or reprogramming the pci system, and undo the fix afterward. Currently, only fix for AMD-8111 LPC device is in the list.
pci_setup_tree()
================
This function was called to enumerate the pci system handed over by BIOS. Solaris kernel maintains a global variable in i86pc/os/pci_cfgspace.c
int pci_bios_maxbus;
It records the maximum number of pci bus on this hardware platform. During boot process, when mlsetup() got called,
i86pc/os/mlsetup.c
97 /*
98 * Setup routine called right before main(). Interposing this function
99 * before main() allows us to call it in a machine-independent fashion.
100 */
101 void
102 mlsetup(struct regs *rp)
103 {
... ...
162 |_______/*
163 |_______ * lgrp_init() and possibly cpuid_pass1() need PCI config
164 |_______ * space access
165 |_______ */
166 #if defined(__xpv)
167 |_______if (DOMAIN_IS_INITDOMAIN(xen_info))
168 |_______|_______pci_cfgspace_init();
169 #else
170 |_______pci_cfgspace_init();
171 #endif
pci_cfgspace_init() will prepare the pci system for configuration space access. The call stack is:
i86pc/os/pci_cfgspace.c
85 void
86 pci_cfgspace_init(void)
87 {
88 |_______mutex_init(&pcicfg_mutex, NULL, MUTEX_SPIN,
89 |_______ (ddi_iblock_cookie_t)ipltospl(15));
90 |_______mutex_init(&pcicfg_chipset_mutex, NULL, MUTEX_SPIN,
91 |_______ (ddi_iblock_cookie_t)ipltospl(15));
92 |_______if (!pci_check()) {
93 |_______|_______mutex_destroy(&pcicfg_mutex);
94 |_______|_______mutex_destroy(&pcicfg_chipset_mutex);
95 |_______}
96 }
i86pc/os/pci_cfgspace.c
98 /*
99 * This code determines if this system supports PCI and which
100 * type of configuration access method is used
101 */
102
103 static int
104 pci_check(void)
105 {
... ...
142 |_______pci_bios_cfg_type = pci_check_bios();
... ...
i86pc/os/pci_cfgspace.c
202 static int
203 pci_check_bios(void)
204 {
... ...
228 |_______pci_bios_mech = (ax & 0x3);
229 |_______pci_bios_vers = regs.ebx.word.bx;
230 |_______pci_bios_maxbus = (regs.ecx.word.cx & 0xff);
pci_bios_maxbus is retrieved from bios here! The logic described here are compiled into CORE_OBJ, and will be called before main() during system boot up.
To be continue ...
分享到:
相关推荐
1. 下载提供的"source insight 3.5 UTF-8中文乱码插件"压缩包。 2. 解压文件,确保你有权限访问和修改Source Insight的安装目录。 3. 找到Source Insight的配置文件或插件目录,将解压后的文件复制或移动到对应位置...
1. 首先,我们需要下载Source Insight的安装包,即"sourceinsight_4.0.86.0-setup.zip"。这是一个ZIP格式的压缩文件,需要使用解压工具将其展开。 2. 解压缩后,您会找到"sourceinsight_4.0.86.0-setup.exe"这个可...
sourceinsight_4.0.86.0-setup.exe,加破解码
sourceinsight_4.0.86.0-setup安装及破解,不求发家致富,但求有口饭吃
1. **代码浏览**:SourceInsight能快速加载和显示大型源代码库,支持多种编程语言的语法高亮。用户可以方便地跳转到函数定义、声明或引用,查看变量和常量的定义。 2. **智能提示**:在编写代码时,SourceInsight能...
SourceInsight是一款强大的源代码查看和编辑工具,尤其在编程领域深受程序员喜爱。它提供了对多种编程语言的支持,包括C、C++、Java等,并且具有语法高亮、代码跳转、自动完成等功能,极大地提高了代码阅读和编辑的...
1. 首先,打开Source Insight 3程序。 2. 然后,进入“Options”(选项)菜单,选择“Global Settings”(全局设置)。 3. 在全局设置界面中,找到“Fonts and Colors”(字体和颜色)选项,点击进入。 4. 在字体和...
Source Insight是一款广受欢迎的源代码阅读和分析工具,尤其在软件开发领域中,它以其强大的代码导航、搜索和理解功能而备受赞誉。然而,对于处理包含非英文字符,特别是中文字符的UTF-8编码文件时,原生的Source ...
1. 下载源文件:获取名为"sourceinsight_4.0.86.0-setup软件"的压缩包,这是安装程序的载体。 2. 解压文件:使用解压缩工具(如WinRAR或7-Zip)打开压缩包,将其中的安装文件解压到一个方便的位置。 3. 运行安装程序...
"Linux Ubuntu下安装Source Insight" Linux Ubuntu下安装Source Insight是指在Ubuntu操作系统下安装Source Insight软件,从而实现在Linux平台下使用Source Insight编辑和阅读源码。本文将详细介绍如何在Ubuntu下...
### Source Insight 中集成 PC-Lint 的详细步骤及注意事项 #### 一、概述 在软件开发过程中,静态代码分析工具能够帮助开发者发现潜在的错误和不规范的编程习惯,从而提高代码质量。PC-Lint 是一款知名的静态代码...
**Source Insight 3.5.0076 知识点详解** Source Insight 是一款广泛应用于软件开发领域的源代码分析和编辑工具,尤其在编程语言如C、C++、Java、C#等领域中表现突出。它以其强大的代码浏览、搜索、跳转和智能提示...
**Source Insight 语言文件介绍** Source Insight是一款广泛使用的源代码编辑器和分析工具,尤其在软件开发领域,它提供了一种高效的方式来进行代码浏览、编辑和理解。该工具的一个核心特性是其支持多种编程语言的...
### Source Insight 编辑器快捷键详解 #### 一、基本操作 - **退出程序**:Alt + F4 - 这个快捷键用于快速关闭 Source Insight 编辑器。 - **重绘屏幕**:Ctrl + Alt + Space - 当编辑器窗口显示异常时,可以...
注意:这是source insight 4.0的主题。解压缩后,在source insight菜单进行导入操作:Source Insight 4->Options->load configurations->选择下载的配置文件
**源码洞察——Source Insight更快捷使用指南** Source Insight是一款广受程序员喜爱的源代码查看和编辑工具,尤其在C/C++、Java等语言的开发中,它的智能高亮、语法分析、代码跳转等功能极大地提高了开发效率。...
1. 安装原版软件:Source Insight Version 4.0.0087 - October 17, 2017 2. 替换原主程序:sourceinsight4.exe 3. 导入授权文件(Import a new license file):si4.pediy.lic Patched sourceinsight4.exe: Size Date...
在探讨“Source Insight 3.5 序列号”这一主题时,首先需要明确的是,序列号(serial number)通常是指软件开发商为了控制软件的分发与使用而提供的一种授权方式。通过序列号,可以验证用户是否拥有使用该软件的合法...
感谢http://www.cnblogs.com/Red_angelX/p/3713935.html的分享 他生成的dll不支持win7 64位,于是重新生成一个支持win7 64位的dll 拷贝这两个dll到si安装目录即可实现对utf-8支持
### 让Source Insight支持AT&T汇编语法高亮 #### 背景介绍 Source Insight是一款功能强大的编辑器,能够帮助开发者高效地进行代码编写、分析及管理等工作。它不仅支持多种编程语言,还能通过自定义配置来扩展对特定...