MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ppt_probe

Function ppt_probe

freebsd/amd64/vmm/io/ppt.c:124–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122static TAILQ_HEAD(, pptdev) pptdev_list = TAILQ_HEAD_INITIALIZER(pptdev_list);
123
124static int
125ppt_probe(device_t dev)
126{
127 int bus, slot, func;
128 struct pci_devinfo *dinfo;
129
130 dinfo = (struct pci_devinfo *)device_get_ivars(dev);
131
132 bus = pci_get_bus(dev);
133 slot = pci_get_slot(dev);
134 func = pci_get_function(dev);
135
136 /*
137 * To qualify as a pci passthrough device a device must:
138 * - be allowed by administrator to be used in this role
139 * - be an endpoint device
140 */
141 if ((dinfo->cfg.hdrtype & PCIM_HDRTYPE) != PCIM_HDRTYPE_NORMAL)
142 return (ENXIO);
143 else if (vmm_is_pptdev(bus, slot, func))
144 return (0);
145 else
146 /*
147 * Returning BUS_PROBE_NOWILDCARD here matches devices that the
148 * SR-IOV infrastructure specified as "ppt" passthrough devices.
149 * All normal devices that did not have "ppt" specified as their
150 * driver will not be matched by this.
151 */
152 return (BUS_PROBE_NOWILDCARD);
153}
154
155static int
156ppt_attach(device_t dev)

Callers

nothing calls this directly

Calls 2

device_get_ivarsFunction · 0.85
vmm_is_pptdevFunction · 0.85

Tested by

no test coverage detected