summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 04:06:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 04:06:28 +0000
commitc8d39e2d64b10a9bc0d0dd481ca0323143e0f9c2 (patch)
tree0812b7b48c7106bddf20aec32dceaaeaf6935e9a /lib
parentReleasing progress-linux version 1:3.12.0-1~progress7.99u1. (diff)
downloadpciutils-c8d39e2d64b10a9bc0d0dd481ca0323143e0f9c2.tar.xz
pciutils-c8d39e2d64b10a9bc0d0dd481ca0323143e0f9c2.zip
Merging upstream version 1:3.13.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/access.c22
-rw-r--r--lib/caps.c2
-rw-r--r--lib/dump.c3
-rw-r--r--lib/filter.c6
-rw-r--r--lib/header.h13
-rw-r--r--lib/internal.h1
-rw-r--r--lib/libpci.ver5
-rw-r--r--lib/pci.h6
-rw-r--r--lib/sysfs.c14
9 files changed, 55 insertions, 17 deletions
diff --git a/lib/access.c b/lib/access.c
index 7d66123..baaabcb 100644
--- a/lib/access.c
+++ b/lib/access.c
@@ -191,7 +191,7 @@ pci_reset_properties(struct pci_dev *d)
}
int
-pci_fill_info_v38(struct pci_dev *d, int flags)
+pci_fill_info_v313(struct pci_dev *d, int flags)
{
unsigned int uflags = flags;
if (uflags & PCI_FILL_RESCAN)
@@ -205,21 +205,23 @@ pci_fill_info_v38(struct pci_dev *d, int flags)
}
/* In version 3.1, pci_fill_info got new flags => versioned alias */
-/* In versions 3.2, 3.3, 3.4, 3.5 and 3.8, the same has happened */
-STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v38(d, flags));
-DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v38);
-DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v38);
-DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v38);
-DEFINE_ALIAS(int pci_fill_info_v33(struct pci_dev *d, int flags), pci_fill_info_v38);
-DEFINE_ALIAS(int pci_fill_info_v34(struct pci_dev *d, int flags), pci_fill_info_v38);
-DEFINE_ALIAS(int pci_fill_info_v35(struct pci_dev *d, int flags), pci_fill_info_v38);
+/* In versions 3.2, 3.3, 3.4, 3.5, 3.8 and 3.12, the same has happened */
+STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v313(d, flags));
+DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v313);
+DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v313);
+DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v313);
+DEFINE_ALIAS(int pci_fill_info_v33(struct pci_dev *d, int flags), pci_fill_info_v313);
+DEFINE_ALIAS(int pci_fill_info_v34(struct pci_dev *d, int flags), pci_fill_info_v313);
+DEFINE_ALIAS(int pci_fill_info_v35(struct pci_dev *d, int flags), pci_fill_info_v313);
+DEFINE_ALIAS(int pci_fill_info_v38(struct pci_dev *d, int flags), pci_fill_info_v313);
SYMBOL_VERSION(pci_fill_info_v30, pci_fill_info@LIBPCI_3.0);
SYMBOL_VERSION(pci_fill_info_v31, pci_fill_info@LIBPCI_3.1);
SYMBOL_VERSION(pci_fill_info_v32, pci_fill_info@LIBPCI_3.2);
SYMBOL_VERSION(pci_fill_info_v33, pci_fill_info@LIBPCI_3.3);
SYMBOL_VERSION(pci_fill_info_v34, pci_fill_info@LIBPCI_3.4);
SYMBOL_VERSION(pci_fill_info_v35, pci_fill_info@LIBPCI_3.5);
-SYMBOL_VERSION(pci_fill_info_v38, pci_fill_info@@LIBPCI_3.8);
+SYMBOL_VERSION(pci_fill_info_v38, pci_fill_info@LIBPCI_3.8);
+SYMBOL_VERSION(pci_fill_info_v313, pci_fill_info@@LIBPCI_3.13);
void
pci_setup_cache(struct pci_dev *d, byte *cache, int len)
diff --git a/lib/caps.c b/lib/caps.c
index cf1df5d..6b39c10 100644
--- a/lib/caps.c
+++ b/lib/caps.c
@@ -130,7 +130,7 @@ pci_find_cap_nr(struct pci_dev *d, unsigned int id, unsigned int type,
unsigned int target = (cap_number ? *cap_number : 0);
unsigned int index = 0;
- pci_fill_info_v38(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
+ pci_fill_info_v313(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
for (c=d->first_cap; c; c=c->next)
{
diff --git a/lib/dump.c b/lib/dump.c
index 5f4ba2e..00ebc9e 100644
--- a/lib/dump.c
+++ b/lib/dump.c
@@ -83,7 +83,8 @@ dump_init(struct pci_access *a)
mn = 0;
if (dump_validate(buf, "##:##.# ") && sscanf(buf, "%x:%x.%d", &bn, &dn, &fn) == 3 ||
dump_validate(buf, "####:##:##.# ") && sscanf(buf, "%x:%x:%x.%d", &mn, &bn, &dn, &fn) == 4 ||
- dump_validate(buf, "#####:##:##.# ") && sscanf(buf, "%x:%x:%x.%d", &mn, &bn, &dn, &fn) == 4)
+ dump_validate(buf, "#####:##:##.# ") && sscanf(buf, "%x:%x:%x.%d", &mn, &bn, &dn, &fn) == 4 ||
+ dump_validate(buf, "######:##:##.# ") && sscanf(buf, "%x:%x:%x.%d", &mn, &bn, &dn, &fn) == 4)
{
dev = pci_get_dev(a, mn, bn, dn, fn);
dump_alloc_data(dev, 256);
diff --git a/lib/filter.c b/lib/filter.c
index 0301f49..4221f57 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -204,20 +204,20 @@ pci_filter_match_v38(struct pci_filter *f, struct pci_dev *d)
return 0;
if (f->device >= 0 || f->vendor >= 0)
{
- pci_fill_info_v38(d, PCI_FILL_IDENT);
+ pci_fill_info_v313(d, PCI_FILL_IDENT);
if ((f->device >= 0 && f->device != d->device_id) ||
(f->vendor >= 0 && f->vendor != d->vendor_id))
return 0;
}
if (f->device_class >= 0)
{
- pci_fill_info_v38(d, PCI_FILL_CLASS);
+ pci_fill_info_v313(d, PCI_FILL_CLASS);
if ((f->device_class ^ d->device_class) & f->device_class_mask)
return 0;
}
if (f->prog_if >= 0)
{
- pci_fill_info_v38(d, PCI_FILL_CLASS_EXT);
+ pci_fill_info_v313(d, PCI_FILL_CLASS_EXT);
if (f->prog_if != d->prog_if)
return 0;
}
diff --git a/lib/header.h b/lib/header.h
index 0b0ed9a..0827ac0 100644
--- a/lib/header.h
+++ b/lib/header.h
@@ -993,6 +993,16 @@
#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */
#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */
#define PCI_ERR_UNC_ACS_VIOL 0x00200000 /* ACS Violation */
+#define PCI_ERR_UNC_INTERNAL 0x00400000 /* Uncorrectable Internal Error */
+#define PCI_ERR_UNC_MC_BLOCKED_TLP 0x00800000 /* MC Blocked TLP */
+#define PCI_ERR_UNC_ATOMICOP_EGRESS_BLOCKED 0x01000000 /* AtomicOp Egress Blocked */
+#define PCI_ERR_UNC_TLP_PREFIX_BLOCKED 0x02000000 /* TLP Prefix Blocked Error */
+#define PCI_ERR_UNC_POISONED_TLP_EGRESS 0x04000000 /* Poisoned TLP Egress Blocked */
+#define PCI_ERR_UNC_DMWR_REQ_EGRESS_BLOCKED 0x08000000 /* DMWr Request Egress Blocked */
+#define PCI_ERR_UNC_IDE_CHECK 0x10000000 /* IDE Check Failed */
+#define PCI_ERR_UNC_MISR_IDE_TLP 0x20000000 /* Misrouted IDE TLP */
+#define PCI_ERR_UNC_PCRC_CHECK 0x40000000 /* PCRC Check Failed */
+#define PCI_ERR_UNC_TLP_XLAT_EGRESS_BLOCKED 0x80000000 /* TLP Translation Egress Blocked */
#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */
/* Same bits as above */
#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */
@@ -1004,6 +1014,8 @@
#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */
#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */
#define PCI_ERR_COR_REP_ANFE 0x00002000 /* Advisory Non-Fatal Error */
+#define PCI_ERR_COR_INTERNAL 0x00004000 /* Corrected Internal Error */
+#define PCI_ERR_COR_HDRLOG_OVER 0x00008000 /* Header Log Overflow */
#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */
/* Same bits as above */
#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */
@@ -1464,6 +1476,7 @@
#define PCI_IDE_SEL_CTL_TX_AGGR_PR(x) (((x) >> 4) & 0x3) /* Tx Aggregation Mode PR */
#define PCI_IDE_SEL_CTL_TX_AGGR_CPL(x) (((x) >> 6) & 0x3) /* Tx Aggregation Mode CPL */
#define PCI_IDE_SEL_CTL_PCRC_EN 0x100 /* PCRC Enable */
+#define PCI_IDE_SEL_CTL_CFG_EN 0x200 /* Selective IDE for Configuration Requests Enable */
#define PCI_IDE_SEL_CTL_PART_ENC(x) (((x) >> 10) & 0xf) /* Partial Header Encryption Mode */
#define PCI_IDE_SEL_CTL_ALG(x) (((x) >> 14) & 0x1f) /* Selected Algorithm */
#define PCI_IDE_SEL_CTL_TC(x) (((x) >> 19) & 0x7) /* Traffic Class */
diff --git a/lib/internal.h b/lib/internal.h
index 68e9fa0..996b80d 100644
--- a/lib/internal.h
+++ b/lib/internal.h
@@ -104,6 +104,7 @@ int pci_fill_info_v33(struct pci_dev *, int flags) VERSIONED_ABI;
int pci_fill_info_v34(struct pci_dev *, int flags) VERSIONED_ABI;
int pci_fill_info_v35(struct pci_dev *, int flags) VERSIONED_ABI;
int pci_fill_info_v38(struct pci_dev *, int flags) VERSIONED_ABI;
+int pci_fill_info_v313(struct pci_dev *, int flags) VERSIONED_ABI;
static inline int want_fill(struct pci_dev *d, unsigned want_fields, unsigned int try_fields)
{
diff --git a/lib/libpci.ver b/lib/libpci.ver
index 33ee024..dbcc876 100644
--- a/lib/libpci.ver
+++ b/lib/libpci.ver
@@ -98,3 +98,8 @@ LIBPCI_3.8 {
pci_filter_parse_id;
pci_filter_parse_slot;
};
+
+LIBPCI_3.13 {
+ global:
+ pci_fill_info;
+};
diff --git a/lib/pci.h b/lib/pci.h
index 4b5f6c1..71dae3a 100644
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -18,7 +18,7 @@
#include "header.h"
#include "types.h"
-#define PCI_LIB_VERSION 0x030c00
+#define PCI_LIB_VERSION 0x030d00
#ifndef PCI_ABI
#define PCI_ABI
@@ -159,6 +159,9 @@ struct pci_dev {
u16 subsys_vendor_id, subsys_id; /* Subsystem vendor id and subsystem id */
struct pci_dev *parent; /* Parent device, does not have to be always accessible */
int no_config_access; /* No access to config space for this device */
+ u32 rcd_link_cap; /* Link Capabilities register for Restricted CXL Devices */
+ u16 rcd_link_status; /* Link Status register for RCD */
+ u16 rcd_link_ctrl; /* Link Control register for RCD */
/* Fields used internally */
struct pci_access *access;
@@ -231,6 +234,7 @@ char *pci_get_string_property(struct pci_dev *d, u32 prop) PCI_ABI;
#define PCI_FILL_SUBSYS 0x00040000 /* subsys_vendor_id and subsys_id */
#define PCI_FILL_PARENT 0x00080000
#define PCI_FILL_DRIVER 0x00100000 /* OS driver currently in use (string property) */
+#define PCI_FILL_RCD_LNK 0x00200000 /* CXL RCD Link status properties (rcd_*) */
void pci_setup_cache(struct pci_dev *, u8 *cache, int len) PCI_ABI;
diff --git a/lib/sysfs.c b/lib/sysfs.c
index 0e763dc..7dedc0b 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -2,7 +2,7 @@
* The PCI Library -- Configuration Access via /sys/bus/pci
*
* Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
- * Copyright (c) 1997--2023 Martin Mares <mj@ucw.cz>
+ * Copyright (c) 1997--2024 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL v2+.
*
@@ -19,6 +19,7 @@
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
+#include <libgen.h>
#include <sys/types.h>
#include "internal.h"
@@ -483,6 +484,17 @@ sysfs_fill_info(struct pci_dev *d, unsigned int flags)
clear_fill(d, PCI_FILL_DRIVER);
}
+ if (want_fill(d, flags, PCI_FILL_RCD_LNK))
+ {
+ char buf[OBJBUFSIZE];
+ if (sysfs_get_string(d, "rcd_link_cap", buf, 0))
+ d->rcd_link_cap = strtoul(buf, NULL, 16);
+ if (sysfs_get_string(d, "rcd_link_ctrl", buf, 0))
+ d->rcd_link_ctrl = strtoul(buf, NULL, 16);
+ if (sysfs_get_string(d, "rcd_link_status", buf, 0))
+ d->rcd_link_status = strtoul(buf, NULL, 16);
+ }
+
pci_generic_fill_info(d, flags);
}