]>
git.proxmox.com Git - mirror_spl-debian.git/blob - include/sys/sunddi.h
6 #include <sys/sunldi.h>
8 #include <linux/kdev_t.h>
10 #include <linux/cdev.h>
11 #include <linux/list.h>
12 #include <linux/device.h>
14 typedef int ddi_devid_t
;
17 DDI_INFO_DEVT2DEVINFO
= 0,
18 DDI_INFO_DEVT2INSTANCE
= 1
31 DDI_HOTPLUG_DETACH
= 3
40 PROP_LEN_AND_VAL_BUF
= 1,
41 PROP_LEN_AND_VAL_ALLOC
= 2,
45 typedef void *devmap_cookie_t
;
50 typedef struct pollhead
{
51 struct polldat
*ph_list
;
54 typedef struct dev_info
{
56 struct dev_ops
*di_ops
;
58 struct class *di_class
;
63 struct list_head di_list
;
66 typedef struct cb_ops
{
67 int (*cb_open
)(dev_t
*devp
, int flag
, int otyp
, cred_t
*credp
);
68 int (*cb_close
)(dev_t dev
, int flag
, int otyp
, cred_t
*credp
);
69 int (*cb_strategy
)(void *bp
);
70 int (*cb_print
)(dev_t dev
, char *str
);
71 int (*cb_dump
)(dev_t dev
, caddr_t addr
, daddr_t blkno
, int nblk
);
72 int (*cb_read
)(dev_t dev
, struct uio
*uiop
, cred_t
*credp
);
73 int (*cb_write
)(dev_t dev
, struct uio
*uiop
, cred_t
*credp
);
74 int (*cb_ioctl
)(dev_t dev
, int cmd
, intptr_t arg
, int mode
,
75 cred_t
*credp
, int *rvalp
);
76 int (*cb_devmap
)(dev_t dev
, devmap_cookie_t dhp
, offset_t off
,
77 size_t len
, size_t *maplen
, uint_t model
);
78 int (*cb_mmap
)(dev_t dev
, off_t off
, int prot
);
79 int (*cb_segmap
)(dev_t dev
, off_t off
, struct as
*asp
,
80 caddr_t
*addrp
, off_t len
, unsigned int prot
,
81 unsigned int maxprot
, unsigned int flags
,
83 int (*cb_chpoll
)(dev_t dev
, short events
, int anyyet
,
84 short *reventsp
, struct pollhead
**phpp
);
85 int (*cb_prop_op
)(dev_t dev
, dev_info_t
*dip
,
86 ddi_prop_op_t prop_op
, int mod_flags
,
87 char *name
, caddr_t valuep
, int *length
);
88 struct streamtab
*cb_str
;
91 int (*cb_aread
)(dev_t dev
, struct aio_req
*aio
, cred_t
*credp
);
92 int (*cb_awrite
)(dev_t dev
, struct aio_req
*aio
, cred_t
*credp
);
95 typedef struct dev_ops
{
99 int (*devo_getinfo
)(dev_info_t
*dip
,
100 ddi_info_cmd_t infocmd
, void *arg
, void **result
);
101 int (*devo_identify
)(dev_info_t
*dip
);
102 int (*devo_probe
)(dev_info_t
*dip
);
103 int (*devo_attach
)(dev_info_t
*dip
, ddi_attach_cmd_t cmd
);
104 int (*devo_detach
)(dev_info_t
*dip
, ddi_detach_cmd_t cmd
);
105 int (*devo_reset
)(dev_info_t
*dip
, ddi_reset_cmd_t cmd
);
107 struct cb_ops
*devo_cb_ops
;
108 struct bus_ops
*devo_bus_ops
;
109 int (*devo_power
)(dev_info_t
*dip
, int component
, int level
);
112 typedef struct mod_ops
{
113 int (*modm_install
)(void);
114 int (*modm_remove
)(void);
115 int (*modm_info
)(void);
118 typedef struct modldrv
{
119 struct mod_ops
*drv_modops
;
121 struct dev_ops
*drv_dev_ops
;
122 struct dev_info
*drv_dev_info
;
129 #define D_64BIT 0x200
134 #define DDI_SUCCESS 0
135 #define DDI_FAILURE -1
137 #define DDI_PSEUDO "ddi_pseudo"
140 #define nochpoll NULL
142 #define mod_driverops NULL
143 #define ddi_prop_op NULL
145 #define getminor(x) (x)
146 #define getmajor(x) (x)
147 #define ddi_driver_major(di) getmajor(di->di_dev)
149 #define DDI_DEV_T_NONE ((dev_t)-1)
150 #define DDI_DEV_T_ANY ((dev_t)-2)
151 #define DDI_MAJOR_T_UNKNOWN ((major_t)0)
153 #define DDI_PROP_DONTPASS 0x0001
154 #define DDI_PROP_CANSLEEP 0x0002
156 #define ddi_prop_lookup_string(x1,x2,x3,x4,x5) (*x5 = NULL)
157 #define ddi_prop_free(x) (void)0
158 #define ddi_root_node() (void)0
160 #define mod_install(x) 0
161 #define mod_remove(x) 0
163 extern int __ddi_create_minor_node(dev_info_t
*dip
, char *name
, int spec_type
,
164 minor_t minor_num
, char *node_type
,
165 int flag
, struct module
*mod
);
166 extern void __ddi_remove_minor_node(dev_info_t
*dip
, char *name
);
167 extern int __mod_install(struct modlinkage
*modlp
);
168 extern int __mod_remove(struct modlinkage
*modlp
);
170 static __inline__
void ddi_report_dev(dev_info_t
*d
) { }
171 static __inline__
void ddi_prop_remove_all(dev_info_t
*dip
) { }
173 static __inline__
int
174 ddi_create_minor_node(dev_info_t
*di
, char *name
, int spec_type
,
175 minor_t minor_num
, char *node_type
, int flag
)
177 return __ddi_create_minor_node(di
, name
, spec_type
, minor_num
,
178 node_type
, flag
, THIS_MODULE
);
185 #define ddi_remove_minor_node __ddi_remove_minor_node
186 #define mod_install __mod_install
187 #define mod_remove __mod_remove
189 #endif /* SPL_SUNDDI_H */