Rev | Line | |
---|
[9] | 1 | /*
|
---|
| 2 | pci_find_dev.c
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | #include "pci.h"
|
---|
| 6 | #include "syslib.h"
|
---|
| 7 | #include <minix/sysutil.h>
|
---|
| 8 |
|
---|
| 9 | /*===========================================================================*
|
---|
| 10 | * pci_find_dev *
|
---|
| 11 | *===========================================================================*/
|
---|
| 12 | PUBLIC int pci_find_dev(bus, dev, func, devindp)
|
---|
| 13 | u8_t bus;
|
---|
| 14 | u8_t dev;
|
---|
| 15 | u8_t func;
|
---|
| 16 | int *devindp;
|
---|
| 17 | {
|
---|
| 18 | int r;
|
---|
| 19 | message m;
|
---|
| 20 |
|
---|
| 21 | m.m_type= BUSC_PCI_FIND_DEV;
|
---|
| 22 | m.m1_i1= bus;
|
---|
| 23 | m.m1_i2= dev;
|
---|
| 24 | m.m1_i3= func;
|
---|
| 25 |
|
---|
| 26 | r= sendrec(pci_procnr, &m);
|
---|
| 27 | if (r != 0)
|
---|
| 28 | panic("pci", "pci_find_dev: can't talk to PCI", r);
|
---|
| 29 |
|
---|
| 30 | if (m.m_type == 1)
|
---|
| 31 | {
|
---|
| 32 | *devindp= m.m1_i1;
|
---|
| 33 | printf("pci_find_dev: got device %d for %d.%d.%d\n",
|
---|
| 34 | *devindp, bus, dev, func);
|
---|
| 35 | return 1;
|
---|
| 36 | }
|
---|
| 37 | if (m.m_type != 0)
|
---|
| 38 | panic("pci", "pci_find_dev: got bad reply from PCI", m.m_type);
|
---|
| 39 |
|
---|
| 40 | printf("pci_find_dev: got nothing\n");
|
---|
| 41 | return 0;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.