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.

你可能感兴趣的:(Solaris)