Data Structures | Functions
nvsvpd.h File Reference

Non-Volatile Storage using Vital Product Data. More...

#include <ipxe/nvs.h>
#include <ipxe/pcivpd.h>

Go to the source code of this file.

Data Structures

struct  nvs_vpd_device
 An NVS VPD device. More...


int nvs_vpd_init (struct nvs_vpd_device *nvsvpd, struct pci_device *pci)
 Initialise NVS VPD device.
void nvs_vpd_nvo_init (struct nvs_vpd_device *nvsvpd, unsigned int field, struct nvo_block *nvo, struct refcnt *refcnt)
 Initialise non-volatile option storage within NVS VPD device.

Detailed Description

Non-Volatile Storage using Vital Product Data.

Definition in file nvsvpd.h.

Function Documentation

int nvs_vpd_init ( struct nvs_vpd_device nvsvpd,
struct pci_device pci 

Initialise NVS VPD device.

nvsvpdNVS VPD device
pciPCI device
Return values:
rcReturn status code

Definition at line 178 of file nvsvpd.c.

References DBGC, nvs_vpd_device::nvs, nvs_vpd_read(), nvs_vpd_write(), PCI_ARGS, PCI_FMT, pci_vpd_init(), rc, nvs_device::read, strerror(), nvs_vpd_device::vpd, and nvs_device::write.

Referenced by hermon_probe().

        int rc;

        /* Initialise VPD device */
        if ( ( rc = pci_vpd_init ( &nvsvpd->vpd, pci ) ) != 0 ) {
                DBGC ( pci, PCI_FMT " NVS could not initialise "
                       "VPD: %s\n", PCI_ARGS ( pci ), strerror ( rc ) );
                return rc;

        /* Initialise NVS device */
        nvsvpd->nvs.read = nvs_vpd_read;
        nvsvpd->nvs.write = nvs_vpd_write;

        return 0;
void nvs_vpd_nvo_init ( struct nvs_vpd_device nvsvpd,
unsigned int  field,
struct nvo_block nvo,
struct refcnt refcnt 

Initialise non-volatile option storage within NVS VPD device.

nvsvpdNVS VPD device
fieldVPD field descriptor
nvoNon-volatile options block
refcntContaining object reference counter, or NULL

Definition at line 220 of file nvsvpd.c.

References address, DBGC, len, nvo_init(), nvs_vpd_device::nvs, nvs_vpd_nvo_resize(), pci_vpd::pci, PCI_ARGS, PCI_FMT, PCI_VPD_FIELD_ARGS, PCI_VPD_FIELD_FMT, pci_vpd_find(), rc, and nvs_vpd_device::vpd.

Referenced by hermon_probe().

        struct pci_device *pci = nvsvpd->vpd.pci;
        unsigned int address;
        size_t len;
        int rc;

        /* Locate VPD field, if present */
        if ( ( rc = pci_vpd_find ( &nvsvpd->vpd, field, &address,
                                   &len ) ) != 0 ) {
                DBGC ( pci, PCI_FMT " NVS VPD field " PCI_VPD_FIELD_FMT
                       " not present; assuming empty\n",
                       PCI_ARGS ( pci ), PCI_VPD_FIELD_ARGS ( field ) );
                len = 0;

        /* Initialise non-volatile options block */
        nvo_init ( nvo, &nvsvpd->nvs, field, len, nvs_vpd_nvo_resize, refcnt );