pci_param_get(9F) Kernel Functions for Drivers pci_param_get(9F)NAMEpci_param_get - get the name-value pair list from the backend store
SYNOPSIS
#include <sys/sunddi.h>
int pci_param_get(dev_info_t *dip, pci_param_t *php);
PARAMETERS
dip A pointer to a dev_info structure
php A pointer to a (void *)param handle
On successful return a non—null handle is returned.
DESCRIPTION
The param handle pointer (php) returned by pci_param_get() contains the
name-value information of both PF (Physical Function) and its config‐
ured VF (Virtual Function) devices. The caller should use
pci_plist_get(9F) to get the param list of the PF device and
pci_plist_getvf(9F) to obtain the param lists for the configured VFs.
The name-value pairs are defined on a per device basis. There is one
set of name-value pairs for the PF and each of the configured VFs. The
name-value pairs are optional and may be absent for any or all of the
devices.
The param handle is invalid after the device is detached.
The caller is responsible to free the php (param handle pointer) after
each call to pci_param_get() using pci_param_free(9F).
RETURN VALUES
DDI_SUCCESS A valid param handle pointer php is returned.
Non-zero value No name-value pairs defined for devices.
USAGE
Use the DDI pci_plist_lookup_xxx() on the param list of the PF/VF
devices to obtain the name-value pairs. Validate all parameters as a
whole; that is, both PF parameters and VF parameters. If the current
configuration cannot be satisfied, the driver needs to fail the attach.
The validation needs to be done before VFs are configured using
pciv_vf_config(9F) interface. Apply these parameters and corresponding
action for PF and VFs.
EXAMPLES
Example 1 pci_param_get() example
pci_param_t my_params;
pci_plist_t pf_plist;
pci_plist_t vf_plist[8];
labelp = NULL;
rval = pci_param_get(dip, &my_params);
if (rval || (my_params == NULL)) {
cmn_err(CE_NOTE, "No params available0);
goto continue_with_attach;
}
rval = pci_plist_get(my_params, &pf_plist);
if (rval || (pf_plist == NULL)) {
cmn_err(CE_NOTE, "No params for PF 0);
goto continue_with_attach;
}
for (i = 0; i < 8; i++) {
rval = pci_plist_getvf(my_params, i, &vf_plist[i]);
if (rval || (vf_plist[i] == NULL)) {
cmn_err(CE_WARN, "No params for VF %d0, i);
continue;
}
}
pci_param_free(my_params);
/*
* Validate the PF and VF params lists.
* Fail the attach if the params are incompatible or exceed the
* resources available.
*/
continue_with_attach:
CONTEXT
The pci_param_get() function can be called from kernel non-interrupt
context.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
┌─────────────────────────────┬─────────────────────────────┐
│ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
├─────────────────────────────┼─────────────────────────────┤
│Interface Stability │Uncommitted │
└─────────────────────────────┴─────────────────────────────┘
SEE ALSOattributes(5), pci_param_free(9F), pci_plist_get(9F),
pci_plist_getvf(9F), pciv_vf_config(9F)SunOS 5.10 19 May 2011 pci_param_get(9F)