mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 16:42:56 -08:00
Add -xxx option that print PCIe extended config space.
ok mikeb@, deraadt@
This commit is contained in:
parent
8ee6a57dc0
commit
5d2ed882d6
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: pcidump.8,v 1.10 2010/03/22 21:53:42 weerd Exp $
|
||||
.\" $OpenBSD: pcidump.8,v 1.11 2010/12/19 23:06:10 kettenis Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Paul de Weerd <weerd@weirdnet.nl>
|
||||
.\"
|
||||
@ -14,7 +14,7 @@
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: March 22 2010 $
|
||||
.Dd $Mdocdate: December 19 2010 $
|
||||
.Dt PCIDUMP 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -23,7 +23,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm pcidump
|
||||
.Op Fl v
|
||||
.Op Fl x | xx
|
||||
.Op Fl x | xx | xxx
|
||||
.Op Fl d Ar pcidev
|
||||
.Sm off
|
||||
.Op Ar bus : dev : func
|
||||
@ -65,6 +65,8 @@ Shows detailed information about PCI devices.
|
||||
Shows a hexadecimal dump of the first 64 bytes of PCI config space.
|
||||
.It Fl xx
|
||||
Shows a hexadecimal dump of the full PCI config space.
|
||||
.It Fl xxx
|
||||
Shows a hexadecimal dump of the PCIe extended config space.
|
||||
.It Xo
|
||||
.Sm off
|
||||
.Ar bus : dev : func
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pcidump.c,v 1.24 2010/09/05 18:14:33 kettenis Exp $ */
|
||||
/* $OpenBSD: pcidump.c,v 1.25 2010/12/19 23:06:10 kettenis Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
|
||||
@ -66,6 +66,7 @@ int pcifd;
|
||||
int romfd;
|
||||
int verbose = 0;
|
||||
int hex = 0;
|
||||
int size = 64;
|
||||
|
||||
const char *pci_capnames[] = {
|
||||
"Reserved",
|
||||
@ -131,6 +132,11 @@ main(int argc, char *argv[])
|
||||
err(1, "%s", romfile);
|
||||
}
|
||||
|
||||
if (hex > 1)
|
||||
size = 256;
|
||||
if (hex > 2)
|
||||
size = 4096;
|
||||
|
||||
if (argc == 1)
|
||||
dumpall = 0;
|
||||
|
||||
@ -263,7 +269,7 @@ probe(int bus, int dev, int func)
|
||||
if (verbose)
|
||||
dump(bus, dev, func);
|
||||
if (hex > 0)
|
||||
hexdump(bus, dev, func, hex > 1);
|
||||
hexdump(bus, dev, func, size);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -616,17 +622,20 @@ dump(int bus, int dev, int func)
|
||||
}
|
||||
|
||||
void
|
||||
hexdump(int bus, int dev, int func, int full)
|
||||
hexdump(int bus, int dev, int func, int size)
|
||||
{
|
||||
u_int32_t reg;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (full ? 256 : 64); i += 4) {
|
||||
for (i = 0; i < size; i += 4) {
|
||||
if (pci_read(bus, dev, func, i, ®) != 0) {
|
||||
if (errno == EINVAL)
|
||||
return;
|
||||
warn("unable to read 0x%02x", i);
|
||||
}
|
||||
|
||||
if ((i % 16) == 0)
|
||||
printf("\t0x%04x:", i);
|
||||
|
||||
if (pci_read(bus, dev, func, i, ®) != 0)
|
||||
warn("unable to read 0x%02x", i);
|
||||
printf(" %08x", reg);
|
||||
|
||||
if ((i % 16) == 12)
|
||||
|
Loading…
Reference in New Issue
Block a user