xref: /minix3/minix/lib/libsys/pci_reserve.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /*
2*433d6423SLionel Sambuc pci_reserve.c
3*433d6423SLionel Sambuc */
4*433d6423SLionel Sambuc 
5*433d6423SLionel Sambuc #include "pci.h"
6*433d6423SLionel Sambuc #include "syslib.h"
7*433d6423SLionel Sambuc #include <minix/sysutil.h>
8*433d6423SLionel Sambuc 
9*433d6423SLionel Sambuc /*===========================================================================*
10*433d6423SLionel Sambuc  *				pci_reserve				     *
11*433d6423SLionel Sambuc  *===========================================================================*/
pci_reserve(devind)12*433d6423SLionel Sambuc void pci_reserve(devind)
13*433d6423SLionel Sambuc int devind;
14*433d6423SLionel Sambuc {
15*433d6423SLionel Sambuc 	int r;
16*433d6423SLionel Sambuc 	message m;
17*433d6423SLionel Sambuc 
18*433d6423SLionel Sambuc 	m.m_type= BUSC_PCI_RESERVE;
19*433d6423SLionel Sambuc 	m.m1_i1= devind;
20*433d6423SLionel Sambuc 
21*433d6423SLionel Sambuc 	r= ipc_sendrec(pci_procnr, &m);
22*433d6423SLionel Sambuc 	if (r != 0)
23*433d6423SLionel Sambuc 		panic("pci_reserve: can't talk to PCI: %d", r);
24*433d6423SLionel Sambuc 
25*433d6423SLionel Sambuc 	if (m.m_type != 0)
26*433d6423SLionel Sambuc 		panic("pci_reserve: got bad reply from PCI: %d", m.m_type);
27*433d6423SLionel Sambuc }
28*433d6423SLionel Sambuc 
29*433d6423SLionel Sambuc /*===========================================================================*
30*433d6423SLionel Sambuc  *                              pci_reserve_ok                               *
31*433d6423SLionel Sambuc  *===========================================================================*/
pci_reserve_ok(int devind)32*433d6423SLionel Sambuc int pci_reserve_ok(int devind)
33*433d6423SLionel Sambuc {
34*433d6423SLionel Sambuc         message m;
35*433d6423SLionel Sambuc 
36*433d6423SLionel Sambuc         m.m1_i1= devind;
37*433d6423SLionel Sambuc 
38*433d6423SLionel Sambuc         return(_taskcall(pci_procnr, BUSC_PCI_RESERVE, &m));
39*433d6423SLionel Sambuc }
40*433d6423SLionel Sambuc 
41