make vfs & filesystems use failable copying
[minix3.git] / lib / libsys / pci_get_bar.c
bloba629f62f2e51781c8cade3912df31610d9ebfc05
1 /*
2 pci_get_bar.c
3 */
5 #include "pci.h"
6 #include "syslib.h"
7 #include <minix/sysutil.h>
9 /*===========================================================================*
10 * pci_get_bar *
11 *===========================================================================*/
12 int pci_get_bar(devind, port, base, size, ioflag)
13 int devind;
14 int port;
15 u32_t *base;
16 u32_t *size;
17 int *ioflag;
19 int r;
20 message m;
22 m.m_type= BUSC_PCI_GET_BAR;
23 m.BUSC_PGB_DEVIND= devind;
24 m.BUSC_PGB_PORT= port;
26 r= ipc_sendrec(pci_procnr, &m);
27 if (r != 0)
28 panic("pci_get_bar: can't talk to PCI: %d", r);
30 if (m.m_type == 0)
32 *base= m.BUSC_PGB_BASE;
33 *size= m.BUSC_PGB_SIZE;
34 *ioflag= m.BUSC_PGB_IOFLAG;
36 return m.m_type;