diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-02-03 03:03:15 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-02-03 10:38:20 -0500 |
commit | 7b67300f7d9db7dcf855e201db2f0da8f318e40d (patch) | |
tree | 140ff3110ad5ac93e0e812b855a6fd55b7633262 /src/fw | |
parent | 01a30dc7e38859125f4120e4f10f26af4049daf7 (diff) | |
download | seabios-7b67300f7d9db7dcf855e201db2f0da8f318e40d.tar.gz |
pci: Implement '%pP' printf handler for 'struct pci_device' pointers
Handle '%pP' format descriptions as a pointer to a 'struct pci_device'
and display it in bus:device.function (%02x:%02x.%x) format.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/fw')
-rw-r--r-- | src/fw/pciinit.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 6b1c9028..8e6716d2 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -306,12 +306,11 @@ void pci_resume(void) static void pci_bios_init_device(struct pci_device *pci) { - u16 bdf = pci->bdf; - dprintf(1, "PCI: init bdf=%02x:%02x.%x id=%04x:%04x\n" - , pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf) - , pci->vendor, pci->device); + dprintf(1, "PCI: init bdf=%pP id=%04x:%04x\n" + , pci, pci->vendor, pci->device); /* map the interrupt */ + u16 bdf = pci->bdf; int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN); if (pin != 0) pci_config_writeb(bdf, PCI_INTERRUPT_LINE, pci_slot_get_irq(pci, pin)); @@ -341,9 +340,7 @@ static void pci_enable_default_vga(void) foreachpci(pci) { if (is_pci_vga(pci)) { - dprintf(1, "PCI: Using %02x:%02x.%x for primary VGA\n", - pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf), - pci_bdf_to_fn(pci->bdf)); + dprintf(1, "PCI: Using %pP for primary VGA\n", pci); return; } } @@ -354,9 +351,7 @@ static void pci_enable_default_vga(void) return; } - dprintf(1, "PCI: Enabling %02x:%02x.%x for primary VGA\n", - pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf), - pci_bdf_to_fn(pci->bdf)); + dprintf(1, "PCI: Enabling %pP for primary VGA\n", pci); pci_config_maskw(pci->bdf, PCI_COMMAND, 0, PCI_COMMAND_IO | PCI_COMMAND_MEMORY); @@ -364,9 +359,7 @@ static void pci_enable_default_vga(void) while (pci->parent) { pci = pci->parent; - dprintf(1, "PCI: Setting VGA enable on bridge %02x:%02x.%x\n", - pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf), - pci_bdf_to_fn(pci->bdf)); + dprintf(1, "PCI: Setting VGA enable on bridge %pP\n", pci); pci_config_maskw(pci->bdf, PCI_BRIDGE_CONTROL, 0, PCI_BRIDGE_CTL_VGA); pci_config_maskw(pci->bdf, PCI_COMMAND, 0, @@ -821,17 +814,17 @@ static int pci_bios_init_root_regions_mem(struct pci_bus *bus) static void pci_region_map_one_entry(struct pci_region_entry *entry, u64 addr) { - u16 bdf = entry->dev->bdf; if (entry->bar >= 0) { - dprintf(1, "PCI: map device bdf=%02x:%02x.%x" + dprintf(1, "PCI: map device bdf=%pP" " bar %d, addr %08llx, size %08llx [%s]\n", - pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf), + entry->dev, entry->bar, addr, entry->size, region_type_name[entry->type]); pci_set_io_region_addr(entry->dev, entry->bar, addr, entry->is64); return; } + u16 bdf = entry->dev->bdf; u64 limit = addr + entry->size - 1; if (entry->type == PCI_REGION_TYPE_IO) { pci_config_writeb(bdf, PCI_IO_BASE, addr >> PCI_IO_SHIFT); |