xref: /titanic_41/usr/src/lib/libpcidb/common/pcidb.h (revision 799d90a47c55505edaae809d753ad319c0a5c7aa)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
23  */
24 
25 /*
26  * This header file is private to illumos and should not be shipped.
27  */
28 
29 #ifndef	_PCIDB_H
30 #define	_PCIDB_H
31 
32 #include <stdint.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define	PCIDB_VERSION	1
39 
40 typedef struct pcidb_hdl pcidb_hdl_t;
41 typedef struct pcidb_vendor pcidb_vendor_t;
42 typedef struct pcidb_device pcidb_device_t;
43 typedef struct pcidb_subvd pcidb_subvd_t;
44 
45 extern pcidb_hdl_t *pcidb_open(int);
46 extern void pcidb_close(pcidb_hdl_t *);
47 
48 extern pcidb_vendor_t *pcidb_lookup_vendor(pcidb_hdl_t *, uint16_t);
49 extern pcidb_vendor_t *pcidb_vendor_iter(pcidb_hdl_t *);
50 extern pcidb_vendor_t *pcidb_vendor_iter_next(pcidb_vendor_t *);
51 
52 extern const char *pcidb_vendor_name(pcidb_vendor_t *);
53 extern uint16_t pcidb_vendor_id(pcidb_vendor_t *);
54 
55 extern pcidb_device_t *pcidb_lookup_device(pcidb_hdl_t *, uint16_t, uint16_t);
56 extern pcidb_device_t *pcidb_lookup_device_by_vendor(pcidb_vendor_t *,
57     uint16_t);
58 extern pcidb_device_t *pcidb_device_iter(pcidb_vendor_t *);
59 extern pcidb_device_t *pcidb_device_iter_next(pcidb_device_t *);
60 
61 extern const char *pcidb_device_name(pcidb_device_t *);
62 extern uint16_t pcidb_device_id(pcidb_device_t *);
63 extern pcidb_vendor_t *pcidb_device_vendor(pcidb_device_t *);
64 
65 extern pcidb_subvd_t *pcidb_lookup_subvd(pcidb_hdl_t *, uint16_t, uint16_t,
66     uint16_t, uint16_t);
67 extern pcidb_subvd_t *pcidb_lookup_subvd_by_vendor(pcidb_vendor_t *, uint16_t,
68     uint16_t, uint16_t);
69 extern pcidb_subvd_t *pcidb_lookup_subvd_by_device(pcidb_device_t *, uint16_t,
70     uint16_t);
71 extern pcidb_subvd_t *pcidb_subvd_iter(pcidb_device_t *);
72 extern pcidb_subvd_t *pcidb_subvd_iter_next(pcidb_subvd_t *);
73 
74 extern const char *pcidb_subvd_name(pcidb_subvd_t *);
75 extern uint16_t pcidb_subvd_svid(pcidb_subvd_t *);
76 extern uint16_t pcidb_subvd_sdid(pcidb_subvd_t *);
77 extern pcidb_device_t *pcidb_subvd_device(pcidb_subvd_t *);
78 extern pcidb_vendor_t *pcidb_subvd_vendor(pcidb_subvd_t *);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* _PCIDB_H */
85