xref: /illumos-gate/usr/src/uts/sun4/io/px/px_util.h (revision 55381082)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_PX_UTIL_H
28 #define	_SYS_PX_UTIL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	HI32(x) ((uint32_t)(((uint64_t)(x)) >> 32))
37 #define	LO32(x) ((uint32_t)(x))
38 #define	NAMEINST(dip)	ddi_driver_name(dip), ddi_get_instance(dip)
39 #define	NAMEADDR(dip)	ddi_node_name(dip), ddi_get_name_addr(dip)
40 
41 extern int px_init_child(px_t *px_p, dev_info_t *child);
42 extern int px_uninit_child(px_t *px_p, dev_info_t *child);
43 extern int px_report_dev(dev_info_t *dip);
44 extern int px_get_props(px_t *px_p, dev_info_t *dip);
45 extern void px_free_props(px_t *px_p);
46 extern int px_map_regs(px_t *px_p, dev_info_t *dip);
47 extern void px_unmap_regs(px_t *px_p);
48 extern int pci_log_cfg_err(dev_info_t *dip, ushort_t status_reg, char *err_msg);
49 
50 /* bus map routines */
51 extern int px_reloc_reg(dev_info_t *dip, dev_info_t *rdip, px_t *px_p,
52 	pci_regspec_t *pci_rp);
53 extern int px_xlate_reg(px_t *px_p, pci_regspec_t *pci_rp,
54 	struct regspec *new_rp);
55 
56 /* bus add intrspec */
57 extern off_t px_get_reg_set_size(dev_info_t *child, int rnumber);
58 extern uint_t px_get_nreg_set(dev_info_t *child);
59 extern uint_t px_get_nintr(dev_info_t *child);
60 extern uint64_t px_get_cfg_pabase(px_t *px_p);
61 
62 #ifdef	__cplusplus
63 }
64 #endif
65 
66 #endif	/* _SYS_PX_UTIL_H */
67