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