xref: /netbsd-src/sys/dev/acpi/acpi_usb.c (revision 144fe6b9122d6e9f7c2a8a2b57448f7253efc894)
1*144fe6b9Sthorpej /* $NetBSD: acpi_usb.c,v 1.2 2021/01/14 14:38:22 thorpej Exp $ */
2f2972b1bSjmcneill 
3f2972b1bSjmcneill /*-
4f2972b1bSjmcneill  * Copyright (c) 2018 The NetBSD Foundation, Inc.
5f2972b1bSjmcneill  * All rights reserved.
6f2972b1bSjmcneill  *
7f2972b1bSjmcneill  * This code is derived from software contributed to The NetBSD Foundation
8f2972b1bSjmcneill  * by Jared McNeill <jmcneill@invisible.ca>.
9f2972b1bSjmcneill  *
10f2972b1bSjmcneill  * Redistribution and use in source and binary forms, with or without
11f2972b1bSjmcneill  * modification, are permitted provided that the following conditions
12f2972b1bSjmcneill  * are met:
13f2972b1bSjmcneill  * 1. Redistributions of source code must retain the above copyright
14f2972b1bSjmcneill  *    notice, this list of conditions and the following disclaimer.
15f2972b1bSjmcneill  * 2. Redistributions in binary form must reproduce the above copyright
16f2972b1bSjmcneill  *    notice, this list of conditions and the following disclaimer in the
17f2972b1bSjmcneill  *    documentation and/or other materials provided with the distribution.
18f2972b1bSjmcneill  *
19f2972b1bSjmcneill  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20f2972b1bSjmcneill  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21f2972b1bSjmcneill  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22f2972b1bSjmcneill  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23f2972b1bSjmcneill  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24f2972b1bSjmcneill  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25f2972b1bSjmcneill  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26f2972b1bSjmcneill  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27f2972b1bSjmcneill  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28f2972b1bSjmcneill  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29f2972b1bSjmcneill  * POSSIBILITY OF SUCH DAMAGE.
30f2972b1bSjmcneill  */
31f2972b1bSjmcneill 
32f2972b1bSjmcneill /*
33f2972b1bSjmcneill  * USB Device-Specific Method (_DSM) support:
34f2972b1bSjmcneill  *
35f2972b1bSjmcneill  * https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/usb-device-specific-method---dsm-
36f2972b1bSjmcneill  */
37f2972b1bSjmcneill 
38f2972b1bSjmcneill #include <sys/cdefs.h>
39*144fe6b9Sthorpej __KERNEL_RCSID(0, "$NetBSD: acpi_usb.c,v 1.2 2021/01/14 14:38:22 thorpej Exp $");
40f2972b1bSjmcneill 
41f2972b1bSjmcneill #include <sys/param.h>
42f2972b1bSjmcneill 
43f2972b1bSjmcneill #include <dev/acpi/acpireg.h>
44f2972b1bSjmcneill #include <dev/acpi/acpivar.h>
45f2972b1bSjmcneill #include <dev/acpi/acpi_usb.h>
46f2972b1bSjmcneill 
47f2972b1bSjmcneill /* Windows-defined USB subsystem device-specific method (_DSM) */
48f2972b1bSjmcneill static UINT8 ehci_acpi_dsm_uuid[ACPI_UUID_LENGTH] = {
49f2972b1bSjmcneill 	0x85, 0xe3, 0x2e, 0xce, 0xe6, 0x00, 0xcb, 0x48,
50f2972b1bSjmcneill 	0x9f, 0x05, 0x2e, 0xdb, 0x92, 0x7c, 0x48, 0x99
51f2972b1bSjmcneill };
52f2972b1bSjmcneill 
53f2972b1bSjmcneill void
acpi_usb_post_reset(ACPI_HANDLE handle)54f2972b1bSjmcneill acpi_usb_post_reset(ACPI_HANDLE handle)
55f2972b1bSjmcneill {
56f2972b1bSjmcneill 
57f2972b1bSjmcneill 	/*
58f2972b1bSjmcneill 	 * Invoke the _DSM control method for post-reset processing function
59f2972b1bSjmcneill 	 * for dual-role USB controllers. If supported, this will perform any
60f2972b1bSjmcneill 	 * controller-specific initialization required to put the dual-role
61f2972b1bSjmcneill 	 * device into host mode.
62f2972b1bSjmcneill 	 */
63f2972b1bSjmcneill 
64*144fe6b9Sthorpej 	(void)acpi_dsm(handle, ehci_acpi_dsm_uuid, 0, 1, NULL, NULL);
65f2972b1bSjmcneill }
66