. pci driver now returns devices, even when they have been pci_reserve()d
. pci_reserve() returns an error on devices that have already been reserved, instead of panic()ing; the pci_reserve() library call still panics, pci_reserve_ok() returns an int. . this allows at_wini to use the instance value as intended, as all devices are seen, even reserved ones . only devices actually used by at_wini are pci_reserve()d . pci doesn't release devices based on argv[0], as at_wini both have the same name and multiple instances won't work together properly
This commit is contained in:
parent
825f29fd89
commit
168d766f32
6 changed files with 39 additions and 7 deletions
|
@ -581,8 +581,6 @@ PRIVATE void init_params_pci(int skip)
|
|||
else
|
||||
continue; /* Unsupported device class */
|
||||
|
||||
pci_reserve(devind);
|
||||
|
||||
/* Found a controller.
|
||||
* Programming interface register tells us more.
|
||||
*/
|
||||
|
@ -611,6 +609,12 @@ PRIVATE void init_params_pci(int skip)
|
|||
skip--;
|
||||
continue;
|
||||
}
|
||||
if(pci_reserve_ok(devind) != OK) {
|
||||
printf("at_wini%d: pci_reserve %d failed - "
|
||||
"ignoring controller!\n",
|
||||
w_instance, devind);
|
||||
continue;
|
||||
}
|
||||
if ((s=sys_irqsetpolicy(irq, 0, &irq_hook)) != OK) {
|
||||
printf("atapci: couldn't set IRQ policy %d\n", irq);
|
||||
continue;
|
||||
|
|
|
@ -140,8 +140,10 @@ message *mp;
|
|||
{
|
||||
/* Ignore all init calls for a process after the first one */
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
pci_release(names[i].name);
|
||||
#endif
|
||||
names[i].tasknr= mp->m_source;
|
||||
|
||||
mp->m_type= 0;
|
||||
|
@ -440,8 +442,8 @@ message *mp;
|
|||
|
||||
devind= mp->m1_i1;
|
||||
|
||||
pci_reserve3(devind, mp->m_source, names[i].name);
|
||||
mp->m_type= OK;
|
||||
|
||||
mp->m_type= pci_reserve3(devind, mp->m_source, names[i].name);
|
||||
r= send(mp->m_source, mp);
|
||||
if (r != 0)
|
||||
{
|
||||
|
|
|
@ -243,8 +243,10 @@ int *devindp;
|
|||
}
|
||||
if (devind >= nr_pcidev)
|
||||
return 0;
|
||||
#if 0
|
||||
if (pcidev[devind].pd_inuse)
|
||||
return 0;
|
||||
#endif
|
||||
*devindp= devind;
|
||||
return 1;
|
||||
}
|
||||
|
@ -262,8 +264,10 @@ u16_t *didp;
|
|||
|
||||
for (devind= 0; devind < nr_pcidev; devind++)
|
||||
{
|
||||
#if 0
|
||||
if (pcidev[devind].pd_inuse)
|
||||
continue;
|
||||
#endif
|
||||
if (!visible(aclp, devind))
|
||||
continue;
|
||||
break;
|
||||
|
@ -289,8 +293,10 @@ u16_t *didp;
|
|||
|
||||
for (devind= *devindp+1; devind < nr_pcidev; devind++)
|
||||
{
|
||||
#if 0
|
||||
if (pcidev[devind].pd_inuse)
|
||||
continue;
|
||||
#endif
|
||||
if (!visible(aclp, devind))
|
||||
continue;
|
||||
break;
|
||||
|
@ -306,7 +312,7 @@ u16_t *didp;
|
|||
/*===========================================================================*
|
||||
* pci_reserve3 *
|
||||
*===========================================================================*/
|
||||
PUBLIC void pci_reserve3(devind, proc, name)
|
||||
PUBLIC int pci_reserve3(devind, proc, name)
|
||||
int devind;
|
||||
int proc;
|
||||
char *name;
|
||||
|
@ -317,7 +323,8 @@ char *name;
|
|||
struct mem_range mr;
|
||||
|
||||
assert(devind <= nr_pcidev);
|
||||
assert(!pcidev[devind].pd_inuse);
|
||||
if(pcidev[devind].pd_inuse)
|
||||
return EBUSY;
|
||||
pcidev[devind].pd_inuse= 1;
|
||||
strcpy(pcidev[devind].pd_name, name);
|
||||
|
||||
|
@ -376,8 +383,11 @@ char *name;
|
|||
proc, r);
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*===========================================================================*
|
||||
* pci_release *
|
||||
*===========================================================================*/
|
||||
|
@ -395,6 +405,7 @@ char *name;
|
|||
pcidev[i].pd_inuse= 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*===========================================================================*
|
||||
* pci_ids *
|
||||
|
|
|
@ -82,7 +82,7 @@ extern struct pci_isabridge pci_isabridge[];
|
|||
extern struct pci_pcibridge pci_pcibridge[];
|
||||
|
||||
/* Utility functions */
|
||||
_PROTOTYPE( void pci_reserve3, (int devind, int proc, char name[M3_STRING]));
|
||||
_PROTOTYPE( int pci_reserve3, (int devind, int proc, char name[M3_STRING]));
|
||||
_PROTOTYPE( void pci_release, (char name[M3_STRING]) );
|
||||
_PROTOTYPE( int pci_first_dev_a, (struct rs_pci *aclp, int *devindp,
|
||||
u16_t *vidp, u16_t *didp) );
|
||||
|
|
|
@ -185,6 +185,7 @@ _PROTOTYPE( int pci_next_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
|
|||
_PROTOTYPE( int pci_find_dev, (U8_t bus, U8_t dev, U8_t func,
|
||||
int *devindp) );
|
||||
_PROTOTYPE( void pci_reserve, (int devind) );
|
||||
_PROTOTYPE( int pci_reserve_ok, (int devind) );
|
||||
_PROTOTYPE( void pci_ids, (int devind, u16_t *vidp, u16_t *didp) );
|
||||
_PROTOTYPE( void pci_rescan_bus, (U8_t busnr) );
|
||||
_PROTOTYPE( u8_t pci_attr_r8, (int devind, int port) );
|
||||
|
|
|
@ -26,3 +26,17 @@ int devind;
|
|||
panic("pci", "pci_reserve: got bad reply from PCI", m.m_type);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* pci_reserve_ok *
|
||||
*===========================================================================*/
|
||||
PUBLIC int pci_reserve_ok(devind)
|
||||
int devind;
|
||||
{
|
||||
int r;
|
||||
message m;
|
||||
|
||||
m.m1_i1= devind;
|
||||
|
||||
return(_taskcall(pci_procnr, BUSC_PCI_RESERVE, &m));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue