Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48350 )
Change subject: azalia: Make `azalia_find_verb` parametric ......................................................................
azalia: Make `azalia_find_verb` parametric
Allow to specify which table should the verb list be read from.
Change-Id: Id1bc40c4364cda848f416bad9eeab1b8ca3e9512 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/device/azalia_device.c M src/include/device/azalia_device.h M src/southbridge/intel/bd82x6x/azalia.c M src/southbridge/intel/i82801gx/azalia.c M src/southbridge/intel/i82801ix/azalia.c M src/southbridge/intel/i82801jx/azalia.c M src/southbridge/intel/ibexpeak/azalia.c 7 files changed, 12 insertions(+), 12 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/48350/1
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index 440b6fb..283d2f0 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -85,17 +85,17 @@ return 0; }
-u32 azalia_find_verb(u32 viddid, const u32 **verb) +u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb) { int idx = 0;
- while (idx < (cim_verb_data_size / sizeof(u32))) { - u32 verb_size = 4 * cim_verb_data[idx + 2]; // in u32 - if (cim_verb_data[idx] != viddid) { + while (idx < (verb_table_bytes / sizeof(u32))) { + u32 verb_size = 4 * verb_table[idx + 2]; // in u32 + if (verb_table[idx] != viddid) { idx += verb_size + 3; // skip verb + header continue; } - *verb = &cim_verb_data[idx + 3]; + *verb = &verb_table[idx + 3]; return verb_size; }
@@ -179,7 +179,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "azalia_audio: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "azalia_audio: No verb!\n"); diff --git a/src/include/device/azalia_device.h b/src/include/device/azalia_device.h index 4e0674e..1945725 100644 --- a/src/include/device/azalia_device.h +++ b/src/include/device/azalia_device.h @@ -19,7 +19,7 @@ #define HDA_ICII_VALID (1 << 1)
int azalia_set_bits(void *port, u32 mask, u32 val); -u32 azalia_find_verb(u32 viddid, const u32 **verb); +u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb); void azalia_audio_init(struct device *dev); extern struct device_operations default_azalia_audio_ops;
diff --git a/src/southbridge/intel/bd82x6x/azalia.c b/src/southbridge/intel/bd82x6x/azalia.c index 136d6f2..fd08528 100644 --- a/src/southbridge/intel/bd82x6x/azalia.c +++ b/src/southbridge/intel/bd82x6x/azalia.c @@ -113,7 +113,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n"); diff --git a/src/southbridge/intel/i82801gx/azalia.c b/src/southbridge/intel/i82801gx/azalia.c index 71f7647..31ff159 100644 --- a/src/southbridge/intel/i82801gx/azalia.c +++ b/src/southbridge/intel/i82801gx/azalia.c @@ -111,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n"); diff --git a/src/southbridge/intel/i82801ix/azalia.c b/src/southbridge/intel/i82801ix/azalia.c index 5df3213..2d8e6d4 100644 --- a/src/southbridge/intel/i82801ix/azalia.c +++ b/src/southbridge/intel/i82801ix/azalia.c @@ -111,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n"); diff --git a/src/southbridge/intel/i82801jx/azalia.c b/src/southbridge/intel/i82801jx/azalia.c index 89e6a8c..3ac0a4a 100644 --- a/src/southbridge/intel/i82801jx/azalia.c +++ b/src/southbridge/intel/i82801jx/azalia.c @@ -111,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n"); diff --git a/src/southbridge/intel/ibexpeak/azalia.c b/src/southbridge/intel/ibexpeak/azalia.c index 0ded4d3..2510996 100644 --- a/src/southbridge/intel/ibexpeak/azalia.c +++ b/src/southbridge/intel/ibexpeak/azalia.c @@ -109,7 +109,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n");
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48350 )
Change subject: azalia: Make `azalia_find_verb` parametric ......................................................................
Patch Set 4: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/48350 )
Change subject: azalia: Make `azalia_find_verb` parametric ......................................................................
azalia: Make `azalia_find_verb` parametric
Allow to specify which table should the verb list be read from.
Change-Id: Id1bc40c4364cda848f416bad9eeab1b8ca3e9512 Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/48350 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/include/device/azalia_device.h M src/southbridge/intel/bd82x6x/azalia.c M src/southbridge/intel/i82801gx/azalia.c M src/southbridge/intel/i82801ix/azalia.c M src/southbridge/intel/i82801jx/azalia.c M src/southbridge/intel/ibexpeak/azalia.c 7 files changed, 12 insertions(+), 12 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 440b6fb..283d2f0 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -85,17 +85,17 @@ return 0; }
-u32 azalia_find_verb(u32 viddid, const u32 **verb) +u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb) { int idx = 0;
- while (idx < (cim_verb_data_size / sizeof(u32))) { - u32 verb_size = 4 * cim_verb_data[idx + 2]; // in u32 - if (cim_verb_data[idx] != viddid) { + while (idx < (verb_table_bytes / sizeof(u32))) { + u32 verb_size = 4 * verb_table[idx + 2]; // in u32 + if (verb_table[idx] != viddid) { idx += verb_size + 3; // skip verb + header continue; } - *verb = &cim_verb_data[idx + 3]; + *verb = &verb_table[idx + 3]; return verb_size; }
@@ -179,7 +179,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "azalia_audio: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "azalia_audio: No verb!\n"); diff --git a/src/include/device/azalia_device.h b/src/include/device/azalia_device.h index 4e0674e..1945725 100644 --- a/src/include/device/azalia_device.h +++ b/src/include/device/azalia_device.h @@ -19,7 +19,7 @@ #define HDA_ICII_VALID (1 << 1)
int azalia_set_bits(void *port, u32 mask, u32 val); -u32 azalia_find_verb(u32 viddid, const u32 **verb); +u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb); void azalia_audio_init(struct device *dev); extern struct device_operations default_azalia_audio_ops;
diff --git a/src/southbridge/intel/bd82x6x/azalia.c b/src/southbridge/intel/bd82x6x/azalia.c index 136d6f2..fd08528 100644 --- a/src/southbridge/intel/bd82x6x/azalia.c +++ b/src/southbridge/intel/bd82x6x/azalia.c @@ -113,7 +113,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n"); diff --git a/src/southbridge/intel/i82801gx/azalia.c b/src/southbridge/intel/i82801gx/azalia.c index 71f7647..31ff159 100644 --- a/src/southbridge/intel/i82801gx/azalia.c +++ b/src/southbridge/intel/i82801gx/azalia.c @@ -111,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n"); diff --git a/src/southbridge/intel/i82801ix/azalia.c b/src/southbridge/intel/i82801ix/azalia.c index 5df3213..2d8e6d4 100644 --- a/src/southbridge/intel/i82801ix/azalia.c +++ b/src/southbridge/intel/i82801ix/azalia.c @@ -111,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n"); diff --git a/src/southbridge/intel/i82801jx/azalia.c b/src/southbridge/intel/i82801jx/azalia.c index 89e6a8c..3ac0a4a 100644 --- a/src/southbridge/intel/i82801jx/azalia.c +++ b/src/southbridge/intel/i82801jx/azalia.c @@ -111,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n"); diff --git a/src/southbridge/intel/ibexpeak/azalia.c b/src/southbridge/intel/ibexpeak/azalia.c index 0ded4d3..2510996 100644 --- a/src/southbridge/intel/ibexpeak/azalia.c +++ b/src/southbridge/intel/ibexpeak/azalia.c @@ -109,7 +109,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = azalia_find_verb(reg32, &verb); + verb_size = azalia_find_verb(cim_verb_data, cim_verb_data_size, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n");