• Bjorn Helgaas's avatar
    PCI: Check for PCI_HEADER_TYPE_BRIDGE equality, not bitmask · 93de6901
    Bjorn Helgaas authored
    Bit 7 of the "Header Type" register indicates a multi-function device when
    set.  Bits 0-6 contain encoded values, where 0x1 indicates a PCI-PCI
    bridge.  It is incorrect to test this as though it were a mask.
    
    For example, while the PCI 3.0 spec only defines values 0x0, 0x1, and 0x2,
    it's conceivable that a future spec could define 0x3 to mean something
    else; then tests for "(hdr_type & 0x7f) & PCI_HEADER_TYPE_BRIDGE" would
    incorrectly succeed for this new 0x3 header type.
    
    Test bits 0-6 of the Header Type for equality with PCI_HEADER_TYPE_BRIDGE.
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    93de6901
ibmphp_pci.c 56.1 KB