13c4226f9Spjha /* 23c4226f9Spjha * CDDL HEADER START 33c4226f9Spjha * 43c4226f9Spjha * The contents of this file are subject to the terms of the 53c4226f9Spjha * Common Development and Distribution License (the "License"). 63c4226f9Spjha * You may not use this file except in compliance with the License. 73c4226f9Spjha * 83c4226f9Spjha * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 93c4226f9Spjha * or http://www.opensolaris.org/os/licensing. 103c4226f9Spjha * See the License for the specific language governing permissions 113c4226f9Spjha * and limitations under the License. 123c4226f9Spjha * 133c4226f9Spjha * When distributing Covered Code, include this CDDL HEADER in each 143c4226f9Spjha * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153c4226f9Spjha * If applicable, add the following below this CDDL HEADER, with the 163c4226f9Spjha * fields enclosed by brackets "[]" replaced with your own identifying 173c4226f9Spjha * information: Portions Copyright [yyyy] [name of copyright owner] 183c4226f9Spjha * 193c4226f9Spjha * CDDL HEADER END 203c4226f9Spjha */ 213c4226f9Spjha /* 22*4bb7efa7SGarrett D'Amore * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 233c4226f9Spjha * Use is subject to license terms. 243c4226f9Spjha */ 253c4226f9Spjha 263c4226f9Spjha /* private devlink info interfaces */ 273c4226f9Spjha 283c4226f9Spjha #ifndef _CFG_LINK_H 293c4226f9Spjha #define _CFG_LINK_H 303c4226f9Spjha 313c4226f9Spjha #include <devfsadm.h> 323c4226f9Spjha 333c4226f9Spjha #ifdef __cplusplus 343c4226f9Spjha extern "C" { 353c4226f9Spjha #endif 363c4226f9Spjha 373c4226f9Spjha #define SCSI_CFG_LINK_RE "^cfg/c[0-9]+$" 383c4226f9Spjha #define SBD_CFG_LINK_RE "^cfg/((((N[0-9]+[.])?(SB|IB))?[0-9]+)|[abcd])$" 393c4226f9Spjha #define USB_CFG_LINK_RE "^cfg/((usb[0-9]+)/([0-9]+)([.]([0-9])+)*)$" 403c4226f9Spjha #define PCI_CFG_LINK_RE "^cfg/[:alnum:]$" 413c4226f9Spjha #define IB_CFG_LINK_RE "^cfg/(hca[0-9A-F]+)$" 423c4226f9Spjha #define SATA_CFG_LINK_RE "^cfg/((sata[0-9]+)/([0-9]+)([.]([0-9])+)*)$" 43*4bb7efa7SGarrett D'Amore #define SDCARD_CFG_LINK_RE "^cfg/sdcard[0-9]+/[0-9]+$" 44ad86e48dSpjha #define PCI_CFG_PATH_LINK_RE \ 45ad86e48dSpjha "^cfg/(.*(pci[0-9]|pcie[0-9]|Slot[0-9]|\\<pci\\>|\\<pcie\\>).*)$" 463c4226f9Spjha 473c4226f9Spjha #define CFG_DIRNAME "cfg" 483c4226f9Spjha 493c4226f9Spjha #define PROPVAL_PCIEX "pciex" 503c4226f9Spjha #define DEVTYPE_PCIE "pcie" 513c4226f9Spjha #define IOB_PRE "iob" 523c4226f9Spjha #define AP_PATH_SEP ":" 533c4226f9Spjha #define AP_PATH_IOB_SEP "." 54b6b3bf89Spjha #define IEEE_SUN_ID 0x080020 553c4226f9Spjha #define APNODE_DEFNAME 0x1 56ad86e48dSpjha #define PCIDEV_NIL ((minor_t)-1) 573c4226f9Spjha 583c4226f9Spjha /* converts size in bits to a mask covering those bit positions */ 593c4226f9Spjha #define SIZE2MASK(s) ((1 << (s)) - 1) 603c4226f9Spjha #define SIZE2MASK64(s) ((1LL << (s)) - 1LL) 613c4226f9Spjha 623c4226f9Spjha /* 633c4226f9Spjha * macros for the ieee1275 "reg" property 643c4226f9Spjha * naming format and semantics: 653c4226f9Spjha * 663c4226f9Spjha * REG_<cell>_SIZE_<field> = bit size of <field> in <cell> 673c4226f9Spjha * REG_<cell>_OFF_<field> = starting bit position of <field> in <cell> 683c4226f9Spjha * 693c4226f9Spjha * REG_<cell>_<field>(r) = returns the value of <field> in <cell> using: 703c4226f9Spjha * (((r) >> REG_<cell>_OFF_<field>) & SIZE2MASK(REG_<cell>_SIZE_<field>)) 713c4226f9Spjha */ 723c4226f9Spjha #define REG_PHYSHI_SIZE_PCIDEV 5 733c4226f9Spjha #define REG_PHYSHI_OFF_PCIDEV 11 743c4226f9Spjha #define REG_PHYSHI_PCIDEV(r) \ 753c4226f9Spjha (((r) >> REG_PHYSHI_OFF_PCIDEV) & SIZE2MASK(REG_PHYSHI_SIZE_PCIDEV)) 763c4226f9Spjha 773c4226f9Spjha /* rp = ptr to 5-tuple int array */ 783c4226f9Spjha #define REG_PHYSHI_INDEX 0 793c4226f9Spjha #define REG_PHYSHI(rp) ((rp)[REG_PHYSHI_INDEX]) 803c4226f9Spjha 813c4226f9Spjha #define REG_PCIDEV(rp) (REG_PHYSHI_PCIDEV(REG_PHYSHI(rp))) 823c4226f9Spjha 833c4226f9Spjha 843c4226f9Spjha #define DEV "/dev" 853c4226f9Spjha #define DEV_LEN 4 863c4226f9Spjha #define DEVICES "/devices" 873c4226f9Spjha #define DEVICES_LEN 8 883c4226f9Spjha 893c4226f9Spjha #ifdef __cplusplus 903c4226f9Spjha } 913c4226f9Spjha #endif 923c4226f9Spjha 933c4226f9Spjha #endif /* _CFG_LINK_H */ 94