mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 16:42:56 -08:00
Print PCI power state when the -v option is given.
ok deraadt@, mpi@
This commit is contained in:
parent
5c3de5b52a
commit
3a2eabfe81
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pcidump.c,v 1.37 2015/01/16 06:40:19 deraadt Exp $ */
|
||||
/* $OpenBSD: pcidump.c,v 1.38 2015/11/21 17:52:10 kettenis Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
|
||||
@ -50,6 +50,7 @@ int pci_nfuncs(int, int);
|
||||
int pci_read(int, int, int, u_int32_t, u_int32_t *);
|
||||
int pci_readmask(int, int, int, u_int32_t, u_int32_t *);
|
||||
void dump_caplist(int, int, int, u_int8_t);
|
||||
void dump_pci_powerstate(int, int, int, uint8_t);
|
||||
void dump_pcie_linkspeed(int, int, int, uint8_t);
|
||||
void print_pcie_ls(uint8_t);
|
||||
int dump_rom(int, int, int);
|
||||
@ -284,6 +285,17 @@ probe(int bus, int dev, int func)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
dump_pci_powerstate(int bus, int dev, int func, uint8_t ptr)
|
||||
{
|
||||
u_int32_t pmcsr;
|
||||
|
||||
if (pci_read(bus, dev, func, ptr + PCI_PMCSR, &pmcsr) != 0)
|
||||
return;
|
||||
|
||||
printf("\t State: D%d\n", pmcsr & PCI_PMCSR_STATE_MASK);
|
||||
}
|
||||
|
||||
void
|
||||
print_pcie_ls(uint8_t speed)
|
||||
{
|
||||
@ -359,6 +371,8 @@ dump_caplist(int bus, int dev, int func, u_int8_t ptr)
|
||||
if (cap >= nitems(pci_capnames))
|
||||
cap = 0;
|
||||
printf("%s\n", pci_capnames[cap]);
|
||||
if (cap == PCI_CAP_PWRMGMT)
|
||||
dump_pci_powerstate(bus, dev, func, ptr);
|
||||
if (cap == PCI_CAP_PCIEXPRESS)
|
||||
dump_pcie_linkspeed(bus, dev, func, ptr);
|
||||
ptr = PCI_CAPLIST_NEXT(reg);
|
||||
|
Loading…
Reference in New Issue
Block a user