pci: Fix PCI_DEVICE_ID()

Message ID 20180604030603.32124-1-andrew@aj.id.au
State Accepted
Headers show
Series
  • pci: Fix PCI_DEVICE_ID()
Related show

Commit Message

Andrew Jeffery June 4, 2018, 3:06 a.m.
The vendor ID is 16 bits not 8. This error leaves the top of the vendor
ID in the bottom bits of the device ID, which resulted in e.g. a failure
to run the PCI quirk for the AST VGA device.

Fixes: 2b841bf0ef1b ("core/pci: Use cached vendor/device IDs in quirks")
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 include/pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Oliver June 4, 2018, 3:33 a.m. | #1
On Mon, Jun 4, 2018 at 1:06 PM, Andrew Jeffery <andrew@aj.id.au> wrote:
> The vendor ID is 16 bits not 8. This error leaves the top of the vendor
> ID in the bottom bits of the device ID, which resulted in e.g. a failure
> to run the PCI quirk for the AST VGA device.
>
> Fixes: 2b841bf0ef1b ("core/pci: Use cached vendor/device IDs in quirks")
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>  include/pci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/pci.h b/include/pci.h
> index 6141159f2fcc..253dbd8b1e9a 100644
> --- a/include/pci.h
> +++ b/include/pci.h
> @@ -76,7 +76,7 @@ struct pci_device {
>         uint32_t                vdid;
>         uint32_t                sub_vdid;
>  #define PCI_VENDOR_ID(x)       ((x) & 0xFFFF)
> -#define PCI_DEVICE_ID(x)       ((x) >> 8)

Haha-what-the-fuck-by: Oliver O'Halloran <oohall@gmail.com>

> +#define PCI_DEVICE_ID(x)       ((x) >> 16)
>         uint32_t                class;
>         uint64_t                cap_list;
>         struct {
> --
> 2.17.0
>
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
Stewart Smith June 19, 2018, 5:29 a.m. | #2
Oliver <oohall@gmail.com> writes:
> On Mon, Jun 4, 2018 at 1:06 PM, Andrew Jeffery <andrew@aj.id.au> wrote:
>> The vendor ID is 16 bits not 8. This error leaves the top of the vendor
>> ID in the bottom bits of the device ID, which resulted in e.g. a failure
>> to run the PCI quirk for the AST VGA device.
>>
>> Fixes: 2b841bf0ef1b ("core/pci: Use cached vendor/device IDs in quirks")
>> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
>> ---
>>  include/pci.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/pci.h b/include/pci.h
>> index 6141159f2fcc..253dbd8b1e9a 100644
>> --- a/include/pci.h
>> +++ b/include/pci.h
>> @@ -76,7 +76,7 @@ struct pci_device {
>>         uint32_t                vdid;
>>         uint32_t                sub_vdid;
>>  #define PCI_VENDOR_ID(x)       ((x) & 0xFFFF)
>> -#define PCI_DEVICE_ID(x)       ((x) >> 8)
>
> Haha-what-the-fuck-by: Oliver O'Halloran <oohall@gmail.com>

Weirdly, this tag isn't picked up by Patchwork... and I'm not sure if
that's a bug or a feature :)
Stewart Smith June 19, 2018, 5:30 a.m. | #3
Andrew Jeffery <andrew@aj.id.au> writes:
> The vendor ID is 16 bits not 8. This error leaves the top of the vendor
> ID in the bottom bits of the device ID, which resulted in e.g. a failure
> to run the PCI quirk for the AST VGA device.
>
> Fixes: 2b841bf0ef1b ("core/pci: Use cached vendor/device IDs in quirks")
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

Urgh. Merged to master as of 50dfd067835af53736ec8106b1f0e99339b54a81

Patch

diff --git a/include/pci.h b/include/pci.h
index 6141159f2fcc..253dbd8b1e9a 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -76,7 +76,7 @@  struct pci_device {
 	uint32_t		vdid;
 	uint32_t		sub_vdid;
 #define PCI_VENDOR_ID(x)	((x) & 0xFFFF)
-#define PCI_DEVICE_ID(x)	((x) >> 8)
+#define PCI_DEVICE_ID(x)	((x) >> 16)
 	uint32_t		class;
 	uint64_t		cap_list;
 	struct {