/* Options */
int verbose; /* Show detailed information */
-static int opt_buscentric; /* Show bus addresses/IRQ's instead of CPU-visible ones */
static int opt_hex; /* Show contents of config space as hexadecimal numbers */
struct pci_filter filter; /* Device filter */
static int opt_tree; /* Show bus tree */
d->config_cached += 64;
}
pci_setup_cache(p, d->config, d->config_cached);
- pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES);
+ pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_PHYS_SLOT);
return d;
}
static void
show_size(pciaddr_t x)
{
+ static const char suffix[][2] = { "", "K", "M", "G", "T" };
+ unsigned i;
if (!x)
return;
- printf(" [size=");
- if (x < 1024)
- printf("%d", (int) x);
- else if (x < 1048576)
- printf("%dK", (int)(x / 1024));
- else if (x < 0x80000000)
- printf("%dM", (int)(x / 1048576));
- else
- printf(PCIADDR_T_FMT, x);
- putchar(']');
+ for (i = 0; i < (sizeof(suffix) / sizeof(*suffix) - 1); i++) {
+ if (x < 1024)
+ break;
+ x /= 1024;
+ }
+ printf(" [size=%u%s]", (unsigned)x, suffix[i]);
}
static void
struct pci_dev *p = d->dev;
word cmd = get_conf_word(d, PCI_COMMAND);
int i;
+ int virtual = 0;
for (i=0; i<cnt; i++)
{
{
printf("[virtual] ");
flg = pos;
+ virtual = 1;
}
if (flg & PCI_BASE_ADDRESS_SPACE_IO)
{
printf("<ignored>");
else
printf("<unassigned>");
- if (!(cmd & PCI_COMMAND_IO))
+ if (!virtual && !(cmd & PCI_COMMAND_IO))
printf(" [disabled]");
}
else
{
i++;
z = get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i);
- if (opt_buscentric)
- {
- u32 y = a & 0xffffffff;
- if (a || z)
- printf("%08x%08x", z, y);
- else
- printf("<unassigned>");
- done = 1;
- }
}
}
if (!done)
(t == PCI_BASE_ADDRESS_MEM_TYPE_64) ? "64-bit" :
(t == PCI_BASE_ADDRESS_MEM_TYPE_1M) ? "low-1M" : "type 3",
(flg & PCI_BASE_ADDRESS_MEM_PREFETCH) ? "" : "non-");
- if (!(cmd & PCI_COMMAND_MEMORY))
+ if (!virtual && !(cmd & PCI_COMMAND_MEMORY))
printf(" [disabled]");
}
show_size(len);
pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->rom_size : 0;
u32 flg = get_conf_long(d, reg);
word cmd = get_conf_word(d, PCI_COMMAND);
+ int virtual = 0;
if (!rom && !flg && !len)
return;
{
printf("[virtual] ");
flg = rom;
+ virtual = 1;
}
printf("Expansion ROM at ");
if (rom & PCI_ROM_ADDRESS_MASK)
printf("<unassigned>");
if (!(flg & PCI_ROM_ADDRESS_ENABLE))
printf(" [disabled]");
- else if (!(cmd & PCI_COMMAND_MEMORY))
+ else if (!virtual && !(cmd & PCI_COMMAND_MEMORY))
printf(" [disabled by cmd]");
show_size(len);
putchar('\n');
return;
}
+ if (p->phy_slot)
+ printf("\tPhysical Slot: %s\n", p->phy_slot);
+
if (verbose > 1)
{
printf("\tControl: I/O%c Mem%c BusMaster%c SpecCycle%c MemWINV%c VGASnoop%c ParErr%c Stepping%c SERR%c FastB2B%c DisINTx%c\n",
printf("SDevice:\t%s\n",
pci_lookup_name(pacc, sdbuf, sizeof(sdbuf), PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_DEVICE, p->vendor_id, p->device_id, sv_id, sd_id));
}
+ if (p->phy_slot)
+ printf("PhySlot:\t%s\n", p->phy_slot);
if (c = get_conf_byte(d, PCI_REVISION_ID))
printf("Rev:\t%02x\n", c);
if (c = get_conf_byte(d, PCI_CLASS_PROG))
break;
case 'b':
pacc->buscentric = 1;
- opt_buscentric = 1;
break;
case 's':
if (msg = pci_filter_parse_slot(&filter, optarg))