xref: /illumos-gate/usr/src/uts/sun4/io/px/px_tools_var.h (revision dabea0db)
169cd775fSschwartz /*
269cd775fSschwartz  * CDDL HEADER START
369cd775fSschwartz  *
469cd775fSschwartz  * The contents of this file are subject to the terms of the
569cd775fSschwartz  * Common Development and Distribution License, Version 1.0 only
669cd775fSschwartz  * (the "License").  You may not use this file except in compliance
769cd775fSschwartz  * with the License.
869cd775fSschwartz  *
969cd775fSschwartz  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1069cd775fSschwartz  * or http://www.opensolaris.org/os/licensing.
1169cd775fSschwartz  * See the License for the specific language governing permissions
1269cd775fSschwartz  * and limitations under the License.
1369cd775fSschwartz  *
1469cd775fSschwartz  * When distributing Covered Code, include this CDDL HEADER in each
1569cd775fSschwartz  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1669cd775fSschwartz  * If applicable, add the following below this CDDL HEADER, with the
1769cd775fSschwartz  * fields enclosed by brackets "[]" replaced with your own identifying
1869cd775fSschwartz  * information: Portions Copyright [yyyy] [name of copyright owner]
1969cd775fSschwartz  *
2069cd775fSschwartz  * CDDL HEADER END
2169cd775fSschwartz  */
2269cd775fSschwartz /*
2369cd775fSschwartz  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
2469cd775fSschwartz  * Use is subject to license terms.
2569cd775fSschwartz  */
2669cd775fSschwartz 
2769cd775fSschwartz #ifndef _SYS_PX_TOOLS_VAR_H
2869cd775fSschwartz #define	_SYS_PX_TOOLS_VAR_H
2969cd775fSschwartz 
3069cd775fSschwartz #pragma ident	"%Z%%M%	%I%	%E% SMI"
3169cd775fSschwartz 
3269cd775fSschwartz #ifdef	__cplusplus
3369cd775fSschwartz extern "C" {
3469cd775fSschwartz #endif
3569cd775fSschwartz 
3669cd775fSschwartz /*
3769cd775fSschwartz  * This file contains definitions shared between the platform specific
3869cd775fSschwartz  * px_tools_4[u/v].c files and px_tools.c
3969cd775fSschwartz  */
4069cd775fSschwartz 
4169cd775fSschwartz /*
4269cd775fSschwartz  * Build device address based on base addr from range prop, and
4369cd775fSschwartz  * bus, dev and func values passed in.
4469cd775fSschwartz  */
4569cd775fSschwartz #define	PX_GET_BDF(p_p)				\
4669cd775fSschwartz 	(((p_p)->bus_no << PCI_REG_BUS_SHIFT) +	\
4769cd775fSschwartz 	((p_p)->dev_no << PCI_REG_DEV_SHIFT) +	\
4869cd775fSschwartz 	((p_p)->func_no << PCI_REG_FUNC_SHIFT))
4969cd775fSschwartz 
5069cd775fSschwartz /*
5169cd775fSschwartz  * PX hardware shifts bus / dev / function bits 4 to the left of their
5269cd775fSschwartz  * normal PCI placement.
5369cd775fSschwartz  */
5469cd775fSschwartz #define	PX_PCI_BDF_OFFSET_DELTA	4
5569cd775fSschwartz 
5669cd775fSschwartz #define	PCI_BAR_OFFSET(x)	(pci_bars[x.barnum])
5769cd775fSschwartz 
5869cd775fSschwartz #define	PX_ISWRITE		B_TRUE
5969cd775fSschwartz #define	PX_ISREAD		B_FALSE
6069cd775fSschwartz 
6169cd775fSschwartz #define	SUCCESS	0
6269cd775fSschwartz 
6369cd775fSschwartz /* Exported from px_tools.c */
6469cd775fSschwartz 
6569cd775fSschwartz extern uint8_t pci_bars[];
6669cd775fSschwartz extern int pci_num_bars;
6769cd775fSschwartz 
6869cd775fSschwartz /* pxtool internal platform spec stuff exported by px_tools_4[u/v].c files */
6969cd775fSschwartz 
7069cd775fSschwartz extern int pxtool_num_inos;
7169cd775fSschwartz 
72*dabea0dbSschwartz int pxtool_pcicfg_access(px_t *px_p, pcitool_reg_t *prg_p,
7369cd775fSschwartz     uint64_t *data_p, boolean_t is_write);
74*dabea0dbSschwartz int pxtool_pciiomem_access(px_t *px_p, pcitool_reg_t *prg_p,
7569cd775fSschwartz     uint64_t *data_p, boolean_t is_write);
7669cd775fSschwartz int pxtool_dev_reg_ops_platchk(dev_info_t *dip, pcitool_reg_t *prg_p);
7769cd775fSschwartz 
7869cd775fSschwartz #ifdef	__cplusplus
7969cd775fSschwartz }
8069cd775fSschwartz #endif
8169cd775fSschwartz 
8269cd775fSschwartz #endif	/* _SYS_PX_TOOLS_VAR_H */
83