xref: /titanic_41/usr/src/uts/sun4/io/px/px_util.h (revision 60405de4d8688d96dd05157c28db3ade5c9bc234)
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 2006 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #define	HI32(x) ((uint32_t)(((uint64_t)(x)) >> 32))
36 #define	LO32(x) ((uint32_t)(x))
37 #define	NAMEINST(dip)	ddi_driver_name(dip), ddi_get_instance(dip)
38 #define	NAMEADDR(dip)	ddi_node_name(dip), ddi_get_name_addr(dip)
39 
40 extern int px_init_child(px_t *px_p, dev_info_t *child);
41 extern int px_uninit_child(px_t *px_p, dev_info_t *child);
42 extern int px_report_dev(dev_info_t *dip);
43 extern int px_get_props(px_t *px_p, dev_info_t *dip);
44 extern void px_free_props(px_t *px_p);
45 extern int px_map_regs(px_t *px_p, dev_info_t *dip);
46 extern void px_unmap_regs(px_t *px_p);
47 extern int pci_log_cfg_err(dev_info_t *dip, ushort_t status_reg, char *err_msg);
48 
49 /* bus map routines */
50 extern int px_reloc_reg(dev_info_t *dip, dev_info_t *rdip, px_t *px_p,
51 	pci_regspec_t *pci_rp);
52 extern int px_xlate_reg(px_t *px_p, pci_regspec_t *pci_rp,
53 	struct regspec *new_rp);
54 extern int px_search_ranges(px_t *px_p, uint32_t space_type, uint32_t reg_begin,
55 	uint32_t reg_end, px_ranges_t **sel_rng_p, uint_t *base_offset_p);
56 
57 /* bus add intrspec */
58 extern off_t px_get_reg_set_size(dev_info_t *child, int rnumber);
59 extern uint_t px_get_nreg_set(dev_info_t *child);
60 extern uint_t px_get_nintr(dev_info_t *child);
61 extern uint64_t px_get_cfg_pabase(px_t *px_p);
62 
63 #ifdef	__cplusplus
64 }
65 #endif
66 
67 #endif	/* _SYS_PX_UTIL_H */
68