3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha/*
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * CDDL HEADER START
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha *
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * The contents of this file are subject to the terms of the
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * Common Development and Distribution License (the "License").
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * You may not use this file except in compliance with the License.
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha *
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * or http://www.opensolaris.org/os/licensing.
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * See the License for the specific language governing permissions
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * and limitations under the License.
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha *
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * When distributing Covered Code, include this CDDL HEADER in each
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * If applicable, add the following below this CDDL HEADER, with the
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * fields enclosed by brackets "[]" replaced with your own identifying
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * information: Portions Copyright [yyyy] [name of copyright owner]
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha *
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * CDDL HEADER END
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha */
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha/*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * Use is subject to license terms.
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha */
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha/* private devlink info interfaces */
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#ifndef _CFG_LINK_H
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define _CFG_LINK_H
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#include <devfsadm.h>
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#ifdef __cplusplus
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjhaextern "C" {
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#endif
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define SCSI_CFG_LINK_RE "^cfg/c[0-9]+$"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define SBD_CFG_LINK_RE "^cfg/((((N[0-9]+[.])?(SB|IB))?[0-9]+)|[abcd])$"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define USB_CFG_LINK_RE "^cfg/((usb[0-9]+)/([0-9]+)([.]([0-9])+)*)$"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define PCI_CFG_LINK_RE "^cfg/[:alnum:]$"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define IB_CFG_LINK_RE "^cfg/(hca[0-9A-F]+)$"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define SATA_CFG_LINK_RE "^cfg/((sata[0-9]+)/([0-9]+)([.]([0-9])+)*)$"
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#define SDCARD_CFG_LINK_RE "^cfg/sdcard[0-9]+/[0-9]+$"
ad86e48d1214c1b0ec33af482240d16fd15cb6ffpjha#define PCI_CFG_PATH_LINK_RE \
ad86e48d1214c1b0ec33af482240d16fd15cb6ffpjha "^cfg/(.*(pci[0-9]|pcie[0-9]|Slot[0-9]|\\<pci\\>|\\<pcie\\>).*)$"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define CFG_DIRNAME "cfg"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define PROPVAL_PCIEX "pciex"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define DEVTYPE_PCIE "pcie"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define IOB_PRE "iob"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define AP_PATH_SEP ":"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define AP_PATH_IOB_SEP "."
b6b3bf894fe73013bb99b5edf4fde2642c93494fpjha#define IEEE_SUN_ID 0x080020
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define APNODE_DEFNAME 0x1
ad86e48d1214c1b0ec33af482240d16fd15cb6ffpjha#define PCIDEV_NIL ((minor_t)-1)
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha/* converts size in bits to a mask covering those bit positions */
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define SIZE2MASK(s) ((1 << (s)) - 1)
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define SIZE2MASK64(s) ((1LL << (s)) - 1LL)
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha/*
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * macros for the ieee1275 "reg" property
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * naming format and semantics:
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha *
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * REG_<cell>_SIZE_<field> = bit size of <field> in <cell>
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * REG_<cell>_OFF_<field> = starting bit position of <field> in <cell>
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha *
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * REG_<cell>_<field>(r) = returns the value of <field> in <cell> using:
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha * (((r) >> REG_<cell>_OFF_<field>) & SIZE2MASK(REG_<cell>_SIZE_<field>))
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha */
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define REG_PHYSHI_SIZE_PCIDEV 5
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define REG_PHYSHI_OFF_PCIDEV 11
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define REG_PHYSHI_PCIDEV(r) \
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha (((r) >> REG_PHYSHI_OFF_PCIDEV) & SIZE2MASK(REG_PHYSHI_SIZE_PCIDEV))
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha/* rp = ptr to 5-tuple int array */
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define REG_PHYSHI_INDEX 0
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define REG_PHYSHI(rp) ((rp)[REG_PHYSHI_INDEX])
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define REG_PCIDEV(rp) (REG_PHYSHI_PCIDEV(REG_PHYSHI(rp)))
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define DEV "/dev"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define DEV_LEN 4
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define DEVICES "/devices"
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#define DEVICES_LEN 8
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#ifdef __cplusplus
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha}
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#endif
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha
3c4226f98775d47a05fa88f9f72479f1a250eaa5pjha#endif /* _CFG_LINK_H */