mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
firewire: core: add test to generate with both AV/C and IIDC units in config ROM generator
Add a KUnit test to verify that the generator produces the expected configuration ROM when both AV/C and IIDC units are registered. Link: https://lore.kernel.org/r/20260901134534.2386577-11-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
parent
49e4d0eea6
commit
56db07175f
|
|
@ -162,6 +162,62 @@ static const u32 config_rom_with_iidc_unit[] = {
|
||||||
cpu_to_be32(0x20436174), // v
|
cpu_to_be32(0x20436174), // v
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const u32 config_rom_with_avc_and_iidc_units[] = {
|
||||||
|
cpu_to_be32(0x040439c0), // bus info
|
||||||
|
cpu_to_be32(0x31333934), // |
|
||||||
|
cpu_to_be32(0xf000b253), // |
|
||||||
|
cpu_to_be32(0x01234567), // |
|
||||||
|
cpu_to_be32(0x89abcdef), // v
|
||||||
|
cpu_to_be32(0x0007073e), // root directory
|
||||||
|
cpu_to_be32(0x0c0083c0), // |
|
||||||
|
cpu_to_be32(0x03001f11), // |
|
||||||
|
cpu_to_be32(0x81000005), // |
|
||||||
|
cpu_to_be32(0x17023901), // |
|
||||||
|
cpu_to_be32(0x8100000a), // |
|
||||||
|
cpu_to_be32(0xd100000d), // |
|
||||||
|
cpu_to_be32(0xd1000015), // v
|
||||||
|
cpu_to_be32(0x00064cb7), // text descriptor leaf (from root)
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x4c696e75), // |
|
||||||
|
cpu_to_be32(0x78204669), // |
|
||||||
|
cpu_to_be32(0x72657769), // |
|
||||||
|
cpu_to_be32(0x72650000), // v
|
||||||
|
cpu_to_be32(0x0003ff1c), // text descriptor leaf (from root)
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x4a756a75), // v
|
||||||
|
cpu_to_be32(0x0004227b), // unit directory (from root)
|
||||||
|
cpu_to_be32(0x1200a02d), // |
|
||||||
|
cpu_to_be32(0x13010001), // |
|
||||||
|
cpu_to_be32(0x17260827), // |
|
||||||
|
cpu_to_be32(0x81000001), // v
|
||||||
|
cpu_to_be32(0x0003f771), // text descriptor leaf (from unit)
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x50756900), // v
|
||||||
|
cpu_to_be32(0x0003d7fe), // unit directory (from root)
|
||||||
|
cpu_to_be32(0x1200a02d), // |
|
||||||
|
cpu_to_be32(0x13000100), // |
|
||||||
|
cpu_to_be32(0xd4000001), // v
|
||||||
|
cpu_to_be32(0x0003ea57), // dependent directory (from unit directory)
|
||||||
|
cpu_to_be32(0x40012345), // |
|
||||||
|
cpu_to_be32(0x81000002), // |
|
||||||
|
cpu_to_be32(0x82000008), // v
|
||||||
|
cpu_to_be32(0x00064cb7), // text descriptor leaf (from dependent directory)
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x4c696e75), // |
|
||||||
|
cpu_to_be32(0x78204669), // |
|
||||||
|
cpu_to_be32(0x72657769), // |
|
||||||
|
cpu_to_be32(0x72650000), // v
|
||||||
|
cpu_to_be32(0x0004a3e9), // text descriptor leaf (from dependent directory)
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x00000000), // |
|
||||||
|
cpu_to_be32(0x43686566), // |
|
||||||
|
cpu_to_be32(0x20436174), // v
|
||||||
|
};
|
||||||
|
|
||||||
static const struct generator_test_case {
|
static const struct generator_test_case {
|
||||||
const char *const name;
|
const char *const name;
|
||||||
int config_rom_generation;
|
int config_rom_generation;
|
||||||
|
|
@ -186,6 +242,12 @@ static const struct generator_test_case {
|
||||||
.expected = config_rom_with_iidc_unit,
|
.expected = config_rom_with_iidc_unit,
|
||||||
.quadlet_length = ARRAY_SIZE(config_rom_with_iidc_unit),
|
.quadlet_length = ARRAY_SIZE(config_rom_with_iidc_unit),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "with_avc_and_iidc_unit",
|
||||||
|
.config_rom_generation = 3,
|
||||||
|
.expected = config_rom_with_avc_and_iidc_units,
|
||||||
|
.quadlet_length = ARRAY_SIZE(config_rom_with_avc_and_iidc_units),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define generator_test_gen_params.
|
// Define generator_test_gen_params.
|
||||||
|
|
@ -219,10 +281,12 @@ static void test_config_rom_generator(struct kunit *test)
|
||||||
card->max_receive = 11;
|
card->max_receive = 11;
|
||||||
card->guid = 0x0123456789abcdefULL;
|
card->guid = 0x0123456789abcdefULL;
|
||||||
|
|
||||||
if (test_case->expected == config_rom_with_avc_unit)
|
if (test_case->expected == config_rom_with_avc_unit ||
|
||||||
|
test_case->expected == config_rom_with_avc_and_iidc_units)
|
||||||
KUNIT_EXPECT_EQ(test, fw_core_add_descriptor(&avc_unit_entry), 0);
|
KUNIT_EXPECT_EQ(test, fw_core_add_descriptor(&avc_unit_entry), 0);
|
||||||
|
|
||||||
if (test_case->expected == config_rom_with_iidc_unit)
|
if (test_case->expected == config_rom_with_iidc_unit ||
|
||||||
|
test_case->expected == config_rom_with_avc_and_iidc_units)
|
||||||
KUNIT_EXPECT_EQ(test, fw_core_add_descriptor(&iidc_unit_entry), 0);
|
KUNIT_EXPECT_EQ(test, fw_core_add_descriptor(&iidc_unit_entry), 0);
|
||||||
|
|
||||||
scoped_guard(mutex, &card_mutex) {
|
scoped_guard(mutex, &card_mutex) {
|
||||||
|
|
@ -233,10 +297,12 @@ static void test_config_rom_generator(struct kunit *test)
|
||||||
KUNIT_EXPECT_MEMEQ(test, config_rom, test_case->expected,
|
KUNIT_EXPECT_MEMEQ(test, config_rom, test_case->expected,
|
||||||
sizeof(*test_case->expected) * test_case->quadlet_length);
|
sizeof(*test_case->expected) * test_case->quadlet_length);
|
||||||
|
|
||||||
if (test_case->expected == config_rom_with_iidc_unit)
|
if (test_case->expected == config_rom_with_iidc_unit ||
|
||||||
|
test_case->expected == config_rom_with_avc_and_iidc_units)
|
||||||
fw_core_remove_descriptor(&iidc_unit_entry);
|
fw_core_remove_descriptor(&iidc_unit_entry);
|
||||||
|
|
||||||
if (test_case->expected == config_rom_with_avc_unit)
|
if (test_case->expected == config_rom_with_avc_unit ||
|
||||||
|
test_case->expected == config_rom_with_avc_and_iidc_units)
|
||||||
fw_core_remove_descriptor(&avc_unit_entry);
|
fw_core_remove_descriptor(&avc_unit_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user