source: trunk/minix/lib/syslib/pci_first_dev.c@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 868 bytes
Line 
1/*
2pci_first_dev.c
3*/
4
5#include "pci.h"
6#include "syslib.h"
7#include <minix/sysutil.h>
8
9/*===========================================================================*
10 * pci_first_dev *
11 *===========================================================================*/
12PUBLIC int pci_first_dev(devindp, vidp, didp)
13int *devindp;
14u16_t *vidp;
15u16_t *didp;
16{
17 int r;
18 message m;
19
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)
25 {
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;
34 }
35 if (m.m_type != 0)
36 panic("pci", "pci_first_dev: got bad reply from PCI", m.m_type);
37
38#if DEBUG
39 printf("pci_first_dev: got nothing\n");
40#endif
41 return 0;
42}
Note: See TracBrowser for help on using the repository browser.