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
35extern "C" {
36#endif
37
38#define	PCIDB_VERSION	1
39
40typedef struct pcidb_hdl pcidb_hdl_t;
41typedef struct pcidb_vendor pcidb_vendor_t;
42typedef struct pcidb_device pcidb_device_t;
43typedef struct pcidb_subvd pcidb_subvd_t;
44
45extern pcidb_hdl_t *pcidb_open(int);
46extern void pcidb_close(pcidb_hdl_t *);
47
48extern pcidb_vendor_t *pcidb_lookup_vendor(pcidb_hdl_t *, uint16_t);
49extern pcidb_vendor_t *pcidb_vendor_iter(pcidb_hdl_t *);
50extern pcidb_vendor_t *pcidb_vendor_iter_next(pcidb_vendor_t *);
51
52extern const char *pcidb_vendor_name(pcidb_vendor_t *);
53extern uint16_t pcidb_vendor_id(pcidb_vendor_t *);
54
55extern pcidb_device_t *pcidb_lookup_device(pcidb_hdl_t *, uint16_t, uint16_t);
56extern pcidb_device_t *pcidb_lookup_device_by_vendor(pcidb_vendor_t *,
57    uint16_t);
58extern pcidb_device_t *pcidb_device_iter(pcidb_vendor_t *);
59extern pcidb_device_t *pcidb_device_iter_next(pcidb_device_t *);
60
61extern const char *pcidb_device_name(pcidb_device_t *);
62extern uint16_t pcidb_device_id(pcidb_device_t *);
63extern pcidb_vendor_t *pcidb_device_vendor(pcidb_device_t *);
64
65extern pcidb_subvd_t *pcidb_lookup_subvd(pcidb_hdl_t *, uint16_t, uint16_t,
66    uint16_t, uint16_t);
67extern pcidb_subvd_t *pcidb_lookup_subvd_by_vendor(pcidb_vendor_t *, uint16_t,
68    uint16_t, uint16_t);
69extern pcidb_subvd_t *pcidb_lookup_subvd_by_device(pcidb_device_t *, uint16_t,
70    uint16_t);
71extern pcidb_subvd_t *pcidb_subvd_iter(pcidb_device_t *);
72extern pcidb_subvd_t *pcidb_subvd_iter_next(pcidb_subvd_t *);
73
74extern const char *pcidb_subvd_name(pcidb_subvd_t *);
75extern uint16_t pcidb_subvd_svid(pcidb_subvd_t *);
76extern uint16_t pcidb_subvd_sdid(pcidb_subvd_t *);
77extern pcidb_device_t *pcidb_subvd_device(pcidb_subvd_t *);
78extern pcidb_vendor_t *pcidb_subvd_vendor(pcidb_subvd_t *);
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif /* _PCIDB_H */
85