1624Sschwartz /* 2624Sschwartz * CDDL HEADER START 3624Sschwartz * 4624Sschwartz * The contents of this file are subject to the terms of the 5624Sschwartz * Common Development and Distribution License, Version 1.0 only 6624Sschwartz * (the "License"). You may not use this file except in compliance 7624Sschwartz * with the License. 8624Sschwartz * 9624Sschwartz * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10624Sschwartz * or http://www.opensolaris.org/os/licensing. 11624Sschwartz * See the License for the specific language governing permissions 12624Sschwartz * and limitations under the License. 13624Sschwartz * 14624Sschwartz * When distributing Covered Code, include this CDDL HEADER in each 15624Sschwartz * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16624Sschwartz * If applicable, add the following below this CDDL HEADER, with the 17624Sschwartz * fields enclosed by brackets "[]" replaced with your own identifying 18624Sschwartz * information: Portions Copyright [yyyy] [name of copyright owner] 19624Sschwartz * 20624Sschwartz * CDDL HEADER END 21624Sschwartz */ 22624Sschwartz /* 23624Sschwartz * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24624Sschwartz * Use is subject to license terms. 25624Sschwartz */ 26624Sschwartz 27624Sschwartz #ifndef _SYS_PX_TOOLS_VAR_H 28624Sschwartz #define _SYS_PX_TOOLS_VAR_H 29624Sschwartz 30624Sschwartz #pragma ident "%Z%%M% %I% %E% SMI" 31624Sschwartz 32624Sschwartz #ifdef __cplusplus 33624Sschwartz extern "C" { 34624Sschwartz #endif 35624Sschwartz 36624Sschwartz /* 37624Sschwartz * This file contains definitions shared between the platform specific 38624Sschwartz * px_tools_4[u/v].c files and px_tools.c 39624Sschwartz */ 40624Sschwartz 41624Sschwartz /* 42624Sschwartz * Build device address based on base addr from range prop, and 43624Sschwartz * bus, dev and func values passed in. 44624Sschwartz */ 45624Sschwartz #define PX_GET_BDF(p_p) \ 46624Sschwartz (((p_p)->bus_no << PCI_REG_BUS_SHIFT) + \ 47624Sschwartz ((p_p)->dev_no << PCI_REG_DEV_SHIFT) + \ 48624Sschwartz ((p_p)->func_no << PCI_REG_FUNC_SHIFT)) 49624Sschwartz 50624Sschwartz /* 51624Sschwartz * PX hardware shifts bus / dev / function bits 4 to the left of their 52624Sschwartz * normal PCI placement. 53624Sschwartz */ 54624Sschwartz #define PX_PCI_BDF_OFFSET_DELTA 4 55624Sschwartz 56624Sschwartz #define PCI_BAR_OFFSET(x) (pci_bars[x.barnum]) 57624Sschwartz 58624Sschwartz #define PX_ISWRITE B_TRUE 59624Sschwartz #define PX_ISREAD B_FALSE 60624Sschwartz 61624Sschwartz #define SUCCESS 0 62624Sschwartz 63624Sschwartz /* Exported from px_tools.c */ 64624Sschwartz 65624Sschwartz extern uint8_t pci_bars[]; 66624Sschwartz extern int pci_num_bars; 67624Sschwartz 68624Sschwartz /* pxtool internal platform spec stuff exported by px_tools_4[u/v].c files */ 69624Sschwartz 70624Sschwartz extern int pxtool_num_inos; 71624Sschwartz 72*1064Sschwartz int pxtool_pcicfg_access(px_t *px_p, pcitool_reg_t *prg_p, 73624Sschwartz uint64_t *data_p, boolean_t is_write); 74*1064Sschwartz int pxtool_pciiomem_access(px_t *px_p, pcitool_reg_t *prg_p, 75624Sschwartz uint64_t *data_p, boolean_t is_write); 76624Sschwartz int pxtool_dev_reg_ops_platchk(dev_info_t *dip, pcitool_reg_t *prg_p); 77624Sschwartz 78624Sschwartz #ifdef __cplusplus 79624Sschwartz } 80624Sschwartz #endif 81624Sschwartz 82624Sschwartz #endif /* _SYS_PX_TOOLS_VAR_H */ 83