Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions drivers/media/platform/apple/ave/ave-abi-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,16 +1677,29 @@ static void ave_t6041_text_boot_word(struct kunit *test)
KUNIT_EXPECT_EQ(test, ave_t8132.builds[0].text_crc, AVE_FW_TEXT_CRC_T8132_26B123);
KUNIT_EXPECT_EQ(test, ave_t8132.text_link_cell, 0U);
/*
* The M5 Pro/Max 26A428 build: the same word, which differs per boot on
* the J775D. The 26C5035 build has none set: its CRC matches as it is.
* T6050 26A428 sets the per-boot TEXT word; 26B123, 26C5035, and
* 26B8125 have none set, share the larger TEXT segment, and speak
* the 26A428 command layout.
*/
KUNIT_ASSERT_EQ(test, ave_t6050.build_count, 3U);
KUNIT_ASSERT_EQ(test, ave_t6050.build_count, 4U);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[0].text_boot_word, off);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[0].text_crc, AVE_FW_TEXT_CRC_T6050_26A428);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].text_size, 0x158000U);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].data_size, 0x134000U);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].text_boot_word, 0U);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].text_crc, AVE_FW_TEXT_CRC_T6050_26C5035);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].text_crc, AVE_FW_TEXT_CRC_T6050_26B123);
KUNIT_EXPECT_TRUE(test, ave_fw_known_crc(AVE_FW_TEXT_CRC_T6050_26B123));
KUNIT_EXPECT_PTR_EQ(test, ave_layout_for_crc(AVE_FW_TEXT_CRC_T6050_26B123),
&ave_layout_26a428);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].text_size, 0x158000U);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].data_size, 0x134000U);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].text_boot_word, 0U);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].text_crc, AVE_FW_TEXT_CRC_T6050_26B8125);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].text_crc, AVE_FW_TEXT_CRC_T6050_26C5035);
KUNIT_EXPECT_TRUE(test, ave_fw_known_crc(AVE_FW_TEXT_CRC_T6050_26C5035));
KUNIT_EXPECT_PTR_EQ(test, ave_layout_for_crc(AVE_FW_TEXT_CRC_T6050_26C5035),
&ave_layout_26a428);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[3].text_boot_word, 0U);
KUNIT_EXPECT_EQ(test, ave_t6050.builds[3].text_crc, AVE_FW_TEXT_CRC_T6050_26B8125);
KUNIT_EXPECT_EQ(test, ave_t6050.text_link_cell, 0U);
for (u32 i = 0; i < size; i++)
text[i] = i * 7 + 3;
Expand Down
7 changes: 4 additions & 3 deletions drivers/media/platform/apple/ave/ave-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,11 @@ static const struct ave_variant ave_t8140 = {
static const struct ave_fw_build ave_t6050_builds[] = {
{ "26A428", 0x154000, 0x134000, AVE_FW_TEXT_CRC_T6050_26A428, 0x4224 },
/*
* macOS 27.3 beta 1 (iBoot 20457.60.65): TEXT is 0x4000 larger, DATA
* keeps its size. It starts as 26A428 does and takes 26A428's command
* layout (ave_layout_for_crc()).
* 26B123 and 26C5035: TEXT is 0x4000 larger, DATA keeps its size.
* Both start as 26A428 does and take 26A428's command layout
* (ave_layout_for_crc()).
*/
{ "26B123", 0x158000, 0x134000, AVE_FW_TEXT_CRC_T6050_26B123 },
{ "26C5035", 0x158000, 0x134000, AVE_FW_TEXT_CRC_T6050_26C5035 },
/* macOS 27.2: 26A428's command layout, as the 27.2 build of the M5 (T8142). */
{ "26B8125", 0x158000, 0x134000, AVE_FW_TEXT_CRC_T6050_26B8125 },
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/platform/apple/ave/ave-fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static const u32 ave_known_text_crc[] = {
AVE_FW_TEXT_CRC_T6040_25G83, /* encoder firmware 9003.78.0 / T6040 */
AVE_FW_TEXT_CRC_T6041_25G83, /* encoder firmware 9003.78.0 / M4 Max */
AVE_FW_TEXT_CRC_T6050_26A428, /* encoder firmware macOS 27.0 26A428 / T6050 */
AVE_FW_TEXT_CRC_T6050_26B123, /* encoder firmware 27.2 26B123 / T6050 */
AVE_FW_TEXT_CRC_T6050_26C5035, /* encoder firmware macOS 27.3 26C5035r / T6050 */
AVE_FW_TEXT_CRC_T6050_26B8125, /* encoder firmware macOS 27.2 26B8125 / T6050 */
AVE_FW_TEXT_CRC_T8142_26A428, /* encoder firmware 9013.45.1, macOS 27.0 26A428 / T8142 */
Expand Down Expand Up @@ -160,7 +161,7 @@ int ave_fw_text_id_crc(const void *text, size_t size, u32 cell_off,
return 0;
}

static bool ave_fw_known_crc(u32 crc)
bool ave_fw_known_crc(u32 crc)
{
for (unsigned int i = 0; i < ARRAY_SIZE(ave_known_text_crc); i++)
if (crc == ave_known_text_crc[i])
Expand Down
8 changes: 5 additions & 3 deletions drivers/media/platform/apple/ave/ave-layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,12 @@ const struct ave_fw_layout *ave_layout_for_crc(u32 crc)
crc == AVE_FW_TEXT_CRC_T8142_26A428)
return &ave_layout_26a428;
/*
* The macOS 27.3 beta 1 build speaks the same command layout: H.264
* and HEVC encode with it on a J714s.
* T6050 builds 26B123, 26B8125, and 26C5035 speak the same 26A428
* command layout: H.264 and HEVC encode with 26B123 on J716c and
* 26C5035 on J714s.
*/
if (crc == AVE_FW_TEXT_CRC_T6050_26C5035 ||
if (crc == AVE_FW_TEXT_CRC_T6050_26B123 ||
crc == AVE_FW_TEXT_CRC_T6050_26C5035 ||
crc == AVE_FW_TEXT_CRC_T6050_26B8125)
return &ave_layout_26a428;
if (crc == AVE_FW_TEXT_CRC_T8132_26B123 ||
Expand Down
3 changes: 3 additions & 0 deletions drivers/media/platform/apple/ave/ave.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ enum ave_opcode {
*/
#define AVE_FW_TEXT_CRC_T6041_25G83 0x9a080cad
#define AVE_FW_TEXT_CRC_T6050_26A428 0x87279429
/* Firmware 27.2 (26B123) / T6050: TEXT 0x158000, DATA 0x134000. */
#define AVE_FW_TEXT_CRC_T6050_26B123 0xd33ed3b4
/* macOS 27.3 beta 1 (26C5035r) / T6050: TEXT 0x158000, DATA 0x134000. */
#define AVE_FW_TEXT_CRC_T6050_26C5035 0xc25b4ddb
/*
Expand Down Expand Up @@ -590,6 +592,7 @@ extern const struct ave_variant ave_t6000, ave_t6041, ave_t6050, ave_t8112,
u64 ave_fw_vcbar(const struct ave_variant *variant, u64 text_iova);
int ave_fw_probe(struct ave_dev *ave);
bool ave_fw_sizes_match(const struct ave_variant *v, size_t text, size_t data);
bool ave_fw_known_crc(u32 crc);
const struct ave_variant *ave_fw_select_build(const struct ave_variant *v,
size_t text, size_t data);
int ave_fw_text_id_crc(const void *text, size_t size, u32 cell_off,
Expand Down
Loading