六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 104|回复: 0

Solaris Source Insight: PCI bus driver moduls

[复制链接]

升级  53.65%

673

主题

673

主题

673

主题

探花

Rank: 6Rank: 6

积分
2073
 楼主| 发表于 2013-1-16 16:36:36 | 显示全部楼层 |阅读模式
<!--@page { margin: 0.79in }P { margin-bottom: 0.08in }-->
Implementation of misc/pcicfg

This module provids below twointerfaces to configure/unconfigure pci devices (include thechildren).

540 /*
541  * This entry pointis called to configure a device (and
542  * all its children)on the given bus. It is called when
543  * a new device isadded to the PCI domain.  This routine
544  * will create thedevice tree and program the devices
545  * registers.
546  */
547 int
548pcicfg_configure(dev_info_t *devi, uint_t device, uint_t function,
549     pcicfg_flags_tflags)

In pcicfg_configure(), the followingprocedures followed:

  • probe the device (includechildren), create devinfo node for each PCI device, and bind it todriver if below configuration is successful.
  • Allocate and program the resoursesfor both bridges and leaf devices.
  • Update standard and specificproperties.

1422 /*
1423  * This will turn resources allocated by pcicfg_configure()
1424  * and remove thedevice tree from the Hotplug Connection (CN)
1425  * and below.  Theroutine assumes the devices have their
1426  * drivers detached.
1427  */
1428 int
1429pcicfg_unconfigure(dev_info_t *devi, uint_t device, uint_t function,
1430     pcicfg_flags_tflags)

In pcicfg_unconfigure(), the followingprocedures followed:

  • Offline the devinfo nodes, thatmeans detaching the device driver and preventing it fromreattaching.
  • Free up resources the devicesconsumed, disable the device and tear down the devinfo node (includechildren).

By the way, this should be a bug incode.
code review comments:

585 |_______|_______if((function != PCICFG_ALL_FUNC) && (function != func))
586|_______|_______|_______goto next;
… ...
657 next:
658 |_______|_______/*
659 |_______|_______ *Determine if ARI Forwarding should be enabled.
660 |_______|_______ */
661 |_______|_______if(func == 0) {
662|_______|_______|_______if ((pcie_ari_supported(devi)
663|_______|_______|_______    == PCIE_ARI_FORW_SUPPORTED) &&
664|_______|_______|_______    (pcie_ari_device(new_device) ==PCIE_ARI_DEVICE)) {

new_device could be used here beforeinitialized.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表