Solaris Source Insight: PCI bus driver moduls
<!--@page { margin: 0.79in }P { margin-bottom: 0.08in }-->Implementation of misc/busra (BusResource Allocator (BUSRA))
30 /*
31* This moduleprovides a set of resource management interfaces
32* to manage busresources globally in the system.
33*
34* The bus nexusdrivers are typically responsible to setup resource
35* maps for the busresources available for a bus instance. However
36* this module alsoprovides resource setup functions for PCI bus
37* (used by bothSPARC and X86 platforms) and ISA bus instances (used
38* only for X86platforms).
39*/
The following interfaces are exportedin this module.
736 int
737ndi_ra_map_setup(dev_info_t *dip, char *type);
738
739 int
740ndi_ra_map_destroy(dev_info_t *dip, char *type);
741
742 int
743ndi_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 theresource management structure in resource map according to “dip”and “type”, if this kind of resource management data structuredoesn't exist yet.
[*]ndi_ra_map_destroy(): free theresource management structure allocated above.
[*]ndi_ra_alloc(): allocate resourcefrom the resource management unit
[*]ndi_ra_free(): free aboveallocated resource
928 /*
929* Setup resource mapfor the pci bus node based on the "available"
930* property and"bus-range" property.
931*/
932 int
933pci_resource_setup(dev_info_t *dip)
1196 void
1197pci_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
1210pci_resource_setup_avail(dev_info_t *dip, pci_regspec_t *avail_p, intentries)
[*]pci_resource_setup(): thisfunction will be called from pci nexus drivers. Four resource typesare created for pci bus: io, mem, bus, pre-fetchable mem. Resourcesof io/mem/pf-mem are filled from “available” property. Busresource is filled from “available-bus-range” or “bus-range”property.
页:
[1]