xref: /illumos-gate/usr/src/uts/sun4/io/px/px_util.h (revision 26947304)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51de45cd9Sgovinda  * Common Development and Distribution License (the "License").
61de45cd9Sgovinda  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*26947304SEvan Yan  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_PX_UTIL_H
277c478bd9Sstevel@tonic-gate #define	_SYS_PX_UTIL_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #define	HI32(x) ((uint32_t)(((uint64_t)(x)) >> 32))
347c478bd9Sstevel@tonic-gate #define	LO32(x) ((uint32_t)(x))
357c478bd9Sstevel@tonic-gate #define	NAMEINST(dip)	ddi_driver_name(dip), ddi_get_instance(dip)
367c478bd9Sstevel@tonic-gate #define	NAMEADDR(dip)	ddi_node_name(dip), ddi_get_name_addr(dip)
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate extern int px_init_child(px_t *px_p, dev_info_t *child);
397c478bd9Sstevel@tonic-gate extern int px_uninit_child(px_t *px_p, dev_info_t *child);
407c478bd9Sstevel@tonic-gate extern int px_report_dev(dev_info_t *dip);
417c478bd9Sstevel@tonic-gate extern int px_get_props(px_t *px_p, dev_info_t *dip);
427c478bd9Sstevel@tonic-gate extern void px_free_props(px_t *px_p);
437c478bd9Sstevel@tonic-gate extern int px_map_regs(px_t *px_p, dev_info_t *dip);
447c478bd9Sstevel@tonic-gate extern void px_unmap_regs(px_t *px_p);
457c478bd9Sstevel@tonic-gate extern int pci_log_cfg_err(dev_info_t *dip, ushort_t status_reg, char *err_msg);
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /* bus map routines */
487c478bd9Sstevel@tonic-gate extern int px_reloc_reg(dev_info_t *dip, dev_info_t *rdip, px_t *px_p,
497c478bd9Sstevel@tonic-gate 	pci_regspec_t *pci_rp);
507c478bd9Sstevel@tonic-gate extern int px_xlate_reg(px_t *px_p, pci_regspec_t *pci_rp,
517c478bd9Sstevel@tonic-gate 	struct regspec *new_rp);
52dabea0dbSschwartz extern int px_search_ranges(px_t *px_p, uint32_t space_type, uint32_t reg_begin,
53*26947304SEvan Yan 	uint32_t reg_end, pci_ranges_t **sel_rng_p, uint_t *base_offset_p);
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /* bus add intrspec */
567c478bd9Sstevel@tonic-gate extern off_t px_get_reg_set_size(dev_info_t *child, int rnumber);
577c478bd9Sstevel@tonic-gate extern uint_t px_get_nreg_set(dev_info_t *child);
587c478bd9Sstevel@tonic-gate extern uint_t px_get_nintr(dev_info_t *child);
597c478bd9Sstevel@tonic-gate extern uint64_t px_get_cfg_pabase(px_t *px_p);
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
627c478bd9Sstevel@tonic-gate }
637c478bd9Sstevel@tonic-gate #endif
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #endif	/* _SYS_PX_UTIL_H */
66