drivers/firewire/core.h

Source file repositories/reference/linux-study-clean/drivers/firewire/core.h

File Facts

System
Linux kernel
Corpus path
drivers/firewire/core.h
Extension
.h
Size
9289 bytes
Lines
326
Domain
Driver Families
Bucket
drivers/firewire
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern 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

extern const struct file_operations fw_device_ops;

void fw_device_cdev_update(struct fw_device *device);
void fw_device_cdev_remove(struct fw_device *device);
void fw_cdev_handle_phy_packet(struct fw_card *card, struct fw_packet *p);


/* -device */

extern struct rw_semaphore fw_device_rwsem;
extern struct xarray fw_device_xa;
extern int fw_cdev_major;

static inline struct fw_device *fw_device_get(struct fw_device *device)
{
	get_device(&device->device);

	return device;
}

static inline void fw_device_put(struct fw_device *device)
{
	put_device(&device->device);
}

struct fw_device *fw_device_get_by_devt(dev_t devt);
int fw_device_set_broadcast_channel(struct device *dev, void *gen);
void fw_node_event(struct fw_card *card, struct fw_node *node, int event);


/* -iso */

int fw_iso_buffer_alloc(struct fw_iso_buffer *buffer, int page_count);
int fw_iso_buffer_map_dma(struct fw_iso_buffer *buffer, struct fw_card *card,
			  enum dma_data_direction direction);
size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed);

static inline void fw_iso_context_init_work(struct fw_iso_context *ctx, work_func_t func)
{
	INIT_WORK(&ctx->work, func);
}

static inline struct fw_iso_context *fw_iso_mc_context_create(struct fw_card *card,
		fw_iso_mc_callback_t callback, void *callback_data)
{
	union fw_iso_callback cb = { .mc = callback };

	return __fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL, 0, 0, 0, 0, cb,
				       callback_data);
}


/* -topology */

// The initial value of BUS_MANAGER_ID register, to express nothing registered.
#define BUS_MANAGER_ID_NOT_REGISTERED	0x3f

enum {
	FW_NODE_CREATED,
	FW_NODE_UPDATED,
	FW_NODE_DESTROYED,
	FW_NODE_LINK_ON,
	FW_NODE_LINK_OFF,
	FW_NODE_INITIATED_RESET,
};

struct fw_node {
	u16 node_id;
	u8 color;
	u8 port_count;
	u8 link_on:1;
	u8 initiated_reset:1;
	u8 b_path:1;
	u8 phy_speed:2;	/* As in the self ID packet. */
	u8 max_speed:2;	/* Minimum of all phy-speeds on the path from the
			 * local node to this node. */
	u8 max_depth:4;	/* Maximum depth to any leaf node */
	u8 max_hops:4;	/* Max hops in this sub tree */

	struct kref kref;

	/* For serializing node topology into a list. */
	struct list_head link;

	// The device when already associated, else NULL.
	struct fw_device *device;

	struct fw_node *ports[] __counted_by(port_count);
};

Annotation

Implementation Notes