pkgin_all: script to auto-install all packages
[minix.git] / lib / libsys / pci_first_dev.c
blob8449cfccc6b70d7c1170cdb6b7cc74a6f22a0cf0
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 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_first_dev: can't talk to PCI: %d", 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_first_dev: got bad reply from PCI: %d", m.m_type);
38 #if DEBUG
39 printf("pci_first_dev: got nothing\n");
40 #endif
41 return 0;