px_tools.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_PX_TOOLS_H
#define _SYS_PX_TOOLS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Ioctls for PCI tools.
*/
/* Return the number of supported interrupts on a PCI bus. */
/*
* This file contains data structures for the pci tool.
*/
#define CONFIG 0
#define BAR0 1
#define BAR1 2
#define BAR2 3
#define BAR3 4
#define BAR4 5
#define BAR5 6
#define ROM 7
/*
* BAR corresponding to space desired.
*/
typedef enum {
/*
* PCITOOL error numbers.
*/
typedef enum {
PCITOOL_SUCCESS = 0x0,
/*
* PCITOOL_DEVICE_SET_INTR ioctl data structure to re-assign the interrupts.
*/
typedef struct pci_intr_set {
/*
* PCITOOL_DEVICE_GET_INTR ioctl data structure to dump out the
* ino mapping information.
*/
typedef struct pci_intr_dev {
typedef struct pci_intr_get {
/* returned - to kernel */
/* # devs returned - from kernel */
/* intrs enabled for devs if > 0 */
/* from kernel */
/*
* Get the size needed to return the number of devices wanted.
* Can't say num_devs - 1 as num_devs may be unsigned.
*/
(sizeof (pci_intr_get_t) - \
sizeof (pci_intr_dev_t) + \
(num_devs * sizeof (pci_intr_dev_t)))
/*
* Size and endian fields for acc_attr bitmask.
*/
#define PX_ACC_ATTR_SIZE_MASK 0x3
#define PX_ACC_ATTR_SIZE_1 0x0
#define PX_ACC_ATTR_SIZE_2 0x1
#define PX_ACC_ATTR_SIZE_4 0x2
#define PX_ACC_ATTR_SIZE_8 0x3
#define PX_ACC_ATTR_ENDN_MASK 0x100
#define PX_ACC_ATTR_ENDN_LTL 0x0
#define PX_ACC_ATTR_ENDN_BIG 0x100
/*
* Data stucture to read and write to pci device registers.
* This is the argument to the following ioctls:
*/
typedef struct pci_reg {
/* BAR from pcitools_bar_t */
/* (DEVCTL_DEVICE_SET/GET_REG) */
/* to kernel */
} pci_reg_t;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PX_TOOLS_H */