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.
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.
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]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_CONTRACT_DEVICE_IMPL_H
27 #define _SYS_CONTRACT_DEVICE_IMPL_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <sys/contract_impl.h>
32 #include <sys/dditypes.h>
33 #include <sys/contract/device.h>
34 #include <sys/fs/snode.h>
41 * Result of negotiation end: event successfully occurred or not
43 #define CT_EV_SUCCESS 150
44 #define CT_EV_FAILURE 151
47 ct_template_t ctd_ctmpl
;
54 contract_t cond_contract
; /* common contract data */
55 char *cond_minor
; /* minor node resource in contract */
56 dev_info_t
*cond_dip
; /* dip for minor node */
57 dev_t cond_devt
; /* dev_t of minor node */
58 uint_t cond_spec
; /* spec type of minor node */
59 uint_t cond_aset
; /* acceptable state set */
60 uint_t cond_noneg
; /* no negotiation if set */
61 uint_t cond_state
; /* current state of device */
62 uint_t cond_neg
; /* contract undergoing negotiation */
63 uint64_t cond_currev_id
; /* id of event being negotiated */
64 uint_t cond_currev_type
; /* type of event being negotiated */
65 uint_t cond_currev_ack
; /* ack/nack status of ev negotiation */
66 list_node_t cond_next
; /* linkage - devinfo's contracts */
72 extern ct_type_t
*device_type
;
76 void contract_device_init(void);
77 ct_ack_t
contract_device_offline(dev_info_t
*dip
, dev_t dev
, int spec_type
);
78 void contract_device_degrade(dev_info_t
*dip
, dev_t dev
, int spec_type
);
79 void contract_device_undegrade(dev_info_t
*dip
, dev_t dev
, int spec_type
);
80 int contract_device_open(dev_t dev
, int spec_type
, contract_t
**ctpp
);
81 void contract_device_remove_dip(dev_info_t
*dip
);
82 ct_ack_t
contract_device_negotiate(dev_info_t
*dip
, dev_t dev
, int spec_type
,
84 void contract_device_finalize(dev_info_t
*dip
, dev_t dev
, int spec_type
,
85 uint_t evtype
, int ct_result
);
86 void contract_device_negend(dev_info_t
*dip
, dev_t dev
, int spec_type
,
93 #endif /* _SYS_CONTRACT_DEVICE_IMPL_H */