svn commit: r242016 - stable/9/usr.sbin/pciconf

Gavin Atkinson gavin at FreeBSD.org
Wed Oct 24 19:22:44 UTC 2012


Author: gavin
Date: Wed Oct 24 19:22:43 2012
New Revision: 242016
URL: http://svn.freebsd.org/changeset/base/242016

Log:
  Merge r240680 from head:
  
    Align the PCI Express #defines with the style used for the PCI-X
    #defines.  This has the advantage that it makes the names more
    compact, and also allows us to correct the non-uniform naming of
    the PCIM_LINK_* defines, making them all consistent amongst themselves.
  
    This is a mostly mechanical rename:
      s/PCIR_EXPRESS_/PCIER_/g
      s/PCIM_EXP_/PCIEM_/g
      s/PCIM_LINK_/PCIEM_LINK_/g
  
    In this MFC, #defines have been added for the old names to assist
    out-of-tree drivers.

Modified:
  stable/9/usr.sbin/pciconf/cap.c
  stable/9/usr.sbin/pciconf/err.c
Directory Properties:
  stable/9/usr.sbin/pciconf/   (props changed)

Modified: stable/9/usr.sbin/pciconf/cap.c
==============================================================================
--- stable/9/usr.sbin/pciconf/cap.c	Wed Oct 24 19:04:17 2012	(r242015)
+++ stable/9/usr.sbin/pciconf/cap.c	Wed Oct 24 19:22:43 2012	(r242016)
@@ -369,53 +369,53 @@ cap_express(int fd, struct pci_conf *p, 
 	uint32_t val;
 	uint16_t flags;
 
-	flags = read_config(fd, &p->pc_sel, ptr + PCIR_EXPRESS_FLAGS, 2);
-	printf("PCI-Express %d ", flags & PCIM_EXP_FLAGS_VERSION);
-	switch (flags & PCIM_EXP_FLAGS_TYPE) {
-	case PCIM_EXP_TYPE_ENDPOINT:
+	flags = read_config(fd, &p->pc_sel, ptr + PCIER_FLAGS, 2);
+	printf("PCI-Express %d ", flags & PCIEM_FLAGS_VERSION);
+	switch (flags & PCIEM_FLAGS_TYPE) {
+	case PCIEM_TYPE_ENDPOINT:
 		printf("endpoint");
 		break;
-	case PCIM_EXP_TYPE_LEGACY_ENDPOINT:
+	case PCIEM_TYPE_LEGACY_ENDPOINT:
 		printf("legacy endpoint");
 		break;
-	case PCIM_EXP_TYPE_ROOT_PORT:
+	case PCIEM_TYPE_ROOT_PORT:
 		printf("root port");
 		break;
-	case PCIM_EXP_TYPE_UPSTREAM_PORT:
+	case PCIEM_TYPE_UPSTREAM_PORT:
 		printf("upstream port");
 		break;
-	case PCIM_EXP_TYPE_DOWNSTREAM_PORT:
+	case PCIEM_TYPE_DOWNSTREAM_PORT:
 		printf("downstream port");
 		break;
-	case PCIM_EXP_TYPE_PCI_BRIDGE:
+	case PCIEM_TYPE_PCI_BRIDGE:
 		printf("PCI bridge");
 		break;
-	case PCIM_EXP_TYPE_PCIE_BRIDGE:
+	case PCIEM_TYPE_PCIE_BRIDGE:
 		printf("PCI to PCIe bridge");
 		break;
-	case PCIM_EXP_TYPE_ROOT_INT_EP:
+	case PCIEM_TYPE_ROOT_INT_EP:
 		printf("root endpoint");
 		break;
-	case PCIM_EXP_TYPE_ROOT_EC:
+	case PCIEM_TYPE_ROOT_EC:
 		printf("event collector");
 		break;
 	default:
-		printf("type %d", (flags & PCIM_EXP_FLAGS_TYPE) >> 4);
+		printf("type %d", (flags & PCIEM_FLAGS_TYPE) >> 4);
 		break;
 	}
-	if (flags & PCIM_EXP_FLAGS_SLOT)
+	if (flags & PCIEM_FLAGS_SLOT)
 		printf(" slot");
-	if (flags & PCIM_EXP_FLAGS_IRQ)
-		printf(" IRQ %d", (flags & PCIM_EXP_FLAGS_IRQ) >> 9);
-	val = read_config(fd, &p->pc_sel, ptr + PCIR_EXPRESS_DEVICE_CAP, 4);
-	flags = read_config(fd, &p->pc_sel, ptr + PCIR_EXPRESS_DEVICE_CTL, 2);
+	if (flags & PCIEM_FLAGS_IRQ)
+		printf(" IRQ %d", (flags & PCIEM_FLAGS_IRQ) >> 9);
+	val = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CAP, 4);
+	flags = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CTL, 2);
 	printf(" max data %d(%d)",
-	    MAX_PAYLOAD((flags & PCIM_EXP_CTL_MAX_PAYLOAD) >> 5),
-	    MAX_PAYLOAD(val & PCIM_EXP_CAP_MAX_PAYLOAD));
-	val = read_config(fd, &p->pc_sel, ptr + PCIR_EXPRESS_LINK_CAP, 4);
-	flags = read_config(fd, &p->pc_sel, ptr+ PCIR_EXPRESS_LINK_STA, 2);
-	printf(" link x%d(x%d)", (flags & PCIM_LINK_STA_WIDTH) >> 4,
-	    (val & PCIM_LINK_CAP_MAX_WIDTH) >> 4);
+	    MAX_PAYLOAD((flags & PCIEM_CTL_MAX_PAYLOAD) >> 5),
+	    MAX_PAYLOAD(val & PCIEM_CAP_MAX_PAYLOAD));
+	val = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_CAP, 4);
+	flags = read_config(fd, &p->pc_sel, ptr+ PCIER_LINK_STA, 2);
+	printf(" link x%d(x%d)", (flags & PCIEM_LINK_STA_WIDTH) >> 4,
+	    (val & PCIEM_LINK_CAP_MAX_WIDTH) >> 4);
 }
 
 static void

Modified: stable/9/usr.sbin/pciconf/err.c
==============================================================================
--- stable/9/usr.sbin/pciconf/err.c	Wed Oct 24 19:04:17 2012	(r242015)
+++ stable/9/usr.sbin/pciconf/err.c	Wed Oct 24 19:22:43 2012	(r242016)
@@ -63,18 +63,18 @@ static struct bit_table pci_status[] = {
 
 /* Error indicators in the PCI-Express device status register. */
 static struct bit_table pcie_device_status[] = {
-	{ PCIM_EXP_STA_CORRECTABLE_ERROR, "Correctable Error Detected" },
-	{ PCIM_EXP_STA_NON_FATAL_ERROR, "Non-Fatal Error Detected" },	
-	{ PCIM_EXP_STA_FATAL_ERROR, "Fatal Error Detected" },	
-	{ PCIM_EXP_STA_UNSUPPORTED_REQ, "Unsupported Request Detected" },	
+	{ PCIEM_STA_CORRECTABLE_ERROR, "Correctable Error Detected" },
+	{ PCIEM_STA_NON_FATAL_ERROR, "Non-Fatal Error Detected" },	
+	{ PCIEM_STA_FATAL_ERROR, "Fatal Error Detected" },	
+	{ PCIEM_STA_UNSUPPORTED_REQ, "Unsupported Request Detected" },	
 	{ 0, NULL },
 };
 
 /* Valid error indicator bits in the PCI-Express device status register. */
-#define	PCIE_ERRORS	(PCIM_EXP_STA_CORRECTABLE_ERROR |		\
-			 PCIM_EXP_STA_NON_FATAL_ERROR |			\
-			 PCIM_EXP_STA_FATAL_ERROR |			\
-			 PCIM_EXP_STA_UNSUPPORTED_REQ)
+#define	PCIE_ERRORS	(PCIEM_STA_CORRECTABLE_ERROR |		\
+			 PCIEM_STA_NON_FATAL_ERROR |			\
+			 PCIEM_STA_FATAL_ERROR |			\
+			 PCIEM_STA_UNSUPPORTED_REQ)
 
 /* AER Uncorrected errors. */
 static struct bit_table aer_uc[] = {
@@ -147,7 +147,7 @@ list_errors(int fd, struct pci_conf *p)
 		return;
 
 	/* Check for PCI-e errors. */
-	sta = read_config(fd, &p->pc_sel, pcie + PCIR_EXPRESS_DEVICE_STA, 2);
+	sta = read_config(fd, &p->pc_sel, pcie + PCIER_DEVICE_STA, 2);
 	print_bits("PCI-e errors", pcie_device_status, sta & PCIE_ERRORS);
 
 	/* See if this device supports AER. */


More information about the svn-src-stable-9 mailing list