summaryrefslogtreecommitdiff
path: root/usr/src/man/man9e/usba_hcdi_device_init.9e
blob: 11ed25dccd246e5653884ead20cde898cbc32712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source.  A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright 2016 Joyent, Inc.
.\"
.Dd May 7, 2016
.Dt USBA_HCDI_DEVICE_INIT 9E
.Os
.Sh NAME
.Nm usba_hcdi_device_init ,
.Nm usba_hcdi_device_fini
.Nd USB device initialization and finalization
.Sh SYNOPSIS
.In sys/usb/usba/hcdi.h
.Ft int
.Fo prefix_hcdi_device_init
.Fa "usba_device_t *usb_device"
.Fa "usb_port_t port"
.Fa "void **hcd_privatep"
.Fc
.Ft void
.Fo prefix_hcdi_device_fini
.Fa "usba_device_t *usb_device"
.Fa "usb_port_t port"
.Fa "void *hcd_private"
.Fc
.Sh INTERFACE LEVEL
.Sy Volatile -
illumos USB HCD private function
.Pp
This is a private function that is not part of the stable DDI.
It may be removed or changed at any time.
.Sh PARAMETERS
.Bl -tag -width Fa
.It Fa usb_device
Pointer to a USB device structure.
.It Fa port
The port number the device was detected on.
.It Fa hcd_privatep
Pointer to storage space for a HCD driver to store private data for the
device.
.It Fa hcd_private
Pointer to the HCD driver's private data for the device.
.El
.Sh DESCRIPTION
The
.Fn usba_hcdi_device_init
entry point is an optional entry point.
It will be called when child devices of the root hub are being initialized.
A call to this entry point will occur before any calls to open a pipe to the
child device through the
.Xr usba_hcdi_pipe_open 9E
entry point.
.Pp
During this time, the HCD driver should do any required initialization
required by the host controller.
The HCD may also opt to store private data for this device as a result of
whatever initialization it performed.
The data should be stored in the
.Fa hcd_privatep
pointer.
Data stored this will be accessible to the HCD driver through the
.Xr usba_hcdi_get_device_private 9F
function.
.Pp
The
.Fn usba_hcdi_device_fini
entry point is an optional entry point.
It will be called when child devices of the root hub are being removed.
The HCD should perform any necessary work with the root controller to finish
tearing down the device.
In addition, if the HCD stored private data it will a pointer to it in the
.Fa hcd_private
pointer.
The HCD driver must release any resources associated with its private data.
If it does not, the resources will be leaked.
.Pp
At the time
.Fn usba_hcdi_device_fini
is called, all associated pipes should have been closed through the
.Xr usba_hcdi_pipe_close 9E
function.
.Pp
The HCD driver is guaranteed that no other entry points will be invoked
for the USB device
.Fa usb_device
while a call to either function is ongoing.
However, the entry point may be called in parallel on behalf of separate
devices.
.Sh CONTEXT
This function is called from kernel context only.
.Sh RETURN VALUES
Upon successful completion, the
.Fn usba_hcdi_device_init
function should return
.Sy USB_SUCCESS .
Otherwise, it should return the appropriate error.
.Sh SEE ALSO
.Xr usba_hcdi 9E ,
.Xr usba_hcdi_pipe_close 9E ,
.Xr usba_hcdi_pipe_open 9E