Tue Nov 10
12:47:45 CST 2009
npe_attach()
Come back to the attach() function.
For resume attach, restore config_regs
for each children devinfo node of npe. Otherwise, initialize all the
npe related things.
[i86pc/io/pciex/npe.c]
302 |_______if
(ddi_soft_state_zalloc(npe_statep, instance) == DDI_SUCCESS)
303
|_______|_______pcip = ddi_get_soft_state(npe_statep, instance);
304
305 |_______if
(pcip == NULL)
306
|_______|_______return (DDI_FAILURE);
The state
structure defined in pci_common.h.
[i86pc/io/pci/pci_common.h]
39 /* State
structure. */
40 typedef struct
pci_state {
41
|_______dev_info_t *pci_dip;
42 |_______int
pci_fmcap;
43 |_______uint_t
pci_soft_state;
44
|_______ddi_iblock_cookie_t pci_fm_ibc;
45
|_______kmutex_t pci_mutex;
46
|_______kmutex_t pci_peek_poke_mutex;
47
|_______kmutex_t pci_err_mutex;
48 } pci_state_t;
pci_dip and
pci_soft_state are initialized immediately.
308
|_______pcip->pci_dip = devi;
309
|_______pcip->pci_soft_state = PCI_SOFT_STATE_CLOSED;
-
Initialize the pcie bus private
date for root complex. PCIe Bus Private Data contains commonly used
PCI/PCIe information and offsets to key registers. pcie_init_bus()
is used for common pcie devices, while pcie_rc_init_bus() is
designed for root complex. In pcie_rc_init_bus(), pcie bus private
data struture is allocated and set to the hook pointer in devinfo
structure.
[common/io/pciex/pcie.c]
711 void
712
pcie_rc_init_bus(dev_info_t *dip)
713 {
714
|_______pcie_bus_t *bus_p;
715
716 |_______bus_p
= (pcie_bus_t *)kmem_zalloc(sizeof (pcie_bus_t), KM_SLEEP);
717
|_______bus_p->bus_dip = dip;
718
|_______bus_p->bus_dev_type = PCIE_PCIECAP_DEV_TYPE_RC_PSEUDO;
719
|_______bus_p->bus_hdr_type = PCI_HEADER_ONE;
720
721 |_______/*
Fake that there are AER logs */
722
|_______bus_p->bus_aer_off = (uint16_t)-1;
723
724 |_______/*
Needed only for handle lookup */
725
|_______bus_p->bus_fm_flags |= PF_FM_READY;
726
727
|_______ndi_set_bus_private(dip, B_FALSE, DEVI_PORT_TYPE_PCI, bus_p);
728 }
The device type is
a pseudo root complex. This bridge only has down port (B_FALSE) and
the bus type is defined as below. PCI_CLASS_BRIDGE is “Bridge
Controller class” defined by PCI class codes specification.
PCI_BRIDGE_PCI is sub-class code based on PCI_CLASS_BRIDGE. And,
PCI_BRIDGE_PCI_IF_PCI2PCI is the program interface. It means that
this bridge is a PCI-2-PCI bridge, not a subattractive decode bridge.
[common/sys/pcie_impl.h]
42
#define|DEVI_PORT_TYPE_PCI \
43
|_______((PCI_CLASS_BRIDGE << 16) | (PCI_BRIDGE_PCI << 8)
| \
44
|_______PCI_BRIDGE_PCI_IF_PCI2PCI)
Bus private data
is embedded in struct dev_info. Functions ndi_set_bus_private() and
ndi_get_bus_private() are used to set and retrieve the bus private
structure.
[common/sys/ddi_impldefs.h]
105 typedef
struct devi_port {
106 |_______union
{
107
|_______|_______struct {
108
|_______|_______|_______uint32_t type;
109
|_______|_______|_______uint32_t pad;
110
|_______|_______} port;
111
|_______|_______uint64_t type64;
112 |_______}
info;
113
|_______void|___*priv_p;
114 }
devi_port_t;
115
116 typedef
struct devi_bus_priv {
117
|_______devi_port_t port_up;
118
|_______devi_port_t port_down;
119 }
devi_bus_priv_t;
126 struct
dev_info {
… …
253 |_______/*
owned by bus framework */
254
|_______devi_bus_priv_t|devi_bus;|______|_______/* bus private data
*/
… …
-
Create a "devctl" minor
node to support DEVCTL_DEVICE_* and DEVCTL_BUS_* ioctls to this
bus.
-
Call pcie_hp_init() to initialize
pcie hot-plug framework. We will look into pci hotplug later.
-
If ARI (Alternative Routing-ID
Interpretation) is supported by this device and not enabled, enable
it. Actually, this function will always returen failure and keep
the ARI disabled. It isn't a suitable point to enable ARI.
-
Initialize pcitool framework with
pcitool_init(). We will look into pcitool later.
-
Initialize pci FMA framework with
ddi_fm_init() and register FMA handler. We will look into PCI FMA
later.
-
Allocate and initialize fault data
cache
-
Query the MCFG table using ACPI.
If MCFG is found, setup the 'ecfg' property accordingly. Otherwise,
set the values to the default values. Note, MCFG, PCI Express memory
mapped configuration space base address Description Table, is not
defined by ACPI sepc, but PCI Firmware Specification, Revision 3.0.
Below is a description of MCFG in PCI Firmware Specification, R3.0.
The MCFG table is
an ACPI table that is used to communicate the base addresses
corresponding to the non-hot removable PCI Segment Groups range
within a PCI Segment Group available to the operating system at boot.
This is required for the PC-compatible systems.
The MCFG table is
only used to communicate the base addresses corresponding to the PCI
Segment Groups
available to the system at boot. This table directly refers to PCI
Segment Groups defined in the system via the _SEG object in the ACPI
name space for the applicable host bridge device. For systems
containing only a single PCI Segment Group, the default PCI Segment
Group number, namely, PCI Segment Group 0, is implied. In such a
case, the default PCI Segment Group need not be represented in the
ACPI Name Space (i.e., no _SEG method is required in such a
hierarchy).
The size of the
memory mapped configuration region is indicated by the start and end
bus number fields in the Memory mapped Enhanced configuration space
base address allocation structure.
The default “ecfg”
property is set to:
[i86pc/io/pciex/npe_misc.c]
147 |_______/*
148 |_______ * If
MCFG is not found or ecfga_base is not found in MCFG table,
149 |_______ * set
the property to the default values.
150 |_______ */
151
|_______ecfginfo[0] = npe_default_ecfga_base;
152
|_______ecfginfo[1] = 0;|_______|_______/* segment 0 */
153
|_______ecfginfo[2] = 0;|_______|_______/* first bus 0 */
154
|_______ecfginfo[3] = 0xff;|____|_______/* last bus ff */
155 |_______(void)
ndi_prop_update_int64_array(DDI_DEV_T_NONE, dip,
156 |_______
"ecfg", ecfginfo, 4);
Here, default base
address for the enhanced configuration access mechanism is set to
0xE0000000.
[i86pc/io/pciex/npe_misc.c]
53 /*
54 * Default
ecfga base address
55 */
56 int64_t
npe_default_ecfga_base = 0xE0000000;
[i86pc/io/pciex/npe.c]
332
|_______ddi_report_dev(devi);
Questions
I didn't find any place to retrieve
and store the start bus number of a root complexin npe_attach(). The
only place intented to save start bus number as far as I can see is
in the “reg” property, which was created in
create_root_bus_dip().
[intel/io/pci/pci_boot.c]
1470 |_______pci_regs[0] =
pci_bus_res[bus].root_addr;
1471 |_______(void)
ndi_prop_update_int_array(DDI_DEV_T_NONE, dip,
1472 |_______ "reg", (int
*)pci_regs, 3);
Unfortunately, the first integer of
“reg” property for root bus is not defined for start bus. So the
following logic will not work for root bus devinfo node.
acpica_get_bdf
PCI_REG_BUS_G
PCI_REG_DEV_G
PCI_REG_FUNC_G
Let's put it here and try to answer it
later.
npe_detach()
npe_detach() does the opposite operation again npe_attach().
To be continued ...
分享到:
相关推荐
**SourceInsight是一款强大的源代码阅读和编辑工具,尤其在编程和软件开发领域中被广泛使用。它提供了丰富的功能,包括语法高亮、代码跳转、自动完成等,极大地提升了程序员的工作效率。Monokai主题是其中一种广受...
2. 解压文件,确保你有权限访问和修改Source Insight的安装目录。 3. 找到Source Insight的配置文件或插件目录,将解压后的文件复制或移动到对应位置。这可能需要查阅Source Insight的官方文档或用户指南来获取准确...
2. **配置Source Insight**: 打开Source Insight,进入“Tools”菜单,选择“External Tools...”。在这里,我们需要新建一个工具配置,指定PC-lint的可执行文件路径,以及需要传递给PC-lint的参数,如输入文件、...
2. **Source Insight 的安装**:安装 Source Insight V3.5 或更高版本。如果使用的是旧版本,建议升级以获得更好的兼容性和性能支持。 3. **必要的文件准备**:下载并准备好所有相关的配置文件,例如 `config.exe` ...
Source Insight是一款广受欢迎的源代码阅读和分析工具,尤其在软件开发领域中,它以其强大的代码导航、搜索和理解功能而备受赞誉。然而,对于处理包含非英文字符,特别是中文字符的UTF-8编码文件时,原生的Source ...
幸运的是,我们有了“sourceinsight-3.5-window7-64-汉化”这个资源,它为SourceInsight 3.5在Windows 7 64位系统上提供了汉化支持。 首先,我们需要了解SourceInsight 3.5的基本功能。它支持多种编程语言,包括C/...
Source Insight 3是一款广受欢迎的源代码阅读器和编辑器,尤其在软件开发领域中,它为程序员提供了强大的代码浏览、分析和编辑功能。对于处理各种编码格式的源代码文件,Source Insight 3表现出了良好的兼容性,其中...
Astyle集成到SourceInsight指导说明 Astyle是一个编码格式化程序,它可以将代码格式化成统一的风格,从而提高代码的可读性和维护性。本文将指导您如何将Astyle集成到SourceInsight中,以便更好地管理代码的风格。 ...
2. **使用外部工具转换编码**:在打开文件前,使用文本编辑器(如Notepad++)将文件从UTF-8转换为Source Insight支持的其他编码,如GBK。但这种方法的缺点是每次编辑后都需要重新转换,不够方便。 3. **修改Source ...
"Linux Ubuntu下安装Source Insight" Linux Ubuntu下安装Source Insight是指在Ubuntu操作系统下安装Source Insight软件,从而实现在Linux平台下使用Source Insight编辑和阅读源码。本文将详细介绍如何在Ubuntu下...
**Source Insight 4.0与Solarized-Dark主题详解** Source Insight是一款强大的源代码阅读、分析和编辑工具,尤其在编程领域中广受欢迎。它以其高效的语言智能、强大的搜索功能和自定义配置能力赢得了程序员的喜爱。...
《Source Insight 4.0.86.0 安装及使用详解》 Source Insight是一款深受程序员喜爱的源代码分析和编辑工具,以其强大的代码浏览、查找和智能提示功能著称。本文将详细介绍如何安装Source Insight 4.0.86.0版本,并...
在探讨“Source Insight 3.5 序列号”这一主题时,首先需要明确的是,序列号(serial number)通常是指软件开发商为了控制软件的分发与使用而提供的一种授权方式。通过序列号,可以验证用户是否拥有使用该软件的合法...
在IT行业,特别是在软件开发领域,Source Insight 是一个经常被使用到的源代码查看工具。它主要被软件开发者用于阅读、修改、重构代码以及查看定义和引用等功能。熟练使用 Source Insight 的快捷键能够显著提高开发...
### 让Source Insight支持AT&T汇编语法高亮 #### 背景介绍 Source Insight是一款功能强大的编辑器,能够帮助开发者高效地进行代码编写、分析及管理等工作。它不仅支持多种编程语言,还能通过自定义配置来扩展对特定...
**SourceInsight_双语版(中文-英文)** SourceInsight是一款强大的源代码阅读和编辑工具,尤其适合程序员在开发C/C++、Java等编程语言项目时使用。这款软件以其高效、直观的特性,为程序员提供了深入理解代码结构、...
很好用的代码编辑工具,SourceInsight 版本号为3.5.0070,发布时间2012年6月20日 内附注册机 官方What's New: Version 3.50.0070 - June 20, 2012 Fix: Java: Generic functions with a type specifier before the ...
2. **智能提示**:在编写代码时,SourceInsight能提供实时的函数、类和变量的自动完成建议,提高编码效率。 3. **查找与搜索**:强大的搜索功能允许用户快速定位代码中的特定字符串、函数或变量,支持正则表达式...
Source Insight 插件,解决SI UTF-8中文显示乱码问题。 Source Insight Patch File, solve display wrong code when using UTF-8 chinese charater
使用 Wine 安装 Source Insight 标题: 使用 Wine 安装 Source Insight 描述: 在 Ubuntu 系统中使用 Wine 安装 Source Insight 标签: Wine, Source Insight 部分内容: Wine 是一个在 Linux 平台上运行 Windows ...