Solaris Source Insight: PCI bus driver moduls - misc/busra module

<!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } -->

Implementation of misc/busra (Bus Resource Allocator (BUSRA))

30 /*

31 * This module provides a set of resource management interfaces

32 * to manage bus resources globally in the system.

33 *

34 * The bus nexus drivers are typically responsible to setup resource

35 * maps for the bus resources available for a bus instance. However

36 * this module also provides resource setup functions for PCI bus

37 * (used by both SPARC and X86 platforms) and ISA bus instances (used

38 * only for X86 platforms).

39 */

The following interfaces are exported in this module.

[common/sys/sunndi.h]

736 int

737 ndi_ra_map_setup(dev_info_t *dip, char *type);

738

739 int

740 ndi_ra_map_destroy(dev_info_t *dip, char *type);

741

742 int

743 ndi_ra_alloc(dev_info_t *dip, ndi_ra_request_t *req, uint64_t *basep,

744 |_______uint64_t *lenp, char *type, uint_t flag);

745

746 int

747 ndi_ra_free(dev_info_t *dip, uint64_t base, uint64_t len, char *type,

748 |_______uint_t flag);

  • ndi_ra_map_setup(): allocate the resource management structure in resource map according to “dip” and “type”, if this kind of resource management data structure doesn't exist yet.

  • ndi_ra_map_destroy(): free the resource management structure allocated above.

  • ndi_ra_alloc(): allocate resource from the resource management unit

  • ndi_ra_free(): free above allocated resource

928 /*

929 * Setup resource map for the pci bus node based on the "available"

930 * property and "bus-range" property.

931 */

932 int

933 pci_resource_setup(dev_info_t *dip)

1196 void

1197 pci_resource_destroy(dev_info_t *dip)

1198 {

1199 |_______(void) ndi_ra_map_destroy(dip, NDI_RA_TYPE_IO);

1200

1201 |_______(void) ndi_ra_map_destroy(dip, NDI_RA_TYPE_MEM);

1202

1203 |_______(void) ndi_ra_map_destroy(dip, NDI_RA_TYPE_PCI_BUSNUM);

1204

1205 |_______(void) ndi_ra_map_destroy(dip, NDI_RA_TYPE_PCI_PREFETCH_MEM);

1206 }

1209 int

1210 pci_resource_setup_avail(dev_info_t *dip, pci_regspec_t *avail_p, int entries)

  • pci_resource_setup(): this function will be called from pci nexus drivers. Four resource types are created for pci bus: io, mem, bus, pre-fetchable mem. Resources of io/mem/pf-mem are filled from “available” property. Bus resource is filled from “available-bus-range” or “bus-range” property.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值