xref: /illumos-gate/usr/src/man/man9e/usba_hcdi_device_init.9e (revision b31ca922c7346747131aed07c0c171ec2f573aac)
19b0e7716SRobert Mustacchi.\"
29b0e7716SRobert Mustacchi.\" This file and its contents are supplied under the terms of the
39b0e7716SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0.
49b0e7716SRobert Mustacchi.\" You may only use this file in accordance with the terms of version
59b0e7716SRobert Mustacchi.\" 1.0 of the CDDL.
69b0e7716SRobert Mustacchi.\"
79b0e7716SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this
89b0e7716SRobert Mustacchi.\" source.  A copy of the CDDL is also available via the Internet at
99b0e7716SRobert Mustacchi.\" http://www.illumos.org/license/CDDL.
109b0e7716SRobert Mustacchi.\"
119b0e7716SRobert Mustacchi.\"
129b0e7716SRobert Mustacchi.\" Copyright 2016 Joyent, Inc.
139b0e7716SRobert Mustacchi.\"
149b0e7716SRobert Mustacchi.Dd May 7, 2016
159b0e7716SRobert Mustacchi.Dt USBA_HCDI_DEVICE_INIT 9E
169b0e7716SRobert Mustacchi.Os
179b0e7716SRobert Mustacchi.Sh NAME
189b0e7716SRobert Mustacchi.Nm usba_hcdi_device_init ,
199b0e7716SRobert Mustacchi.Nm usba_hcdi_device_fini
209b0e7716SRobert Mustacchi.Nd USB device initialization and finalization
219b0e7716SRobert Mustacchi.Sh SYNOPSIS
229b0e7716SRobert Mustacchi.In sys/usb/usba/hcdi.h
239b0e7716SRobert Mustacchi.Ft int
249b0e7716SRobert Mustacchi.Fo prefix_hcdi_device_init
259b0e7716SRobert Mustacchi.Fa "usba_device_t *usb_device"
269b0e7716SRobert Mustacchi.Fa "usb_port_t port"
279b0e7716SRobert Mustacchi.Fa "void **hcd_privatep"
289b0e7716SRobert Mustacchi.Fc
299b0e7716SRobert Mustacchi.Ft void
309b0e7716SRobert Mustacchi.Fo prefix_hcdi_device_fini
319b0e7716SRobert Mustacchi.Fa "usba_device_t *usb_device"
329b0e7716SRobert Mustacchi.Fa "usb_port_t port"
339b0e7716SRobert Mustacchi.Fa "void *hcd_private"
349b0e7716SRobert Mustacchi.Fc
359b0e7716SRobert Mustacchi.Sh INTERFACE LEVEL
369b0e7716SRobert Mustacchi.Sy Volatile -
379b0e7716SRobert Mustacchiillumos USB HCD private function
389b0e7716SRobert Mustacchi.Pp
3972d3dbb9SYuri PankovThis is a private function that is not part of the stable DDI.
4072d3dbb9SYuri PankovIt may be removed or changed at any time.
419b0e7716SRobert Mustacchi.Sh PARAMETERS
429b0e7716SRobert Mustacchi.Bl -tag -width Fa
439b0e7716SRobert Mustacchi.It Fa usb_device
449b0e7716SRobert MustacchiPointer to a USB device structure.
459b0e7716SRobert Mustacchi.It Fa port
469b0e7716SRobert MustacchiThe port number the device was detected on.
479b0e7716SRobert Mustacchi.It Fa hcd_privatep
489b0e7716SRobert MustacchiPointer to storage space for a HCD driver to store private data for the
499b0e7716SRobert Mustacchidevice.
509b0e7716SRobert Mustacchi.It Fa hcd_private
519b0e7716SRobert MustacchiPointer to the HCD driver's private data for the device.
529b0e7716SRobert Mustacchi.El
539b0e7716SRobert Mustacchi.Sh DESCRIPTION
549b0e7716SRobert MustacchiThe
559b0e7716SRobert Mustacchi.Fn usba_hcdi_device_init
5672d3dbb9SYuri Pankoventry point is an optional entry point.
5772d3dbb9SYuri PankovIt will be called when child devices of the root hub are being initialized.
5872d3dbb9SYuri PankovA call to this entry point will occur before any calls to open a pipe to the
5972d3dbb9SYuri Pankovchild device through the
609b0e7716SRobert Mustacchi.Xr usba_hcdi_pipe_open 9E
619b0e7716SRobert Mustacchientry point.
629b0e7716SRobert Mustacchi.Pp
639b0e7716SRobert MustacchiDuring this time, the HCD driver should do any required initialization
6472d3dbb9SYuri Pankovrequired by the host controller.
6572d3dbb9SYuri PankovThe HCD may also opt to store private data for this device as a result of
6672d3dbb9SYuri Pankovwhatever initialization it performed.
6772d3dbb9SYuri PankovThe data should be stored in the
689b0e7716SRobert Mustacchi.Fa hcd_privatep
6972d3dbb9SYuri Pankovpointer.
7072d3dbb9SYuri PankovData stored this will be accessible to the HCD driver through the
719b0e7716SRobert Mustacchi.Xr usba_hcdi_get_device_private 9F
729b0e7716SRobert Mustacchifunction.
739b0e7716SRobert Mustacchi.Pp
749b0e7716SRobert MustacchiThe
759b0e7716SRobert Mustacchi.Fn usba_hcdi_device_fini
7672d3dbb9SYuri Pankoventry point is an optional entry point.
7772d3dbb9SYuri PankovIt will be called when child devices of the root hub are being removed.
7872d3dbb9SYuri PankovThe HCD should perform any necessary work with the root controller to finish
7972d3dbb9SYuri Pankovtearing down the device.
8072d3dbb9SYuri PankovIn addition, if the HCD stored private data it will a pointer to it in the
819b0e7716SRobert Mustacchi.Fa hcd_private
8272d3dbb9SYuri Pankovpointer.
8372d3dbb9SYuri PankovThe HCD driver must release any resources associated with its private data.
8472d3dbb9SYuri PankovIf it does not, the resources will be leaked.
859b0e7716SRobert Mustacchi.Pp
869b0e7716SRobert MustacchiAt the time
879b0e7716SRobert Mustacchi.Fn usba_hcdi_device_fini
889b0e7716SRobert Mustacchiis called, all associated pipes should have been closed through the
899b0e7716SRobert Mustacchi.Xr usba_hcdi_pipe_close 9E
909b0e7716SRobert Mustacchifunction.
919b0e7716SRobert Mustacchi.Pp
929b0e7716SRobert MustacchiThe HCD driver is guaranteed that no other entry points will be invoked
939b0e7716SRobert Mustacchifor the USB device
949b0e7716SRobert Mustacchi.Fa usb_device
9572d3dbb9SYuri Pankovwhile a call to either function is ongoing.
9672d3dbb9SYuri PankovHowever, the entry point may be called in parallel on behalf of separate
9772d3dbb9SYuri Pankovdevices.
989b0e7716SRobert Mustacchi.Sh CONTEXT
999b0e7716SRobert MustacchiThis function is called from kernel context only.
1009b0e7716SRobert Mustacchi.Sh RETURN VALUES
1019b0e7716SRobert MustacchiUpon successful completion, the
1029b0e7716SRobert Mustacchi.Fn usba_hcdi_device_init
1039b0e7716SRobert Mustacchifunction should return
104a2f77ecdSPeter Tribble.Sy USB_SUCCESS .
1059b0e7716SRobert MustacchiOtherwise, it should return the appropriate error.
1069b0e7716SRobert Mustacchi.Sh SEE ALSO
107*b31ca922SChris Fraire.Xr usba_hcdi 9E ,
1089b0e7716SRobert Mustacchi.Xr usba_hcdi_pipe_close 9E ,
1099b0e7716SRobert Mustacchi.Xr usba_hcdi_pipe_open 9E
110