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@google.com>
Reviewed-on: https://review.coreboot.org/26170
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Duncan Laurie 2018-05-07 14:26:59 -07:00 committed by Patrick Georgi
parent bae9f85ddb
commit beb2af4e35
3 changed files with 40 additions and 0 deletions

View File

@ -1221,6 +1221,21 @@ void acpigen_write_return_string(const char *arg)
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)
{

View File

@ -636,6 +636,30 @@ typedef struct acpi_tstate {
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,
UPC_TYPE_PROPRIETARY = 0xff,
/*
* 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. */

View File

@ -255,6 +255,7 @@ void acpigen_write_byte_buffer(uint8_t *arr, size_t size);
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