mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 16:42:56 -08:00
Print BARs for bridges as well.
ok deraadt@
This commit is contained in:
parent
347300ea0b
commit
4719bcb463
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pcidump.c,v 1.46 2017/08/31 12:03:02 otto Exp $ */
|
||||
/* $OpenBSD: pcidump.c,v 1.47 2018/04/08 13:55:40 kettenis Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
|
||||
@ -50,6 +50,7 @@ const char *str2busdevfunc(const char *, int *, int *, int *);
|
||||
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_bars(int, int, int, int);
|
||||
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);
|
||||
@ -455,7 +456,7 @@ dump_caplist(int bus, int dev, int func, u_int8_t ptr)
|
||||
}
|
||||
|
||||
void
|
||||
dump_type0(int bus, int dev, int func)
|
||||
dump_bars(int bus, int dev, int func, int end)
|
||||
{
|
||||
const char *memtype;
|
||||
u_int64_t mem;
|
||||
@ -463,7 +464,7 @@ dump_type0(int bus, int dev, int func)
|
||||
u_int32_t reg, reg1;
|
||||
int bar;
|
||||
|
||||
for (bar = PCI_MAPREG_START; bar < PCI_MAPREG_END; bar += 0x4) {
|
||||
for (bar = PCI_MAPREG_START; bar < end; bar += 0x4) {
|
||||
if (pci_read(bus, dev, func, bar, ®) != 0 ||
|
||||
pci_readmask(bus, dev, func, bar, ®1) != 0)
|
||||
warn("unable to read PCI_MAPREG 0x%02x", bar);
|
||||
@ -519,6 +520,14 @@ dump_type0(int bus, int dev, int func)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dump_type0(int bus, int dev, int func)
|
||||
{
|
||||
u_int32_t reg;
|
||||
|
||||
dump_bars(bus, dev, func, PCI_MAPREG_END);
|
||||
|
||||
if (pci_read(bus, dev, func, PCI_CARDBUS_CIS_REG, ®) != 0)
|
||||
warn("unable to read PCI_CARDBUS_CIS_REG");
|
||||
@ -549,13 +558,8 @@ void
|
||||
dump_type1(int bus, int dev, int func)
|
||||
{
|
||||
u_int32_t reg;
|
||||
int bar;
|
||||
|
||||
for (bar = PCI_MAPREG_START; bar < PCI_MAPREG_PPB_END; bar += 0x4) {
|
||||
if (pci_read(bus, dev, func, bar, ®) != 0)
|
||||
warn("unable to read PCI_MAPREG 0x%02x", bar);
|
||||
printf("\t0x%04x: %08x\n", bar, reg);
|
||||
}
|
||||
dump_bars(bus, dev, func, PCI_MAPREG_PPB_END);
|
||||
|
||||
if (pci_read(bus, dev, func, PCI_PRIBUS_1, ®) != 0)
|
||||
warn("unable to read PCI_PRIBUS_1");
|
||||
|
Loading…
Reference in New Issue
Block a user