1 // SPDX-License-Identifier: GPL-2.0
4 * Purpose: Provide PCI VPD support
6 * Copyright (C) 2010 Broadcom Corporation.
10 #include <linux/export.h>
12 int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt)
16 for (i = off; i < len; ) {
19 if (val & PCI_VPD_LRDT) {
20 /* Don't return success of the tag isn't complete */
21 if (i + PCI_VPD_LRDT_TAG_SIZE > len)
27 i += PCI_VPD_LRDT_TAG_SIZE +
28 pci_vpd_lrdt_size(&buf[i]);
30 u8 tag = val & ~PCI_VPD_SRDT_LEN_MASK;
35 if (tag == PCI_VPD_SRDT_END)
38 i += PCI_VPD_SRDT_TAG_SIZE +
39 pci_vpd_srdt_size(&buf[i]);
45 EXPORT_SYMBOL_GPL(pci_vpd_find_tag);
47 int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
48 unsigned int len, const char *kw)
52 for (i = off; i + PCI_VPD_INFO_FLD_HDR_SIZE <= off + len;) {
53 if (buf[i + 0] == kw[0] &&
57 i += PCI_VPD_INFO_FLD_HDR_SIZE +
58 pci_vpd_info_field_size(&buf[i]);
63 EXPORT_SYMBOL_GPL(pci_vpd_find_info_keyword);