make vfs & filesystems use failable copying
[minix3.git] / lib / libsys / pci_find_dev.c
blob5244c4ab5c1cd228be6e4333a7793b883e322ed9
1 /*
2 pci_find_dev.c
3 */
5 #include "pci.h"
6 #include "syslib.h"
7 #include <minix/sysutil.h>
9 /*===========================================================================*
10 * pci_find_dev *
11 *===========================================================================*/
12 int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp)
14 int r;
15 message m;
17 m.m_type= BUSC_PCI_FIND_DEV;
18 m.m1_i1= bus;
19 m.m1_i2= dev;
20 m.m1_i3= func;
22 r= ipc_sendrec(pci_procnr, &m);
23 if (r != 0)
24 panic("pci_find_dev: can't talk to PCI: %d", r);
26 if (m.m_type == 1)
28 *devindp= m.m1_i1;
29 printf("pci_find_dev: got device %d for %d.%d.%d\n",
30 *devindp, bus, dev, func);
31 return 1;
33 if (m.m_type != 0)
34 panic("pci_find_dev: got bad reply from PCI: %d", m.m_type);
36 printf("pci_find_dev: got nothing\n");
37 return 0;