iPXE
|
PCI Vital Product Data. More...
Go to the source code of this file.
Data Structures | |
struct | pci_vpd_field |
A PCI VPD field. More... | |
struct | pci_vpd_cache |
PCI VPD cache. More... | |
struct | pci_vpd |
PCI VPD. More... | |
Macros | |
#define | PCI_VPD_ADDRESS 0x02 |
PCI VPD address register. More... | |
#define | PCI_VPD_FLAG 0x8000 |
PCI VPD write flag. More... | |
#define | PCI_VPD_DATA 0x04 |
PCI VPD data register. More... | |
#define | PCI_VPD_MAX_LEN 0xff |
Maximum PCI VPD field length. More... | |
#define | PCI_VPD_FIELD(tag, keyword1, keyword2) ( ( (tag) << 16 ) | ( (keyword2) << 8 ) | ( (keyword1) << 0 ) ) |
Construct PCI VPD field descriptor. More... | |
#define | PCI_VPD_WHOLE_TAG_FIELD(tag) PCI_VPD_FIELD ( (tag), '\0', '\0' ) |
Construct PCI VPD whole-tag field descriptor. More... | |
#define | PCI_VPD_TAG(field) ( (field) >> 16 ) |
Extract PCI VPD ISAPnP tag. More... | |
#define | PCI_VPD_KEYWORD(field) ( cpu_to_le16 ( (field) & 0xffff ) ) |
Extract PCI VPD keyword. More... | |
#define | PCI_VPD_FIELD_FMT "%c%c" |
PCI VPD field debug message format. More... | |
#define | PCI_VPD_FIELD_ARGS(field) ( (field) >> 0 ), ( (field) >> 8 ) |
PCI VPD field debug message arguments. More... | |
#define | PCI_VPD_TAG_RO 0x90 |
PCI VPD Read-Only field tag. More... | |
#define | PCI_VPD_TAG_RW 0x91 |
PCI VPD Read-Write field tag. More... | |
#define | PCI_VPD_FIELD_NAME PCI_VPD_WHOLE_TAG_FIELD ( ISAPNP_TAG_ANSISTR ) |
PCI VPD Card Name field descriptor. More... | |
#define | PCI_VPD_FIELD_PN PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'P', 'N' ) |
PCI VPD Part Number field descriptor. More... | |
#define | PCI_VPD_FIELD_EC PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'E', 'C' ) |
PCI VPD Engineering Change Level field descriptor. More... | |
#define | PCI_VPD_FIELD_FG PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'F', 'G' ) |
PCI VPD Fabric Geography field descriptor. More... | |
#define | PCI_VPD_FIELD_LC PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'L', 'C' ) |
PCI VPD Location field descriptor. More... | |
#define | PCI_VPD_FIELD_MN PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'M', 'N' ) |
PCI VPD Manufacturer ID field descriptor. More... | |
#define | PCI_VPD_FIELD_PG PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'P', 'G' ) |
PCI VPD PCI Geography field descriptor. More... | |
#define | PCI_VPD_FIELD_SN PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'S', 'N' ) |
PCI VPD Serial Number field descriptor. More... | |
#define | PCI_VPD_FIELD_CP PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'C', 'P' ) |
PCI VPD Extended Capability field descriptor. More... | |
#define | PCI_VPD_FIELD_RV PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'R', 'V' ) |
PCI VPD Checksum and Reserved field descriptor. More... | |
#define | PCI_VPD_FIELD_YA PCI_VPD_FIELD ( PCI_VPD_TAG_RW, 'Y', 'A' ) |
PCI VPD Asset Tag field descriptor. More... | |
#define | PCI_VPD_FIELD_RW PCI_VPD_FIELD ( PCI_VPD_TAG_RW, 'R', 'W' ) |
PCI VPD Remaining Read/Write Area field descriptor. More... | |
#define | PCI_VPD_MAX_WAIT_MS 100 |
Maximum wait for PCI VPD (in ms) More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | pci_vpd_is_present (struct pci_vpd *vpd) |
Check for presence of PCI VPD. More... | |
static int | pci_vpd_cache_is_valid (struct pci_vpd *vpd) |
Check if PCI VPD read cache is valid. More... | |
static void | pci_vpd_invalidate_cache (struct pci_vpd *vpd) |
Invalidate PCI VPD read cache. More... | |
int | pci_vpd_init (struct pci_vpd *vpd, struct pci_device *pci) |
Initialise PCI Vital Product Data. More... | |
int | pci_vpd_read (struct pci_vpd *vpd, unsigned int address, void *buf, size_t len) |
Read PCI VPD. More... | |
int | pci_vpd_write (struct pci_vpd *vpd, unsigned int address, const void *buf, size_t len) |
Write PCI VPD. More... | |
int | pci_vpd_find (struct pci_vpd *vpd, unsigned int field, unsigned int *address, size_t *len) |
Locate PCI VPD field. More... | |
int | pci_vpd_resize (struct pci_vpd *vpd, unsigned int field, size_t len, unsigned int *address) |
Resize VPD field. More... | |
PCI Vital Product Data.
Definition in file pcivpd.h.
#define PCI_VPD_WHOLE_TAG_FIELD | ( | tag | ) | PCI_VPD_FIELD ( (tag), '\0', '\0' ) |
#define PCI_VPD_TAG | ( | field | ) | ( (field) >> 16 ) |
#define PCI_VPD_KEYWORD | ( | field | ) | ( cpu_to_le16 ( (field) & 0xffff ) ) |
#define PCI_VPD_FIELD_FMT "%c%c" |
#define PCI_VPD_FIELD_ARGS | ( | field | ) | ( (field) >> 0 ), ( (field) >> 8 ) |
#define PCI_VPD_FIELD_NAME PCI_VPD_WHOLE_TAG_FIELD ( ISAPNP_TAG_ANSISTR ) |
#define PCI_VPD_FIELD_PN PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'P', 'N' ) |
#define PCI_VPD_FIELD_EC PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'E', 'C' ) |
#define PCI_VPD_FIELD_FG PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'F', 'G' ) |
#define PCI_VPD_FIELD_LC PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'L', 'C' ) |
#define PCI_VPD_FIELD_MN PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'M', 'N' ) |
#define PCI_VPD_FIELD_PG PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'P', 'G' ) |
#define PCI_VPD_FIELD_SN PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'S', 'N' ) |
#define PCI_VPD_FIELD_CP PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'C', 'P' ) |
#define PCI_VPD_FIELD_RV PCI_VPD_FIELD ( PCI_VPD_TAG_RO, 'R', 'V' ) |
#define PCI_VPD_FIELD_YA PCI_VPD_FIELD ( PCI_VPD_TAG_RW, 'Y', 'A' ) |
#define PCI_VPD_FIELD_RW PCI_VPD_FIELD ( PCI_VPD_TAG_RW, 'R', 'W' ) |
#define PCI_VPD_MAX_WAIT_MS 100 |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Check for presence of PCI VPD.
vpd | PCI VPD |
is_present | VPD is present |
Definition at line 146 of file pcivpd.h.
References pci_vpd::cap.
|
inlinestatic |
Check if PCI VPD read cache is valid.
vpd | PCI VPD |
is_valid | Read cache is valid |
Definition at line 157 of file pcivpd.h.
References pci_vpd_cache::address, and pci_vpd::cache.
Referenced by pci_vpd_read_dword().
|
inlinestatic |
Invalidate PCI VPD read cache.
vpd | PCI VPD |
Definition at line 167 of file pcivpd.h.
References pci_vpd_cache::address, and pci_vpd::cache.
Referenced by pci_vpd_init(), and pci_vpd_write_dword().
int pci_vpd_init | ( | struct pci_vpd * | vpd, |
struct pci_device * | pci | ||
) |
Initialise PCI Vital Product Data.
vpd | PCI VPD |
pci | PCI device |
rc | Return status code |
Definition at line 48 of file pcivpd.c.
References pci_vpd::cap, DBGC, ENOTTY, pci_vpd::pci, PCI_ARGS, PCI_CAP_ID_VPD, pci_find_capability(), PCI_FMT, and pci_vpd_invalidate_cache().
Referenced by nvs_vpd_init().
Read PCI VPD.
vpd | PCI VPD |
address | Starting address |
buf | Data buffer |
len | Length of data buffer |
rc | Return status code |
Definition at line 183 of file pcivpd.c.
References address, bytes, data, len, pci_vpd_read_dword(), and rc.
Referenced by nvs_vpd_read(), pci_vpd_dump(), pci_vpd_find(), pci_vpd_find_tag(), and pci_vpd_resize().
Write PCI VPD.
vpd | PCI VPD |
address | Starting address |
buf | Data buffer |
len | Length of data buffer |
rc | Return status code |
Definition at line 225 of file pcivpd.c.
References address, bytes, data, len, pci_vpd_read_dword(), pci_vpd_write_dword(), and rc.
Referenced by nvs_vpd_write(), and pci_vpd_resize().
Locate PCI VPD field.
vpd | PCI VPD |
field | VPD field descriptor |
address | Address of field body |
len | Length of field body |
rc | Return status code |
Definition at line 353 of file pcivpd.c.
References address, DBGC, ENOENT, pci_vpd_field::keyword, len, pci_vpd_field::len, pci_vpd::pci, PCI_ARGS, PCI_FMT, pci_vpd_dump(), PCI_VPD_FIELD_ARGS, PCI_VPD_FIELD_FMT, pci_vpd_find_tag(), PCI_VPD_KEYWORD, pci_vpd_read(), PCI_VPD_TAG, and rc.
Referenced by nvs_vpd_nvo_init(), nvs_vpd_read(), nvs_vpd_write(), and pci_vpd_resize().
Resize VPD field.
vpd | PCI VPD |
field | VPD field descriptor |
len | New length of field body |
address | Address of field body |
rc | Return status code |
Definition at line 411 of file pcivpd.c.
References address, assert(), DBGC, ENOMEM, ENOSPC, ENXIO, free, pci_vpd_field::keyword, len, pci_vpd_field::len, malloc(), pci_vpd::pci, PCI_ARGS, PCI_FMT, pci_vpd_dump(), PCI_VPD_FIELD_ARGS, PCI_VPD_FIELD_FMT, PCI_VPD_FIELD_RW, pci_vpd_find(), PCI_VPD_KEYWORD, PCI_VPD_MAX_LEN, pci_vpd_read(), PCI_VPD_TAG, PCI_VPD_TAG_RW, pci_vpd_write(), and rc.
Referenced by nvs_vpd_resize().