10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51501Sgovinda * Common Development and Distribution License (the "License"). 61501Sgovinda * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*10923SEvan.Yan@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_PX_UTIL_H 270Sstevel@tonic-gate #define _SYS_PX_UTIL_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate #define HI32(x) ((uint32_t)(((uint64_t)(x)) >> 32)) 340Sstevel@tonic-gate #define LO32(x) ((uint32_t)(x)) 350Sstevel@tonic-gate #define NAMEINST(dip) ddi_driver_name(dip), ddi_get_instance(dip) 360Sstevel@tonic-gate #define NAMEADDR(dip) ddi_node_name(dip), ddi_get_name_addr(dip) 370Sstevel@tonic-gate 380Sstevel@tonic-gate extern int px_init_child(px_t *px_p, dev_info_t *child); 390Sstevel@tonic-gate extern int px_uninit_child(px_t *px_p, dev_info_t *child); 400Sstevel@tonic-gate extern int px_report_dev(dev_info_t *dip); 410Sstevel@tonic-gate extern int px_get_props(px_t *px_p, dev_info_t *dip); 420Sstevel@tonic-gate extern void px_free_props(px_t *px_p); 430Sstevel@tonic-gate extern int px_map_regs(px_t *px_p, dev_info_t *dip); 440Sstevel@tonic-gate extern void px_unmap_regs(px_t *px_p); 450Sstevel@tonic-gate extern int pci_log_cfg_err(dev_info_t *dip, ushort_t status_reg, char *err_msg); 460Sstevel@tonic-gate 470Sstevel@tonic-gate /* bus map routines */ 480Sstevel@tonic-gate extern int px_reloc_reg(dev_info_t *dip, dev_info_t *rdip, px_t *px_p, 490Sstevel@tonic-gate pci_regspec_t *pci_rp); 500Sstevel@tonic-gate extern int px_xlate_reg(px_t *px_p, pci_regspec_t *pci_rp, 510Sstevel@tonic-gate struct regspec *new_rp); 521064Sschwartz extern int px_search_ranges(px_t *px_p, uint32_t space_type, uint32_t reg_begin, 53*10923SEvan.Yan@Sun.COM uint32_t reg_end, pci_ranges_t **sel_rng_p, uint_t *base_offset_p); 540Sstevel@tonic-gate 550Sstevel@tonic-gate /* bus add intrspec */ 560Sstevel@tonic-gate extern off_t px_get_reg_set_size(dev_info_t *child, int rnumber); 570Sstevel@tonic-gate extern uint_t px_get_nreg_set(dev_info_t *child); 580Sstevel@tonic-gate extern uint_t px_get_nintr(dev_info_t *child); 590Sstevel@tonic-gate extern uint64_t px_get_cfg_pabase(px_t *px_p); 600Sstevel@tonic-gate 610Sstevel@tonic-gate #ifdef __cplusplus 620Sstevel@tonic-gate } 630Sstevel@tonic-gate #endif 640Sstevel@tonic-gate 650Sstevel@tonic-gate #endif /* _SYS_PX_UTIL_H */ 66