Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/48348 )
Change subject: azalia: Make `find_verb` function non-static ......................................................................
azalia: Make `find_verb` function non-static
To allow dropping copies of this function, make it non-static. Also, rename it to `azalia_find_verb` as the function is now globally visible. Finally, replace the copies in chipset code with `azalia_find_verb`.
Change-Id: Ie66323b2c62139e86d3d7e003f6653a3def7b5f2 Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/48348 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, 8 insertions(+), 97 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 e12ffad..20e7d2b 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -85,7 +85,7 @@ return 0; }
-static u32 find_verb(struct device *dev, u32 viddid, const u32 **verb) +u32 azalia_find_verb(struct device *dev, u32 viddid, const u32 **verb) { int idx = 0;
@@ -179,7 +179,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "azalia_audio: codec viddid: %08x\n", reg32); - verb_size = find_verb(dev, reg32, &verb); + verb_size = azalia_find_verb(dev, 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 7bb8e10..7b5f5d6 100644 --- a/src/include/device/azalia_device.h +++ b/src/include/device/azalia_device.h @@ -19,6 +19,7 @@ #define HDA_ICII_VALID (1 << 1)
int azalia_set_bits(void *port, u32 mask, u32 val); +u32 azalia_find_verb(struct device *dev, 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 5e810c4..1925a6f 100644 --- a/src/southbridge/intel/bd82x6x/azalia.c +++ b/src/southbridge/intel/bd82x6x/azalia.c @@ -41,24 +41,6 @@ return 0; }
-static u32 find_verb(struct device *dev, 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) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &cim_verb_data[idx + 3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - /* * Wait 50usec for the codec to indicate it is ready. * No response would imply that the codec is non-operative. @@ -131,7 +113,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = find_verb(dev, reg32, &verb); + verb_size = azalia_find_verb(dev, 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 a511468..fa3e9b4 100644 --- a/src/southbridge/intel/i82801gx/azalia.c +++ b/src/southbridge/intel/i82801gx/azalia.c @@ -39,24 +39,6 @@ return 0; }
-static u32 find_verb(struct device *dev, 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) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &cim_verb_data[idx + 3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - /* * Wait 50usec for the codec to indicate it is ready. * No response would imply that the codec is non-operative. @@ -129,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = find_verb(dev, reg32, &verb); + verb_size = azalia_find_verb(dev, 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 7078e67..9752285 100644 --- a/src/southbridge/intel/i82801ix/azalia.c +++ b/src/southbridge/intel/i82801ix/azalia.c @@ -39,24 +39,6 @@ return 0; }
-static u32 find_verb(struct device *dev, 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) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &cim_verb_data[idx + 3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - /* * Wait 50usec for the codec to indicate it is ready. * No response would imply that the codec is non-operative. @@ -129,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = find_verb(dev, reg32, &verb); + verb_size = azalia_find_verb(dev, 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 982efb7..81768bb 100644 --- a/src/southbridge/intel/i82801jx/azalia.c +++ b/src/southbridge/intel/i82801jx/azalia.c @@ -39,24 +39,6 @@ return 0; }
-static u32 find_verb(struct device *dev, 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) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &cim_verb_data[idx + 3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - /* * Wait 50usec for the codec to indicate it is ready. * No response would imply that the codec is non-operative. @@ -129,7 +111,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = find_verb(dev, reg32, &verb); + verb_size = azalia_find_verb(dev, 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 0c19598..af4f8ff 100644 --- a/src/southbridge/intel/ibexpeak/azalia.c +++ b/src/southbridge/intel/ibexpeak/azalia.c @@ -37,24 +37,6 @@ return 0; }
-static u32 find_verb(struct device *dev, 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) { - idx += verb_size + 3; // skip verb + header - continue; - } - *verb = &cim_verb_data[idx + 3]; - return verb_size; - } - - /* Not all codecs need to load another verb */ - return 0; -} - /* * Wait 50usec for the codec to indicate it is ready. * No response would imply that the codec is non-operative. @@ -127,7 +109,7 @@ /* 2 */ reg32 = read32(base + HDA_IR_REG); printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32); - verb_size = find_verb(dev, reg32, &verb); + verb_size = azalia_find_verb(dev, reg32, &verb);
if (!verb_size) { printk(BIOS_DEBUG, "Azalia: No verb!\n");