pshot.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_PSHOT_H
#define _SYS_PSHOT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* user accessable features
*/
/* determines max pshot_minor allocation per softstate */
#define PSHOT_MAX_MINOR_PERINST 2
#define PSHOT_MAX_MINOR_NAMELEN 16
#define PSHOT_NODENAME_DEVCTL "devctl"
#define PSHOT_NODENAME_TESTCTL "testctl"
#define PSHOT_PROP_DEVNAME "dev-name"
#define PSHOT_PROP_DEVNT "dev-nt"
#define PSHOT_PROP_DEVCOMPAT "dev-compat"
#ifdef _KERNEL
#define PARENT_IS_PSHOT(self) \
static int pshot_debug = 0;
static int pshot_event_test_enable = 0;
#ifdef DEBUG
#define pshot_debug pshot_debug_on
static int pshot_debug_on = 0;
static int pshot_event_test_on = 0;
#endif
#define PSHOT_MAX_CBCACHE 6
#define PSHOT_MAX_TSTCACHE 8
/*
* soft state and minor node management
* (includes user features above)
*/
/*
* a "node number" is currently implemented as an index into a pshot_minor_t
* array, therefore the max must be less than PSHOT_MAX_MINOR_PERINST and
* ideally, the minor array should be fully populated, with a node number
* defined for each index
*/
#define PSHOT_NODENUM_DEVCTL 0
#define PSHOT_NODENUM_TESTCTL 1
typedef struct pshot_minor pshot_minor_t;
struct pshot_minor {
char name[PSHOT_MAX_MINOR_NAMELEN];
};
struct pshot {
int instance;
int level; /* pm power level */
int busy; /* pm busy state */
int busy_ioctl; /* track busy and idle ioctl calls */
};
static int pshot_minor_decode_inst(minor_t);
/*
* children device configuration
*/
typedef struct pshot_device {
char *name;
char *nodetype;
char *compat;
#define PSHOT_DEV_ANYNT 0x1
static char *pshot_str2nt(char *);
static int pshot_devices_setup(dev_info_t *);
const pshot_device_t *, size_t);
/*
* softstate state bits
*/
#define IS_OPEN 0x0001
#define IS_OPEN_EXCL 0x0002
#define DEV_RESET_PENDING 0x0004
#define BUS_RESET_PENDING 0x0008
#define POWER_FLAG 0x0010
#define FAIL_SUSPEND_FLAG 0x0020
#define STRICT_PARENT 0x0040
#define NO_INVOL_FLAG 0x0080
#define PM_SUPPORTED 0x0100
/*
* Leaf ops (supports hotplug controls to the device)
*/
static int pshot_probe(dev_info_t *);
int *);
int *);
/*
* Event handling prototype support.
*/
#define PSHOT_EVENT_NAME_DEV_OFFLINE "pshot_dev_offline"
#define PSHOT_EVENT_NAME_DEV_RESET "pshot_dev_reset"
#define PSHOT_EVENT_NAME_BUS_RESET "pshot_bus_reset"
#define PSHOT_EVENT_NAME_BUS_QUIESCE "pshot_bus_quiesce"
#define PSHOT_EVENT_NAME_BUS_UNQUIESCE "pshot_bus_unquiesce"
#define PSHOT_EVENT_NAME_BUS_TEST_POST "pshot_bus_test_post"
#define PSHOT_EVENT_NAME_DEBUG_SET "pshot_debug_set"
#define PSHOT_EVENT_NAME_SUB_RESET "pshot_sub_reset"
/* for hash sanity check */
#define PSHOT_EVENT_TAG_OFFLINE 0
#define PSHOT_EVENT_TAG_DEV_RESET 1
#define PSHOT_EVENT_TAG_BUS_RESET 2
#define PSHOT_EVENT_TAG_BUS_QUIESCE 3
#define PSHOT_EVENT_TAG_BUS_UNQUIESCE 4
#define PSHOT_EVENT_TAG_TEST_POST 5
typedef struct pshot_event_callback {
int (*callback)();
void *arg;
struct pshot_event_callback *next;
void *arg, void *bus_impldata);
void *bus_impldata);
#ifdef DEBUG
void *arg, void *bus_impldata);
static void pshot_event_test(void *arg);
static void pshot_event_test_post_one(void *arg);
#endif
/* event busops */
/* function prototypes */
ddi_bus_config_op_t, void *, dev_info_t **);
ddi_bus_config_op_t, void *);
ddi_intr_handle_impl_t *, void *);
static void pshot_setup_autoattach(dev_info_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PSHOT_H */