xref: /titanic_50/usr/src/uts/sun4/io/px/px_util.h (revision c10c16dec587a0662068f6e2991c29ed3a9db943)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_PX_UTIL_H
27 #define	_SYS_PX_UTIL_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #define	HI32(x) ((uint32_t)(((uint64_t)(x)) >> 32))
34 #define	LO32(x) ((uint32_t)(x))
35 #define	NAMEINST(dip)	ddi_driver_name(dip), ddi_get_instance(dip)
36 #define	NAMEADDR(dip)	ddi_node_name(dip), ddi_get_name_addr(dip)
37 
38 extern int px_init_child(px_t *px_p, dev_info_t *child);
39 extern int px_uninit_child(px_t *px_p, dev_info_t *child);
40 extern int px_report_dev(dev_info_t *dip);
41 extern int px_get_props(px_t *px_p, dev_info_t *dip);
42 extern void px_free_props(px_t *px_p);
43 extern int px_map_regs(px_t *px_p, dev_info_t *dip);
44 extern void px_unmap_regs(px_t *px_p);
45 extern int pci_log_cfg_err(dev_info_t *dip, ushort_t status_reg, char *err_msg);
46 
47 /* bus map routines */
48 extern int px_reloc_reg(dev_info_t *dip, dev_info_t *rdip, px_t *px_p,
49 	pci_regspec_t *pci_rp);
50 extern int px_xlate_reg(px_t *px_p, pci_regspec_t *pci_rp,
51 	struct regspec *new_rp);
52 extern int px_search_ranges(px_t *px_p, uint32_t space_type, uint32_t reg_begin,
53 	uint32_t reg_end, pci_ranges_t **sel_rng_p, uint_t *base_offset_p);
54 
55 /* bus add intrspec */
56 extern off_t px_get_reg_set_size(dev_info_t *child, int rnumber);
57 extern uint_t px_get_nreg_set(dev_info_t *child);
58 extern uint_t px_get_nintr(dev_info_t *child);
59 extern uint64_t px_get_cfg_pabase(px_t *px_p);
60 
61 #ifdef	__cplusplus
62 }
63 #endif
64 
65 #endif	/* _SYS_PX_UTIL_H */
66