]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Merge pull request #146 from alexisgrytalms/master
authorMartin Mareš <mj@ucw.cz>
Fri, 8 Dec 2023 18:41:49 +0000 (19:41 +0100)
committerGitHub <noreply@github.com>
Fri, 8 Dec 2023 18:41:49 +0000 (19:41 +0100)
CXL: DVSEC fixes and CXLCap3

61 files changed:
Makefile
README
common.c
lib/access.c
lib/aix-device.c
lib/caps.c
lib/darwin.c
lib/dump.c
lib/ecam.c
lib/emulated.c
lib/fbsd-device.c
lib/filter.c
lib/generic.c
lib/header.h
lib/hurd.c
lib/i386-io-beos.h
lib/i386-io-cygwin.h
lib/i386-io-djgpp.h
lib/i386-io-haiku.h
lib/i386-io-hurd.h
lib/i386-io-linux.h
lib/i386-io-sunos.h
lib/i386-io-windows.h
lib/i386-ports.c
lib/init.c
lib/internal.h
lib/mmio-ports.c
lib/names-cache.c
lib/names-hash.c
lib/names-hwdb.c
lib/names-net.c
lib/names-parse.c
lib/names.c
lib/names.h
lib/nbsd-libpci.c
lib/obsd-device.c
lib/params.c
lib/pci.h
lib/pread.h
lib/proc.c
lib/sylixos-device.c
lib/sysdep.h
lib/sysfs.c
lib/types.h
lib/win32-cfgmgr32.c
lib/win32-kldbg.c
lib/win32-sysdbg.c
ls-caps-vendor.c
ls-caps.c
ls-ecaps.c
ls-kernel.c
ls-map.c
ls-tree.c
ls-vpd.c
lspci.c
lspci.h
pciutils.h
setpci.c
setpci.man
tests/pri-pasid [new file with mode: 0644]
update-pciids.sh

index 0e878a6956d7181a51d0fd4906dbf5badaa71b58..228cb5693aaf7fa0297e295ec3539708eb1e67dc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -103,7 +103,7 @@ lspci$(EXEEXT): LDLIBS+=$(LIBKMOD_LIBS)
 ls-kernel.o: CFLAGS+=$(LIBKMOD_CFLAGS)
 
 update-pciids: update-pciids.sh
-       sed <$< >$@ "s@^DEST=.*@DEST=$(if $(IDSDIR),$(IDSDIR)/,)$(PCI_IDS)@;s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@"
+       sed <$< >$@ "s@^DEST=.*@DEST=$(if $(IDSDIR),$(IDSDIR)/,)$(PCI_IDS)@;s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@;s@VERSION=.*@VERSION=$(VERSION)@"
        chmod +x $@
 
 # The example of use of libpci
diff --git a/README b/README
index 1a981c299e2da5b7b17de690854f9619175aaba0..04e9348f5b5a601b31bce336e016d4f13d42dced 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 This package contains the PCI Utilities, version @VERSION@.
 
-Copyright (c) 1997--2022 Martin Mares <mj@ucw.cz>
+Copyright (c) 1997--2023 Martin Mares <mj@ucw.cz>
 
 All files in this package can be freely distributed and used according
 to the terms of the GNU General Public License, either version 2 or
index 3d69dd0b4a5ab45384fa4f86f76147f3445a3b0e..748e5a4639d8580e10beb8c270356e14ad1b6be5 100644 (file)
--- a/common.c
+++ b/common.c
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2016 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index b8fdbe2319b5a717ddadd6eda22dc9e039205508..7d6612387233da28ba25e2d2433bdc427c971648 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2022 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index 9355395c1b111dff03269c80071d59c537071a5e..028d92ae312503582d37efb72d486b225e2cb16e 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1999 Jari Kirma <kirma@cs.hut.fi>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /*
index 039c86f7e206a6bf5ec7a7bb0b85491a65eaacfa..cf1df5d581121a62978630ec864b75345199092c 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <string.h>
index 9167393efe164bba7ea757f82a68e45e0a89a13f..8ae90082c8af017a88974aa6a88a157c49b641cc 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2013 Apple, Inc.
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <errno.h>
index c0f929133973ad079ab3895cdb2bbe726f99d94e..8b7320a05ba83feccb51569d46c0f4ff47fc8cff 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index aa3b60aab386cbb6da51ed51b239c856f7441b61..961e4162d1dd1837e9a6b61d051c4d9ed3723567 100644 (file)
@@ -3,7 +3,9 @@
  *
  *      Copyright (c) 2023 Pali Rohár <pali@kernel.org>
  *
- *      Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /*
index d15c8f7eed32a14a76f950bf565b169594e715fe..92cd06e96bb8f95c4b8ac208f53b4dacef97cda3 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2022 Pali Rohár
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "internal.h"
index 604c8f02189a02fc814171989ddfd9ccdc4d7bbd..2ea5e84402e690ddbbacb2687867792104bad1c3 100644 (file)
@@ -5,7 +5,9 @@
  *     Updated in 2003 by Samy Al Bahra <samy@kerneled.com>
  *     Updated in 2017 by Imre Vadász <imrevdsz@gmail.com>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <errno.h>
index 86486d3c7d0f31e2195aa5a91f92b3877a6f0809..0301f49f93ff76e6a29f6d781817c2dfd4f83886 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1998--2022 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdlib.h>
index 6211c90fbe607d76177925b58049fbae22237fec..f7340a2b16d1f7ae4be99e418d82863107c8f6d7 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2022 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <string.h>
index 332c97b5b1e23da505709ba974a3a88516e2fb34..2bace9357f3fea3e817c2f537b70c8f8cc0f6f67 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2010 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /*
 #define PCI_EXT_CAP_ID_LMR     0x27    /* Lane Margining at Receiver */
 #define PCI_EXT_CAP_ID_HIER_ID 0x28    /* Hierarchy ID */
 #define PCI_EXT_CAP_ID_NPEM    0x29    /* Native PCIe Enclosure Management */
+#define PCI_EXT_CAP_ID_32GT    0x2a    /* Physical Layer 32.0 GT/s */
 #define PCI_EXT_CAP_ID_DOE     0x2e    /* Data Object Exchange */
 
 /*** Definitions of capabilities ***/
 #define  PCI_EXP_DEVCTL2_ARI           0x0020  /* ARI Forwarding */
 #define  PCI_EXP_DEVCTL2_ATOMICOP_REQUESTER_EN 0x0040  /* AtomicOp RequesterEnable */
 #define  PCI_EXP_DEVCTL2_ATOMICOP_EGRESS_BLOCK 0x0080  /* AtomicOp Egress Blocking */
+#define  PCI_EXP_DEVCTL2_IDO_REQ_EN    0x0100  /* Allow IDO for requests */
+#define  PCI_EXP_DEVCTL2_IDO_CMP_EN    0x0200  /* Allow IDO for completions */
 #define  PCI_EXP_DEVCTL2_LTR           0x0400  /* LTR enabled */
+#define  PCI_EXP_DEVCTL2_EPR_REQ       0x0800  /* Emergency Power Reduction Request */
 #define  PCI_EXP_DEVCTL2_10BIT_TAG_REQ 0x1000 /* 10 Bit Tag Requester enabled */
 #define  PCI_EXP_DEVCTL2_OBFF(x)               (((x) >> 13) & 3) /* OBFF enabled */
+#define  PCI_EXP_DEVCTL2_EE_TLP_BLK    0x8000  /* End-End TLP Prefix Blocking */
 #define PCI_EXP_DEVSTA2                        0x2a    /* Device Status */
 #define PCI_EXP_LNKCAP2                        0x2c    /* Link Capabilities */
 #define  PCI_EXP_LNKCAP2_SPEED(x)      (((x) >> 1) & 0x7f)
 #define  PCI_PRI_CTRL_ENABLE   0x01    /* Enable */
 #define  PCI_PRI_CTRL_RESET    0x02    /* Reset */
 #define PCI_PRI_STATUS         0x06    /* PRI status register */
-#define  PCI_PRI_STATUS_RF     0x001   /* Response Failure */
-#define  PCI_PRI_STATUS_UPRGI  0x002   /* Unexpected PRG index */
-#define  PCI_PRI_STATUS_STOPPED        0x100   /* PRI Stopped */
+#define  PCI_PRI_STATUS_RF     0x0001  /* Response Failure */
+#define  PCI_PRI_STATUS_UPRGI  0x0002  /* Unexpected PRG index */
+#define  PCI_PRI_STATUS_STOPPED        0x0100  /* PRI Stopped */
+#define  PCI_PRI_STATUS_PASID  0x8000  /* PASID required in PRG response */
 #define PCI_PRI_MAX_REQ                0x08    /* PRI max reqs supported */
 #define PCI_PRI_ALLOC_REQ      0x0c    /* PRI max reqs allowed */
 
 #define PCI_DOE_STS            0xC     /* DOE Status Register */
 #define  PCI_DOE_STS_BUSY              0x1     /* DOE Busy */
 #define  PCI_DOE_STS_INT               0x2     /* DOE Interrupt Status */
-#define  PCI_DOE_STS_ERROR             0x3     /* DOE Error */
+#define  PCI_DOE_STS_ERROR             0x4     /* DOE Error */
 #define  PCI_DOE_STS_OBJECT_READY      0x80000000 /* Data Object Ready */
 
 /*
index c5a381e78fa91999093c113f920fa34b645cb607..a9c9b893c4924297d21a452cebd963d7a0884491 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2017 Joan Lledó <jlledom@member.fsf.org>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #define _GNU_SOURCE
index 15f391b35e21b7d7b9dab6136d4908d7cff3e55d..49b70949273a74a8b03ce88dab3f5338014c5220 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2009 Francois Revol <revol@free.fr>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /* those are private syscalls */
index a8501ccdcff0366bd60cab4218ae48b8c9368067..0b71d16c3ff635bc71e0d6173cee4bbcc9ee3ed9 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <sys/io.h>
index 53f2f4e9bdc0a9760c0af400dbc02e08fc3aff99..bb295266901634dd70e7fff6593522a64f105d0f 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2010, 2017 Rudolf Marek <r.marek@assembler.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <pc.h>
index dd0094162a24005d93523f09616bd134a6472f92..ce5362be82a6d7f7dae5cc87d1e4406a2f7f2a32 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2009 Francois Revol <revol@free.fr>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <Drivers.h>
index 000fd4204ac669fa681034798b96922bde7328ef..d44b2f537e856848b06daafc4706564097ff1f9e 100644 (file)
@@ -7,7 +7,9 @@
  *                        Thomas Schwinge <tschwinge@gnu.org>
  *     Copyright (c) 2007 Thomas Schwinge <tschwinge@gnu.org>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <sys/io.h>
index a2fd69e502aaee1688e0830ee62382b55ff344e1..e6bb9b6e1187b9f9b98d7eb05622e2ca5c278496 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <sys/io.h>
index 903ad7c6a3be88ccfd206f5b81f254af64998c24..86948d9316c8063e406f9a7fedb4193ee9efa548 100644 (file)
@@ -4,7 +4,9 @@
  *     Copyright (c) 2003 Bill Moore <billm@eng.sun.com>
  *     Copyright (c) 2003--2006 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <sys/sysi86.h>
index 6bb578cb40d74c0fccefc119e66e858ad8b9b4d3..fd1a54e24b73e2a4664787936d75557d2eb2064d 100644 (file)
@@ -5,7 +5,9 @@
  *     Copyright (c) 2006 Martin Mares <mj@ucw.cz>
  *     Copyright (c) 2021 Pali Rohár <pali@kernel.org>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <io.h>
index 0ca87ddda2ab731448dcd12912fc644eda7425e8..1e2c4028e08dca240bee387c9b0d0e443cf76f5f 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #define _GNU_SOURCE
index fe40f91ccc36c1d4fd5c52595116ab78899f1340..347668163f7a9f9a0b6d75227022b19f5a4ae3b8 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2018 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index ebd16f45648b746dd65a22a90e4cac6733e81ac4..00ac401ec5a3e07d3165b391d59b7ec9d01dd0c1 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2022 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "config.h"
index a9e23c34966365f96266ae5a2130b51c3df57525..f380cb3ec63b2bcb984b3f9071dc50aa65f0aeed 100644 (file)
@@ -3,7 +3,9 @@
  *
  *      Copyright (c) 2022 Pali Rohár <pali@kernel.org>
  *
- *      Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /*
index ba5de6d678f71d18fbb2476dced4f237d3d9b28b..65bfb85acbc5bf76e70bd5515b0fa08f9efc1b62 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2008--2009 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "internal.h"
index 2f5bc3cf21e9bd807753f93d8b206c10877ec065..8c7567604acb8595b05e0e7b42f3a514a458e098 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <string.h>
index 171723b68639c29578087d8ebf900cd6c584610c..71e7229470eacfe341fd4a023c9583fe576785f1 100644 (file)
@@ -4,7 +4,9 @@
  *     Copyright (c) 2013--2014 Tom Gundersen <teg@jklm.no>
  *     Copyright (c) 2014 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <string.h>
index 95a6fd2654cd26cb378efad050b8fbd225bc1e07..14141f4c2be879cd6d96e740422f3acea16d9579 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2007--2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <string.h>
index c86f8af3462f158b9ffabadffaf2dff1bcf1481a..f50b8ecd3dacb157e8d31252704064f4318e11f8 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index a4314f61c91be1128678a8fa86df283407e20b69..f8d39971c84ffb1759d2daee87d7539e4868d554 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2014 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index d7e71ff7183a8edd67123b4edb4e24d6ec10db17..b34e3e645e6fe30842919aac0cd4ec6247a2100e 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2014 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #define MAX_LINE 1024
index 2b2ca4166d2a762ef9b5648d1fd112ce34cd1505..0f9f27b0f11b89747df9b8309bee4416ea4ee038 100644 (file)
@@ -6,7 +6,9 @@
  *      Copyright (c) 2002 Quentin Garnier <cube@cubidou.net>
  *     Copyright (c) 2002 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /*
index 71cde5eb32c48bcb2fdec7c439c5409fd36c1b36..e2e7652bcd75b32418af6d23e8561c0fca410639 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Adapted from fbsd-device.c by Matthieu Herrb <matthieu.herrb@laas.fr>, 2006
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <fcntl.h>
index 979fb16dcaa53b41dcf29ca1f22a173cf249c4be..ac756ad79a313661e13f3d67cf85ec5e3cd43bf6 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2008--2023 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index cb032a13f119b1b52313092373445dec4e305cea..2322bf73be8433875c8f4dde629f21d34aafbd47 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2023 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #ifndef _PCI_LIB_H
index 3db90e3e182a3a82912660905598cd462de35962..99a91b2d6c55040c237e232a3df3cab5af991cb8 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /*
index 9b33863e69e68cfdbc42821c2d87b9fcbd647359..2eb5dc5b43e3c8612f05660b6924e8e1aac97e83 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #define _GNU_SOURCE
index 07195d562a6f0b092ceb7c7206fae91c92254095..170ae02bf644841a25a3c2cc8e29f52a180cc95b 100644 (file)
@@ -1,9 +1,11 @@
 /*
- *  The PCI Library -- Direct Configuration access via SylixOS Ports
+ *     The PCI Library -- Direct Configuration access via SylixOS Ports
  *
- *  Copyright (c) 2018 YuJian.Gong <gongyujian@acoinfo.com>
+ *     Copyright (c) 2018 YuJian.Gong <gongyujian@acoinfo.com>
  *
- *  Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #define _GNU_SOURCE
index bdeb34a193f9d6b22479dd5d58a6da3eb7afa4ff..750203573f006dd1b088a00e0ec4f788ece2ee15 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2020 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #ifdef __GNUC__
index ffa4f9d63d34916fe91945b0e83040049d95c564..1bb4ae91595b9a97cce656cd63c68db3145a5382 100644 (file)
@@ -4,7 +4,9 @@
  *     Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
  *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #define _GNU_SOURCE
@@ -564,7 +566,7 @@ static int sysfs_write(struct pci_dev *d, int pos, byte *buf, int len)
 
 /* pread() is not available and do_read() only works for a single fd, so we
  * cannot implement read_vpd properly. */
-static int sysfs_read_vpd(struct pci_dev *d, int pos, byte *buf, int len)
+static int sysfs_read_vpd(struct pci_dev *d UNUSED, int pos UNUSED, byte *buf UNUSED, int len UNUSED)
 {
   return 0;
 }
index ab53f7c8bb9c741cf1a2eb53e7325bc54c7fba62..200490648bfed104a9a356f2de88e770ee64528c 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2022 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <sys/types.h>
index 9743002af73c7c49637dff11db7d4e99b2cc9d59..0bcc0aa3c06bbbd0e2ae21b2b740349780238287 100644 (file)
@@ -3,7 +3,9 @@
  *
  *      Copyright (c) 2021 Pali Rohár <pali@kernel.org>
  *
- *      Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <windows.h>
index 4c8ee5405496e6b006421bf99dc5c3f8533b536c..9593a05efd22fcf9ed9a130e066d9f7b26eb94b3 100644 (file)
@@ -3,7 +3,9 @@
  *
  *      Copyright (c) 2022 Pali Rohár <pali@kernel.org>
  *
- *      Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <windows.h>
index 5d0c07a733624883ef598b4ecddbd6a19a83ff35..6b17f3774a1a6de6fbc02ee5a89d9385c2736036 100644 (file)
@@ -3,7 +3,9 @@
  *
  *      Copyright (c) 2022 Pali Rohár <pali@kernel.org>
  *
- *      Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <windows.h>
index dc24f90002a2f7bc1753d38b465f0af1ff829387..62ee586dcd6de978162cb8e5c7b813fe7fe4df96 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2014 Gerd Hoffmann <kraxel@redhat.com>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
@@ -62,11 +64,11 @@ show_vendor_caps_virtio(struct device *d, int where, int cap)
 static int
 do_show_vendor_caps(struct device *d, int where, int cap)
 {
-  switch (get_conf_word(d, PCI_VENDOR_ID))
+  switch (d->dev->vendor_id)
     {
     case 0x1af4: /* Red Hat */
-      if (get_conf_word(d, PCI_DEVICE_ID) >= 0x1000 &&
-         get_conf_word(d, PCI_DEVICE_ID) <= 0x107f)
+      if (d->dev->device_id >= 0x1000 &&
+         d->dev->device_id <= 0x107f)
        return show_vendor_caps_virtio(d, where, cap);
       break;
     }
index a481b16b8578a9e717954be8629c07244d15e04b..2c99812c4ed25cdb72c7c71054b53365ec78675c 100644 (file)
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2018 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
@@ -839,7 +841,7 @@ static void cap_express_link(struct device *d, int where, int type)
   if ((type == PCI_EXP_TYPE_ROOT_PORT) || (type == PCI_EXP_TYPE_ENDPOINT) ||
       (type == PCI_EXP_TYPE_LEG_END) || (type == PCI_EXP_TYPE_PCI_BRIDGE))
     printf(" RCB %d bytes,", w & PCI_EXP_LNKCTL_RCB ? 128 : 64);
-  printf(" Disabled%c CommClk%c\n\t\t\tExtSynch%c ClockPM%c AutWidDis%c BWInt%c AutBWInt%c\n",
+  printf(" LnkDisable%c CommClk%c\n\t\t\tExtSynch%c ClockPM%c AutWidDis%c BWInt%c AutBWInt%c\n",
        FLAG(w, PCI_EXP_LNKCTL_DISABLE),
        FLAG(w, PCI_EXP_LNKCTL_CLOCK),
        FLAG(w, PCI_EXP_LNKCTL_XSYNCH),
@@ -1151,12 +1153,9 @@ static void cap_express_dev2(struct device *d, int where, int type)
     }
 
   w = get_conf_word(d, where + PCI_EXP_DEVCTL2);
-  printf("\t\tDevCtl2: Completion Timeout: %s, TimeoutDis%c LTR%c 10BitTagReq%c OBFF %s,",
+  printf("\t\tDevCtl2: Completion Timeout: %s, TimeoutDis%c",
        cap_express_dev2_timeout_value(PCI_EXP_DEVCTL2_TIMEOUT_VALUE(w)),
-       FLAG(w, PCI_EXP_DEVCTL2_TIMEOUT_DIS),
-       FLAG(w, PCI_EXP_DEVCTL2_LTR),
-       FLAG(w, PCI_EXP_DEVCTL2_10BIT_TAG_REQ),
-       cap_express_devctl2_obff(PCI_EXP_DEVCTL2_OBFF(w)));
+       FLAG(w, PCI_EXP_DEVCTL2_TIMEOUT_DIS));
   if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_DOWNSTREAM)
     printf(" ARIFwd%c\n", FLAG(w, PCI_EXP_DEVCTL2_ARI));
   else
@@ -1174,6 +1173,15 @@ static void cap_express_dev2(struct device *d, int where, int type)
         printf(" EgressBlck%c", FLAG(w, PCI_EXP_DEVCTL2_ATOMICOP_EGRESS_BLOCK));
       printf("\n");
     }
+  printf("\t\t\t IDOReq%c IDOCompl%c LTR%c EmergencyPowerReductionReq%c\n",
+       FLAG(w, PCI_EXP_DEVCTL2_IDO_REQ_EN),
+       FLAG(w, PCI_EXP_DEVCTL2_IDO_CMP_EN),
+       FLAG(w, PCI_EXP_DEVCTL2_LTR),
+       FLAG(w, PCI_EXP_DEVCTL2_EPR_REQ));
+  printf("\t\t\t 10BitTagReq%c OBFF %s, EETLPPrefixBlk%c\n",
+       FLAG(w, PCI_EXP_DEVCTL2_10BIT_TAG_REQ),
+       cap_express_devctl2_obff(PCI_EXP_DEVCTL2_OBFF(w)),
+       FLAG(w, PCI_EXP_DEVCTL2_EE_TLP_BLK));
 }
 
 static const char *cap_express_link2_speed_cap(int vector)
@@ -1183,8 +1191,10 @@ static const char *cap_express_link2_speed_cap(int vector)
    * permitted to skip support for any data rates between 2.5GT/s and the
    * highest supported rate.
    */
-  if (vector & 0x60)
+  if (vector & 0x40)
     return "RsvdP";
+  if (vector & 0x20)
+    return "2.5-64GT/s";
   if (vector & 0x10)
     return "2.5-32GT/s";
   if (vector & 0x08)
@@ -1428,7 +1438,7 @@ cap_express(struct device *d, int where, int cap)
     default:
       printf("Unknown type %d", type);
   }
-  printf(", MSI %02x\n", (cap & PCI_EXP_FLAGS_IRQ) >> 9);
+  printf(", IntMsgNum %d\n", (cap & PCI_EXP_FLAGS_IRQ) >> 9);
   if (verbose < 2)
     return type;
 
index f58a5ff6127914b4dcaf845aefd75f917f45a04b..77381c9a00c5407949f1110bafefa8e1538cbacf 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2022 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
@@ -189,7 +191,7 @@ cap_aer(struct device *d, int where, int type)
 
       l = get_conf_long(d, where + PCI_ERR_ROOT_STATUS);
       printf("\t\tRootSta: CERcvd%c MultCERcvd%c UERcvd%c MultUERcvd%c\n"
-           "\t\t\t FirstFatal%c NonFatalMsg%c FatalMsg%c IntMsg %d\n",
+           "\t\t\t FirstFatal%c NonFatalMsg%c FatalMsg%c IntMsgNum %d\n",
            FLAG(l, PCI_ERR_ROOT_COR_RCV),
            FLAG(l, PCI_ERR_ROOT_MULTI_COR_RCV),
            FLAG(l, PCI_ERR_ROOT_UNCOR_RCV),
@@ -219,7 +221,7 @@ static void cap_dpc(struct device *d, int where)
     return;
 
   l = get_conf_word(d, where + PCI_DPC_CAP);
-  printf("\t\tDpcCap:\tINT Msg #%d, RPExt%c PoisonedTLP%c SwTrigger%c RP PIO Log %d, DL_ActiveErr%c\n",
+  printf("\t\tDpcCap:\tIntMsgNum %d, RPExt%c PoisonedTLP%c SwTrigger%c RP PIO Log %d, DL_ActiveErr%c\n",
     PCI_DPC_CAP_INT_MSG(l), FLAG(l, PCI_DPC_CAP_RP_EXT), FLAG(l, PCI_DPC_CAP_TLP_BLOCK),
     FLAG(l, PCI_DPC_CAP_SW_TRIGGER), PCI_DPC_CAP_RP_LOG(l), FLAG(l, PCI_DPC_CAP_DL_ACT_ERR));
 
@@ -322,9 +324,9 @@ cap_pri(struct device *d, int where)
   printf("\t\tPRICtl: Enable%c Reset%c\n",
        FLAG(w, PCI_PRI_CTRL_ENABLE), FLAG(w, PCI_PRI_CTRL_RESET));
   w = get_conf_word(d, where + PCI_PRI_STATUS);
-  printf("\t\tPRISta: RF%c UPRGI%c Stopped%c\n",
+  printf("\t\tPRISta: RF%c UPRGI%c Stopped%c PASID%c\n",
        FLAG(w, PCI_PRI_STATUS_RF), FLAG(w, PCI_PRI_STATUS_UPRGI),
-       FLAG(w, PCI_PRI_STATUS_STOPPED));
+       FLAG(w, PCI_PRI_STATUS_STOPPED), FLAG(w, PCI_PRI_STATUS_PASID));
   l = get_conf_long(d, where + PCI_PRI_MAX_REQ);
   printf("\t\tPage Request Capacity: %08x, ", l);
   l = get_conf_long(d, where + PCI_PRI_ALLOC_REQ);
@@ -369,7 +371,7 @@ cap_sriov(struct device *d, int where)
     return;
 
   l = get_conf_long(d, where + PCI_IOV_CAP);
-  printf("\t\tIOVCap:\tMigration%c 10BitTagReq%c Interrupt Message Number: %03x\n",
+  printf("\t\tIOVCap:\tMigration%c 10BitTagReq%c IntMsgNum %d\n",
        FLAG(l, PCI_IOV_CAP_VFM), FLAG(l, PCI_IOV_CAP_VF_10BIT_TAG_REQ), PCI_IOV_CAP_IMN(l));
   w = get_conf_word(d, where + PCI_IOV_CTRL);
   printf("\t\tIOVCtl:\tEnable%c Migration%c Interrupt%c MSE%c ARIHierarchy%c 10BitTagReq%c\n",
@@ -1310,7 +1312,7 @@ cap_ptm(struct device *d, int where)
 
   buff = get_conf_long(d, where + 4);
   printf("\t\tPTMCap: ");
-  printf("Requester:%c Responder:%c Root:%c\n",
+  printf("Requester%c Responder%c Root%c\n",
     FLAG(buff, 0x1),
     FLAG(buff, 0x2),
     FLAG(buff, 0x4));
@@ -1331,7 +1333,7 @@ cap_ptm(struct device *d, int where)
 
   buff = get_conf_long(d, where + 8);
   printf("\t\tPTMControl: ");
-  printf("Enabled:%c RootSelected:%c\n",
+  printf("Enabled%c RootSelected%c\n",
     FLAG(buff, 0x1),
     FLAG(buff, 0x2));
 
@@ -1459,7 +1461,7 @@ cap_doe(struct device *d, int where)
   printf("\t\tDOECap: IntSup%c\n",
         FLAG(l, PCI_DOE_CAP_INT_SUPP));
   if (l & PCI_DOE_CAP_INT_SUPP)
-    printf("\t\t\tInterrupt Message Number %03x\n",
+    printf("\t\t\tIntMsgNum %d\n",
           PCI_DOE_CAP_INT_MSG(l));
 
   l = get_conf_long(d, where + PCI_DOE_CTL);
@@ -1621,6 +1623,9 @@ show_ext_caps(struct device *d, int type)
          case PCI_EXT_CAP_ID_NPEM:
            printf("Native PCIe Enclosure Management <?>\n");
            break;
+      case PCI_EXT_CAP_ID_32GT:
+           printf("Physical Layer 32.0 GT/s <?>\n");
+        break;
          case PCI_EXT_CAP_ID_DOE:
            cap_doe(d, where);
            break;
index b90a469f7056f69c5d3adc72b1674002b7aecedf..c939c52867e61ac76c67fddd12dcc7b043bc328f 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2013 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index 9b2cc8cfa72db2a248ea323cf522b7ff36638f6e..a77eb0c85f55ab3b9bc176be358f6bf234900bc2 100644 (file)
--- a/ls-map.c
+++ b/ls-map.c
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index e21e44ce3cdb9160ce4a3248943ba38e5f9221c7..5189930e70f2cb1dd6f7628ca7cf656cf3fd9c64 100644 (file)
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2021 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdarg.h>
index 92627e4f403f81e7bec5f1ad854daa9613dbcf5f..fcb80ae030eabdc2d61378103349908cc58f4f0e 100644 (file)
--- a/ls-vpd.c
+++ b/ls-vpd.c
@@ -6,7 +6,9 @@
  *     Written by Ben Hutchings <bhutchings@solarflare.com>
  *     Improved by Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
diff --git a/lspci.c b/lspci.c
index 0a96260829d891392a1bca6efbf178e7eeb07bdd..9452cd31a2b0a830f876fd11e13239fd625f9106 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2020 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
diff --git a/lspci.h b/lspci.h
index 160c65a2a968ddde2c1721e8ca7ecd407a06504e..c5a9ec726871770cbeb23206a2530c63610997a1 100644 (file)
--- a/lspci.h
+++ b/lspci.h
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2018 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #define PCIUTILS_LSPCI
index 17e02c9bb82db78eedab52c5540d5378b1db10a3..95c26e64f3d00e19c8b5424e65f3fd4112c3a290 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2018 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "lib/pci.h"
index ca1f31df4c5a158559e13e8d1280188bbfa98d18..d2df573400205b268792c162a45758b6c5037bc8 100644 (file)
--- a/setpci.c
+++ b/setpci.c
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1998--2020 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdio.h>
index 9e4e1d8a6c44c2963b33449cd1c8ee4dddb191ea..fd4495f4d1b4e740af207b22cd33eca024e82277 100644 (file)
@@ -135,7 +135,7 @@ are hexadecimal numbers. In the latter case, only the bits corresponding to bina
 ones in the \fImask\fP are changed (technically, this is a read-modify-write operation).
 
 .PP
-There are several ways how to identity a register:
+There are several ways to identify a register:
 .IP \(bu
 Tell its address in hexadecimal.
 .IP \(bu
diff --git a/tests/pri-pasid b/tests/pri-pasid
new file mode 100644 (file)
index 0000000..9fc8c09
--- /dev/null
@@ -0,0 +1,325 @@
+6a:01.0 Class 0880: Device 8086:0b25
+       Subsystem: Device 8086:0000
+       Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
+       Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
+       Latency: 0
+       NUMA node: 0
+       IOMMU group: 38
+       Region 0: Memory at 206ffff40000 (64-bit, prefetchable) [size=64K]
+       Region 2: Memory at 206ffff00000 (64-bit, prefetchable) [size=128K]
+       Capabilities: [40] Express (v2) Root Complex Integrated Endpoint, MSI 00
+               DevCap: MaxPayload 512 bytes, PhantFunc 0
+                       ExtTag+ RBE+ FLReset+
+               DevCtl: CorrErr+ NonFatalErr+ FatalErr+ UnsupReq-
+                       RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+ FLReset-
+                       MaxPayload 512 bytes, MaxReadReq 4096 bytes
+               DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr- TransPend-
+               DevCap2: Completion Timeout: Not Supported, TimeoutDis+ NROPrPrP- LTR+
+                        10BitTagComp+ 10BitTagReq+ OBFF Not Supported, ExtFmt+ EETLPPrefix+, MaxEETLPPrefixes 1
+                        EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
+                        FRS-
+                        AtomicOpsCap: 32bit- 64bit- 128bitCAS-
+               DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis+ LTR- 10BitTagReq+ OBFF Disabled,
+                        AtomicOpsCtl: ReqEn-
+       Capabilities: [80] MSI-X: Enable+ Count=9 Masked-
+               Vector table: BAR=0 offset=00002000
+               PBA: BAR=0 offset=00003000
+       Capabilities: [90] Power Management version 3
+               Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
+               Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
+       Capabilities: [100 v2] Advanced Error Reporting
+               UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
+               UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-
+               UESvrt: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP+ ECRC- UnsupReq- ACSViol-
+               CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
+               CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
+               AERCap: First Error Pointer: 00, ECRCGenCap- ECRCGenEn- ECRCChkCap- ECRCChkEn-
+                       MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
+               HeaderLog: 00000000 00000000 00000000 00000000
+       Capabilities: [150 v1] Latency Tolerance Reporting
+               Max snoop latency: 0ns
+               Max no snoop latency: 0ns
+       Capabilities: [160 v1] Transaction Processing Hints
+               Device specific mode supported
+               Steering table in TPH capability structure
+       Capabilities: [170 v1] Virtual Channel
+               Caps:   LPEVC=1 RefClk=100ns PATEntryBits=1
+               Arb:    Fixed+ WRR32- WRR64- WRR128-
+               Ctrl:   ArbSelect=Fixed
+               Status: InProgress-
+               VC0:    Caps:   PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
+                       Arb:    Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
+                       Ctrl:   Enable+ ID=0 ArbSelect=Fixed TC/VC=fd
+                       Status: NegoPending- InProgress-
+               VC1:    Caps:   PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
+                       Arb:    Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
+                       Ctrl:   Enable+ ID=1 ArbSelect=Fixed TC/VC=02
+                       Status: NegoPending- InProgress-
+       Capabilities: [200 v1] Designated Vendor-Specific: Vendor=8086 ID=0005 Rev=0 Len=24 <?>
+       Capabilities: [220 v1] Address Translation Service (ATS)
+               ATSCap: Invalidate Queue Depth: 00
+               ATSCtl: Enable+, Smallest Translation Unit: 00
+       Capabilities: [230 v1] Process Address Space ID (PASID)
+               PASIDCap: Exec- Priv+, Max PASID Width: 14
+               PASIDCtl: Enable+ Exec- Priv+
+       Capabilities: [240 v1] Page Request Interface (PRI)
+               PRICtl: Enable- Reset-
+               PRISta: RF- UPRGI- Stopped+ PASID+
+               Page Request Capacity: 00000200, Page Request Allocation: 00000000
+       Kernel driver in use: idxd
+00: 86 80 25 0b 46 01 10 00 00 00 80 08 00 00 00 00
+10: 0c 00 f4 ff 6f 20 00 00 0c 00 f0 ff 6f 20 00 00
+20: 00 00 00 00 00 00 00 00 00 00 00 00 86 80 00 00
+30: 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00
+40: 10 80 92 00 22 80 00 10 57 59 00 00 00 00 00 00
+50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+60: 00 00 00 00 10 08 73 10 10 10 00 00 00 00 00 00
+70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+80: 11 90 08 80 00 20 00 00 00 30 00 00 00 00 00 00
+90: 01 00 03 00 08 00 00 00 00 00 00 00 00 00 00 00
+a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+100: 01 00 02 15 00 00 00 00 00 00 10 00 00 00 04 00
+110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+150: 18 00 01 16 00 00 00 00 00 00 00 00 00 00 00 00
+160: 17 00 01 17 05 02 01 00 02 01 00 00 00 00 0a 00
+170: 02 00 01 20 11 00 00 00 01 00 00 00 00 00 00 00
+180: 00 00 00 00 fd 00 00 80 00 00 00 00 00 00 00 00
+190: 02 00 00 81 00 00 00 00 00 00 00 00 00 00 00 00
+1a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+200: 23 00 01 22 86 80 80 01 05 00 00 00 01 00 00 00
+210: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
+220: 0f 00 01 23 60 00 00 80 00 00 00 00 00 00 00 00
+230: 1b 00 01 24 04 14 05 00 00 00 00 00 00 00 00 00
+240: 13 00 01 00 00 00 00 81 00 02 00 00 00 00 00 00
+250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+2a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+2b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+2c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+2d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+2e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+2f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+350: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+3a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+3b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+3c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+3d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+3e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+3f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+410: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+4a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+4b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+4c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+4d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+4e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+4f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+500: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+510: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+520: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+530: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+540: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+550: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+560: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+570: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+590: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+5a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+5b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+5c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+5d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+5e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+5f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+620: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+630: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+640: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+6a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+6b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+6c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+6d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+6e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+6f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+710: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+730: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+740: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+760: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+770: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+790: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+7a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+7b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+7c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+7d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+7e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+7f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+810: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+820: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+830: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+840: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+850: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+860: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+870: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+8a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+8b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+8c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+8d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+8e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+8f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+950: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+960: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+970: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+9a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+9b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+9c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+9d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+9e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+9f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+aa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ac0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+bb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+bc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+bd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+be0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+bf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ca0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+cb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+cc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+cd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ce0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+cf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+da0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+db0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+dc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+dd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+de0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+df0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+eb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+fa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
index 929f6af716ec8dbe03870aaa9bb3e285544fd18e..607502ad45a51a033cc336eac5ca538e2af91202 100755 (executable)
@@ -6,6 +6,9 @@ SRC="https://pci-ids.ucw.cz/v2.2/pci.ids"
 DEST=pci.ids
 PCI_COMPRESSED_IDS=
 GREP=grep
+VERSION=unknown
+USER_AGENT=update-pciids/$VERSION
+QUIET=
 
 [ "$1" = "-q" ] && quiet=true || quiet=false
 
@@ -16,10 +19,9 @@ if ! touch ${DEST} >/dev/null 2>&1 ; then
        exit 1
 fi
 
-if [ "$PCI_COMPRESSED_IDS" = 1 ] ; then
-       DECOMP="cat"
-       SRC="$SRC.gz"
-       GREP=zgrep
+if command -v xz >/dev/null 2>&1 ; then
+       DECOMP="xz -d"
+       SRC="$SRC.xz"
 elif command -v bzip2 >/dev/null 2>&1 ; then
        DECOMP="bzip2 -d"
        SRC="$SRC.bz2"
@@ -31,30 +33,39 @@ else
 fi
 
 if command -v curl >/dev/null 2>&1 ; then
-       DL="curl -o $DEST.new $SRC"
-       ${quiet} && DL="$DL -s -S"
+       ${quiet} && QUIET="-s -S"
+       dl ()
+       {
+               curl -o $DEST.new --user-agent "$USER_AGENT curl" $QUIET $SRC
+       }
 elif command -v wget >/dev/null 2>&1 ; then
-       DL="wget --no-timestamping -O $DEST.new $SRC"
-       ${quiet} && DL="$DL -q"
+       ${quiet} && QUIET="-q"
+       dl ()
+       {
+               wget --no-timestamping -O $DEST.new --user-agent "$USER_AGENT wget" $QUIET $SRC
+       }
 elif command -v lynx >/dev/null 2>&1 ; then
-       DL="eval lynx -source $SRC >$DEST.new"
+       dl ()
+       {
+               lynx -source -useragent="$USER_AGENT lynx" $SRC >$DEST.new
+       }
 else
        echo >&2 "update-pciids: cannot find curl, wget or lynx"
        exit 1
 fi
 
-if ! $DL ; then
+if ! dl ; then
        echo >&2 "update-pciids: download failed"
        rm -f $DEST.new
        exit 1
 fi
 
-if ! $DECOMP <$DEST.new >$DEST.neww ; then
+if ! $DECOMP <$DEST.new >$DEST.new.plain ; then
        echo >&2 "update-pciids: decompression failed, probably truncated file"
        exit 1
 fi
 
-if ! $GREP >/dev/null "^C " $DEST.neww ; then
+if ! $GREP >/dev/null "^C " $DEST.new.plain ; then
        echo >&2 "update-pciids: missing class info, probably truncated file"
        exit 1
 fi
@@ -62,10 +73,20 @@ fi
 if [ -f $DEST ] ; then
        ln -f $DEST $DEST.old
        # --reference is supported only by chmod from GNU file, so let's ignore any errors
-       chmod -f --reference=$DEST.old $DEST.neww 2>/dev/null || true
+       chmod -f --reference=$DEST.old $DEST.new $DEST.new.plain 2>/dev/null || true
+fi
+
+if [ "$PCI_COMPRESSED_IDS" = 1 ] ; then
+       if [ "${SRC%.gz}" != .gz ] ; then
+               # Recompress to gzip
+               gzip <$DEST.new.plain >$DEST.new
+       fi
+       mv $DEST.new $DEST
+       rm -f $DEST.new.plain
+else
+       mv $DEST.new.plain $DEST
+       rm -f $DEST.new
 fi
-mv $DEST.neww $DEST
-rm $DEST.new
 
 # Older versions did not compress the ids file, so let's make sure we
 # clean that up.