-corrected "MSI" capability

-added some new subclasses and capabilities
-move capability list printing into a separate function and call it
 for each header type (not type 0 only)
This commit is contained in:
drochner 2002-09-21 16:19:34 +00:00
parent 80eaffef1b
commit ec517fd6a5
1 changed files with 90 additions and 56 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_subr.c,v 1.50 2002/05/19 00:01:09 sommerfeld Exp $ */
/* $NetBSD: pci_subr.c,v 1.51 2002/09/21 16:19:34 drochner 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.50 2002/05/19 00:01:09 sommerfeld Exp $");
__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.51 2002/09/21 16:19:34 drochner Exp $");
#ifdef _KERNEL_OPT
#include "opt_pci.h"
@ -89,6 +89,7 @@ const struct pci_class pci_subclass_mass_storage[] = {
{ "IPI", PCI_SUBCLASS_MASS_STORAGE_IPI, },
{ "RAID", PCI_SUBCLASS_MASS_STORAGE_RAID, },
{ "ATA", PCI_SUBCLASS_MASS_STORAGE_ATA, },
{ "SATA", PCI_SUBCLASS_MASS_STORAGE_SATA, },
{ "miscellaneous", PCI_SUBCLASS_MASS_STORAGE_MISC, },
{ 0 },
};
@ -213,6 +214,8 @@ const struct pci_class pci_subclass_wireless[] = {
{ "RF", PCI_SUBCLASS_WIRELESS_RF, },
{ "bluetooth", PCI_SUBCLASS_WIRELESS_BLUETOOTH, },
{ "broadband", PCI_SUBCLASS_WIRELESS_BROADBAND, },
{ "802.11a (5 GHz)", PCI_SUBCLASS_WIRELESS_802_11A, },
{ "802.11b (2.4 GHz)", PCI_SUBCLASS_WIRELESS_802_11B, },
{ "miscellaneous", PCI_SUBCLASS_WIRELESS_MISC, },
{ 0 },
};
@ -776,63 +779,84 @@ pci_conf_print_type0(
}
printf("\n");
printf(" Interrupt line: 0x%02x\n", PCI_INTERRUPT_LINE(rval));
}
if (regs[o2i(PCI_COMMAND_STATUS_REG)] & PCI_STATUS_CAPLIST_SUPPORT) {
for (off = PCI_CAPLIST_PTR(regs[o2i(PCI_CAPLISTPTR_REG)]);
off != 0;
off = PCI_CAPLIST_NEXT(regs[o2i(off)])) {
rval = regs[o2i(off)];
printf(" Capability register at 0x%02x\n", off);
static void
pci_conf_print_caplist(
#ifdef _KERNEL
pci_chipset_tag_t pc, pcitag_t tag,
#endif
const pcireg_t *regs)
{
int off;
pcireg_t rval;
printf(" type: 0x%02x (", PCI_CAPLIST_CAP(rval));
switch (PCI_CAPLIST_CAP(rval)) {
case PCI_CAP_RESERVED0:
printf("reserved");
break;
case PCI_CAP_PWRMGMT:
printf("Power Management, rev. %d.0",
(rval >> 0) & 0x07); /* XXX not clear */
break;
case PCI_CAP_AGP:
printf("AGP, rev. %d.%d",
(rval >> 24) & 0x0f,
(rval >> 20) & 0x0f);
break;
case PCI_CAP_VPD:
printf("VPD");
break;
case PCI_CAP_SLOTID:
printf("SlotID");
break;
case PCI_CAP_MBI:
printf("MBI");
break;
case PCI_CAP_CPCI_HOTSWAP:
printf("CompactPCI Hot-swapping");
break;
case PCI_CAP_PCIX:
printf("PCI-X");
break;
case PCI_CAP_LDT:
printf("LDT");
break;
case PCI_CAP_VENDSPEC:
printf("Vendor-specific");
break;
case PCI_CAP_DEBUGPORT:
printf("Debug Port");
break;
case PCI_CAP_CPCI_RSRCCTL:
printf("CompactPCI Resource Control");
break;
case PCI_CAP_HOTPLUG:
printf("Hot-Plug");
break;
default:
printf("unknown");
}
printf(")\n");
for (off = PCI_CAPLIST_PTR(regs[o2i(PCI_CAPLISTPTR_REG)]);
off != 0;
off = PCI_CAPLIST_NEXT(regs[o2i(off)])) {
rval = regs[o2i(off)];
printf(" Capability register at 0x%02x\n", off);
printf(" type: 0x%02x (", PCI_CAPLIST_CAP(rval));
switch (PCI_CAPLIST_CAP(rval)) {
case PCI_CAP_RESERVED0:
printf("reserved");
break;
case PCI_CAP_PWRMGMT:
printf("Power Management, rev. %d.0",
(rval >> 0) & 0x07); /* XXX not clear */
break;
case PCI_CAP_AGP:
printf("AGP, rev. %d.%d",
(rval >> 24) & 0x0f,
(rval >> 20) & 0x0f);
break;
case PCI_CAP_VPD:
printf("VPD");
break;
case PCI_CAP_SLOTID:
printf("SlotID");
break;
case PCI_CAP_MSI:
printf("MSI");
break;
case PCI_CAP_CPCI_HOTSWAP:
printf("CompactPCI Hot-swapping");
break;
case PCI_CAP_PCIX:
printf("PCI-X");
break;
case PCI_CAP_LDT:
printf("LDT");
break;
case PCI_CAP_VENDSPEC:
printf("Vendor-specific");
break;
case PCI_CAP_DEBUGPORT:
printf("Debug Port");
break;
case PCI_CAP_CPCI_RSRCCTL:
printf("CompactPCI Resource Control");
break;
case PCI_CAP_HOTPLUG:
printf("Hot-Plug");
break;
case PCI_CAP_AGP8:
printf("AGP 8x");
break;
case PCI_CAP_SECURE:
printf("Secure Device");
break;
case PCI_CAP_PCIEXPRESS:
printf("PCI Express");
break;
case PCI_CAP_MSIX:
printf("MSI-X");
break;
default:
printf("unknown");
}
printf(")\n");
}
}
@ -1202,6 +1226,16 @@ pci_conf_print(
hdrtype);
printf("\n");
/* papability list, if present */
if (regs[o2i(PCI_COMMAND_STATUS_REG)] & PCI_STATUS_CAPLIST_SUPPORT) {
#ifdef _KERNEL
pci_conf_print_caplist(pc, tag, regs);
#else
pci_conf_print_caplist(regs);
#endif
printf("\n");
}
/* device-dependent header */
printf(" Device-dependent header:\n");
pci_conf_print_regs(regs, endoff, 256);