Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48351 )
Change subject: azalia: Replace `hda_find_verb` uses ......................................................................
azalia: Replace `hda_find_verb` uses
This function is equivalent to `azalia_find_verb`. Also relocate the function description comment.
Change-Id: I40d1e634c31b00bd7808a651990d9bd6f0d054e9 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/device/azalia_device.c M src/soc/intel/common/hda_verb.c M src/southbridge/intel/lynxpoint/hda_verb.c 3 files changed, 27 insertions(+), 92 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/51/48351/1
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index 283d2f0..e46c27f 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -85,6 +85,31 @@ return 0; }
+/* + * Find a specific entry within a verb table + * + * @param verb_table: verb table data + * @param verb_table_bytes: verb table size in bytes + * @param viddid: vendor/device to search for + * @param verb: pointer to entry within table + * + * Returns size of the entry within the verb table, + * Returns 0 if the entry is not found + * + * The HDA verb table is composed of dwords. A set of 4 dwords is + * grouped together to form a "jack" descriptor. + * Bits 31:28 - Codec Address + * Bits 27:20 - NID + * Bits 19:8 - Verb ID + * Bits 7:0 - Payload + * + * coreboot groups different codec verb tables into a single table + * and prefixes each with a specific header consisting of 3 + * dword entries: + * 1 - Codec Vendor/Device ID + * 2 - Subsystem ID + * 3 - Number of jacks (groups of 4 dwords) for this codec + */ u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb) { int idx = 0; diff --git a/src/soc/intel/common/hda_verb.c b/src/soc/intel/common/hda_verb.c index 57104c4..e812ec5 100644 --- a/src/soc/intel/common/hda_verb.c +++ b/src/soc/intel/common/hda_verb.c @@ -91,51 +91,6 @@ return -1; }
-/* - * Find a specific entry within a verb table - * - * @param verb_table_bytes: verb table size in bytes - * @param verb_table_data: verb table data - * @param viddid: vendor/device to search for - * @param verb: pointer to entry within table - * - * Returns size of the entry within the verb table, - * Returns 0 if the entry is not found - * - * The HDA verb table is composed of dwords. A set of 4 dwords is - * grouped together to form a "jack" descriptor. - * Bits 31:28 - Codec Address - * Bits 27:20 - NID - * Bits 19:8 - Verb ID - * Bits 7:0 - Payload - * - * coreboot groups different codec verb tables into a single table - * and prefixes each with a specific header consisting of 3 - * dword entries: - * 1 - Codec Vendor/Device ID - * 2 - Subsystem ID - * 3 - Number of jacks (groups of 4 dwords) for this codec - */ -static u32 hda_find_verb(u32 verb_table_bytes, - const u32 *verb_table_data, - u32 viddid, const u32 **verb) -{ - int idx = 0; - - while (idx < (verb_table_bytes / sizeof(u32))) { - u32 verb_size = 4 * verb_table_data[idx+2]; // in u32 - if (verb_table_data[idx] != viddid) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &verb_table_data[idx+3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - int hda_codec_write(u8 *base, u32 size, const u32 *data) { int i; @@ -184,7 +139,7 @@ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "HDA: codec viddid: %08x\n", reg32);
- size = hda_find_verb(verb_size, verb_data, reg32, &verb); + size = azalia_find_verb(verb_data, verb_size, reg32, &verb); if (!size) { printk(BIOS_DEBUG, "HDA: No verb table entry found\n"); return -1; diff --git a/src/southbridge/intel/lynxpoint/hda_verb.c b/src/southbridge/intel/lynxpoint/hda_verb.c index 7c6537d..9caffed 100644 --- a/src/southbridge/intel/lynxpoint/hda_verb.c +++ b/src/southbridge/intel/lynxpoint/hda_verb.c @@ -79,51 +79,6 @@ return -1; }
-/* - * Find a specific entry within a verb table - * - * @param verb_table_bytes: verb table size in bytes - * @param verb_table_data: verb table data - * @param viddid: vendor/device to search for - * @param **verb: pointer to entry within table - * - * Returns size of the entry within the verb table, - * Returns 0 if the entry is not found - * - * The HDA verb table is composed of dwords. A set of 4 dwords is - * grouped together to form a "jack" descriptor. - * Bits 31:28 - Codec Address - * Bits 27:20 - NID - * Bits 19:8 - Verb ID - * Bits 7:0 - Payload - * - * coreboot groups different codec verb tables into a single table - * and prefixes each with a specific header consisting of 3 - * dword entries: - * 1 - Codec Vendor/Device ID - * 2 - Subsystem ID - * 3 - Number of jacks (groups of 4 dwords) for this codec - */ -static u32 hda_find_verb(u32 verb_table_bytes, - const u32 *verb_table_data, - u32 viddid, const u32 **verb) -{ - int idx = 0; - - while (idx < (verb_table_bytes / sizeof(u32))) { - u32 verb_size = 4 * verb_table_data[idx+2]; // in u32 - if (verb_table_data[idx] != viddid) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &verb_table_data[idx+3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - int hda_codec_write(u8 *base, u32 size, const u32 *data) { int i; @@ -172,7 +127,7 @@ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "HDA: codec viddid: %08x\n", reg32);
- size = hda_find_verb(verb_size, verb_data, reg32, &verb); + size = azalia_find_verb(verb_data, verb_size, reg32, &verb); if (!size) { printk(BIOS_DEBUG, "HDA: No verb table entry found\n"); return -1;
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48351 )
Change subject: azalia: Replace `hda_find_verb` uses ......................................................................
Patch Set 4: Code-Review+2
Hello Felix Singer, build bot (Jenkins), Nico Huber, Arthur Heymans, Michael Niewöhner, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48351
to look at the new patch set (#5).
Change subject: azalia: Repface `hda_find_verb` uses ......................................................................
azalia: Repface `hda_find_verb` uses
This function is equivalent to `azalia_find_verb` in its current form, so replace them. Also, adapt and move the function description comment.
Change-Id: I40d1e634c31b00bd7808a651990d9bd6f0d054e9 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/device/azalia_device.c M src/soc/intel/common/hda_verb.c M src/southbridge/intel/lynxpoint/hda_verb.c 3 files changed, 27 insertions(+), 92 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/51/48351/5
Hello Felix Singer, build bot (Jenkins), Nico Huber, Arthur Heymans, Michael Niewöhner, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48351
to look at the new patch set (#6).
Change subject: azalia: Replace `hda_find_verb` uses ......................................................................
azalia: Replace `hda_find_verb` uses
This function is equivalent to `azalia_find_verb` in its current form, so replace them. Also, adapt and move the function description comment.
Change-Id: I40d1e634c31b00bd7808a651990d9bd6f0d054e9 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/device/azalia_device.c M src/soc/intel/common/hda_verb.c M src/southbridge/intel/lynxpoint/hda_verb.c 3 files changed, 27 insertions(+), 92 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/51/48351/6
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48351 )
Change subject: azalia: Replace `hda_find_verb` uses ......................................................................
Patch Set 6: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/48351 )
Change subject: azalia: Replace `hda_find_verb` uses ......................................................................
azalia: Replace `hda_find_verb` uses
This function is equivalent to `azalia_find_verb` in its current form, so replace them. Also, adapt and move the function description comment.
Change-Id: I40d1e634c31b00bd7808a651990d9bd6f0d054e9 Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/48351 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Rudolph siro@das-labor.org --- M src/device/azalia_device.c M src/soc/intel/common/hda_verb.c M src/southbridge/intel/lynxpoint/hda_verb.c 3 files changed, 27 insertions(+), 92 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Rudolph: Looks good to me, approved
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index 283d2f0..e46c27f 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -85,6 +85,31 @@ return 0; }
+/* + * Find a specific entry within a verb table + * + * @param verb_table: verb table data + * @param verb_table_bytes: verb table size in bytes + * @param viddid: vendor/device to search for + * @param verb: pointer to entry within table + * + * Returns size of the entry within the verb table, + * Returns 0 if the entry is not found + * + * The HDA verb table is composed of dwords. A set of 4 dwords is + * grouped together to form a "jack" descriptor. + * Bits 31:28 - Codec Address + * Bits 27:20 - NID + * Bits 19:8 - Verb ID + * Bits 7:0 - Payload + * + * coreboot groups different codec verb tables into a single table + * and prefixes each with a specific header consisting of 3 + * dword entries: + * 1 - Codec Vendor/Device ID + * 2 - Subsystem ID + * 3 - Number of jacks (groups of 4 dwords) for this codec + */ u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb) { int idx = 0; diff --git a/src/soc/intel/common/hda_verb.c b/src/soc/intel/common/hda_verb.c index 57104c4..e812ec5 100644 --- a/src/soc/intel/common/hda_verb.c +++ b/src/soc/intel/common/hda_verb.c @@ -91,51 +91,6 @@ return -1; }
-/* - * Find a specific entry within a verb table - * - * @param verb_table_bytes: verb table size in bytes - * @param verb_table_data: verb table data - * @param viddid: vendor/device to search for - * @param verb: pointer to entry within table - * - * Returns size of the entry within the verb table, - * Returns 0 if the entry is not found - * - * The HDA verb table is composed of dwords. A set of 4 dwords is - * grouped together to form a "jack" descriptor. - * Bits 31:28 - Codec Address - * Bits 27:20 - NID - * Bits 19:8 - Verb ID - * Bits 7:0 - Payload - * - * coreboot groups different codec verb tables into a single table - * and prefixes each with a specific header consisting of 3 - * dword entries: - * 1 - Codec Vendor/Device ID - * 2 - Subsystem ID - * 3 - Number of jacks (groups of 4 dwords) for this codec - */ -static u32 hda_find_verb(u32 verb_table_bytes, - const u32 *verb_table_data, - u32 viddid, const u32 **verb) -{ - int idx = 0; - - while (idx < (verb_table_bytes / sizeof(u32))) { - u32 verb_size = 4 * verb_table_data[idx+2]; // in u32 - if (verb_table_data[idx] != viddid) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &verb_table_data[idx+3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - int hda_codec_write(u8 *base, u32 size, const u32 *data) { int i; @@ -184,7 +139,7 @@ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "HDA: codec viddid: %08x\n", reg32);
- size = hda_find_verb(verb_size, verb_data, reg32, &verb); + size = azalia_find_verb(verb_data, verb_size, reg32, &verb); if (!size) { printk(BIOS_DEBUG, "HDA: No verb table entry found\n"); return -1; diff --git a/src/southbridge/intel/lynxpoint/hda_verb.c b/src/southbridge/intel/lynxpoint/hda_verb.c index 7c6537d..9caffed 100644 --- a/src/southbridge/intel/lynxpoint/hda_verb.c +++ b/src/southbridge/intel/lynxpoint/hda_verb.c @@ -79,51 +79,6 @@ return -1; }
-/* - * Find a specific entry within a verb table - * - * @param verb_table_bytes: verb table size in bytes - * @param verb_table_data: verb table data - * @param viddid: vendor/device to search for - * @param **verb: pointer to entry within table - * - * Returns size of the entry within the verb table, - * Returns 0 if the entry is not found - * - * The HDA verb table is composed of dwords. A set of 4 dwords is - * grouped together to form a "jack" descriptor. - * Bits 31:28 - Codec Address - * Bits 27:20 - NID - * Bits 19:8 - Verb ID - * Bits 7:0 - Payload - * - * coreboot groups different codec verb tables into a single table - * and prefixes each with a specific header consisting of 3 - * dword entries: - * 1 - Codec Vendor/Device ID - * 2 - Subsystem ID - * 3 - Number of jacks (groups of 4 dwords) for this codec - */ -static u32 hda_find_verb(u32 verb_table_bytes, - const u32 *verb_table_data, - u32 viddid, const u32 **verb) -{ - int idx = 0; - - while (idx < (verb_table_bytes / sizeof(u32))) { - u32 verb_size = 4 * verb_table_data[idx+2]; // in u32 - if (verb_table_data[idx] != viddid) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &verb_table_data[idx+3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - int hda_codec_write(u8 *base, u32 size, const u32 *data) { int i; @@ -172,7 +127,7 @@ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "HDA: codec viddid: %08x\n", reg32);
- size = hda_find_verb(verb_size, verb_data, reg32, &verb); + size = azalia_find_verb(verb_data, verb_size, reg32, &verb); if (!size) { printk(BIOS_DEBUG, "HDA: No verb table entry found\n"); return -1;