Module Name:    src
Committed By:   msaitoh
Date:           Wed May 24 06:51:27 UTC 2017

Modified Files:
        src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
 Decode TPH Requester Control register.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/pci/pcireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.181 src/sys/dev/pci/pci_subr.c:1.182
--- src/sys/dev/pci/pci_subr.c:1.181	Mon May 22 04:21:20 2017
+++ src/sys/dev/pci/pci_subr.c	Wed May 24 06:51:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.181 2017/05/22 04:21:20 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.182 2017/05/24 06:51:27 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.181 2017/05/22 04:21:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.182 2017/05/24 06:51:27 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3410,6 +3410,40 @@ pci_conf_print_tph_req_cap(const pcireg_
 		    (unsigned char)__SHIFTOUT(reg, PCI_TPH_REQ_CAP_STTBLLOC)));
 	size = __SHIFTOUT(reg, PCI_TPH_REQ_CAP_STTBLSIZ) + 1;
 	printf("      ST Table Size: %d\n", size);
+
+	reg = regs[o2i(extcapoff + PCI_TPH_REQ_CTL)];
+	printf("    TPH Requester Control register: 0x%08x\n", reg);
+	printf("      ST Mode Select: ");
+	switch (__SHIFTOUT(reg, PCI_TPH_REQ_CTL_STSEL)) {
+	case PCI_TPH_REQ_CTL_STSEL_NO:
+		printf("No ST Mode\n");
+		break;
+	case PCI_TPH_REQ_CTL_STSEL_IV:
+		printf("Interrupt Vector Mode\n");
+		break;
+	case PCI_TPH_REQ_CTL_STSEL_DS:
+		printf("Device Specific Mode\n");
+		break;
+	default:
+		printf("(reserved vaule)\n");
+		break;
+	}
+	printf("      TPH Requester Enable: ");
+	switch (__SHIFTOUT(reg, PCI_TPH_REQ_CTL_TPHREQEN)) {
+	case PCI_TPH_REQ_CTL_TPHREQEN_NO: /* 0x0 */
+		printf("Not permitted\n");
+		break;
+	case PCI_TPH_REQ_CTL_TPHREQEN_TPH:
+		printf("TPH and not Extended TPH\n");
+		break;
+	case PCI_TPH_REQ_CTL_TPHREQEN_ETPH:
+		printf("TPH and Extended TPH");
+		break;
+	default:
+		printf("(reserved vaule)\n");
+		break;
+	}
+	
 	for (i = 0; i < size ; i += 2) {
 		reg = regs[o2i(extcapoff + PCI_TPH_REQ_STTBL + i / 2)];
 		for (j = 0; j < 2 ; j++) {

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.128 src/sys/dev/pci/pcireg.h:1.129
--- src/sys/dev/pci/pcireg.h:1.128	Fri Apr 21 09:01:52 2017
+++ src/sys/dev/pci/pcireg.h	Wed May 24 06:51:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.128 2017/04/21 09:01:52 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.129 2017/05/24 06:51:27 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1856,8 +1856,15 @@ struct pci_rom {
 #define	PCI_TPH_REQ_CAP_STTBLLOC __BITS(10, 9)	/* ST Table Location */
 #define	PCI_TPH_REQ_CAP_STTBLSIZ __BITS(26, 16)	/* ST Table Size */
 #define	PCI_TPH_REQ_CTL	0x08	/* TPH Requester Control */
-#define	PCI_TPH_REQ_CTL_STSEL	_BITS(2, 0)	/* ST Mode Select */
-#define	PCI_TPH_REQ_CTL_TPHREQEN _BITS(9, 8)	/* TPH Requester Enable */
+#define	PCI_TPH_REQ_CTL_STSEL	__BITS(2, 0)	/* ST Mode Select */
+#define	PCI_TPH_REQ_CTL_STSEL_NO	0	 /* No ST Mode */
+#define	PCI_TPH_REQ_CTL_STSEL_IV	1	 /* Interrupt Vector Mode */
+#define	PCI_TPH_REQ_CTL_STSEL_DS	2	 /* Device Specific Mode */
+#define	PCI_TPH_REQ_CTL_TPHREQEN __BITS(9, 8)	/* TPH Requester Enable */
+#define	PCI_TPH_REQ_CTL_TPHREQEN_NO	0	 /* Not permitted */
+#define	PCI_TPH_REQ_CTL_TPHREQEN_TPH	1	 /* TPH and no extended TPH */
+#define	PCI_TPH_REQ_CTL_TPHREQEN_RSVD	2	 /* Reserved */
+#define	PCI_TPH_REQ_CTL_TPHREQEN_ETPH	3	 /* TPH and Extended TPH */
 #define	PCI_TPH_REQ_STTBL 0x0c	/* TPH ST Table */
 
 /*

Reply via email to