diff options
-rw-r--r-- | xen/drivers/char/ns16550.c | 11 | ||||
-rw-r--r-- | xen/drivers/passthrough/pci.c | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index a6a4a2a728..2eb7f6cff7 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -470,21 +470,28 @@ static int pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx) { uint32_t bar, len; - int b, d, f; + int b, d, f, nextf; /* NB. Start at bus 1 to avoid AMT: a plug-in card cannot be on bus 0. */ for ( b = skip_amt ? 1 : 0; b < 0x100; b++ ) { for ( d = 0; d < 0x20; d++ ) { - for ( f = 0; f < 0x8; f++ ) + for ( f = 0; f < 8; f = nextf ) { + nextf = (f || (pci_conf_read16(0, b, d, f, PCI_HEADER_TYPE) & + 0x80)) ? f + 1 : 8; + switch ( pci_conf_read16(0, b, d, f, PCI_CLASS_DEVICE) ) { case 0x0700: /* single port serial */ case 0x0702: /* multi port serial */ case 0x0780: /* other (e.g serial+parallel) */ break; + case 0xffff: + if ( !f ) + nextf = 8; + /* fall through */ default: continue; } diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 0ab0488c27..29d88fd32d 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -665,7 +665,11 @@ static int __init _scan_pci_devices(struct pci_seg *pseg, void *arg) for ( func = 0; func < 8; func++ ) { if ( pci_device_detect(pseg->nr, bus, dev, func) == 0 ) + { + if ( !func ) + break; continue; + } pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func)); if ( !pdev ) |