mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 16:42:56 -08:00
More PCI extended capabilities handling in pcidump.
From Simon Mages ok deraadt@
This commit is contained in:
parent
035d6a8f9a
commit
8e37be7614
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pcireg.h,v 1.52 2017/03/22 07:21:39 jsg Exp $ */
|
||||
/* $OpenBSD: pcireg.h,v 1.53 2017/03/25 07:33:46 mlarkin Exp $ */
|
||||
/* $NetBSD: pcireg.h,v 1.26 2000/05/10 16:58:42 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
@ -606,7 +606,7 @@ typedef u_int8_t pci_revision_t;
|
||||
#define PCI_PCIE_ECAP 0x100
|
||||
#define PCI_PCIE_ECAP_ID(x) (((x) & 0x0000ffff))
|
||||
#define PCI_PCIE_ECAP_VER(x) (((x) >> 16) & 0x0f)
|
||||
#define PCI_PCIE_ECAP_NEXT(x) ((x) >> 20)
|
||||
#define PCI_PCIE_ECAP_NEXT(x) (((x) >> 20) & 0xffc)
|
||||
#define PCI_PCIE_ECAP_LAST 0x0
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pcidump.c,v 1.42 2017/03/16 22:05:46 deraadt Exp $ */
|
||||
/* $OpenBSD: pcidump.c,v 1.43 2017/03/25 07:33:46 mlarkin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
|
||||
@ -392,6 +392,7 @@ void
|
||||
dump_pcie_enhanced_caplist(int bus, int dev, int func)
|
||||
{
|
||||
u_int32_t reg;
|
||||
u_int32_t capidx;
|
||||
u_int16_t ptr;
|
||||
u_int16_t ecap;
|
||||
|
||||
@ -407,10 +408,12 @@ dump_pcie_enhanced_caplist(int bus, int dev, int func)
|
||||
|
||||
ecap = PCI_PCIE_ECAP_ID(reg);
|
||||
if (ecap >= nitems(pci_enhanced_capnames))
|
||||
ecap = 0;
|
||||
capidx = 0;
|
||||
else
|
||||
capidx = ecap;
|
||||
|
||||
printf("\t0x%04x: Enhanced Capability 0x%02x: ", ptr, ecap);
|
||||
printf("%s\n", pci_enhanced_capnames[ecap]);
|
||||
printf("%s\n", pci_enhanced_capnames[capidx]);
|
||||
|
||||
ptr = PCI_PCIE_ECAP_NEXT(reg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user