Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: July 2017
 
 

pci_param_get(9F)

Name

pci_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 configured 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 available\n");
        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 \n");
        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 %d\n", 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 Also

attributes(5), pci_param_free(9F), pci_plist_get(9F), pci_plist_getvf(9F), pciv_vf_config(9F)