iPXE
|
PCI Vital Product Data. More...
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/pci.h>
#include <ipxe/isapnp.h>
#include <ipxe/pcivpd.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
int | pci_vpd_init (struct pci_vpd *vpd, struct pci_device *pci) |
Initialise PCI Vital Product Data. More... | |
static int | pci_vpd_read_dword (struct pci_vpd *vpd, int address, uint32_t *data) |
Read one dword of PCI Vital Product Data. More... | |
static int | pci_vpd_write_dword (struct pci_vpd *vpd, int address, uint32_t data) |
Write one dword of 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... | |
static void | pci_vpd_dump (struct pci_vpd *vpd, unsigned int address, size_t len) |
Dump PCI VPD region (for debugging) More... | |
static int | pci_vpd_find_tag (struct pci_vpd *vpd, unsigned int tag, unsigned int *address, size_t *len) |
Locate PCI VPD tag. 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.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
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 one dword of PCI Vital Product Data.
vpd | PCI VPD |
address | Address to read |
data | Read data |
rc | Return status code |
Definition at line 75 of file pcivpd.c.
References address, pci_vpd_cache::address, pci_vpd::cache, pci_vpd::cap, data, pci_vpd_cache::data, DBGC, DBGC2, ENOTTY, ETIMEDOUT, flag, htonl, mdelay(), pci_vpd::pci, PCI_ARGS, PCI_FMT, pci_read_config_dword(), pci_read_config_word(), PCI_VPD_ADDRESS, pci_vpd_cache_is_valid(), PCI_VPD_DATA, PCI_VPD_FLAG, PCI_VPD_MAX_WAIT_MS, and pci_write_config_word().
Referenced by pci_vpd_read(), and pci_vpd_write().
Write one dword of PCI Vital Product Data.
vpd | PCI VPD |
address | Address to write |
data | Data to write |
rc | Return status code |
Definition at line 133 of file pcivpd.c.
References address, pci_vpd::cap, data, DBGC, DBGC2, ENOTTY, ETIMEDOUT, flag, htonl, mdelay(), pci_vpd::pci, PCI_ARGS, PCI_FMT, pci_read_config_word(), PCI_VPD_ADDRESS, PCI_VPD_DATA, PCI_VPD_FLAG, pci_vpd_invalidate_cache(), PCI_VPD_MAX_WAIT_MS, pci_write_config_dword(), and pci_write_config_word().
Referenced by pci_vpd_write().
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().
Dump PCI VPD region (for debugging)
vpd | PCI VPD |
address | Starting address |
len | Length of data |
Definition at line 271 of file pcivpd.c.
References address, DBG_LOG, DBGC_HDA, len, pci_vpd_read(), and rc.
Referenced by pci_vpd_find(), and pci_vpd_resize().
|
static |
Locate PCI VPD tag.
vpd | PCI VPD |
tag | ISAPnP tag |
address | Address of tag body |
len | Length of tag body |
rc | Return status code |
Definition at line 298 of file pcivpd.c.
References address, DBGC, ENOENT, ISAPNP_IS_LARGE_TAG, ISAPNP_LARGE_TAG_NAME, ISAPNP_SMALL_TAG_LEN, ISAPNP_SMALL_TAG_NAME, ISAPNP_TAG_END, le16_to_cpu, len, pci_vpd::pci, PCI_ARGS, PCI_FMT, pci_vpd_read(), rc, and tag.
Referenced by pci_vpd_find().
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().