mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
s390x/pci: refactor list_pci
Because of the refactor of s390_pci_find_dev_by_idx(), list_pci() should be updated. We introduce a new function to get the next available zpci device. It simplifies the code of looking up zpci devices. Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com> Acked-by: Pierre Morel <pmorel@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
ab9746570a
commit
4e3bfc167d
3 changed files with 44 additions and 25 deletions
|
@ -91,6 +91,26 @@ int chsc_sei_nt2_have_event(void)
|
|||
return !QTAILQ_EMPTY(&s->pending_sei);
|
||||
}
|
||||
|
||||
S390PCIBusDevice *s390_pci_find_next_avail_dev(S390PCIBusDevice *pbdev)
|
||||
{
|
||||
int idx = 0;
|
||||
S390PCIBusDevice *dev = NULL;
|
||||
S390pciState *s = s390_get_phb();
|
||||
|
||||
if (pbdev) {
|
||||
idx = (pbdev->fh & FH_MASK_INDEX) + 1;
|
||||
}
|
||||
|
||||
for (; idx < PCI_SLOT_MAX; idx++) {
|
||||
dev = s->pbdev[idx];
|
||||
if (dev && dev->state != ZPCI_FS_RESERVED) {
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
S390PCIBusDevice *s390_pci_find_dev_by_fid(uint32_t fid)
|
||||
{
|
||||
S390PCIBusDevice *pbdev;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue