my $devices = {};
foreach my $pcibus (@$res) {
foreach my $device (@{$pcibus->{devices}}) {
- next if !$device->{'qdev_id'};
- $devices->{$device->{'qdev_id'}} = 1;
+ if ($device->{'pci_bridge'}) {
+
+ $devices->{$device->{'qdev_id'}} = 1;
+ foreach my $bridge_device (@{$device->{'pci_bridge'}->{devices}}) {
+ next if !$bridge_device->{'qdev_id'};
+ $devices->{$bridge_device->{'qdev_id'}} = 1;
+ $devices->{$device->{'qdev_id'}}++;
+ }
+ } else {
+ next if !$device->{'qdev_id'};
+ $devices->{$device->{'qdev_id'}} = 1;
+ }
}
}