summaryrefslogtreecommitdiff
path: root/src/drivers/usb/acpi/chip.h
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2018-05-07 15:24:10 -0700
committerPatrick Georgi <pgeorgi@google.com>2018-05-18 12:22:50 +0000
commit4721f43390ec732cb2ef82911da098779f4db0c4 (patch)
treed36f00dad527ec02a4e99968d1164f21734b51e6 /src/drivers/usb/acpi/chip.h
parent8ccf59a94778fb54cc08368fb58a42b64d9489f6 (diff)
downloadcoreboot-4721f43390ec732cb2ef82911da098779f4db0c4.tar.xz
drivers/usb/acpi: Add a driver for generating USB ACPI
Add a support for generating USB port descriptors for ACPI based on their definition by the board in devicetree.cb. This will generate a _UPC and _PLD for each port, using a generic _PLD by default. The _PLD can also be customized for more accurate descriptions if necessary. This sample devictree.cb shows a USB 2.0 type-A port behind a root hub connected to an xHCI controller: device pci 14.0 on chip drivers/usb/acpi register "desc" = ""Root Hub"" register "type" = "UPC_TYPE_HUB" device usb 0.0 on chip drivers/usb/acpi register "desc" = ""USB 2.0 Type-A"" register "type" = "UPC_TYPE_A" device usb 2.0 on end end end end end It will generate the following ACPI code in the SSDT: Scope (\_SB.PCI0.XHCI.RHUB.HS01) { Name (_DDN, "USB 2.0 Type-A") Name (_UPC, Package (0x04) { 0xFF, 0x00, Zero, Zero }) Name (_PLD, ToPLD ( PLD_Revision = 0x2, PLD_IgnoreColor = 0x1, PLD_Red = 0x0, PLD_Green = 0x0, PLD_Blue = 0x0, PLD_Width = 0x0, PLD_Height = 0x0, PLD_UserVisible = 0x1, PLD_Dock = 0x0, PLD_Lid = 0x0, PLD_Panel = "UNKNOWN", PLD_VerticalPosition = "CENTER", PLD_HorizontalPosition = "CENTER", PLD_Shape = "RECTANGLE", PLD_GroupOrientation = 0x0, PLD_GroupToken = 0x0, PLD_GroupPosition = 0x0, PLD_Bay = 0x0, PLD_Ejectable = 0x0, PLD_EjectRequired = 0x0, PLD_CabinetNumber = 0x0, PLD_CardCageNumber = 0x0, PLD_Reference = 0x0, PLD_Rotation = 0x0, PLD_Order = 0x0, PLD_VerticalOffset = 0x0, PLD_HorizontalOffset = 0x0) ) } Change-Id: I7024390e407fda4b195211bd4755bb5ca53b2b37 Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://review.coreboot.org/26173 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/usb/acpi/chip.h')
-rw-r--r--src/drivers/usb/acpi/chip.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/drivers/usb/acpi/chip.h b/src/drivers/usb/acpi/chip.h
new file mode 100644
index 0000000000..f3f629abff
--- /dev/null
+++ b/src/drivers/usb/acpi/chip.h
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __USB_ACPI_CHIP_H__
+#define __USB_ACPI_CHIP_H__
+
+#include <arch/acpi.h>
+#include <arch/acpi_pld.h>
+
+struct drivers_usb_acpi_config {
+ const char *desc;
+
+ /*
+ * Physical ports that are user visible
+ *
+ * UPC_TYPE_A
+ * UPC_TYPE_MINI_AB
+ * UPC_TYPE_EXPRESSCARD
+ * UPC_TYPE_USB3_A
+ * UPC_TYPE_USB3_B
+ * UPC_TYPE_USB3_MICRO_B
+ * UPC_TYPE_USB3_MICRO_AB
+ * UPC_TYPE_USB3_POWER_B
+ * UPC_TYPE_C_USB2_ONLY
+ * UPC_TYPE_C_USB2_SS_SWITCH
+ * UPC_TYPE_C_USB2_SS
+ *
+ * Non-visible ports or special devices
+ *
+ * UPC_TYPE_PROPRIETARY
+ * UPC_TYPE_INTERNAL
+ * UPC_TYPE_UNUSED
+ * UPC_TYPE_HUB
+ */
+ enum acpi_upc_type type;
+
+ /* Define a custom physical location for the port */
+ bool use_custom_pld;
+ struct acpi_pld custom_pld;
+};
+
+#endif /* __USB_ACPI_CHIP_H__ */