3 * Purpose: Provide PCI VPD support
5 * Copyright (C) 2010 Broadcom Corporation.
9 #include <linux/export.h>
11 int pci_vpd_find_tag(const u8
*buf
, unsigned int off
, unsigned int len
, u8 rdt
)
15 for (i
= off
; i
< len
; ) {
18 if (val
& PCI_VPD_LRDT
) {
19 /* Don't return success of the tag isn't complete */
20 if (i
+ PCI_VPD_LRDT_TAG_SIZE
> len
)
26 i
+= PCI_VPD_LRDT_TAG_SIZE
+
27 pci_vpd_lrdt_size(&buf
[i
]);
29 u8 tag
= val
& ~PCI_VPD_SRDT_LEN_MASK
;
34 if (tag
== PCI_VPD_SRDT_END
)
37 i
+= PCI_VPD_SRDT_TAG_SIZE
+
38 pci_vpd_srdt_size(&buf
[i
]);
44 EXPORT_SYMBOL_GPL(pci_vpd_find_tag
);
46 int pci_vpd_find_info_keyword(const u8
*buf
, unsigned int off
,
47 unsigned int len
, const char *kw
)
51 for (i
= off
; i
+ PCI_VPD_INFO_FLD_HDR_SIZE
<= off
+ len
;) {
52 if (buf
[i
+ 0] == kw
[0] &&
56 i
+= PCI_VPD_INFO_FLD_HDR_SIZE
+
57 pci_vpd_info_field_size(&buf
[i
]);
62 EXPORT_SYMBOL_GPL(pci_vpd_find_info_keyword
);