Commit 9eb45d5c authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Bjorn Helgaas

PCI: Update VPD definitions

The 'end' tag is actually 0x0f; it's the representation as a small resource
data type tag that's 0x78 (i.e., shifted by 3).  Correct PCI_VPD_STIN_END
and PCI_VPD_SRDT_END accordingly.

Also, add helper functions to extract the resource data type tags for both
large and small resource data types.

[bhelgaas: changelog]
Tested-by: default avatarShane Seymour <shane.seymour@hpe.com>
Tested-by: default avatarBabu Moger <babu.moger@oracle.com>
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Cc: Alexander Duyck <alexander.duyck@gmail.com>
parent 92e963f5
...@@ -1834,12 +1834,13 @@ bool pci_acs_path_enabled(struct pci_dev *start, ...@@ -1834,12 +1834,13 @@ bool pci_acs_path_enabled(struct pci_dev *start,
#define PCI_VPD_LRDT_RW_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA) #define PCI_VPD_LRDT_RW_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA)
/* Small Resource Data Type Tag Item Names */ /* Small Resource Data Type Tag Item Names */
#define PCI_VPD_STIN_END 0x78 /* End */ #define PCI_VPD_STIN_END 0x0f /* End */
#define PCI_VPD_SRDT_END PCI_VPD_STIN_END #define PCI_VPD_SRDT_END (PCI_VPD_STIN_END << 3)
#define PCI_VPD_SRDT_TIN_MASK 0x78 #define PCI_VPD_SRDT_TIN_MASK 0x78
#define PCI_VPD_SRDT_LEN_MASK 0x07 #define PCI_VPD_SRDT_LEN_MASK 0x07
#define PCI_VPD_LRDT_TIN_MASK 0x7f
#define PCI_VPD_LRDT_TAG_SIZE 3 #define PCI_VPD_LRDT_TAG_SIZE 3
#define PCI_VPD_SRDT_TAG_SIZE 1 #define PCI_VPD_SRDT_TAG_SIZE 1
...@@ -1862,6 +1863,17 @@ static inline u16 pci_vpd_lrdt_size(const u8 *lrdt) ...@@ -1862,6 +1863,17 @@ static inline u16 pci_vpd_lrdt_size(const u8 *lrdt)
return (u16)lrdt[1] + ((u16)lrdt[2] << 8); return (u16)lrdt[1] + ((u16)lrdt[2] << 8);
} }
/**
* pci_vpd_lrdt_tag - Extracts the Large Resource Data Type Tag Item
* @lrdt: Pointer to the beginning of the Large Resource Data Type tag
*
* Returns the extracted Large Resource Data Type Tag item.
*/
static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt)
{
return (u16)(lrdt[0] & PCI_VPD_LRDT_TIN_MASK);
}
/** /**
* pci_vpd_srdt_size - Extracts the Small Resource Data Type length * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
* @lrdt: Pointer to the beginning of the Small Resource Data Type tag * @lrdt: Pointer to the beginning of the Small Resource Data Type tag
...@@ -1873,6 +1885,17 @@ static inline u8 pci_vpd_srdt_size(const u8 *srdt) ...@@ -1873,6 +1885,17 @@ static inline u8 pci_vpd_srdt_size(const u8 *srdt)
return (*srdt) & PCI_VPD_SRDT_LEN_MASK; return (*srdt) & PCI_VPD_SRDT_LEN_MASK;
} }
/**
* pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item
* @lrdt: Pointer to the beginning of the Small Resource Data Type tag
*
* Returns the extracted Small Resource Data Type Tag Item.
*/
static inline u8 pci_vpd_srdt_tag(const u8 *srdt)
{
return ((*srdt) & PCI_VPD_SRDT_TIN_MASK) >> 3;
}
/** /**
* pci_vpd_info_field_size - Extracts the information field length * pci_vpd_info_field_size - Extracts the information field length
* @lrdt: Pointer to the beginning of an information field header * @lrdt: Pointer to the beginning of an information field header
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment