pci: Use pci_sbdf_t in pci_device_detect()

Use a single pci_sbdf_t instead of each of its part as individual parameters.

Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Teddy Astie authored and Jan Beulich committed 2026-07-06 09:40:38 +02:00
1 parent ac840e066f
commit e457520245
4 files changed
+11 -10

No files matched your search

+2 -2
View File
@@ -706,7 +706,7 @@ static unsigned int __init find_dbgp(struct ehci_dbgp *dbgp,
{
unsigned int cap;
if ( !pci_device_detect(0, bus, slot, func) )
if ( !pci_device_detect(PCI_SBDF(0, bus, slot, func)) )
{
if ( !func )
break;
@@ -1520,7 +1520,7 @@ void __init ehci_dbgp_init(void)
dbgp->slot = slot;
dbgp->func = func;
if ( !pci_device_detect(0, bus, slot, func) )
if ( !pci_device_detect(PCI_SBDF(0, bus, slot, func)) )
return;
dbgp->cap = __find_dbgp(bus, slot, func);
+3 -3
View File
@@ -1166,11 +1166,11 @@ out:
return ret;
}
bool __init pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func)
bool __init pci_device_detect(pci_sbdf_t sbdf)
{
u32 vendor;
vendor = pci_conf_read32(PCI_SBDF(seg, bus, dev, func), PCI_VENDOR_ID);
vendor = pci_conf_read32(sbdf, PCI_VENDOR_ID);
/* some broken boards return 0 or ~0 if a slot is empty: */
if ( (vendor == 0xffffffffU) || (vendor == 0x00000000U) ||
(vendor == 0x0000ffffU) || (vendor == 0xffff0000U) )
@@ -1221,7 +1221,7 @@ static int __init cf_check _scan_pci_devices(struct pci_seg *pseg, void *arg)
{
for ( func = 0; func < 8; func++ )
{
if ( !pci_device_detect(pseg->nr, bus, dev, func) )
if ( !pci_device_detect(PCI_SBDF(pseg->nr, bus, dev, func)) )
{
if ( !func )
break;
+5 -4
View File
@@ -389,7 +389,8 @@ static int __init acpi_parse_dev_scope(
printk(VTDPREFIX " endpoint: %pp\n",
&PCI_SBDF(seg, bus, path->dev, path->fn));
if ( drhd && pci_device_detect(seg, bus, path->dev, path->fn) )
if ( drhd &&
pci_device_detect(PCI_SBDF(seg, bus, path->dev, path->fn)) )
{
if ( pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
PCI_CLASS_DEVICE + 1) != 0x03
@@ -537,7 +538,7 @@ acpi_parse_one_drhd(struct acpi_dmar_header *header)
d = PCI_SLOT(dmaru->scope.devices[i]);
f = PCI_FUNC(dmaru->scope.devices[i]);
if ( !pci_device_detect(drhd->segment, b, d, f) )
if ( !pci_device_detect(PCI_SBDF(drhd->segment, b, d, f)) )
printk(XENLOG_WARNING VTDPREFIX
" Non-existent device (%pp) in this DRHD's scope!\n",
&PCI_SBDF(drhd->segment, b, d, f));
@@ -573,7 +574,7 @@ static int __init register_one_rmrr(struct acpi_rmrr_unit *rmrru)
u8 d = PCI_SLOT(rmrru->scope.devices[i]);
u8 f = PCI_FUNC(rmrru->scope.devices[i]);
if ( pci_device_detect(rmrru->segment, b, d, f) == 0 )
if ( pci_device_detect(PCI_SBDF(rmrru->segment, b, d, f)) == 0 )
{
dprintk(XENLOG_WARNING VTDPREFIX,
" Non-existent device (%pp) is reported"
@@ -767,7 +768,7 @@ static int __init register_one_satc(struct acpi_satc_unit *satcu)
uint8_t d = PCI_SLOT(satcu->scope.devices[i]);
uint8_t f = PCI_FUNC(satcu->scope.devices[i]);
if ( !pci_device_detect(satcu->segment, b, d, f) )
if ( !pci_device_detect(PCI_SBDF(satcu->segment, b, d, f)) )
{
dprintk(XENLOG_WARNING VTDPREFIX,
" Non-existent device (%pp) is reported in SATC scope!\n",
+1 -1
View File
@@ -218,7 +218,7 @@ static always_inline bool pcidevs_trylock(void)
#endif
bool pci_known_segment(u16 seg);
bool pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
bool pci_device_detect(pci_sbdf_t sbdf);
int scan_pci_devices(void);
enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn);
int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.