minix/lib/syslib/pci_reserve.c
Ben Gras 168d766f32 . 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
2007-02-20 17:09:19 +00:00

43 lines
983 B
C

/*
pci_reserve.c
*/
#include "pci.h"
#include "syslib.h"
#include <minix/sysutil.h>
/*===========================================================================*
* pci_reserve *
*===========================================================================*/
PUBLIC void pci_reserve(devind)
int devind;
{
int r;
message m;
m.m_type= BUSC_PCI_RESERVE;
m.m1_i1= devind;
r= sendrec(pci_procnr, &m);
if (r != 0)
panic("pci", "pci_reserve: can't talk to PCI", r);
if (m.m_type != 0)
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));
}