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