linux/drivers/firewire/core-card.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2005-2007  Kristian Hoegsberg <[email protected]>
 */

#include <linux/bug.h>
#include <linux/completion.h>
#include <linux/crc-itu-t.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>

#include <linux/atomic.h>
#include <asm/byteorder.h>

#include "core.h"
#include <trace/events/firewire.h>

#define define_fw_printk_level(func, kern_level)
define_fw_printk_level(fw_err, KERN_ERR);
define_fw_printk_level(fw_notice, KERN_NOTICE);

int fw_compute_block_crc(__be32 *block)
{}

static DEFINE_MUTEX(card_mutex);
static LIST_HEAD(card_list);

static LIST_HEAD(descriptor_list);
static int descriptor_count;

static __be32 tmp_config_rom[256];
/* ROM header, bus info block, root dir header, capabilities = 7 quadlets */
static size_t config_rom_length =;

#define BIB_CRC(v)
#define BIB_CRC_LENGTH(v)
#define BIB_INFO_LENGTH(v)
#define BIB_BUS_NAME
#define BIB_LINK_SPEED(v)
#define BIB_GENERATION(v)
#define BIB_MAX_ROM(v)
#define BIB_MAX_RECEIVE(v)
#define BIB_CYC_CLK_ACC(v)
#define BIB_PMC
#define BIB_BMC
#define BIB_ISC
#define BIB_CMC
#define BIB_IRMC
#define NODE_CAPABILITIES

/*
 * IEEE-1394 specifies a default SPLIT_TIMEOUT value of 800 cycles (100 ms),
 * but we have to make it longer because there are many devices whose firmware
 * is just too slow for that.
 */
#define DEFAULT_SPLIT_TIMEOUT

#define CANON_OUI

static void generate_config_rom(struct fw_card *card, __be32 *config_rom)
{}

static void update_config_roms(void)
{}

static size_t required_space(struct fw_descriptor *desc)
{}

int fw_core_add_descriptor(struct fw_descriptor *desc)
{}
EXPORT_SYMBOL();

void fw_core_remove_descriptor(struct fw_descriptor *desc)
{}
EXPORT_SYMBOL();

static int reset_bus(struct fw_card *card, bool short_reset)
{}

void fw_schedule_bus_reset(struct fw_card *card, bool delayed, bool short_reset)
{}
EXPORT_SYMBOL();

static void br_work(struct work_struct *work)
{}

static void allocate_broadcast_channel(struct fw_card *card, int generation)
{}

static const char gap_count_table[] =;

void fw_schedule_bm_work(struct fw_card *card, unsigned long delay)
{}

static void bm_work(struct work_struct *work)
{}

void fw_card_initialize(struct fw_card *card,
			const struct fw_card_driver *driver,
			struct device *device)
{}
EXPORT_SYMBOL();

int fw_card_add(struct fw_card *card,
		u32 max_receive, u32 link_speed, u64 guid)
{}
EXPORT_SYMBOL();

/*
 * The next few functions implement a dummy driver that is used once a card
 * driver shuts down an fw_card.  This allows the driver to cleanly unload,
 * as all IO to the card will be handled (and failed) by the dummy driver
 * instead of calling into the module.  Only functions for iso context
 * shutdown still need to be provided by the card driver.
 *
 * .read/write_csr() should never be called anymore after the dummy driver
 * was bound since they are only used within request handler context.
 * .set_config_rom() is never called since the card is taken out of card_list
 * before switching to the dummy driver.
 */

static int dummy_read_phy_reg(struct fw_card *card, int address)
{}

static int dummy_update_phy_reg(struct fw_card *card, int address,
				int clear_bits, int set_bits)
{}

static void dummy_send_request(struct fw_card *card, struct fw_packet *packet)
{}

static void dummy_send_response(struct fw_card *card, struct fw_packet *packet)
{}

static int dummy_cancel_packet(struct fw_card *card, struct fw_packet *packet)
{}

static int dummy_enable_phys_dma(struct fw_card *card,
				 int node_id, int generation)
{}

static struct fw_iso_context *dummy_allocate_iso_context(struct fw_card *card,
				int type, int channel, size_t header_size)
{}

static u32 dummy_read_csr(struct fw_card *card, int csr_offset)
{}

static void dummy_write_csr(struct fw_card *card, int csr_offset, u32 value)
{}

static int dummy_start_iso(struct fw_iso_context *ctx,
			   s32 cycle, u32 sync, u32 tags)
{}

static int dummy_set_iso_channels(struct fw_iso_context *ctx, u64 *channels)
{}

static int dummy_queue_iso(struct fw_iso_context *ctx, struct fw_iso_packet *p,
			   struct fw_iso_buffer *buffer, unsigned long payload)
{}

static void dummy_flush_queue_iso(struct fw_iso_context *ctx)
{}

static int dummy_flush_iso_completions(struct fw_iso_context *ctx)
{}

static const struct fw_card_driver dummy_driver_template =;

void fw_card_release(struct kref *kref)
{}
EXPORT_SYMBOL_GPL();

void fw_core_remove_card(struct fw_card *card)
{}
EXPORT_SYMBOL();

/**
 * fw_card_read_cycle_time: read from Isochronous Cycle Timer Register of 1394 OHCI in MMIO region
 *			    for controller card.
 * @card: The instance of card for 1394 OHCI controller.
 * @cycle_time: The mutual reference to value of cycle time for the read operation.
 *
 * Read value from Isochronous Cycle Timer Register of 1394 OHCI in MMIO region for the given
 * controller card. This function accesses the region without any lock primitives or IRQ mask.
 * When returning successfully, the content of @value argument has value aligned to host endianness,
 * formetted by CYCLE_TIME CSR Register of IEEE 1394 std.
 *
 * Context: Any context.
 * Return:
 * * 0 - Read successfully.
 * * -ENODEV - The controller is unavailable due to being removed or unbound.
 */
int fw_card_read_cycle_time(struct fw_card *card, u32 *cycle_time)
{}
EXPORT_SYMBOL_GPL();