if ( slot >= PHP_SLOT_START && slot < PHP_SLOT_END )
{
php_slot = PCI_TO_PHP_SLOT(slot);
- if ( !dpci_infos.php_devs[php_slot].valid )
+ if ( !test_pci_slot(slot) )
{
goto found;
}
/* slot == 0, pick up a free one */
for ( i = 0; i < PHP_SLOT_LEN; i++ )
{
- if ( !dpci_infos.php_devs[i].valid )
+ if ( !test_pci_slot(PHP_TO_PCI_SLOT(i)) )
{
php_slot = i;
goto found;
uint32_t bdf = 0;
int rc = -1;
- if ( php_slot < 0 || php_slot >= PHP_SLOT_LEN )
+ if ( test_pci_slot(PHP_TO_PCI_SLOT(php_slot)) != 1 )
return -1;
php_dev = &dpci_infos.php_devs[php_slot];
assigned_device = php_dev->pt_dev;
- if ( !assigned_device || !php_dev->valid )
+ if ( !assigned_device )
return -1;
pci_dev = assigned_device->pci_dev;
GPEState *s = &gpe_state;
int php_slot = PCI_TO_PHP_SLOT(pci_slot);
- if ( pci_slot < PHP_SLOT_START || pci_slot >= PHP_SLOT_END ) {
+ if ( test_pci_slot(pci_slot) < 0 ) {
fprintf(logfile, "not find the pci slot %d when hot remove.\n", pci_slot);
return;