- Add PCI_MAPREG_ROM_ADDR_MASK macro and PCI_MAPREG_ROM_ADDR() macro.

- print PCI_MAPREG_ROM_ENABLE bit.
- Decode Expansion ROM Validation ECN.
- Add Native PCIe Enclosure Management ECN's extended capability type.
  Not decoded yet.
This commit is contained in:
msaitoh 2017-10-05 06:14:30 +00:00
parent e4fcba91cd
commit 7c17378f49
2 changed files with 69 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_subr.c,v 1.190 2017/07/13 08:41:19 msaitoh Exp $ */
/* $NetBSD: pci_subr.c,v 1.191 2017/10/05 06:14:30 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.190 2017/07/13 08:41:19 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.191 2017/10/05 06:14:30 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_pci.h"
@ -3873,6 +3873,7 @@ pci_conf_print_ptm_cap(const pcireg_t *regs, int capoff, int extcapoff)
/* XXX pci_conf_print_desigvndsp_cap */
/* XXX pci_conf_print_vf_resizbar_cap */
/* XXX pci_conf_print_hierarchyid_cap */
/* XXX pci_conf_print_npem_cap */
#undef MS
#undef SM
@ -3959,6 +3960,8 @@ static struct {
NULL },
{ PCI_EXTCAP_HIERARCHYID, "Hierarchy ID",
NULL },
{ PCI_EXTCAP_NPEM, "Native PCIe Enclosure Management",
NULL },
};
static int
@ -4099,6 +4102,7 @@ pci_conf_print_type0(
{
int off, width;
pcireg_t rval;
const char *str;
for (off = PCI_MAPREG_START; off < PCI_MAPREG_END; off += width) {
#ifdef _KERNEL
@ -4115,9 +4119,43 @@ pci_conf_print_type0(
printf(" Subsystem vendor ID: 0x%04x\n", PCI_VENDOR(rval));
printf(" Subsystem ID: 0x%04x\n", PCI_PRODUCT(rval));
/* XXX */
printf(" Expansion ROM Base Address: 0x%08x\n",
regs[o2i(PCI_MAPREG_ROM)]);
rval = regs[o2i(PCI_MAPREG_ROM)];
printf(" Expansion ROM Base Address Register: 0x%08x\n", rval);
printf(" base: 0x%08x\n", (uint32_t)PCI_MAPREG_ROM_ADDR(rval));
onoff("Expansion ROM Enable", rval, PCI_MAPREG_ROM_ENABLE);
printf(" Validation Status: ");
switch (__SHIFTOUT(rval, PCI_MAPREG_ROM_VALID_STAT)) {
case PCI_MAPREG_ROM_VSTAT_NOTSUPP:
str = "Validation not supported";
break;
case PCI_MAPREG_ROM_VSTAT_INPROG:
str = "Validation in Progress";
break;
case PCI_MAPREG_ROM_VSTAT_VPASS:
str = "Validation Pass. "
"Valid contents, trust test was not performed";
break;
case PCI_MAPREG_ROM_VSTAT_VPASSTRUST:
str = "Validation Pass. Valid and trusted contents";
break;
case PCI_MAPREG_ROM_VSTAT_VFAIL:
str = "Validation Fail. Invalid contents";
break;
case PCI_MAPREG_ROM_VSTAT_VFAILUNTRUST:
str = "Validation Fail. Valid but untrusted contents";
break;
case PCI_MAPREG_ROM_VSTAT_WPASS:
str = "Warning Pass. Validation passed with warning. "
"Valid contents, trust test was not performed";
break;
case PCI_MAPREG_ROM_VSTAT_WPASSTRUST:
str = "Warning Pass. Validation passed with warning. "
"Valid and trusted contents";
break;
}
printf("%s\n", str);
printf(" Validation Details: 0x%x\n",
(uint32_t)__SHIFTOUT(rval, PCI_MAPREG_ROM_VALID_DETAIL));
if (regs[o2i(PCI_COMMAND_STATUS_REG)] & PCI_STATUS_CAPLIST_SUPPORT)
printf(" Capability list pointer: 0x%02x\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcireg.h,v 1.132 2017/07/13 08:41:19 msaitoh Exp $ */
/* $NetBSD: pcireg.h,v 1.133 2017/10/05 06:14:30 msaitoh Exp $ */
/*
* Copyright (c) 1995, 1996, 1999, 2000
@ -485,6 +485,20 @@ typedef u_int8_t pci_revision_t;
(PCI_MAPREG_IO_ADDR(mr) & -PCI_MAPREG_IO_ADDR(mr))
#define PCI_MAPREG_IO_ADDR_MASK 0xfffffffc
#define PCI_MAPREG_ROM_ADDR(mr) \
((mr) & PCI_MAPREG_ROM_ADDR_MASK)
#define PCI_MAPREG_ROM_VALID_STAT __BITS(3, 1) /* Validation Status */
#define PCI_MAPREG_ROM_VSTAT_NOTSUPP 0x0 /* Validation not supported */
#define PCI_MAPREG_ROM_VSTAT_INPROG 0x1 /* Validation in Progress */
#define PCI_MAPREG_ROM_VSTAT_VPASS 0x2 /* Valid contnt, trust test nperf*/
#define PCI_MAPREG_ROM_VSTAT_VPASSTRUST 0x3 /* Valid and trusted contents */
#define PCI_MAPREG_ROM_VSTAT_VFAIL 0x4 /* Invaild contents */
#define PCI_MAPREG_ROM_VSTAT_VFAILUNTRUST 0x5 /* Vaild but untrusted contents*/
#define PCI_MAPREG_ROM_VSTAT_WPASS 0x6 /* VPASS + warning */
#define PCI_MAPREG_ROM_VSTAT_WPASSTRUST 0x7 /* VPASSTRUST + warning */
#define PCI_MAPREG_ROM_VALID_DETAIL __BITS(7, 4) /* Validation Details */
#define PCI_MAPREG_ROM_ADDR_MASK __BITS(31, 11)
#define PCI_MAPREG_SIZE_TO_MASK(size) \
(-(size))
@ -1443,6 +1457,7 @@ struct pci_rom {
#define PCI_EXTCAP_DESIGVNDSP 0x0023 /* Designated Vendor-Specific */
#define PCI_EXTCAP_VF_RESIZBAR 0x0024 /* VF Resizable BAR */
#define PCI_EXTCAP_HIERARCHYID 0x0028 /* Hierarchy ID */
#define PCI_EXTCAP_NPEM 0x0029 /* Native PCIe Enclosure Management */
/*
* Extended capability ID: 0x0001
@ -2042,4 +2057,14 @@ struct pci_rom {
* VF Resizable BAR
*/
/*
* Extended capability ID: 0x0028
* Hierarchy ID
*/
/*
* Extended capability ID: 0x0029
* Native PCIe Enclosure Management
*/
#endif /* _DEV_PCI_PCIREG_H_ */