#define NR_DRIVERS 16
-PRIVATE struct name
-{
- char name[M3_STRING];
- int tasknr;
-} names[NR_DRIVERS];
-
PRIVATE struct acl
{
int inuse;
pci_init();
- for (i= 0; i<NR_DRIVERS; i++)
- names[i].tasknr= ANY;
-
for(;;)
{
r= receive(ANY, &m);
PRIVATE void do_init(mp)
message *mp;
{
- int i, r, empty;
+ int r;
#if DEBUG
- printf("PCI: pci_init: called by '%s'\n", mp->m3_ca1);
-#endif
- empty= -1;
- for (i= 0; i<NR_DRIVERS; i++)
- {
- if (empty == -1 && names[i].tasknr == ANY)
- empty= i;
- if (strcmp(names[i].name, mp->m3_ca1) == 0)
- break;
- }
- if (i >= NR_DRIVERS)
- {
- if (empty == -1)
- panic("pci", "do_init: too many clients", NR_DRIVERS);
- i= empty;
- strcpy(names[i].name, mp->m3_ca1);
- }
- else if (names[i].tasknr == mp->m_source)
- {
- /* Ignore all init calls for a process after the first one */
- }
-#if 0
- else
- pci_release(names[i].name);
+ printf("PCI: pci_init: called by '%d'\n", mp->m_source);
#endif
- names[i].tasknr= mp->m_source;
mp->m_type= 0;
r= send(mp->m_source, mp);
printf("do_acl: deleting ACL for %d ('%s') at entry %d\n",
acl[i].acl.rsp_endpoint, acl[i].acl.rsp_label, i);
+ /* Also release all devices held by this process */
+ pci_release(proc_nr);
+
reply(mp, OK);
}
{
int i, r, devind;
- /* Find the name of the caller */
- for (i= 0; i<NR_DRIVERS; i++)
- {
- if (names[i].tasknr == mp->m_source)
- break;
- }
- if (i >= NR_DRIVERS)
- {
- printf("pci`do_reserve: task %d did not call pci_init\n",
- mp->m_source);
- return;
- }
-
devind= mp->m1_i1;
-
- mp->m_type= pci_reserve3(devind, mp->m_source, names[i].name);
+ mp->m_type= pci_reserve2(devind, mp->m_source);
r= send(mp->m_source, mp);
if (r != 0)
{
u16_t pd_vid;
u16_t pd_did;
u8_t pd_ilr;
+
u8_t pd_inuse;
+ endpoint_t pd_proc;
struct bar
{
u32_t pb_size;
} pd_bar[BAM_NR];
int pd_bar_nr;
-
- char pd_name[M3_STRING];
} pcidev[NR_PCIDEV];
/* pb_flags */
/*===========================================================================*
* pci_reserve3 *
*===========================================================================*/
-PUBLIC int pci_reserve3(devind, proc, name)
+PUBLIC int pci_reserve2(devind, proc)
int devind;
int proc;
-char *name;
{
int i, r;
u8_t ilr;
if(pcidev[devind].pd_inuse)
return EBUSY;
pcidev[devind].pd_inuse= 1;
- strcpy(pcidev[devind].pd_name, name);
+ pcidev[devind].pd_proc= proc;
for (i= 0; i<pcidev[devind].pd_bar_nr; i++)
{
return OK;
}
-#if 0
/*===========================================================================*
* pci_release *
*===========================================================================*/
-PUBLIC void pci_release(name)
-char *name;
+PUBLIC void pci_release(proc)
+endpoint_t proc;
{
int i;
{
if (!pcidev[i].pd_inuse)
continue;
- if (strcmp(pcidev[i].pd_name, name) != 0)
+ if (pcidev[i].pd_proc != proc)
continue;
pcidev[i].pd_inuse= 0;
}
}
-#endif
/*===========================================================================*
* pci_ids *
extern struct pci_pcibridge pci_pcibridge[];
/* Utility functions */
-_PROTOTYPE( int pci_reserve3, (int devind, int proc, char name[M3_STRING]));
-_PROTOTYPE( void pci_release, (char name[M3_STRING]) );
+_PROTOTYPE( int pci_reserve2, (int devind, endpoint_t proc) );
+_PROTOTYPE( void pci_release, (endpoint_t proc) );
_PROTOTYPE( int pci_first_dev_a, (struct rs_pci *aclp, int *devindp,
u16_t *vidp, u16_t *didp) );
_PROTOTYPE( int pci_next_dev_a, (struct rs_pci *aclp, int *devindp,