1 /*
2 pci_get_bar.c
3 */
4
5 #include "pci.h"
6 #include "syslib.h"
7 #include <minix/sysutil.h>
8
9 /*===========================================================================*
10 * pci_get_bar *
11 *===========================================================================*/
pci_get_bar(devind,port,base,size,ioflag)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;
18 {
19 int r;
20 message m;
21
22 m.m_type= BUSC_PCI_GET_BAR;
23 m.m_lsys_pci_busc_get_bar.devind = devind;
24 m.m_lsys_pci_busc_get_bar.port = port;
25
26 r= ipc_sendrec(pci_procnr, &m);
27 if (r != 0)
28 panic("pci_get_bar: can't talk to PCI: %d", r);
29
30 if (m.m_type == 0)
31 {
32 *base= m.m_pci_lsys_busc_get_bar.base;
33 *size= m.m_pci_lsys_busc_get_bar.size;
34 *ioflag= m.m_pci_lsys_busc_get_bar.flags;
35 }
36 return m.m_type;
37 }
38
39