2 * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.
\r
4 * This software is available to you under the OpenIB.org BSD license
\r
7 * Redistribution and use in source and binary forms, with or
\r
8 * without modification, are permitted provided that the following
\r
9 * conditions are met:
\r
11 * - Redistributions of source code must retain the above
\r
12 * copyright notice, this list of conditions and the following
\r
15 * - Redistributions in binary form must reproduce the above
\r
16 * copyright notice, this list of conditions and the following
\r
17 * disclaimer in the documentation and/or other materials
\r
18 * provided with the distribution.
\r
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
\r
24 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
\r
25 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
26 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
34 #if !defined _IOU_DRIVER_H_
\r
35 #define _IOU_DRIVER_H_
\r
37 #include "complib/cl_types.h"
\r
38 #include "complib/cl_atomic.h"
\r
39 #include "complib/cl_debug.h"
\r
40 #include "complib/cl_mutex.h"
\r
41 #include "complib/cl_qlist.h"
\r
42 #include "complib/cl_ptr_vector.h"
\r
43 #include "complib/cl_pnp_po.h"
\r
44 #include "iba/ib_al.h"
\r
45 #include "iou_ioc_mgr.h"
\r
47 /* Safe string functions. */
\r
50 * Windows 2000 doesn't support the inline version of safe strings.
\r
51 * Force the use of the library version of safe strings.
\r
53 #define NTSTRSAFE_LIB
\r
55 #include <ntstrsafe.h>
\r
59 * Main header for IB Bus driver.
\r
62 #define IOU_ENTER( lvl ) \
\r
63 CL_ENTER( lvl, iou_globals.dbg_lvl )
\r
65 #define IOU_EXIT( lvl ) \
\r
66 CL_EXIT( lvl, iou_globals.dbg_lvl )
\r
68 #define IOU_TRACE( lvl, msg ) \
\r
69 CL_TRACE( lvl, iou_globals.dbg_lvl, msg )
\r
71 #define IOU_TRACE_EXIT( lvl, msg ) \
\r
72 CL_TRACE_EXIT( lvl, iou_globals.dbg_lvl, msg )
\r
74 #define IOU_PRINT( lvl, msg ) \
\r
75 CL_PRINT( lvl, iou_globals.dbl_lvl, msg )
\r
77 #define IOU_DBG_ERROR CL_DBG_ERROR
\r
78 #define IOU_DBG_DRV (1 << 0)
\r
79 #define IOU_DBG_PNP (1 << 1)
\r
80 #define IOU_DBG_POWER (1 << 2)
\r
81 #define IOU_DBG_PORT (1 << 3)
\r
82 #define IOU_DBG_IOU (1 << 4)
\r
85 * ALLOC_PRAGMA sections:
\r
87 * Default pagable code. Won't be locked in memory.
\r
90 * Code that needs to be locked in memory when the device is
\r
91 * in the paging, crash dump, or hibernation path.
\r
96 * Device extension for the device object that serves as entry point for
\r
97 * the interface and IOCTL requests.
\r
99 typedef struct _iou_fdo_ext
\r
101 cl_pnp_po_ext_t cl_ext;
\r
104 * Device power map returned by the bus driver for the device, used
\r
105 * when sending IRP_MN_SET_POWER for device state in response to
\r
106 * IRP_MN_SET_POWER for system state.
\r
108 DEVICE_POWER_STATE po_state[PowerSystemMaximum];
\r
116 * Device extension for bus driver PDOs.
\r
118 typedef struct _iou_pdo_ext
\r
120 cl_pnp_po_ext_t cl_ext;
\r
122 cl_list_item_t list_item;
\r
124 POWER_STATE dev_po_state;
\r
127 * Pointer to the bus root device extension. Used to manage access to
\r
128 * child PDO pointer vector when a child is removed politely.
\r
130 iou_fdo_ext_t *p_parent_ext;
\r
133 * The following two flags are exclusively set, but can both be FALSE.
\r
134 * Flag that indicates whether the device is present in the system or not.
\r
135 * This affects how a IRP_MN_REMOVE_DEVICE IRP is handled for a child PDO.
\r
136 * This flag is cleared when:
\r
137 * - an HCA (for IPoIB devices) is removed from the system for all port
\r
138 * devices loaded for that HCA
\r
139 * - an IOU is reported as removed by the CIA.
\r
141 boolean_t b_present;
\r
144 * Flag that indicates whether the device has been reported to the PnP
\r
145 * manager as having been removed. That is, the device was reported
\r
146 * in a previous BusRelations query and not in a subsequent one.
\r
147 * This flag is set when
\r
148 * - the device is in the surprise remove state when the parent bus
\r
149 * device is removed
\r
150 * - the device is found to be not present during a BusRelations query
\r
151 * and thus not reported.
\r
153 boolean_t b_reported_missing;
\r
159 * Global Driver parameters.
\r
161 typedef struct _iou_globals
\r
166 /* Driver object. Used for creating child devices. */
\r
167 DRIVER_OBJECT *p_driver_obj;
\r
172 extern iou_globals_t iou_globals;
\r
175 #endif /* !defined _IOU_DRIVER_H_ */
\r