nhlt: add api to override oem_id and oem_table_id of acpi_header_t
This patch added nhlt_soc_serialize_oem_overrides and nhlt_serilalize_oem_overrides to be able to override oem_id and oem_table_id.board file can pass specific string by calling nhlt_soc_serialize_oem_overrides kernel use these two fields to construct a topology binary name if the designate file is not found a default dfw_sst.bin will be used it is optional. BUG=chrome-os-partner:49570 BRANCH=glados TEST=Build & Booted kunimitsu board. Verified that kernel can read new strings. Change-Id: I00b64fb8bb63de601d3116e0b8941057c1efa230 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 374ce08b2d8a2f4e5dd7f51eacb505dbb77fd171 Original-Change-Id: I03623c8ac81efb5a5ea3ec9c6cd604d2e9294022 Original-Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Original-Reviewed-on: https://chromium-review.googlesource.com/322860 Original-Commit-Ready: Yang Fang <yang.a.fang@intel.com> Original-Tested-by: Yang Fang <yang.a.fang@intel.com> Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13602 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
0165038561
commit
16ff85971f
|
@ -124,6 +124,15 @@ void nhlt_next_instance(struct nhlt *nhlt, int link_type);
|
||||||
*/
|
*/
|
||||||
uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr);
|
uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serialize NHLT object to ACPI table. Take in the beginning address of where
|
||||||
|
* the table will reside oem_id and oem_table_id and return the address of the
|
||||||
|
* next ACPI table. On error 0 will be returned. The NHLT object is no longer
|
||||||
|
* valid after thisfunction is called.
|
||||||
|
*/
|
||||||
|
uintptr_t nhlt_serialize_oem_overrides(struct nhlt *nhlt, uintptr_t acpi_addr,
|
||||||
|
const char *oem_id, const char *oem_table_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* While very similar to nhlt_serialize() the SoC specific function allows
|
* While very similar to nhlt_serialize() the SoC specific function allows
|
||||||
* the chipset to perform any needed accounting work such as updating ACPI
|
* the chipset to perform any needed accounting work such as updating ACPI
|
||||||
|
@ -131,6 +140,14 @@ uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr);
|
||||||
*/
|
*/
|
||||||
uintptr_t nhlt_soc_serialize(struct nhlt *nhlt, uintptr_t acpi_addr);
|
uintptr_t nhlt_soc_serialize(struct nhlt *nhlt, uintptr_t acpi_addr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* While very similar to nhlt_serialize_oem_overrides() the SoC specific
|
||||||
|
* function allows the chipset to perform any needed accounting work such
|
||||||
|
* as updating ACPI field references for the serialized structure.
|
||||||
|
*/
|
||||||
|
uintptr_t nhlt_soc_serialize_oem_overrides(struct nhlt *nhlt,
|
||||||
|
uintptr_t acpi_addr, const char *oem_id, const char *oem_table_id);
|
||||||
|
|
||||||
/* Link and device types. */
|
/* Link and device types. */
|
||||||
enum {
|
enum {
|
||||||
NHLT_LINK_HDA,
|
NHLT_LINK_HDA,
|
||||||
|
|
|
@ -388,10 +388,18 @@ static void nhlt_serialize_endpoints(struct nhlt *nhlt, struct cursor *cur)
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
|
uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
|
||||||
|
{
|
||||||
|
return nhlt_serialize_oem_overrides(nhlt, acpi_addr, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
uintptr_t nhlt_serialize_oem_overrides(struct nhlt *nhlt,
|
||||||
|
uintptr_t acpi_addr, const char *oem_id, const char *oem_table_id)
|
||||||
{
|
{
|
||||||
struct cursor cur;
|
struct cursor cur;
|
||||||
acpi_header_t *header;
|
acpi_header_t *header;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
|
size_t oem_id_len;
|
||||||
|
size_t oem_table_id_len;
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "ACPI: * NHLT\n");
|
printk(BIOS_DEBUG, "ACPI: * NHLT\n");
|
||||||
|
|
||||||
|
@ -403,8 +411,18 @@ uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
|
||||||
memcpy(header->signature, "NHLT", 4);
|
memcpy(header->signature, "NHLT", 4);
|
||||||
write_le32(&header->length, sz);
|
write_le32(&header->length, sz);
|
||||||
write_le8(&header->revision, 5);
|
write_le8(&header->revision, 5);
|
||||||
memcpy(header->oem_id, OEM_ID, 6);
|
|
||||||
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
|
if (oem_id == NULL)
|
||||||
|
oem_id = OEM_ID;
|
||||||
|
|
||||||
|
if (oem_table_id == NULL)
|
||||||
|
oem_table_id = ACPI_TABLE_CREATOR;
|
||||||
|
|
||||||
|
oem_id_len = MIN(strlen(oem_id), 6);
|
||||||
|
oem_table_id_len = MIN(strlen(oem_table_id), 8);
|
||||||
|
|
||||||
|
memcpy(header->oem_id, oem_id, oem_id_len);
|
||||||
|
memcpy(header->oem_table_id, oem_table_id, oem_table_id_len);
|
||||||
memcpy(header->asl_compiler_id, ASLC, 4);
|
memcpy(header->asl_compiler_id, ASLC, 4);
|
||||||
|
|
||||||
cur.buf = (void *)(acpi_addr + sizeof(acpi_header_t));
|
cur.buf = (void *)(acpi_addr + sizeof(acpi_header_t));
|
||||||
|
|
|
@ -86,6 +86,12 @@ struct nhlt_endpoint *nhlt_soc_add_endpoint(struct nhlt *nhlt, int soc_hwintf,
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t nhlt_soc_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
|
uintptr_t nhlt_soc_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
|
||||||
|
{
|
||||||
|
return nhlt_soc_serialize_oem_overrides(nhlt, acpi_addr, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
uintptr_t nhlt_soc_serialize_oem_overrides(struct nhlt *nhlt,
|
||||||
|
uintptr_t acpi_addr, const char *oem_id, const char *oem_table_id)
|
||||||
{
|
{
|
||||||
global_nvs_t *gnvs;
|
global_nvs_t *gnvs;
|
||||||
|
|
||||||
|
@ -98,5 +104,6 @@ uintptr_t nhlt_soc_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
|
||||||
gnvs->nhla = (uintptr_t)acpi_addr;
|
gnvs->nhla = (uintptr_t)acpi_addr;
|
||||||
gnvs->nhll = nhlt_current_size(nhlt);
|
gnvs->nhll = nhlt_current_size(nhlt);
|
||||||
|
|
||||||
return nhlt_serialize(nhlt, acpi_addr);
|
return nhlt_serialize_oem_overrides(nhlt, acpi_addr,
|
||||||
|
oem_id, oem_table_id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue