drivers/firewire/device-attribute-test.c

Source file repositories/reference/linux-study-clean/drivers/firewire/device-attribute-test.c

File Facts

System
Linux kernel
Corpus path
drivers/firewire/device-attribute-test.c
Extension
.c
Size
8039 bytes
Lines
254
Domain
Driver Families
Bucket
drivers/firewire
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
//
// device-attribute-test.c - An application of Kunit to test implementation for device attributes.
//
// Copyright (c) 2023 Takashi Sakamoto
//
// This file can not be built independently since it is intentionally included in core-device.c.

#include <kunit/test.h>

// Configuration ROM for AV/C Devices 1.0 (Dec. 12, 2000, 1394 Trading Association)
// Annex C:Configuration ROM example(informative)
// C.1 Simple AV/C device
//
// Copied from the documentation.
static const u32 simple_avc_config_rom[] = {
	0x0404eabf,
	0x31333934,
	0xe0646102,
	0xffffffff,
	0xffffffff,
	0x00063287, // root directory.
	0x03ffffff,
	0x8100000a,
	0x17ffffff,
	0x8100000e,
	0x0c0083c0,
	0xd1000001,
	0x0004442d, // unit 0 directory.
	0x1200a02d,
	0x13010001,
	0x17ffffff,
	0x81000007,
	0x0005c915, // leaf for textual descriptor.
	0x00000000,
	0x00000000,
	0x56656e64,
	0x6f72204e,
	0x616d6500,
	0x00057f16, // leaf for textual descriptor.
	0x00000000,
	0x00000000,
	0x4d6f6465,
	0x6c204e61,
	0x6d650000,
};

// Ibid.
// Annex A:Consideration for configuration ROM reader design (informative)
// A.1 Vendor directory
//
// Written by hand.
static const u32 legacy_avc_config_rom[] = {
	0x04199fe7,
	0x31333934,
	0xe0644000,
	0x00112233,
	0x44556677,
	0x0005dace, // root directory.
	0x03012345,
	0x0c0083c0,
	0x8d000009,
	0xd1000002,
	0xc3000004,
	0x0002e107, // unit 0 directory.
	0x12abcdef,
	0x13543210,
	0x0002cb73, // vendor directory.
	0x17fedcba,
	0x81000004,
	0x00026dc1, // leaf for EUI-64.
	0x00112233,
	0x44556677,
	0x00050e84, // leaf for textual descriptor.
	0x00000000,
	0x00000000,
	0x41424344,
	0x45464748,
	0x494a0000,
};

static void device_attr_simple_avc(struct kunit *test)
{
	static const struct fw_device node = {
		.device = {
			.type = &fw_device_type,
		},
		.config_rom = simple_avc_config_rom,
		.config_rom_length = sizeof(simple_avc_config_rom),
	};

Annotation

Implementation Notes