. pci driver now returns devices, even when they have been pci_reserve()d
[minix3.git] / lib / syslib / pci_first_dev.c
blob9fd06de758685d57c628136328e6cccbf748dfe6
1 /*
2 pci_first_dev.c
3 */
5 #include "pci.h"
6 #include "syslib.h"
7 #include <minix/sysutil.h>
9 /*===========================================================================*
10 * pci_first_dev *
11 *===========================================================================*/
12 PUBLIC int pci_first_dev(devindp, vidp, didp)
13 int *devindp;
14 u16_t *vidp;
15 u16_t *didp;
17 int r;
18 message m;
20 m.m_type= BUSC_PCI_FIRST_DEV;
21 r= sendrec(pci_procnr, &m);
22 if (r != 0)
23 panic("pci", "pci_first_dev: can't talk to PCI", r);
24 if (m.m_type == 1)
26 *devindp= m.m1_i1;
27 *vidp= m.m1_i2;
28 *didp= m.m1_i3;
29 #if DEBUG
30 printf("pci_first_dev: got device %d, %04x/%04x\n",
31 *devindp, *vidp, *didp);
32 #endif
33 return 1;
35 if (m.m_type != 0)
36 panic("pci", "pci_first_dev: got bad reply from PCI", m.m_type);
38 #if DEBUG
39 printf("pci_first_dev: got nothing\n");
40 #endif
41 return 0;