source: trunk/minix/lib/syslib/pci_dev_name.c@ 11

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

Minix 3.1.2a

File size: 999 bytes
Line 
1/*
2pci_dev_name.c
3*/
4
5#include "pci.h"
6#include "syslib.h"
7#include <minix/sysutil.h>
8
9/*===========================================================================*
10 * pci_dev_name *
11 *===========================================================================*/
12PUBLIC char *pci_dev_name(vid, did)
13u16_t vid;
14u16_t did;
15{
16 static char name[80]; /* We need a better interface for this */
17
18 int r;
19 message m;
20
21 m.m_type= BUSC_PCI_DEV_NAME;
22 m.m1_i1= vid;
23 m.m1_i2= did;
24 m.m1_i3= sizeof(name);
25 m.m1_p1= name;
26
27 r= sendrec(pci_procnr, &m);
28 if (r != 0)
29 panic("pci", "pci_dev_name: can't talk to PCI", r);
30
31 if (m.m_type == ENOENT)
32 {
33 printf("pci_dev_name: got no name\n");
34 return NULL; /* No name for this device */
35 }
36 if (m.m_type != 0)
37 panic("pci", "pci_dev_name: got bad reply from PCI", m.m_type);
38
39 name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL
40 * terminated.
41 */
42
43#if DEBUG
44 printf("pci_dev_name: got name %s\n", name);
45#endif
46 return name;
47}
48
Note: See TracBrowser for help on using the repository browser.