1*3c4226f9Spjha /* 2*3c4226f9Spjha * CDDL HEADER START 3*3c4226f9Spjha * 4*3c4226f9Spjha * The contents of this file are subject to the terms of the 5*3c4226f9Spjha * Common Development and Distribution License (the "License"). 6*3c4226f9Spjha * You may not use this file except in compliance with the License. 7*3c4226f9Spjha * 8*3c4226f9Spjha * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*3c4226f9Spjha * or http://www.opensolaris.org/os/licensing. 10*3c4226f9Spjha * See the License for the specific language governing permissions 11*3c4226f9Spjha * and limitations under the License. 12*3c4226f9Spjha * 13*3c4226f9Spjha * When distributing Covered Code, include this CDDL HEADER in each 14*3c4226f9Spjha * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*3c4226f9Spjha * If applicable, add the following below this CDDL HEADER, with the 16*3c4226f9Spjha * fields enclosed by brackets "[]" replaced with your own identifying 17*3c4226f9Spjha * information: Portions Copyright [yyyy] [name of copyright owner] 18*3c4226f9Spjha * 19*3c4226f9Spjha * CDDL HEADER END 20*3c4226f9Spjha */ 21*3c4226f9Spjha /* 22*3c4226f9Spjha * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*3c4226f9Spjha * Use is subject to license terms. 24*3c4226f9Spjha */ 25*3c4226f9Spjha 26*3c4226f9Spjha /* private devlink info interfaces */ 27*3c4226f9Spjha 28*3c4226f9Spjha #ifndef _CFG_LINK_H 29*3c4226f9Spjha #define _CFG_LINK_H 30*3c4226f9Spjha 31*3c4226f9Spjha #pragma ident "%Z%%M% %I% %E% SMI" 32*3c4226f9Spjha 33*3c4226f9Spjha #include <devfsadm.h> 34*3c4226f9Spjha 35*3c4226f9Spjha #ifdef __cplusplus 36*3c4226f9Spjha extern "C" { 37*3c4226f9Spjha #endif 38*3c4226f9Spjha 39*3c4226f9Spjha #define SCSI_CFG_LINK_RE "^cfg/c[0-9]+$" 40*3c4226f9Spjha #define SBD_CFG_LINK_RE "^cfg/((((N[0-9]+[.])?(SB|IB))?[0-9]+)|[abcd])$" 41*3c4226f9Spjha #define USB_CFG_LINK_RE "^cfg/((usb[0-9]+)/([0-9]+)([.]([0-9])+)*)$" 42*3c4226f9Spjha #define PCI_CFG_LINK_RE "^cfg/[:alnum:]$" 43*3c4226f9Spjha #define IB_CFG_LINK_RE "^cfg/(hca[0-9A-F]+)$" 44*3c4226f9Spjha #define SATA_CFG_LINK_RE "^cfg/((sata[0-9]+)/([0-9]+)([.]([0-9])+)*)$" 45*3c4226f9Spjha #define PCI_CFG_PATH_LINK_RE "^cfg/(.*pcie.*)$" 46*3c4226f9Spjha 47*3c4226f9Spjha #define CFG_DIRNAME "cfg" 48*3c4226f9Spjha 49*3c4226f9Spjha #define PROP_FIRST_CHAS "first-in-chassis" 50*3c4226f9Spjha #define PROP_SLOT_NAMES "slot-names" 51*3c4226f9Spjha #define PROP_PHYS_SLOT "physical-slot#" 52*3c4226f9Spjha #define PROP_DEV_TYPE "device_type" 53*3c4226f9Spjha #define PROP_BUS_RANGE "bus-range" 54*3c4226f9Spjha #define PROP_SERID "serialid#" 55*3c4226f9Spjha #define PROP_REG "reg" 56*3c4226f9Spjha #define PROP_AP_NAMES "ap-names" 57*3c4226f9Spjha #define PROPVAL_PCIEX "pciex" 58*3c4226f9Spjha #define DEVTYPE_PCIE "pcie" 59*3c4226f9Spjha #define IOB_PRE "iob" 60*3c4226f9Spjha #define AP_PATH_SEP ":" 61*3c4226f9Spjha #define AP_PATH_IOB_SEP "." 62*3c4226f9Spjha #define VENDID_SUN 0x108e 63*3c4226f9Spjha #define APNODE_DEFNAME 0x1 64*3c4226f9Spjha 65*3c4226f9Spjha /* converts size in bits to a mask covering those bit positions */ 66*3c4226f9Spjha #define SIZE2MASK(s) ((1 << (s)) - 1) 67*3c4226f9Spjha #define SIZE2MASK64(s) ((1LL << (s)) - 1LL) 68*3c4226f9Spjha 69*3c4226f9Spjha /* 70*3c4226f9Spjha * macros for the ieee1275 "reg" property 71*3c4226f9Spjha * naming format and semantics: 72*3c4226f9Spjha * 73*3c4226f9Spjha * REG_<cell>_SIZE_<field> = bit size of <field> in <cell> 74*3c4226f9Spjha * REG_<cell>_OFF_<field> = starting bit position of <field> in <cell> 75*3c4226f9Spjha * 76*3c4226f9Spjha * REG_<cell>_<field>(r) = returns the value of <field> in <cell> using: 77*3c4226f9Spjha * (((r) >> REG_<cell>_OFF_<field>) & SIZE2MASK(REG_<cell>_SIZE_<field>)) 78*3c4226f9Spjha */ 79*3c4226f9Spjha #define REG_PHYSHI_SIZE_PCIDEV 5 80*3c4226f9Spjha #define REG_PHYSHI_OFF_PCIDEV 11 81*3c4226f9Spjha #define REG_PHYSHI_PCIDEV(r) \ 82*3c4226f9Spjha (((r) >> REG_PHYSHI_OFF_PCIDEV) & SIZE2MASK(REG_PHYSHI_SIZE_PCIDEV)) 83*3c4226f9Spjha 84*3c4226f9Spjha /* rp = ptr to 5-tuple int array */ 85*3c4226f9Spjha #define REG_PHYSHI_INDEX 0 86*3c4226f9Spjha #define REG_PHYSHI(rp) ((rp)[REG_PHYSHI_INDEX]) 87*3c4226f9Spjha 88*3c4226f9Spjha #define REG_PCIDEV(rp) (REG_PHYSHI_PCIDEV(REG_PHYSHI(rp))) 89*3c4226f9Spjha 90*3c4226f9Spjha 91*3c4226f9Spjha #define DEV "/dev" 92*3c4226f9Spjha #define DEV_LEN 4 93*3c4226f9Spjha #define DEVICES "/devices" 94*3c4226f9Spjha #define DEVICES_LEN 8 95*3c4226f9Spjha 96*3c4226f9Spjha #ifdef __cplusplus 97*3c4226f9Spjha } 98*3c4226f9Spjha #endif 99*3c4226f9Spjha 100*3c4226f9Spjha #endif /* _CFG_LINK_H */ 101