[coreboot-gerrit] Change in coreboot[master]: acpi: Add support for generating ACPI _UPC

Duncan Laurie (Code Review) gerrit at coreboot.org
Tue May 8 23:16:46 CEST 2018


Duncan Laurie has uploaded this change for review. ( https://review.coreboot.org/26170


Change subject: acpi: Add support for generating ACPI _UPC
......................................................................

acpi: Add support for generating ACPI _UPC

This commit adds support for writing ACPI _UPC structures that
help describe USB ports for the OS.

This is a simple structure format which indicates what type of
port it is and whether it is connectable.  It should be paired
with an ACPI _PLD structure to define USB ports for the OS.

Change-Id: Ide3768f60f96e9ad7f919ad3fb11d91045dc174a
Signed-off-by: Duncan Laurie <dlaurie at google.com>
---
M src/arch/x86/acpigen.c
M src/arch/x86/include/arch/acpi.h
M src/arch/x86/include/arch/acpigen.h
3 files changed, 39 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/26170/1

diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 10a4e1e..867c809 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -1221,6 +1221,21 @@
 	acpigen_write_string(arg);
 }
 
+void acpigen_write_upc(enum acpi_upc_type type)
+{
+	acpigen_write_name("_UPC");
+	acpigen_write_package(4);
+	/* Connectable */
+	acpigen_write_byte(type == UPC_TYPE_UNUSED ? 0 : 0xff);
+	/* Type */
+	acpigen_write_byte(type);
+	/* Reserved0 */
+	acpigen_write_zero();
+	/* Reserved1 */
+	acpigen_write_zero();
+	acpigen_pop_len();
+}
+
 void acpigen_write_dsm(const char *uuid, void (**callbacks)(void *),
 		       size_t count, void *arg)
 {
diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h
index fe0c6f2..39e5d5e 100644
--- a/src/arch/x86/include/arch/acpi.h
+++ b/src/arch/x86/include/arch/acpi.h
@@ -636,6 +636,29 @@
 	u32 status;
 } __packed acpi_tstate_t;
 
+/* Port types for ACPI _UPC object */
+enum acpi_upc_type {
+	/* These types are defined in ACPI 6.2 section 9.14 */
+	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,
+	/*
+	 * The following types are not directly defined in the ACPI
+	 * spec but are used by coreboot to identify a USB device type.
+	 */
+	UPC_TYPE_INTERNAL = 0xff,
+	UPC_TYPE_UNUSED,
+	UPC_TYPE_HUB
+};
+
 unsigned long fw_cfg_acpi_tables(unsigned long start);
 
 /* These are implemented by the target port or north/southbridge. */
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index 216e75f..250c0b7 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -255,6 +255,7 @@
 void acpigen_write_return_byte_buffer(uint8_t *arr, size_t size);
 void acpigen_write_return_singleton_buffer(uint8_t arg);
 void acpigen_write_return_byte(uint8_t arg);
+void acpigen_write_upc(enum acpi_upc_type type);
 /*
  * Generate ACPI AML code for _DSM method.
  * This function takes as input uuid for the device, set of callbacks and

-- 
To view, visit https://review.coreboot.org/26170
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide3768f60f96e9ad7f919ad3fb11d91045dc174a
Gerrit-Change-Number: 26170
Gerrit-PatchSet: 1
Gerrit-Owner: Duncan Laurie <dlaurie at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180508/1affae05/attachment-0001.html>


More information about the coreboot-gerrit mailing list